@@ -72,6 +72,8 @@ public class SubversionRepository extends Repository {
72
72
*/
73
73
public static final String CMD_FALLBACK = "svn" ;
74
74
75
+ private static final String URLprefix = "URL:" ;
76
+
75
77
protected String reposPath ;
76
78
77
79
public SubversionRepository () {
@@ -424,9 +426,8 @@ private List<String> getAuthCommandLineParams() {
424
426
return result ;
425
427
}
426
428
427
- @ Override
428
- String determineParent () throws IOException {
429
- String parent = null ;
429
+ private String getInfoPart (String partName ) throws IOException {
430
+ String part = null ;
430
431
File directory = new File (directoryName );
431
432
432
433
List <String > cmd = new ArrayList <>();
@@ -441,23 +442,37 @@ String determineParent() throws IOException {
441
442
try (BufferedReader in = new BufferedReader (new InputStreamReader (process .getInputStream ()))) {
442
443
String line ;
443
444
while ((line = in .readLine ()) != null ) {
444
- if (line .startsWith ("URL:" )) {
445
+ if (line .startsWith (partName )) {
445
446
String parts [] = line .split ("\\ s+" );
446
447
if (parts .length != 2 ) {
447
448
LOGGER .log (Level .WARNING ,
448
449
"Failed to get parent for {0}" , directoryName );
449
450
}
450
- parent = parts [1 ];
451
+ part = parts [1 ];
451
452
break ;
452
453
}
453
454
}
454
455
}
455
456
456
- return parent ;
457
+ return part ;
457
458
}
458
459
459
460
@ Override
460
- String determineBranch () {
461
- return null ;
461
+ String determineParent () throws IOException {
462
+ return getInfoPart (URLprefix );
463
+ }
464
+
465
+ @ Override
466
+ String determineBranch () throws IOException {
467
+ String branch = null ;
468
+
469
+ String url = getInfoPart (URLprefix );
470
+ int idx ;
471
+ final String branchesStr = "branches/" ;
472
+ if ((idx = url .indexOf (branchesStr )) > 0 ) {
473
+ branch = url .substring (idx + branchesStr .length ());
474
+ }
475
+
476
+ return branch ;
462
477
}
463
478
}
0 commit comments