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; }
/** * Delete the given refspec from the remote repository. * * @param refspec the refspec to delete */ @Override public Optional<Ref> deleteRef(String refspec) { Optional<Ref> deletedRef = remoteRepository.command(UpdateRef.class).setName(refspec) .setDelete(true).call(); return deletedRef; }
/** * 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(); }
private void setRef(final GeogigTransaction transaction, String refName, ObjectId value) { transaction.command(UpdateRef.class).setName(refName).setNewValue(value).call(); } }
/** * Delete the given refspec from the remote repository. * * @param refspec the refspec to delete */ @Override public Optional<Ref> deleteRef(String refspec) { Optional<Ref> deletedRef = remoteRepo.command(UpdateRef.class).setName(refspec) .setDelete(true).call(); return deletedRef; }
/** * 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(); }
/** * Delete the given refspec from the remote repository. * * @param refspec the refspec to delete */ @Override public Optional<Ref> deleteRef(String refspec) { Optional<Ref> deletedRef = remoteRepository.command(UpdateRef.class).setName(refspec) .setDelete(true).call(); return deletedRef; }
/** * 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(Context liveContext, Ref ref) { String name = ref.getName(); ObjectId objectId = ref.getObjectId(); liveContext.command(UpdateRef.class).setName(name).setNewValue(objectId).call(); }
@Test public void testDeleteWithNonexistentName() { Optional<Ref> ref = geogig.command(UpdateRef.class).setDelete(true).setName("NoRef").call(); assertFalse(ref.isPresent()); } }
@Test public void testDeleteWithNonexistentName() { Optional<Ref> ref = geogig.command(UpdateRef.class).setDelete(true).setName("NoRef").call(); assertFalse(ref.isPresent()); } }
@Test public void testNoValue() { exception.expect(IllegalStateException.class); geogig.command(UpdateRef.class).setName(Ref.MASTER).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(); } }