Skip to content

Commit 648c49e

Browse files
committed
devide getFileContent(): from branch and from revision #1
1 parent 1852ec6 commit 648c49e

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ Note: null passed as a branch name is considered as Master Branch. Any non-null
6262
- Sets proxy parameters if necessary
6363
- `String getRepoUrl()`
6464
- Returns string url of current vcs repository
65-
- `String getFileContent(String branchName, String fileRelativePath, String revision)`
65+
- `String getFileContentFromBranch(String branchName, String filePath)`
6666
- Returns file content as a string using UTF-8 encoding.
67-
- `fileRelativePath` is a path to file within `branchName` branch
68-
- File state at `revision` revision is used. If `revision` is null then Head state is used
67+
- HEAD file state within branch `branchName` is used
68+
- `String getFileContentFromRevision(String revision, String filePath)`
69+
- Returns file content as a string using UTF-8 encoding.
70+
- File state at `revision` revision is used.
6971
- `VCSCommit setFileContent(String branchName, String filePath, String content, String commitMessage)`
7072
- Rewrites a file with path `filePath` within branch `branchName` with content `content` and applies `commitMessage` message to commit
7173
- Creates the file and its parent folders if doesn't exists

src/main/java/org/scm4j/vcs/api/IVCS.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public interface IVCS {
2020

2121
String getRepoUrl();
2222

23-
String getFileContent(String branchName, String fileRelativePath, String revision) throws EVCSFileNotFound;
23+
String getFileContentFromBranch(String branchName, String filePath) throws EVCSFileNotFound;
24+
25+
String getFileContentFromRevision(String revision, String filePath) throws EVCSFileNotFound;
2426

2527
VCSCommit setFileContent(String branchName, String filePath, String content, String commitMessage);
2628

src/main/java/org/scm4j/vcs/api/exceptions/EVCSFileNotFound.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class EVCSFileNotFound extends EVCSException {
44

55
private static final long serialVersionUID = 1L;
66

7-
public EVCSFileNotFound(String repoUrl, String branchName, String filePath, String revision) {
8-
super(String.format("file %s is not found in branch %s at revision %s of repo %s", filePath, branchName, revision == null ? "HEAD" : revision, repoUrl));
7+
public EVCSFileNotFound(String repoUrl, String filePath, String revision) {
8+
super(String.format("file %s is not found in at revision %s of repo %s", filePath, revision == null ? "HEAD" : revision, repoUrl));
99
}
1010
}

src/test/java/org/scm4j/vcs/api/exceptions/ExceptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void testEVCSBranchExists() {
2727

2828
@Test
2929
public void testEVCSFileNotFound() {
30-
EVCSFileNotFound e = new EVCSFileNotFound("test repo", "test branch", "test file", "test revision");
30+
EVCSFileNotFound e = new EVCSFileNotFound("test repo", "test file", "test revision");
3131
assertFalse(e.getMessage().isEmpty());
3232
}
3333

0 commit comments

Comments
 (0)