@@ -170,9 +170,12 @@ public void setDirectoryName(String directoryName) {
170
170
* @param sinceRevision the revision number immediately preceding the first
171
171
* revision we want, or {@code null} to fetch the entire
172
172
* history
173
+ * @param numEntries number of entries to return. If 0, return all.
173
174
* @return An Executor ready to be started
174
175
*/
175
- Executor getHistoryLogExecutor (final File file , String sinceRevision ) {
176
+ Executor getHistoryLogExecutor (final File file , String sinceRevision ,
177
+ int numEntries ) {
178
+
176
179
String abs ;
177
180
try {
178
181
abs = file .getCanonicalPath ();
@@ -194,6 +197,9 @@ Executor getHistoryLogExecutor(final File file, String sinceRevision) {
194
197
cmd .addAll (getAuthCommandLineParams ());
195
198
cmd .add ("--xml" );
196
199
cmd .add ("-v" );
200
+ if (numEntries > 0 ) {
201
+ cmd .add ("-l" + numEntries );
202
+ }
197
203
if (sinceRevision != null ) {
198
204
cmd .add ("-r" );
199
205
// We would like to use sinceRevision+1 here, but if no new
@@ -252,9 +258,14 @@ History getHistory(File file) throws HistoryException {
252
258
}
253
259
254
260
@ Override
255
- History getHistory (File file , String sinceRevision )
261
+ History getHistory (File file , String sinceRevision ) throws HistoryException {
262
+ return getHistory (file , sinceRevision , 0 );
263
+ }
264
+
265
+ private History getHistory (File file , String sinceRevision , int numEntries )
256
266
throws HistoryException {
257
- return new SubversionHistoryParser ().parse (file , this , sinceRevision );
267
+ return new SubversionHistoryParser ().parse (file , this , sinceRevision ,
268
+ numEntries );
258
269
}
259
270
260
271
private String escapeFileName (String name ) {
@@ -475,4 +486,21 @@ String determineBranch() throws IOException {
475
486
476
487
return branch ;
477
488
}
489
+
490
+ @ Override
491
+ public String determineCurrentVersion () throws IOException {
492
+ String curVersion = null ;
493
+
494
+ try {
495
+ History hist = getHistory (new File (getDirectoryName ()), null , 1 );
496
+ HistoryEntry he = hist .getHistoryEntries ().get (0 );
497
+ curVersion = he .getDate () + ": " + he .getRevision () +
498
+ " " + he .getAuthor () + " " + he .getMessage ();
499
+ } catch (HistoryException ex ) {
500
+ LOGGER .log (Level .WARNING , "cannot get current version info for {0}" ,
501
+ getDirectoryName ());
502
+ }
503
+
504
+ return curVersion ;
505
+ }
478
506
}
0 commit comments