@Test public void getBasePath_project_trunk() { assertEquals("/project", client.getBasePath(repository(), "/project/trunk").get()); }
@Override public Optional<String> getBasePath(SVNRepository svnRepository, String branchPath) { if (isTrunk(branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "trunk"), "/" ) ); } else if (isBranch(svnRepository, branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "branches"), "/" ) ); } else { return Optional.empty(); } }
SVNClientImpl implements SVNClient { @Override public Optional<String> getBasePath(SVNRepository svnRepository, String branchPath) { if (isTrunk(branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "trunk"), "/" ) ); } else if (isBranch(svnRepository, branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "branches"), "/" ) ); } else { return Optional.empty(); } } }
SVNClientImpl implements SVNClient { @Override public Optional<String> getBasePath(SVNRepository svnRepository, String branchPath) { if (isTrunk(branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "trunk"), "/" ) ); } else if (isBranch(svnRepository, branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "branches"), "/" ) ); } else { return Optional.empty(); } } @Autowired  SVNClientImpl(SVNEventDao svnEventDao, EnvService envService, TransactionService transactionService); }
SVNClientImpl implements SVNClient { @Override public Optional<String> getBasePath(SVNRepository svnRepository, String branchPath) { if (isTrunk(branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "trunk"), "/" ) ); } else if (isBranch(svnRepository, branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "branches"), "/" ) ); } else { return Optional.empty(); } } @Autowired  SVNClientImpl(SVNEventDao svnEventDao, EnvService envService, TransactionService transactionService); @Override boolean exists(SVNRepository repository, SVNURL url, SVNRevision revision); @Override long getRepositoryRevision(SVNRepository repository, SVNURL url); @Override void log(SVNRepository repository, SVNURL url, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision stopRevision, boolean stopOnCopy, boolean discoverChangedPaths, long limit, boolean includeMergedRevisions, ISVNLogEntryHandler isvnLogEntryHandler); @Override List<Long> getMergedRevisions(SVNRepository repository, SVNURL url, long revision); @Override SVNHistory getHistory(SVNRepository repository, String path); @Override List<SVNRevisionPath> getRevisionPaths(SVNRepository repository, long revision); @Override List<String> getBranches(SVNRepository repository, SVNURL url); @Override String getDiff(SVNRepository repository, String path, List<Long> revisions); @Override Optional<String> download(SVNRepository repository, String path); @Override Optional<String> getBasePath(SVNRepository svnRepository, String branchPath); @Override SVNReference getReference(SVNRepository repository, String path); @Override SVNInfo getInfo(SVNRepository repository, SVNURL url, SVNRevision revision); @Override boolean isTrunkOrBranch(SVNRepository repository, String path); @Override boolean isTagOrBranch(SVNRepository repository, String path); @Override boolean isTag(SVNRepository repository, String path); @Override boolean isBranch(SVNRepository repository, String path); @Override boolean isTrunk(String path); }
SVNClientImpl implements SVNClient { @Override public Optional<String> getBasePath(SVNRepository svnRepository, String branchPath) { if (isTrunk(branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "trunk"), "/" ) ); } else if (isBranch(svnRepository, branchPath)) { return Optional.of( StringUtils.stripEnd( StringUtils.substringBefore(branchPath, "branches"), "/" ) ); } else { return Optional.empty(); } } @Autowired  SVNClientImpl(SVNEventDao svnEventDao, EnvService envService, TransactionService transactionService); @Override boolean exists(SVNRepository repository, SVNURL url, SVNRevision revision); @Override long getRepositoryRevision(SVNRepository repository, SVNURL url); @Override void log(SVNRepository repository, SVNURL url, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision stopRevision, boolean stopOnCopy, boolean discoverChangedPaths, long limit, boolean includeMergedRevisions, ISVNLogEntryHandler isvnLogEntryHandler); @Override List<Long> getMergedRevisions(SVNRepository repository, SVNURL url, long revision); @Override SVNHistory getHistory(SVNRepository repository, String path); @Override List<SVNRevisionPath> getRevisionPaths(SVNRepository repository, long revision); @Override List<String> getBranches(SVNRepository repository, SVNURL url); @Override String getDiff(SVNRepository repository, String path, List<Long> revisions); @Override Optional<String> download(SVNRepository repository, String path); @Override Optional<String> getBasePath(SVNRepository svnRepository, String branchPath); @Override SVNReference getReference(SVNRepository repository, String path); @Override SVNInfo getInfo(SVNRepository repository, SVNURL url, SVNRevision revision); @Override boolean isTrunkOrBranch(SVNRepository repository, String path); @Override boolean isTagOrBranch(SVNRepository repository, String path); @Override boolean isTag(SVNRepository repository, String path); @Override boolean isBranch(SVNRepository repository, String path); @Override boolean isTrunk(String path); static final int HISTORY_MAX_DEPTH; }