provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.NORMAL);
provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.NORMAL);
provider.setAttribute(_path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); provider.setAttribute(_path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.NORMAL);
provider.setAttribute(path3, "basic:isRegularFile", true); provider.setAttribute(path3, "isRegularFile", true); provider.setAttribute(path3, "notExisits", true); provider.setAttribute(path3, "advanced:notExisits", true); provider.setAttribute(path3, ":isRegularFile", true);
provider.setAttribute(path3, "basic:isRegularFile", true); provider.setAttribute(path3, "isRegularFile", true); provider.setAttribute(path3, "notExisits", true); provider.setAttribute(path3, "advanced:notExisits", true); provider.setAttribute(path3, ":isRegularFile", true);
provider.setAttribute(_path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); provider.setAttribute(_path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.NORMAL);
@Test(expected = GitException.class) public void testSquashFailBecauseCommitIsFromAnotherBranch() throws IOException, GitAPIException { final URI newRepo = URI.create("git://squash-repo"); final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo, EMPTY_ENV); final Path generalPath = provider.getPath(URI.create("git://master@squash-repo/")); final Path path = provider.getPath(URI.create("git://develop@squash-repo/myfile1.txt")); final Path path2 = provider.getPath(URI.create("git://master@squash-repo/myfile2.txt")); final Path path3 = provider.getPath(URI.create("git://master@squash-repo/myfile3.txt")); final OutputStream aStream = provider.newOutputStream(path); aStream.write("my cool content".getBytes()); aStream.close(); final List<RevCommit> commits = getCommitsFromBranch((GitImpl) fs.getGit(), "develop"); final OutputStream bStream = provider.newOutputStream(path2); bStream.write("my cool content".getBytes()); bStream.close(); final OutputStream cStream = provider.newOutputStream(path3); cStream.write("my cool content".getBytes()); cStream.close(); final VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", "squashing!", new Date(), commits.get(0).getName()); final SquashOption squashOption = new SquashOption(record); provider.setAttribute(generalPath, SquashOption.SQUASH_ATTR, squashOption); }
@Test(expected = GitException.class) public void testSquashFailBecauseCommitIsFromAnotherBranch() throws IOException, GitAPIException { final URI newRepo = URI.create("git://squash-repo"); final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo, EMPTY_ENV); final Path generalPath = provider.getPath(URI.create("git://master@squash-repo/")); final Path path = provider.getPath(URI.create("git://develop@squash-repo/myfile1.txt")); final Path path2 = provider.getPath(URI.create("git://master@squash-repo/myfile2.txt")); final Path path3 = provider.getPath(URI.create("git://master@squash-repo/myfile3.txt")); final OutputStream aStream = provider.newOutputStream(path); aStream.write("my cool content".getBytes()); aStream.close(); final List<RevCommit> commits = getCommitsFromBranch((GitImpl) fs.getGit(), "develop"); final OutputStream bStream = provider.newOutputStream(path2); bStream.write("my cool content".getBytes()); bStream.close(); final OutputStream cStream = provider.newOutputStream(path3); cStream.write("my cool content".getBytes()); cStream.close(); final VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", "squashing!", new Date(), commits.get(0).getName()); final SquashOption squashOption = new SquashOption(record); provider.setAttribute(generalPath, SquashOption.SQUASH_ATTR, squashOption); }
@Test public void testCreateFileIntoRepositoryWithFolder() throws IOException, GitAPIException { final Map<String, ?> env = new HashMap<String, Object>() {{ put("init", Boolean.TRUE); }}; String oldPath = "git://test/old"; final URI oldUri = URI.create(oldPath); final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(oldUri, env); final Path path = provider.getPath(URI.create("git://master@test/old/some/path/myfile.txt")); provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); final OutputStream outStream = provider.newOutputStream(path); assertThat(outStream).isNotNull(); outStream.write(("my cool content").getBytes()); outStream.close(); assertThat(new File(provider.getGitRepoContainerDir(), "test/old" + ".git")).exists(); int commitsCount = 0; for (RevCommit com : ((GitImpl) fs.getGit())._log().all().call()) { commitsCount++; } }
@Test public void testCreateFileIntoRepositoryWithFolder() throws IOException, GitAPIException { final Map<String, ?> env = new HashMap<String, Object>() {{ put("init", Boolean.TRUE); }}; String oldPath = "git://test/old"; final URI oldUri = URI.create(oldPath); final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(oldUri, env); final Path path = provider.getPath(URI.create("git://master@test/old/some/path/myfile.txt")); provider.setAttribute(path, FileSystemState.FILE_SYSTEM_STATE_ATTR, FileSystemState.BATCH); final OutputStream outStream = provider.newOutputStream(path); assertThat(outStream).isNotNull(); outStream.write(("my cool content").getBytes()); outStream.close(); assertThat(new File(provider.getGitRepoContainerDir(), "test/old" + ".git")).exists(); int commitsCount = 0; for (RevCommit com : ((GitImpl) fs.getGit())._log().all().call()) { commitsCount++; } }
final SquashOption squashOption = new SquashOption(record); provider.setAttribute(generalPath, SquashOption.SQUASH_ATTR, squashOption);
final SquashOption squashOption = new SquashOption(record); provider.setAttribute(generalPath, SquashOption.SQUASH_ATTR, squashOption);
provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-1: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-2: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-1: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-2: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-1: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-2: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-1: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption); SquashOption squashOption = new SquashOption(record); logger.info("COMMITTER-2: Squashing"); provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);
provider.setAttribute(master, SquashOption.SQUASH_ATTR, squashOption);