Skip to content

Commit 5f2b677

Browse files
committed
Merge branch 'develop'
# Conflicts: # build.gradle
2 parents 5bb622e + 3ce6149 commit 5f2b677

File tree

2 files changed

+63
-16
lines changed

2 files changed

+63
-16
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ defaultTasks 'build';
1919

2020
dependencies {
2121
compile 'com.github.scm4j:scm4j-vcs-api:master-SNAPSHOT'
22-
compile 'org.tmatesoft.svnkit:svnkit:1.8.14'
22+
compile 'org.tmatesoft.svnkit:svnkit:1.8.6'
2323

2424
testCompile 'junit:junit:4.12'
2525
testCompile 'com.github.scm4j:scm4j-vcs-test:master-SNAPSHOT'

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

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,66 @@
11
package org.scm4j.vcs.svn;
22

3+
import java.io.ByteArrayOutputStream;
4+
import java.io.File;
5+
import java.io.FileWriter;
6+
import java.io.UnsupportedEncodingException;
7+
import java.nio.charset.StandardCharsets;
8+
import java.util.ArrayList;
9+
import java.util.Collection;
10+
import java.util.Collections;
11+
import java.util.HashSet;
12+
import java.util.List;
13+
import java.util.Set;
14+
315
import org.apache.commons.io.FileUtils;
4-
import org.scm4j.vcs.api.*;
16+
import org.scm4j.vcs.api.IVCS;
17+
import org.scm4j.vcs.api.VCSChangeType;
18+
import org.scm4j.vcs.api.VCSCommit;
19+
import org.scm4j.vcs.api.VCSDiffEntry;
20+
import org.scm4j.vcs.api.VCSMergeResult;
21+
import org.scm4j.vcs.api.WalkDirection;
522
import org.scm4j.vcs.api.exceptions.EVCSBranchExists;
623
import org.scm4j.vcs.api.exceptions.EVCSException;
724
import org.scm4j.vcs.api.exceptions.EVCSFileNotFound;
825
import org.scm4j.vcs.api.workingcopy.IVCSLockedWorkingCopy;
926
import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace;
1027
import org.scm4j.vcs.api.workingcopy.IVCSWorkspace;
11-
import org.tmatesoft.svn.core.*;
28+
import org.tmatesoft.svn.core.ISVNLogEntryHandler;
29+
import org.tmatesoft.svn.core.SVNCommitInfo;
30+
import org.tmatesoft.svn.core.SVNDepth;
31+
import org.tmatesoft.svn.core.SVNDirEntry;
32+
import org.tmatesoft.svn.core.SVNException;
33+
import org.tmatesoft.svn.core.SVNLogEntry;
34+
import org.tmatesoft.svn.core.SVNNodeKind;
35+
import org.tmatesoft.svn.core.SVNProperties;
36+
import org.tmatesoft.svn.core.SVNURL;
1237
import org.tmatesoft.svn.core.auth.BasicAuthenticationManager;
1338
import org.tmatesoft.svn.core.auth.SVNAuthentication;
1439
import org.tmatesoft.svn.core.auth.SVNPasswordAuthentication;
1540
import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
1641
import org.tmatesoft.svn.core.io.SVNRepository;
1742
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
18-
import org.tmatesoft.svn.core.wc.*;
19-
import org.tmatesoft.svn.core.wc2.*;
20-
21-
import java.io.ByteArrayOutputStream;
22-
import java.io.File;
23-
import java.io.FileWriter;
24-
import java.io.UnsupportedEncodingException;
25-
import java.nio.charset.StandardCharsets;
26-
import java.util.*;
43+
import org.tmatesoft.svn.core.wc.ISVNConflictHandler;
44+
import org.tmatesoft.svn.core.wc.ISVNOptions;
45+
import org.tmatesoft.svn.core.wc.SVNClientManager;
46+
import org.tmatesoft.svn.core.wc.SVNConflictChoice;
47+
import org.tmatesoft.svn.core.wc.SVNConflictDescription;
48+
import org.tmatesoft.svn.core.wc.SVNConflictResult;
49+
import org.tmatesoft.svn.core.wc.SVNCopyClient;
50+
import org.tmatesoft.svn.core.wc.SVNCopySource;
51+
import org.tmatesoft.svn.core.wc.SVNDiffClient;
52+
import org.tmatesoft.svn.core.wc.SVNRevision;
53+
import org.tmatesoft.svn.core.wc.SVNRevisionRange;
54+
import org.tmatesoft.svn.core.wc.SVNStatusType;
55+
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
56+
import org.tmatesoft.svn.core.wc.SVNWCClient;
57+
import org.tmatesoft.svn.core.wc.SVNWCUtil;
58+
import org.tmatesoft.svn.core.wc2.ISvnObjectReceiver;
59+
import org.tmatesoft.svn.core.wc2.SvnDiff;
60+
import org.tmatesoft.svn.core.wc2.SvnDiffStatus;
61+
import org.tmatesoft.svn.core.wc2.SvnDiffSummarize;
62+
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
63+
import org.tmatesoft.svn.core.wc2.SvnTarget;
2764

2865
public class SVNVCS implements IVCS {
2966
private static final int SVN_PATH_IS_NOT_WORKING_COPY_ERROR_CODE = 155007;
@@ -299,8 +336,9 @@ public String getRepoUrl() {
299336
return repo.getRepoUrl();
300337
}
301338

302-
private void fillUnifiedDiffs(final String srcBranchName, final String dstBranchName, List<VCSDiffEntry> entries)
339+
private List<VCSDiffEntry> fillUnifiedDiffs(final String srcBranchName, final String dstBranchName, List<VCSDiffEntry> entries)
303340
throws SVNException {
341+
List<VCSDiffEntry> res = new ArrayList<>();
304342
for (VCSDiffEntry entry : entries) {
305343
ByteArrayOutputStream baos = new ByteArrayOutputStream();
306344

@@ -326,11 +364,12 @@ private void fillUnifiedDiffs(final String srcBranchName, final String dstBranch
326364
diff.run();
327365

328366
try {
329-
entry.setUnifiedDiff(baos.toString("UTF-8"));
367+
res.add(new VCSDiffEntry(entry.getFilePath(), entry.getChangeType(), baos.toString("UTF-8")));
330368
} catch (UnsupportedEncodingException e) {
331369
throw new RuntimeException(e);
332370
}
333371
}
372+
return res;
334373
}
335374

336375
private SVNLogEntry getBranchFirstCommit(final String branchPath) throws SVNException {
@@ -362,7 +401,7 @@ public void receive(SvnTarget target, SvnDiffStatus diffStatus) throws SVNExcept
362401
return;
363402
}
364403
VCSDiffEntry entry = new VCSDiffEntry(diffStatus.getPath(),
365-
SVNChangeTypeToVCSChangeType(diffStatus.getModificationType()));
404+
SVNChangeTypeToVCSChangeType(diffStatus.getModificationType()), null);
366405
res.add(entry);
367406
}
368407

@@ -389,7 +428,7 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
389428
try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy()) {
390429
checkout(getBranchUrl(dstBranchName), wc.getFolder());
391430
List<VCSDiffEntry> entries = getDiffEntries(srcBranchName, dstBranchName);
392-
fillUnifiedDiffs(srcBranchName, dstBranchName, entries);
431+
entries = fillUnifiedDiffs(srcBranchName, dstBranchName, entries);
393432
return entries;
394433
}
395434
} catch (SVNException e) {
@@ -399,6 +438,14 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
399438
}
400439
}
401440

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+
402449
@Override
403450
public Set<String> getBranches() {
404451
try {

0 commit comments

Comments
 (0)