.setOldValue(oldRef == null ? null : oldRef.getObjectId())//
.setOldValue(oldRef == null ? null : oldRef.getObjectId())//
when(mockUpdateRef.setDelete(anyBoolean())).thenReturn(mockUpdateRef); when(mockUpdateRef.setNewValue((ObjectId) anyObject())).thenReturn(mockUpdateRef); when(mockUpdateRef.setOldValue((ObjectId) anyObject())).thenReturn(mockUpdateRef); when(mockUpdateRef.setReason(anyString())).thenReturn(mockUpdateRef);
when(mockUpdateRef.setDelete(anyBoolean())).thenReturn(mockUpdateRef); when(mockUpdateRef.setNewValue((ObjectId) anyObject())).thenReturn(mockUpdateRef); when(mockUpdateRef.setOldValue((ObjectId) anyObject())).thenReturn(mockUpdateRef); when(mockUpdateRef.setReason(anyString())).thenReturn(mockUpdateRef);
private Iterable<RefDiff> updateLocalRemoteRefs(Remote remote, List<LocalRemoteRef> fetchSpecs, final boolean prune) { List<RefDiff> updatedLocalRemoteRefs = new ArrayList<>(); for (LocalRemoteRef expected : fetchSpecs) { final boolean isNew = expected.isNew; final boolean remoteDeleted = expected.remoteDeleted; final String localName = expected.localRemoteRef.getName(); if (remoteDeleted) { if (prune) { updatedLocalRemoteRefs.add(RefDiff.removed(expected.localRemoteRef)); command(UpdateRef.class).setName(localName) .setOldValue(expected.localRemoteRef.getObjectId()).setDelete(true) .call(); } continue; } RefDiff localRefDiff; Ref oldRef = isNew ? null : expected.localRemoteRef; Ref newRef = new Ref(localName, expected.remoteRef.getObjectId()); command(UpdateRef.class).setName(localName).setNewValue(newRef.getObjectId()).call(); localRefDiff = new RefDiff(oldRef, newRef); updatedLocalRemoteRefs.add(localRefDiff); } return updatedLocalRemoteRefs; }
@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())); }
cmd.setOldValue(oldValue)// .setNewValue(newValue);
cmd.setOldValue(oldValue)// .setNewValue(newValue);
@Test public void testDeleteRefThatWasASymRef() 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(); geogig.command(UpdateSymRef.class).setName("refs/heads/branch1") .setOldValue(commit1.getId().toString()).setNewValue(Ref.MASTER) .setReason("this is a test").call(); geogig.command(UpdateRef.class).setName("refs/heads/branch1").setNewValue(commit2.getId()) .setOldValue(Ref.MASTER).call(); Optional<Ref> branchId = geogig.command(RefParse.class).setName("refs/heads/branch1") .call(); assertTrue(branchId.get().getObjectId().equals(commit2.getId())); geogig.command(UpdateRef.class).setDelete(true).setName("refs/heads/branch1").call(); }
@Test public void testDeleteRefThatWasASymRef() 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(); geogig.command(UpdateSymRef.class).setName("refs/heads/branch1") .setOldValue(commit1.getId().toString()).setNewValue(Ref.MASTER) .setReason("this is a test").call(); geogig.command(UpdateRef.class).setName("refs/heads/branch1").setNewValue(commit2.getId()) .setOldValue(Ref.MASTER).call(); Optional<Ref> branchId = geogig.command(RefParse.class).setName("refs/heads/branch1") .call(); assertTrue(branchId.get().getObjectId().equals(commit2.getId())); geogig.command(UpdateRef.class).setDelete(true).setName("refs/heads/branch1").call(); }
.setOldValue(masterCommit3.getId()).setNewValue(mergeCommit.getId()).call();
.setOldValue(masterCommit3.getId()).setNewValue(mergeCommit.getId()).call();