private Ref setRef(final GeogigTransaction transaction, String refName, ObjectId value) { return transaction.command(UpdateRef.class).setName(refName).setNewValue(value).call() .get(); }
/** * Updates the WORK_HEAD ref to the specified tree. * * @param newTree the tree to be set as the new WORK_HEAD */ @Override public synchronized ObjectId updateWorkHead(ObjectId newTree) { context.command(UpdateRef.class).setName(Ref.WORK_HEAD).setNewValue(newTree).call(); return newTree; }
/** * Updates the STAGE_HEAD ref to the specified tree. * * @param newTree the tree to set as the new STAGE_HEAD */ @Override public void updateStageHead(ObjectId newTree) { context.command(UpdateRef.class).setName(Ref.STAGE_HEAD).setNewValue(newTree).call(); }
/** * Updates the STAGE_HEAD ref to the specified tree. * * @param newTree the tree to set as the new STAGE_HEAD */ @Override public void updateStageHead(ObjectId newTree) { context.command(UpdateRef.class).setName(Ref.STAGE_HEAD).setNewValue(newTree).call(); }
/** * Updates the WORK_HEAD ref to the specified tree. * * @param newTree the tree to be set as the new WORK_HEAD */ @Override public synchronized ObjectId updateWorkHead(ObjectId newTree) { context.command(UpdateRef.class).setName(Ref.WORK_HEAD).setNewValue(newTree).call(); return newTree; }
private void setRef(final GeogigTransaction transaction, String refName, ObjectId value) { transaction.command(UpdateRef.class).setName(refName).setNewValue(value).call(); } }
private Optional<Ref> updateRef(ObjectId objectId, String refName) { return this.command(UpdateRef.class).setNewValue(objectId).setName(refName).call(); }
private Optional<Ref> updateRef(ObjectId objectId, String refName) { return this.command(UpdateRef.class).setNewValue(objectId).setName(refName).call(); }
private void setRef(Context liveContext, Ref ref) { String name = ref.getName(); ObjectId objectId = ref.getObjectId(); liveContext.command(UpdateRef.class).setName(name).setNewValue(objectId).call(); }
private RevTree createStageHeadTree(NodeRef... treeRefs) { RevTree root = createFromRefs(objectDb, treeRefs); geogig.command(UpdateRef.class).setName(Ref.STAGE_HEAD).setNewValue(root.getId()).call(); return root; }
private RevTree createStageHeadTree(NodeRef... treeRefs) { RevTree root = createFromRefs(objectDb, treeRefs); geogig.command(UpdateRef.class).setName(Ref.STAGE_HEAD).setNewValue(root.getId()).call(); return root; }
@Given("^I have a remote ref called \"([^\"]*)\"$") public void i_have_a_remote_ref_called(String expected) throws Throwable { String ref = "refs/remotes/origin/" + expected; localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(UpdateRef.class).setName(ref) .setNewValue(ObjectId.NULL).call(); Optional<Ref> refValue = localRepo.geogigCLI.getGeogig(Hints.readWrite()) .command(RefParse.class).setName(ref).call(); assertTrue(refValue.isPresent()); assertEquals(refValue.get().getObjectId(), ObjectId.NULL); }
@Given("^I have a remote ref called \"([^\"]*)\"$") public void i_have_a_remote_ref_called(String expected) throws Throwable { String ref = "refs/remotes/origin/" + expected; localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(UpdateRef.class).setName(ref) .setNewValue(ObjectId.NULL).call(); Optional<Ref> refValue = localRepo.geogigCLI.getGeogig(Hints.readWrite()) .command(RefParse.class).setName(ref).call(); assertTrue(refValue.isPresent()); assertEquals(refValue.get().getObjectId(), ObjectId.NULL); }
@Given("^I have a remote ref called \"([^\"]*)\"$") public void i_have_a_remote_ref_called(String expected) throws Throwable { String ref = "refs/remotes/origin/" + expected; localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(UpdateRef.class).setName(ref) .setNewValue(ObjectId.NULL).call(); Optional<Ref> refValue = localRepo.geogigCLI.getGeogig(Hints.readWrite()) .command(RefParse.class).setName(ref).call(); assertTrue(refValue.isPresent()); assertEquals(refValue.get().getObjectId(), ObjectId.NULL); }
@Test public void InvalidBranchNameTest() throws Exception { insertAndAdd(points1); geogig.command(AddOp.class).call(); geogig.command(CommitOp.class).call(); Ref testBranch = geogig.command(BranchCreateOp.class).setName("TestBranch").call(); testBranch = geogig.command(UpdateRef.class).setName("TestBranch") .setNewValue(testBranch.getObjectId()).call().get(); exception.expect(IllegalArgumentException.class); geogig.command(BranchDeleteOp.class).setName("TestBranch").call(); }
@Test public void InvalidBranchNameTest() throws Exception { insertAndAdd(points1); geogig.command(AddOp.class).call(); geogig.command(CommitOp.class).call(); Ref testBranch = geogig.command(BranchCreateOp.class).setName("TestBranch").call(); testBranch = geogig.command(UpdateRef.class).setName("TestBranch") .setNewValue(testBranch.getObjectId()).call().get(); exception.expect(IllegalArgumentException.class); geogig.command(BranchDeleteOp.class).setName("TestBranch").call(); } }
@Test public void testConstructorAndMutators() throws Exception { insertAndAdd(points1); RevCommit commit1 = geogig.command(CommitOp.class).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); RevCommit commit2 = geogig.command(CommitOp.class).call(); Optional<Ref> newBranch = geogig.command(UpdateRef.class).setName("refs/heads/branch1") .setNewValue(commit2.getId()).setOldValue(commit1.getId()).setReason("Testing") .call(); assertTrue(newBranch.get().getObjectId().equals(commit2.getId())); assertFalse(newBranch.get().getObjectId().equals(commit1.getId())); }
@Test public void testConstructorAndMutators() throws Exception { insertAndAdd(points1); RevCommit commit1 = geogig.command(CommitOp.class).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); RevCommit commit2 = geogig.command(CommitOp.class).call(); Optional<Ref> newBranch = geogig.command(UpdateRef.class).setName("refs/heads/branch1") .setNewValue(commit2.getId()).setOldValue(commit1.getId()).setReason("Testing") .call(); assertTrue(newBranch.get().getObjectId().equals(commit2.getId())); assertFalse(newBranch.get().getObjectId().equals(commit1.getId())); }
private RevTree createHeadTree(NodeRef... treeRefs) { RevTree root = createFromRefs(objectDb, treeRefs); objectDb.put(root); CommitBuilder cb = new CommitBuilder(geogig.getPlatform()); ObjectId treeId = root.getId(); RevCommit commit = cb.setTreeId(treeId).setCommitter("Gabriel Roldan") .setAuthor("Gabriel Roldan").build(); objectDb.put(commit); SymRef head = (SymRef) geogig.command(RefParse.class).setName(Ref.HEAD).call().get(); final String currentBranch = head.getTarget(); geogig.command(UpdateRef.class).setName(currentBranch).setNewValue(commit.getId()).call(); verifyRepositoryTree(NodeRef.ROOT, treeId); verifyTreeStructure(treeId, treeRefs); return root; }
private RevTree createHeadTree(NodeRef... treeRefs) { RevTree root = createFromRefs(objectDb, treeRefs); objectDb.put(root); RevCommitBuilder cb = RevCommit.builder().platform(geogig.getPlatform()); ObjectId treeId = root.getId(); RevCommit commit = cb.treeId(treeId).committer("Gabriel Roldan").author("Gabriel Roldan") .build(); objectDb.put(commit); SymRef head = (SymRef) geogig.command(RefParse.class).setName(Ref.HEAD).call().get(); final String currentBranch = head.getTarget(); geogig.command(UpdateRef.class).setName(currentBranch).setNewValue(commit.getId()).call(); verifyRepositoryTree(NodeRef.ROOT, treeId); verifyTreeStructure(treeId, treeRefs); return root; }