|
1 | 1 | package org.scm4j.vcs.svn; |
2 | 2 |
|
3 | | -import java.io.ByteArrayOutputStream; |
4 | | -import java.io.File; |
5 | | -import java.io.FileWriter; |
6 | | -import java.nio.charset.StandardCharsets; |
7 | | -import java.util.ArrayList; |
8 | | -import java.util.Collection; |
9 | | -import java.util.Collections; |
10 | | -import java.util.Comparator; |
11 | | -import java.util.HashSet; |
12 | | -import java.util.Iterator; |
13 | | -import java.util.List; |
14 | | -import java.util.Set; |
15 | | - |
16 | 3 | import org.apache.commons.io.FileUtils; |
17 | 4 | import org.apache.commons.lang3.StringUtils; |
18 | | -import org.scm4j.vcs.api.IVCS; |
19 | | -import org.scm4j.vcs.api.VCSChangeType; |
20 | | -import org.scm4j.vcs.api.VCSCommit; |
21 | | -import org.scm4j.vcs.api.VCSDiffEntry; |
22 | | -import org.scm4j.vcs.api.VCSMergeResult; |
23 | | -import org.scm4j.vcs.api.VCSTag; |
24 | | -import org.scm4j.vcs.api.WalkDirection; |
| 5 | +import org.scm4j.vcs.api.*; |
25 | 6 | import org.scm4j.vcs.api.exceptions.EVCSBranchExists; |
26 | 7 | import org.scm4j.vcs.api.exceptions.EVCSException; |
27 | 8 | import org.scm4j.vcs.api.exceptions.EVCSFileNotFound; |
28 | 9 | import org.scm4j.vcs.api.exceptions.EVCSTagExists; |
29 | 10 | import org.scm4j.vcs.api.workingcopy.IVCSLockedWorkingCopy; |
30 | 11 | import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace; |
31 | 12 | import org.scm4j.vcs.api.workingcopy.IVCSWorkspace; |
32 | | -import org.tmatesoft.svn.core.ISVNLogEntryHandler; |
33 | | -import org.tmatesoft.svn.core.SVNCommitInfo; |
34 | | -import org.tmatesoft.svn.core.SVNDepth; |
35 | | -import org.tmatesoft.svn.core.SVNDirEntry; |
36 | | -import org.tmatesoft.svn.core.SVNException; |
37 | | -import org.tmatesoft.svn.core.SVNLogEntry; |
38 | | -import org.tmatesoft.svn.core.SVNLogEntryPath; |
39 | | -import org.tmatesoft.svn.core.SVNNodeKind; |
40 | | -import org.tmatesoft.svn.core.SVNProperties; |
41 | | -import org.tmatesoft.svn.core.SVNURL; |
| 13 | +import org.tmatesoft.svn.core.*; |
42 | 14 | import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; |
43 | 15 | import org.tmatesoft.svn.core.auth.SVNAuthentication; |
44 | 16 | import org.tmatesoft.svn.core.auth.SVNPasswordAuthentication; |
45 | 17 | import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; |
46 | 18 | import org.tmatesoft.svn.core.io.SVNRepository; |
47 | 19 | import org.tmatesoft.svn.core.io.SVNRepositoryFactory; |
48 | | -import org.tmatesoft.svn.core.wc.ISVNConflictHandler; |
49 | | -import org.tmatesoft.svn.core.wc.ISVNOptions; |
50 | | -import org.tmatesoft.svn.core.wc.SVNClientManager; |
51 | | -import org.tmatesoft.svn.core.wc.SVNConflictChoice; |
52 | | -import org.tmatesoft.svn.core.wc.SVNConflictDescription; |
53 | | -import org.tmatesoft.svn.core.wc.SVNConflictResult; |
54 | | -import org.tmatesoft.svn.core.wc.SVNCopyClient; |
55 | | -import org.tmatesoft.svn.core.wc.SVNCopySource; |
56 | | -import org.tmatesoft.svn.core.wc.SVNDiffClient; |
57 | | -import org.tmatesoft.svn.core.wc.SVNRevision; |
58 | | -import org.tmatesoft.svn.core.wc.SVNRevisionRange; |
59 | | -import org.tmatesoft.svn.core.wc.SVNStatusType; |
60 | | -import org.tmatesoft.svn.core.wc.SVNUpdateClient; |
61 | | -import org.tmatesoft.svn.core.wc.SVNWCClient; |
62 | | -import org.tmatesoft.svn.core.wc.SVNWCUtil; |
63 | | -import org.tmatesoft.svn.core.wc2.ISvnObjectReceiver; |
64 | | -import org.tmatesoft.svn.core.wc2.SvnDiff; |
65 | | -import org.tmatesoft.svn.core.wc2.SvnDiffStatus; |
66 | | -import org.tmatesoft.svn.core.wc2.SvnDiffSummarize; |
67 | | -import org.tmatesoft.svn.core.wc2.SvnOperationFactory; |
68 | | -import org.tmatesoft.svn.core.wc2.SvnTarget; |
| 20 | +import org.tmatesoft.svn.core.wc.*; |
| 21 | +import org.tmatesoft.svn.core.wc2.*; |
| 22 | + |
| 23 | +import java.io.ByteArrayOutputStream; |
| 24 | +import java.io.File; |
| 25 | +import java.io.FileWriter; |
| 26 | +import java.nio.charset.StandardCharsets; |
| 27 | +import java.util.*; |
69 | 28 |
|
70 | 29 | public class SVNVCS implements IVCS { |
71 | 30 | private static final int SVN_PATH_IS_NOT_WORKING_COPY_ERROR_CODE = 155007; |
@@ -151,10 +110,8 @@ public void createBranch(String srcBranchName, String dstBranchName, String comm |
151 | 110 | } |
152 | 111 |
|
153 | 112 | public void createBranch(SVNURL fromUrl, SVNURL toUrl, String commitMessage) { |
154 | | - try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy()) { |
155 | | - |
| 113 | + try { |
156 | 114 | getBranchUrl("test"); // for exceptions rethrowing test only |
157 | | - |
158 | 115 | SVNCopyClient copyClient = clientManager.getCopyClient(); |
159 | 116 | SVNCopySource copySource = new SVNCopySource(SVNRevision.HEAD, SVNRevision.HEAD, fromUrl); |
160 | 117 | copySource.setCopyContents(false); |
@@ -491,13 +448,10 @@ public int compare(SVNDirEntry o1, SVNDirEntry o2) { |
491 | 448 | return 0; |
492 | 449 | } |
493 | 450 | }); |
494 | | - Iterator<SVNDirEntry> entriesIterator = entriesList.iterator(); |
495 | | - while (entriesIterator.hasNext()) { |
496 | | - SVNDirEntry entry = (SVNDirEntry) entriesIterator.next(); |
497 | | - |
| 451 | + for (SVNDirEntry entry : entriesList) { |
498 | 452 | if (entry.getKind() == SVNNodeKind.DIR) { |
499 | 453 | res.add((path.isEmpty() ? "" : StringUtils.appendIfMissing(path, "/")) + entry.getName()); |
500 | | - res.addAll(listEntries((path.equals("")) ? entry.getName( ) : path + entry.getName())); |
| 454 | + res.addAll(listEntries((path.equals("")) ? entry.getName() : path + entry.getName())); |
501 | 455 | } |
502 | 456 | } |
503 | 457 |
|
@@ -644,8 +598,8 @@ public Boolean fileExists(String branchName, String filePath) { |
644 | 598 |
|
645 | 599 | @Override |
646 | 600 | public VCSTag createTag(String branchName, String tagName, String tagMessage, String revisionToTag) throws EVCSTagExists { |
647 | | - try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy()) { |
648 | | - SVNURL srcURL = getBranchUrl(branchName); |
| 601 | + try { |
| 602 | + SVNURL srcURL = getBranchUrl(branchName); |
649 | 603 | SVNURL dstURL = SVNURL.parseURIEncoded(repoUrl + TAGS_PATH + tagName); |
650 | 604 | SVNLogEntry copyFromEntry = revToSVNEntry(getBranchName(branchName), |
651 | 605 | revisionToTag == null ? SVNRevision.HEAD.getNumber() : Long.parseLong(revisionToTag)); |
|
0 commit comments