Skip to content

Commit 47d2545

Browse files
authored
Update README.md
1 parent 1823250 commit 47d2545

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# pk-vcs-git
1+
# Overview
2+
3+
Pk-vcs-git is [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) IVCS implementation for Git repositories.
4+
5+
# Terms
6+
- Workspace Home
7+
- Home folder of all folders used by vcs-related operations. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
8+
- Repository Workspace
9+
- Folder for LWC folders related to Repository of one type. See [pk-vcs-api](https://github.com/ProjectKaiser/pk-vcs-api) for details
10+
- Test Repository
11+
- Git repository which is used to execute functional tests
12+
- Hosted on [Github](https://github.com/) using username and password provided by enviroment variables (see below)
13+
- Generates new before and deletes after each test
14+
- Named randomly (uuid is used)
15+
- [Kohsuke Github API](http://github-api.kohsuke.org/) is used as to work with Github API
16+
17+
# Using pk-vcs-git
18+
- Add github-hosted pk-vcs-git project as maven dependency using jitpack.io. As an example, add following to gradle.build file:
19+
```gradle
20+
allprojects {
21+
repositories {
22+
maven { url "https://jitpack.io" }
23+
}
24+
}
25+
26+
dependencies {
27+
compile 'com.github.ProjectKaiser:pk-vcs-git:master-SNAPSHOT'
28+
}
29+
```
30+
- 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)
31+
```java
32+
public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "git-workspaces";
33+
...
34+
IVCSWorkspace workspace = new VCSWorkspace(WORKSPACE_DIR);
35+
...
36+
```
37+
- 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
38+
```java
39+
String repoUrl = "https://github.com/ProjectKaiser/pk-vcs-api";
40+
IVCSRepositoryWorkspace repoWorkspace = workspace.getVCSRepositoryWorkspace(repoUrl);
41+
```
42+
- Create `GitVCS` instance providing Repository Workspace
43+
```java
44+
IVCS vcs = new GitVCS(repoWorkspace);
45+
```
46+
- Use `vcs.setProxy()` and `vcs.setCredentials()` if neccessary
47+
-
48+
# Implementation details
49+
50+
- [JGit](https://eclipse.org/jgit/) is used as framework to work with Git repositories
51+
- [Github](https://github.com/) is used as hosting of a Test Repository
52+
- LWC is obtained for each vcs operation.
53+
- `getLocalGit(IVCSLockedWorkingCopy wc)` method is used to create a Git implementation to execute vcs operations within `wc` Working Copy
54+
- If provided LWC is empty then current Test Repository is cloned into this LWC, otherwise just Git object is created
55+
- If `IVCS.setProxy()` is called then provided proxy is used to each url which contains `repoUrl`
56+
57+
# Functional testing
58+
59+
- Github is used for hosting the Test Repository
60+
- [Kohsuke Github API](http://github-api.kohsuke.org/) is used to create and delete Test Repository
61+
- `PK_VCS_TEST_GITHUB_USER` enviroment var or JVM var is used as username for access to Github
62+
- `PK_VCS_TEST_GITHUB_PASS` enviroment var or JVM var is used as user password for access to Github
63+
- New Test Repository is created before each test and deletes automatically after each test
64+
- To execute tests just run GitVCSTest class as JUnit test. Tests from VCSAbstractTest class will be executed. See [pk-vcs-test](https://github.com/ProjectKaiser/pk-vcs-test) for details

0 commit comments

Comments
 (0)