Skip to content

Commit 48d2bbf

Browse files
author
Denis
committed
getBranchesDiff() updated
getCommitsMesages() fixed documentation updated
1 parent 05eeac7 commit 48d2bbf

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Overview
2-
Pk-vcs-svn is lightweight library for execute basic SVN VCS operations (merge, branch create etc). It uses [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) exposing IVCS implementation for SVN repositories and [SVNKit](https://svnkit.com/) as framework to work with SVN repositories
2+
Pk-vcs-svn is lightweight library for execute basic SVN VCS operations (merge, branch create etc). It uses [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) exposing IVCS implementation for SVN repositories and [SVNKit](https://svnkit.com/) as framework to work with SVN repositories.
3+
Features:
4+
- Branch create and remove
5+
- Branch merge returning result(success or list of conflicted files)
6+
- Commit messages list
7+
- Summarized branch changes list
8+
- Branches list
9+
- File content getting and setting
10+
- File create and remove
311

412
# Terms
513
- Workspace Home

src/main/java/com/projectkaiser/scm/vcs/svn/SVNVCS.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,22 @@ public String getRepoUrl() {
330330
@Override
331331
public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final String destBranchName) {
332332
try {
333+
final List<SVNLogEntry> entries = new ArrayList<>();
334+
repository.log(new String[] { "branches/" + srcBranchName }, -1 /* start from head descending */,
335+
0, true, true, -1, new ISVNLogEntryHandler() {
336+
@Override
337+
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
338+
entries.add(logEntry);
339+
}
340+
});
341+
SVNLogEntry branchFirstCommit = entries.get(entries.size() - 1);
342+
333343
SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
334344
SvnDiffSummarize diff = svnOperationFactory.createDiffSummarize();
335345
diff.setSources(
336-
SvnTarget.fromURL(getBranchUrl(destBranchName), SVNRevision.HEAD),
346+
SvnTarget.fromURL(getBranchUrl(srcBranchName), SVNRevision.create(branchFirstCommit.getRevision())),
337347
SvnTarget.fromURL(getBranchUrl(srcBranchName), SVNRevision.HEAD));
348+
338349
final List<VCSDiffEntry> res = new ArrayList<>();
339350
diff.setReceiver(new ISvnObjectReceiver<SvnDiffStatus>() {
340351
public void receive(SvnTarget target, SvnDiffStatus diffStatus) throws SVNException {
@@ -411,7 +422,8 @@ private void listEntries(Set<String> entries, String path) throws SVNException {
411422
public List<String> getCommitMessages(String branchName, Integer limit) {
412423
final List<String> res = new ArrayList<>();
413424
try {
414-
repository.log(new String[] { branchName }, -1 /* start from head descending */,
425+
repository.log(new String[] { branchName == null ? MASTER_PATH : BRANCHES_PATH + branchName },
426+
-1 /* start from head descending */,
415427
0, true, true, limit, new ISVNLogEntryHandler() {
416428
@Override
417429
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {

0 commit comments

Comments
 (0)