Skip to content

Commit b3ea070

Browse files
committed
refactor
1 parent 7eeb9a3 commit b3ea070

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ defaultTasks 'build';
3232
dependencies {
3333
compile 'com.github.scm4j:scm4j-vcs-api:master-SNAPSHOT'
3434
compile 'org.tmatesoft.svnkit:svnkit:1.9.0-r10609-atlassian-hosted'
35+
compile 'org.apache.commons:commons-lang3:3.5'
3536

3637
testCompile 'junit:junit:4.12'
3738
testCompile 'com.github.scm4j:scm4j-vcs-test:master-SNAPSHOT'

src/main/java/org/scm4j/vcs/svn/SVNVCS.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,6 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
438438
}
439439
}
440440

441-
public void createTrunk(String commitMessage) throws SVNException {
442-
createBranch(SVNURL.parseURIEncoded(repoUrl), SVNURL.parseURIEncoded(repoUrl + MASTER_PATH), commitMessage);
443-
}
444-
445-
public void createBranches(String commitMessage) throws SVNException {
446-
createBranch(SVNURL.parseURIEncoded(repoUrl), SVNURL.parseURIEncoded(repoUrl + BRANCHES_PATH), commitMessage);
447-
}
448-
449441
@Override
450442
public Set<String> getBranches() {
451443
try {

src/test/java/org/scm4j/vcs/svn/SVNVCSUtils.java renamed to src/main/java/org/scm4j/vcs/svn/SVNVCSUtils.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.tmatesoft.svn.core.SVNURL;
66
import org.tmatesoft.svn.core.io.SVNRepository;
77
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
8+
import org.apache.commons.lang3.StringUtils;
89

910
import java.io.File;
1011

@@ -24,23 +25,11 @@ public static void createFolderStructure(SVNVCS svn, String commitMessage) {
2425
.getClientManager()
2526
.getCommitClient()
2627
.doMkDir(new SVNURL[] {
27-
SVNURL.parseURIEncoded(appendSlash(svn.getRepoUrl()) + SVNVCS.MASTER_PATH),
28-
SVNURL.parseURIEncoded(appendSlash(svn.getRepoUrl()) + SVNVCS.BRANCHES_PATH)},
28+
SVNURL.parseURIEncoded(StringUtils.appendIfMissing(svn.getRepoUrl(), "/") + SVNVCS.MASTER_PATH),
29+
SVNURL.parseURIEncoded(StringUtils.appendIfMissing(svn.getRepoUrl(), "/") + SVNVCS.BRANCHES_PATH)},
2930
commitMessage);
3031
} catch (SVNException e) {
3132
throw new EVCSException(e);
3233
}
3334
}
34-
35-
public static String removeLastSlash(String url) {
36-
if(url.endsWith("/")) {
37-
return url.substring(0, url.lastIndexOf("/"));
38-
} else {
39-
return url;
40-
}
41-
}
42-
43-
public static String appendSlash(String url) {
44-
return removeLastSlash(url) + "/";
45-
}
4635
}

0 commit comments

Comments
 (0)