Skip to content

Commit e75462b

Browse files
committed
Merge branch 'master' into B1
# Conflicts: # README.md # build.gradle
2 parents 321c5fd + 7772757 commit e75462b

File tree

8 files changed

+58
-48
lines changed

8 files changed

+58
-48
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ hs_err_pid*
1414
/gradle
1515
build
1616
bin
17-
/pk-vcs-svn_gradle.launch
17+
*.iml

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[![Release](https://jitpack.io/v/ProjectKaiser/pk-vcs-svn.svg)](https://jitpack.io/#ProjectKaiser/pk-vcs-svn)
1+
[![Release](https://jitpack.io/v/scm4j/scm4j-vcs-svn.svg)](https://jitpack.io/#scm4j/scm4j-vcs-svn)
22

33
# Overview
4-
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.
4+
scm4j-vcs-svn is lightweight library for execute basic SVN VCS operations (merge, branch create etc). It uses [scm4j-vcs-api](https://github.com/scm4j/scm4j-vcs-api) exposing IVCS implementation for SVN repositories and [SVNKit](https://svnkit.com/) as framework to work with SVN repositories.
55
Features:
66
- Branch create and remove
77
- Branch merge returning result(success or list of conflicted files)
@@ -13,19 +13,18 @@ Features:
1313

1414
# Terms
1515
- Workspace Home
16-
- Home folder of all folders used by vcs-related operations. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
16+
- Local home folder of all folders used by vcs-related operations. See [scm4j-vcs-api](https://github.com/scm4j/scm4j-vcs-api) for details
1717
- Repository Workspace
18-
- Folder for LWC folders related to Repository of one type. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
18+
- Local folder for LWC folders related to Repository of one type. See [scm4j-vcs-api](https://github.com/scm4j/scm4j-vcs-api) for details
1919
- Locked Working Copy, LWC
20-
- Folder where vcs-related operations are executed. Provides thread- and process-safe repository of working folders. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
20+
- Local folder where vcs-related operations are executed. Provides thread- and process-safe repository of working folders. See [scm4j-vcs-api](https://github.com/scm4j/scm4j-vcs-api) for details
2121
- Test Repository
22-
- A SVN repository used for functional testing
23-
- Local file system is used, no dedicated server
24-
- Creates new before and deletes after each test
22+
- A local file-based SVN repository used for functional testing
23+
- Creates new before and deletes after each test automatically
2524
- Named randomly (uuid is used)
2625

27-
# Using pk-vcs-svn
28-
- Add github-hosted pk-vcs-svn and pk-vcs-api projects as maven dependencies using [jitpack.io](https://jitpack.io/). As an example, add following to gradle.build file:
26+
# Using scm4j-vcs-svn
27+
- Add github-hosted scm4j-vcs-svn project as maven dependency using [jitpack.io](https://jitpack.io/). As an example, add following to gradle.build file:
2928
```gradle
3029
allprojects {
3130
repositories {
@@ -35,36 +34,35 @@ Features:
3534

3635
dependencies {
3736
// versioning: master-SNAPSHOT (lastest build, unstable), + (lastest release, stable) or certain version (e.g. 1.1)
38-
compile 'com.github.ProjectKaiser:pk-vcs-svn:1.0'
39-
compile 'com.github.ProjectKaiser:pk-vcs-api:1.1'
37+
compile 'com.github.scm4j:scm4j-vcs-svn:+'
4038
}
4139
```
42-
Or download release jars from https://github.com/ProjectKaiser/pk-vcs-svn/releases, https://github.com/ProjectKaiser/pk-vcs-api/releases
40+
Or download release jars from https://github.com/scm4j/scm4j-vcs-svn/releases
4341
- Create Workspace Home instance providing path to any folder as Workspace Home folder path. This folder will contain repositories folders (if different vcs or repositories are used)
4442
```java
45-
public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "git-workspaces";
43+
public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "svn-workspaces";
4644
...
4745
IVCSWorkspace workspace = new VCSWorkspace(WORKSPACE_DIR);
4846
...
4947
```
5048
- Obtain Repository Workspace from Workspace Home providing a certain Repository's url. The obtained Repository Workspace will represent a folder within Workspace Home dir which will contain all Working Copies relating to the provided VCS Repository
5149
```java
52-
String repoUrl = "https://github.com/ProjectKaiser/pk-vcs-api";
50+
String repoUrl = "https://github.com/MyUser/MyRepo";
5351
IVCSRepositoryWorkspace repoWorkspace = workspace.getVCSRepositoryWorkspace(repoUrl);
5452
```
5553
- Create `SVNVCS` instance providing Repository Workspace, username and password for Repository
5654
```java
5755
IVCS vcs = new SVNVCS(repoWorkspace, username, pass);
5856
```
59-
- Use methods of `IVCS` interface. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
57+
- Use methods of `IVCS` interface. See [scm4j-vcs-api](https://github.com/scm4j/scm4j-vcs-api) for details
6058
- Use `vcs.setProxy()` and `vcs.setCredentials()` if necessary
6159

6260
# Implementation details
6361
- [SVNKit](https://svnkit.com/) is used for manage SVN repositories
6462
- LWC is obtained automatically when necessary
6563

6664
# Functional testing
67-
- To execute tests just run SVNVCSTest class as JUnit test. Tests from VCSAbstractTest class will be executed. See [pk-vcs-test](https://github.com/ProjectKaiser/pk-vcs-test) for details
65+
- To execute tests just run SVNVCSTest class as JUnit test. Tests from VCSAbstractTest class will be executed. See [scm4j-vcs-test](https://github.com/scm4j/scm4j-vcs-test) for details
6866
- Or run `gradle test`
6967

7068
# Limitations

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'eclipse'
55
sourceCompatibility = JavaVersion.VERSION_1_7
66
targetCompatibility = JavaVersion.VERSION_1_7
77

8-
group = 'com.projectkaiser.scm'
8+
group = 'org.scm4j'
99
version = '1.3'
1010

1111
repositories {
@@ -18,11 +18,11 @@ repositories {
1818
defaultTasks 'build';
1919

2020
dependencies {
21-
compile 'com.github.ProjectKaiser:pk-vcs-api:1.2'
21+
compile 'com.github.scm4j:scm4j-vcs-api:master-SNAPSHOT'
2222
compile 'org.tmatesoft.svnkit:svnkit:1.8.14'
2323

2424
testCompile 'junit:junit:4.12'
25-
testCompile 'com.github.ProjectKaiser:pk-vcs-test:1.2'
25+
testCompile 'com.github.scm4j:scm4j-vcs-test:master-SNAPSHOT'
2626
testCompile 'org.mockito:mockito-core:2.0.62-beta'
2727
}
2828

gradle/wrapper/gradle-wrapper.jar

52.9 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Apr 07 15:40:18 GMT+03:00 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'pk-vcs-svn'
1+
rootProject.name = 'scm4j-vcs-svn'

src/main/java/com/projectkaiser/scm/vcs/svn/SVNVCS.java renamed to src/main/java/org/scm4j/vcs/svn/SVNVCS.java

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.projectkaiser.scm.vcs.svn;
1+
package org.scm4j.vcs.svn;
22

33
import java.io.ByteArrayOutputStream;
44
import java.io.File;
@@ -50,16 +50,17 @@
5050
import org.tmatesoft.svn.core.wc2.SvnOperationFactory;
5151
import org.tmatesoft.svn.core.wc2.SvnTarget;
5252

53-
import com.projectkaiser.scm.vcs.api.IVCS;
54-
import com.projectkaiser.scm.vcs.api.VCSChangeType;
55-
import com.projectkaiser.scm.vcs.api.VCSCommit;
56-
import com.projectkaiser.scm.vcs.api.VCSDiffEntry;
57-
import com.projectkaiser.scm.vcs.api.VCSMergeResult;
58-
import com.projectkaiser.scm.vcs.api.exceptions.EVCSBranchExists;
59-
import com.projectkaiser.scm.vcs.api.exceptions.EVCSException;
60-
import com.projectkaiser.scm.vcs.api.exceptions.EVCSFileNotFound;
61-
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSLockedWorkingCopy;
62-
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSRepositoryWorkspace;
53+
import org.scm4j.vcs.api.IVCS;
54+
import org.scm4j.vcs.api.VCSChangeType;
55+
import org.scm4j.vcs.api.VCSCommit;
56+
import org.scm4j.vcs.api.VCSDiffEntry;
57+
import org.scm4j.vcs.api.VCSMergeResult;
58+
import org.scm4j.vcs.api.exceptions.EVCSBranchExists;
59+
import org.scm4j.vcs.api.exceptions.EVCSException;
60+
import org.scm4j.vcs.api.exceptions.EVCSFileNotFound;
61+
import org.scm4j.vcs.api.workingcopy.IVCSLockedWorkingCopy;
62+
import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace;
63+
import org.scm4j.vcs.api.workingcopy.IVCSWorkspace;
6364

6465
public class SVNVCS implements IVCS {
6566

@@ -72,7 +73,7 @@ public class SVNVCS implements IVCS {
7273
private SVNClientManager clientManager;
7374
private SVNURL trunkSVNUrl;
7475
private SVNAuthentication userPassAuth;
75-
private IVCSRepositoryWorkspace repo;
76+
private final IVCSRepositoryWorkspace repo;
7677
private String repoUrl;
7778

7879
public static final String MASTER_PATH= "trunk/";
@@ -334,8 +335,8 @@ public String getRepoUrl() {
334335
return repo.getRepoUrl();
335336
}
336337

337-
private void fillUnifiedDiffs(final String srcBranchName, final String dstBranchName, List<VCSDiffEntry> entries,
338-
IVCSLockedWorkingCopy wc) throws SVNException {
338+
private void fillUnifiedDiffs(final String srcBranchName, final String dstBranchName, List<VCSDiffEntry> entries)
339+
throws SVNException {
339340
for (VCSDiffEntry entry : entries) {
340341
ByteArrayOutputStream baos = new ByteArrayOutputStream();
341342

@@ -381,8 +382,8 @@ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
381382
}
382383

383384

384-
private List<VCSDiffEntry> getDiffEntries(final String srcBranchName, final String dstBranchName,
385-
final IVCSLockedWorkingCopy wc) throws SVNException {
385+
private List<VCSDiffEntry> getDiffEntries(final String srcBranchName, final String dstBranchName)
386+
throws SVNException {
386387
final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
387388
final SvnDiffSummarize summarizeDiff = svnOperationFactory.createDiffSummarize();
388389
final List<VCSDiffEntry> res = new ArrayList<>();
@@ -423,8 +424,8 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
423424
try {
424425
try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy()) {
425426
checkout(getBranchUrl(dstBranchName), wc.getFolder());
426-
List<VCSDiffEntry> entries = getDiffEntries(srcBranchName, dstBranchName, wc);
427-
fillUnifiedDiffs(srcBranchName, dstBranchName, entries, wc);
427+
List<VCSDiffEntry> entries = getDiffEntries(srcBranchName, dstBranchName);
428+
fillUnifiedDiffs(srcBranchName, dstBranchName, entries);
428429
return entries;
429430
}
430431
} catch (SVNException e) {
@@ -545,4 +546,9 @@ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
545546
throw new RuntimeException(e);
546547
}
547548
}
549+
550+
@Override
551+
public IVCSWorkspace getWorkspace() {
552+
return repo.getWorkspace();
553+
}
548554
}

src/test/java/com/projectkaiser/scm/vcs/svn/SVNVCSTest.java renamed to src/test/java/org/scm4j/vcs/svn/SVNVCSTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
package com.projectkaiser.scm.vcs.svn;
1+
package org.scm4j.vcs.svn;
22

33
import java.io.File;
44
import java.io.IOException;
55
import java.util.Collection;
66

77
import org.junit.After;
88
import org.mockito.Mockito;
9+
import org.scm4j.vcs.svn.SVNVCS;
910
import org.tmatesoft.svn.core.SVNDepth;
1011
import org.tmatesoft.svn.core.SVNException;
1112
import org.tmatesoft.svn.core.SVNURL;
@@ -14,25 +15,24 @@
1415
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
1516
import org.tmatesoft.svn.core.wc.SVNWCClient;
1617

17-
import com.projectkaiser.scm.vcs.api.IVCS;
18-
import com.projectkaiser.scm.vcs.api.abstracttest.VCSAbstractTest;
19-
import com.projectkaiser.scm.vcs.api.exceptions.EVCSException;
20-
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSRepositoryWorkspace;
18+
import org.scm4j.vcs.api.IVCS;
19+
import org.scm4j.vcs.api.abstracttest.VCSAbstractTest;
20+
import org.scm4j.vcs.api.exceptions.EVCSException;
21+
import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace;
2122

2223
public class SVNVCSTest extends VCSAbstractTest {
2324

2425
private static final String TRUNK_CREATED_COMMIT_MESSAGE = "trunk/ created";
2526
private static final String BRANCHES_CREATED_COMMIT_MESSAGE = "branches/ created";
2627
private SVNVCS svn;
27-
private SVNURL localRepoUrl;
2828
private SVNRepository svnRepo;
2929
private SVNWCClient mockedSVNRevertClient;
30-
private RuntimeException testSvnRevertException = new RuntimeException("test exeption on svn revert");
30+
private final RuntimeException testSvnRevertException = new RuntimeException("test exeption on svn revert");
3131

3232
@Override
3333
public void setUp() throws Exception {
3434
super.setUp();
35-
localRepoUrl = SVNRepositoryFactory.createLocalRepository(new File(repoUrl.replace("file://", "")), true, true);
35+
SVNURL localRepoUrl = SVNRepositoryFactory.createLocalRepository(new File(repoUrl.replace("file://", "")), true, true);
3636

3737
svnRepo = SVNRepositoryFactory.create(localRepoUrl);
3838

0 commit comments

Comments
 (0)