@@ -210,7 +210,7 @@ public void checkout(SVNURL sourceUrl, File destPath) throws Exception {
210210 updateClient .doSwitch (destPath , sourceUrl , SVNRevision .HEAD ,
211211 SVNRevision .HEAD , SVNDepth .INFINITY , false , false );
212212 } else {
213- updateClient .doCheckout (sourceUrl , destPath , SVNRevision .HEAD , SVNRevision .HEAD , SVNDepth .INFINITY , true );
213+ updateClient .doCheckout (sourceUrl , destPath , SVNRevision .HEAD , SVNRevision .HEAD , SVNDepth .UNKNOWN , false );
214214 }
215215 }
216216
@@ -411,10 +411,10 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
411411 }
412412
413413 @ Override
414- public Set <String > getBranches () {
414+ public Set <String > getBranches (String path ) {
415415 try {
416416 List <String > entries = new ArrayList <>();
417- listEntries (entries , SVNVCS .BRANCHES_PATH );
417+ listEntries (entries , SVNVCS .BRANCHES_PATH , path );
418418 Set <String > res = new HashSet <>(entries );
419419 addTrunkIfExists (res );
420420 return res ;
@@ -435,9 +435,13 @@ protected void addTrunkIfExists(Set<String> res) {
435435 }
436436 }
437437
438- protected void listEntries (List <String > entries , String path ) throws Exception {
438+ protected void listEntries (List <String > entries , String path , String subdir ) throws Exception {
439+
440+ if (repository .checkPath (path + subdir , -1 ) == SVNNodeKind .NONE ) {
441+ return ;
442+ }
439443 @ SuppressWarnings ("unchecked" )
440- Collection <SVNDirEntry > subEntries = repository .getDir (path , -1 , null , (Collection <SVNDirEntry >) null );
444+ Collection <SVNDirEntry > subEntries = repository .getDir (path + subdir , -1 , null , (Collection <SVNDirEntry >) null );
441445 List <SVNDirEntry > list = new ArrayList <>(subEntries );
442446 Collections .sort (list , new Comparator <SVNDirEntry >() {
443447 @ Override
@@ -453,7 +457,7 @@ public int compare(SVNDirEntry o1, SVNDirEntry o2) {
453457 });
454458 for (SVNDirEntry entry : list ) {
455459 if (entry .getKind () == SVNNodeKind .DIR ) {
456- entries .add (((path .equals (SVNVCS .BRANCHES_PATH ) ? "" : path ) + entry .getName ())
460+ entries .add (((path .equals (SVNVCS .BRANCHES_PATH ) ? "" : path ) + subdir + entry .getName ())
457461 .replace (SVNVCS .BRANCHES_PATH , "" ));
458462 }
459463 }
@@ -632,30 +636,31 @@ protected SVNLogEntry revToSVNEntry(String branchName, Long rev) throws Exceptio
632636 return null ;
633637 }
634638
639+ private class SVNTagBaseCommit implements ISVNLogEntryHandler {
640+
641+ public Long copyFromRevision ;
642+
643+ @ Override
644+ public void handleLogEntry (SVNLogEntry logEntry ) throws SVNException {
645+ for (String s : logEntry .getChangedPaths ().keySet ()) {
646+ SVNLogEntryPath entryPath = logEntry .getChangedPaths ().get (s );
647+ copyFromRevision = entryPath .getCopyRevision ();
648+ }
649+ }
650+ }
651+
635652 @ Override
636653 public List <VCSTag > getTags () {
637654 List <String > entries = new ArrayList <>();
638655 try {
639- listEntries (entries , TAGS_PATH );
656+ listEntries (entries , TAGS_PATH , "" );
640657 List <VCSTag > res = new ArrayList <>();
658+ SVNTagBaseCommit handler ;
641659 for (String entryStr : entries ) {
642660
643661 SVNLogEntry entry = revToSVNEntry (entryStr , -1L );
644662
645- class SVNTagBaseCommit implements ISVNLogEntryHandler {
646-
647- public Long copyFromRevision ;
648-
649- @ Override
650- public void handleLogEntry (SVNLogEntry logEntry ) throws SVNException {
651- for (String s : logEntry .getChangedPaths ().keySet ()) {
652- SVNLogEntryPath entryPath = logEntry .getChangedPaths ().get (s );
653- copyFromRevision = entryPath .getCopyRevision ();
654- }
655- }
656- }
657-
658- SVNTagBaseCommit handler = new SVNTagBaseCommit ();
663+ handler = new SVNTagBaseCommit ();
659664
660665 repository .log (new String [] { entryStr }, -1 /* start from head descending */ ,
661666 0 , true , true , -1 , handler );
@@ -710,4 +715,16 @@ public void removeTag(String tagName) {
710715 throw new RuntimeException (e );
711716 }
712717 }
718+
719+
720+ @ Override
721+ public void checkout (String branchName , String targetPath ) {
722+ try {
723+ checkout (getBranchUrl (branchName ), new File (targetPath ));
724+ } catch (SVNException e ) {
725+ throw new EVCSException (e );
726+ } catch (Exception e ) {
727+ throw new RuntimeException (e );
728+ }
729+ }
713730}
0 commit comments