Skip to content

Commit 7768f35

Browse files
committed
Merge branch 'master' of https://github.com/scm4j/scm4j-vcs-api
2 parents 26656e3 + d02309c commit 7768f35

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ Note: null passed as a branch name is considered as Master Branch. Any non-null
6363
- Sets proxy parameters if necessary
6464
- `String getRepoUrl()`
6565
- Returns string url of current vcs repository
66-
- `String getFileContent(String branchName, String fileRelativePath, String encoding)`
67-
- Returns file content as a string using `encoding` encoding.
66+
- `String getFileContent(String branchName, String fileRelativePath, String revision)`
67+
- Returns file content as a string using UTF-8 encoding.
6868
- `fileRelativePath` is a path to file within `branchName` branch
69-
- The Head file state is used
70-
- Use `String getFileContent(String branchName, String fileRelativePath)` overload to use UTF-8 encoding by default
69+
- File state at `revision` revision is used. If `revision` is null then Head state is used
7170
- `VCSCommit setFileContent(String branchName, String filePath, String content, String commitMessage)`
7271
- Rewrites a file with path `filePath` within branch `branchName` with content `content` and applies `commitMessage` message to commit
7372
- Creates the file and its parent folders if doesn't exists
@@ -86,6 +85,7 @@ Note: null passed as a branch name is considered as Master Branch. Any non-null
8685
- Returns ordered list of all commits located between commits specified by `firstCommitId` and `untilCommitId` inclusively within branch `branchName`
8786
- If `firstCommitId` is null then all commits until commit specified by `untilCommitId` inclusively are fetched
8887
- If `untilCommitId` is null then all commits starting from commit specified by `firstCommitId` are fetched
88+
- If `firstCommitId` and `untilCommitId` are null then all commits are fetched
8989
- `List<VCSCommit> getCommitsRange(String branchName, String firstCommitId, WalkDirection direction, int limit)`
9090
- Returns ordered list of `limit` commits (0 is unlimited) starting from commit specified by `firstCommitId` in direction specified by `direction`
9191
- If `firstCommitId` is null then commits are starting at branch `branchName` first commit (for ASC direction) or at head of branch (for DESC direction)
@@ -139,6 +139,18 @@ LWC usage scenario:
139139
- OBSOLETE
140140
- `IVCSLockedWorkingCopy.close()` method has been called. Corresponding folder is unlocked and could be used by other `IVCSLockedWorkingCopy` instances. `IVCSLockedWorkingCopy` instance with this state should not be used anymore.
141141
- If a Working copy can not be reused due of VCS system data damage (e.g. .git, .svn folders) or due of vcs Working Copy can not be cleaned, reverted, switched, checked out etc, execute `IVCSLockedWorkingCopy.setCorrupted(true)`. LWC folder will be deleted on close.
142+
- Code snippet
143+
```java
144+
public static final String WORKSPACE_DIR = System.getProperty("java.io.tmpdir") + "scm4j-vcs-workspaces";
145+
public static void main(String[] args) {
146+
IVCSWorkspace workspace = new VCSWorkspace(WORKSPACE_DIR);
147+
String repoUrl = "https://github.com/scm4j/scm4j-vcs-api";
148+
IVCSRepositoryWorkspace repoWorkspace = workspace.getVCSRepositoryWorkspace(repoUrl);
149+
try (IVCSLockedWorkingCopy wc = repoWorkspace.getVCSLockedWorkingCopy()) {
150+
// wc.getFolder() is locked folder
151+
}
152+
}
153+
```
142154

143155
# Folder structure
144156
- Workspace Home folder (e.g. c:\temp\scm4j-vcs-workspces\)

0 commit comments

Comments
 (0)