Skip to content

Commit bc7a3c1

Browse files
committed
tag creating fixed
added gradle test failures logging
1 parent 0416cd3 commit bc7a3c1

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ jacocoTestReport {
2525
}
2626
}
2727

28+
test {
29+
testLogging {
30+
events "failed"
31+
exceptionFormat "full"
32+
}
33+
}
34+
35+
2836
repositories {
2937
maven { url "https://jitpack.io" }
3038
mavenCentral()

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

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.io.ByteArrayOutputStream;
44
import java.io.File;
55
import java.io.FileWriter;
6-
import java.net.URL;
76
import java.nio.charset.StandardCharsets;
87
import java.util.ArrayList;
98
import java.util.Collection;
@@ -61,12 +60,10 @@
6160
import org.tmatesoft.svn.core.wc.SVNWCClient;
6261
import org.tmatesoft.svn.core.wc.SVNWCUtil;
6362
import org.tmatesoft.svn.core.wc2.ISvnObjectReceiver;
64-
import org.tmatesoft.svn.core.wc2.SvnCopySource;
6563
import org.tmatesoft.svn.core.wc2.SvnDiff;
6664
import org.tmatesoft.svn.core.wc2.SvnDiffStatus;
6765
import org.tmatesoft.svn.core.wc2.SvnDiffSummarize;
6866
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
69-
import org.tmatesoft.svn.core.wc2.SvnRemoteCopy;
7067
import org.tmatesoft.svn.core.wc2.SvnTarget;
7168

7269
public class SVNVCS implements IVCS {
@@ -463,7 +460,7 @@ public Set<String> getBranches(String path) {
463460
}
464461
Set<String> res = new HashSet<>();
465462
for (String str : tempRes) {
466-
res.add(StringUtils.removeStart(StringUtils.removeStart(str, SVNVCS.BRANCHES_PATH), path));
463+
res.add(StringUtils.removeStart(str, SVNVCS.BRANCHES_PATH));
467464
}
468465
return res;
469466
} catch (SVNException e) {
@@ -642,29 +639,19 @@ public Boolean fileExists(String branchName, String filePath) {
642639
@Override
643640
public VCSTag createTag(String branchName, String tagName, String tagMessage, String revisionToTag) throws EVCSTagExists {
644641
try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy()) {
645-
checkout(getBranchUrl(branchName), wc.getFolder(), null);
646642
SVNURL srcURL = getBranchUrl(branchName);
647643
SVNURL dstURL = SVNURL.parseURIEncoded(repoUrl + TAGS_PATH + tagName);
644+
SVNLogEntry copyFromEntry = revToSVNEntry(getBranchName(branchName),
645+
revisionToTag == null ? SVNRevision.HEAD.getNumber() : Long.parseLong(revisionToTag));
648646
SVNCopySource copySource = revisionToTag == null ?
649-
new SVNCopySource(SVNRevision.HEAD, SVNRevision.HEAD, srcURL) :
647+
new SVNCopySource(SVNRevision.HEAD, SVNRevision.create(copyFromEntry.getRevision()), srcURL) :
650648
new SVNCopySource(SVNRevision.parse(revisionToTag), SVNRevision.parse(revisionToTag), srcURL);
651649

652-
SvnRemoteCopy tagOperation = new SvnOperationFactory().createRemoteCopy();
653-
SvnCopySource source = SvnCopySource.create(SvnTarget.fromURL(srcURL), SVNRevision.UNDEFINED);
654-
tagOperation.addCopySource(source);
655-
tagOperation.setSingleTarget(SvnTarget.fromURL(dstURL));
656-
tagOperation.setFailWhenDstExists(true);
657-
tagOperation.setCommitMessage(tagMessage);
658-
tagOperation.run();
659-
//
660-
// clientManager.getCopyClient().doCopy(new SVNCopySource[] {copySource}, dstURL,
661-
// false, false, true, tagMessage, null);
650+
clientManager.getCopyClient().doCopy(new SVNCopySource[] {copySource}, dstURL,
651+
false, false, true, tagMessage, null);
662652

663653
SVNDirEntry entry = repository.info(TAGS_PATH + tagName, -1);
664654

665-
SVNLogEntry copyFromEntry = revToSVNEntry(getBranchName(branchName),
666-
revisionToTag == null ? SVNRevision.BASE.getNumber() : Long.parseLong(revisionToTag));
667-
668655
return new VCSTag(tagName, tagMessage, entry.getAuthor(), svnLogEntryToVCSCommit(copyFromEntry));
669656
} catch (SVNException e) {
670657
if (e.getErrorMessage().getErrorCode().getCode() == SVN_ITEM_EXISTS_ERROR_CODE) {

0 commit comments

Comments
 (0)