@@ -280,24 +280,18 @@ Executor getHistoryLogExecutor(File file, String sinceRevision, String tillRevis
280
280
* Try to get file contents for given revision.
281
281
*
282
282
* @param sink a required target sink
283
- * @param fullpath full pathname of the file
284
- * @param rev revision
283
+ * @param fullPath full pathname of the file
284
+ * @param revision revision
285
285
* @return a defined instance with {@code success} == {@code true} if no
286
286
* error occurred and with non-zero {@code iterations} if some data was
287
287
* transferred
288
288
*/
289
- private HistoryRevResult getHistoryRev (BufferSink sink , String fullpath , String rev ) {
290
-
289
+ private HistoryRevResult getHistoryRev (BufferSink sink , String fullPath , String revision ) {
291
290
HistoryRevResult result = new HistoryRevResult ();
292
291
File directory = new File (getDirectoryName ());
293
292
294
- String revision = rev ;
295
- if (rev .indexOf (':' ) != -1 ) {
296
- revision = rev .substring (0 , rev .indexOf (':' ));
297
- }
298
-
299
293
try {
300
- String filename = fullpath .substring (getDirectoryName ().length () + 1 );
294
+ String filename = fullPath .substring (getDirectoryName ().length () + 1 );
301
295
ensureCommand (CMD_PROPERTY_KEY , CMD_FALLBACK );
302
296
String [] argv = {RepoCommand , "cat" , "-r" , revision , filename };
303
297
Executor executor = new Executor (Arrays .asList (argv ), directory ,
@@ -307,7 +301,7 @@ private HistoryRevResult getHistoryRev(BufferSink sink, String fullpath, String
307
301
308
302
/*
309
303
* If exit value of the process was not 0 then the file did
310
- * not exist or internal hg error occured .
304
+ * not exist or internal hg error occurred .
311
305
*/
312
306
result .success = (status == 0 );
313
307
} catch (Exception exp ) {
@@ -321,13 +315,13 @@ private HistoryRevResult getHistoryRev(BufferSink sink, String fullpath, String
321
315
* Get the name of file in given revision. This is used to get contents
322
316
* of a file in historical revision.
323
317
*
324
- * @param fullpath file path
318
+ * @param fullPath file path
325
319
* @param fullRevToFind revision number (in the form of <code>{rev}:{node|short}</code>)
326
320
* @return original filename
327
321
*/
328
- private String findOriginalName (String fullpath , String fullRevToFind ) throws IOException {
322
+ private String findOriginalName (String fullPath , String fullRevToFind ) throws IOException {
329
323
Matcher matcher = LOG_COPIES_PATTERN .matcher ("" );
330
- String file = fullpath .substring (getDirectoryName ().length () + 1 );
324
+ String file = fullPath .substring (getDirectoryName ().length () + 1 );
331
325
ArrayList <String > argv = new ArrayList <>();
332
326
File directory = new File (getDirectoryName ());
333
327
@@ -359,7 +353,7 @@ private String findOriginalName(String fullpath, String fullRevToFind) throws IO
359
353
// argv.add("reverse(" + rev_to_find + ":)");
360
354
argv .add ("--template" );
361
355
argv .add ("{rev}:{file_copies}\\ n" );
362
- argv .add (fullpath );
356
+ argv .add (fullPath );
363
357
364
358
Executor executor = new Executor (argv , directory ,
365
359
RuntimeEnvironment .getInstance ().getInteractiveCommandTimeout ());
@@ -405,26 +399,25 @@ private String findOriginalName(String fullpath, String fullRevToFind) throws IO
405
399
if (status != 0 ) {
406
400
LOGGER .log (Level .WARNING ,
407
401
"Failed to get original name in revision {2} for: \" {0}\" Exit code: {1}" ,
408
- new Object []{fullpath , String .valueOf (status ), fullRevToFind });
402
+ new Object []{fullPath , String .valueOf (status ), fullRevToFind });
409
403
return null ;
410
404
}
411
405
412
- return (fullpath .substring (0 , getDirectoryName ().length () + 1 ) + file );
406
+ return (fullPath .substring (0 , getDirectoryName ().length () + 1 ) + file );
413
407
}
414
408
415
409
@ Override
416
410
boolean getHistoryGet (OutputStream out , String parent , String basename , String rev ) {
417
-
418
- String fullpath ;
411
+ String fullPath ;
419
412
try {
420
- fullpath = new File (parent , basename ).getCanonicalPath ();
413
+ fullPath = new File (parent , basename ).getCanonicalPath ();
421
414
} catch (IOException exp ) {
422
415
LOGGER .log (Level .SEVERE ,
423
416
"Failed to get canonical path: {0}" , exp .getClass ().toString ());
424
417
return false ;
425
418
}
426
419
427
- HistoryRevResult result = getHistoryRev (out ::write , fullpath , rev );
420
+ HistoryRevResult result = getHistoryRev (out ::write , fullPath , rev );
428
421
if (!result .success && result .iterations < 1 ) {
429
422
/*
430
423
* If we failed to get the contents it might be that the file was
@@ -433,14 +426,14 @@ boolean getHistoryGet(OutputStream out, String parent, String basename, String r
433
426
*/
434
427
String origpath ;
435
428
try {
436
- origpath = findOriginalName (fullpath , rev );
429
+ origpath = findOriginalName (fullPath , rev );
437
430
} catch (IOException exp ) {
438
431
LOGGER .log (Level .SEVERE ,
439
432
"Failed to get original revision: {0}" ,
440
433
exp .getClass ().toString ());
441
434
return false ;
442
435
}
443
- if (origpath != null && !origpath .equals (fullpath )) {
436
+ if (origpath != null && !origpath .equals (fullPath )) {
444
437
result = getHistoryRev (out ::write , origpath , rev );
445
438
}
446
439
}
0 commit comments