Adds 'head' as revision for Subversion repositories

To still support the editor plugin, a new field in the
browse command results is needed to indicate, whether
such a result or rather the requested revision can be
modified by a new commit.

This is the case, when
- for Subversion repositories either the new 'head' or the
latest revision has been requested, or
- for Git and HG when a branch (or the default by specifying
no concrete revision) has been used.
This commit is contained in:
Rene Pfeuffer
2024-11-05 10:54:49 +01:00
parent 9ff259df03
commit 4ebf0e2044
14 changed files with 140 additions and 62 deletions

View File

@@ -54,11 +54,27 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
BrowseCommandRequest request = new BrowseCommandRequest();
request.setPath("a.txt");
BrowserResult result = createCommand().getBrowserResult(request);
assertTrue(result.isModifiable());
assertEquals("HEAD", result.getRequestedRevision());
FileObject fileObject = result.getFile();
assertEquals("a.txt", fileObject.getName());
assertFalse(fileObject.isTruncated());
}
@Test
public void testDifferentBranch() throws IOException {
BrowseCommandRequest request = new BrowseCommandRequest();
request.setRevision("test-branch");
BrowserResult result = createCommand().getBrowserResult(request);
assertTrue(result.isModifiable());
Collection<FileObject> foList = result.getFile().getChildren();
assertThat(foList)
.extracting("name")
.containsExactly("c", "a.txt");
}
@Test
public void testDefaultDefaultBranch() throws IOException {
// without default branch, the repository head should be used