本文整理了Java中org.locationtech.geogig.model.Ref.getObjectId
方法的一些代码示例,展示了Ref.getObjectId
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ref.getObjectId
方法的具体详情如下:
包路径:org.locationtech.geogig.model.Ref
类名称:Ref
方法名:getObjectId
暂无
代码示例来源:origin: locationtech/geogig
/**
* Constructs a new {@code SymRef} with the given name and target reference.
*
* @param name the name of the symbolic reference
* @param target the reference that this symbolic ref points to
*/
public SymRef(String name, Ref target) {
super(name, target.getObjectId());
this.target = target.getName();
}
代码示例来源:origin: locationtech/geogig
static CompletableFuture<Integer> countMissingCommits(Ref oldTip, Ref newTip, Context context) {
if (oldTip.getObjectId().equals(newTip.getObjectId())) {
return CompletableFuture.completedFuture(Integer.valueOf(0));
}
return CompletableFuture.supplyAsync(() -> {
Iterator<RevCommit> missingCommits = context.command(LogOp.class)
.setUntil(newTip.getObjectId()).setSince(oldTip.getObjectId()).call();
int commitsBehind = Iterators.size(missingCommits);
return commitsBehind;
});
}
代码示例来源:origin: locationtech/geogig
@Override
public boolean apply(@Nullable Ref ref) {
String refName = ref.getName();
ObjectId refId = ref.getObjectId();
return refName.startsWith(Ref.HEADS_PREFIX) && refId.equals(this.id);
}
};
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
public boolean apply(@Nullable Ref ref) {
String refName = ref.getName();
ObjectId refId = ref.getObjectId();
return refName.startsWith(Ref.HEADS_PREFIX) && refId.equals(this.id);
}
};
代码示例来源:origin: locationtech/geogig
/**
* @param o object to compare against
* @return whether or not this ref is equal to the target object
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Ref)) {
return false;
}
Ref r = (Ref) o;
return name.equals(r.getName()) && objectId.equals(r.getObjectId());
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
protected ImmutableList<RevTag> _call() {
List<Ref> refs = newArrayList(
command(ForEachRef.class).setPrefixFilter(Ref.TAGS_PREFIX).call());
List<ObjectId> tagIds = transform(refs, (r) -> r.getObjectId());
Iterator<RevTag> alltags;
alltags = objectDatabase().getAll(tagIds, BulkOpListener.NOOP_LISTENER, RevTag.class);
ImmutableList<RevTag> res = ImmutableList.copyOf(alltags);
return res;
}
代码示例来源:origin: locationtech/geogig
private void testRsolvePartial(String refSpec, String refName) {
Optional<Ref> ref;
ref = command.setName(refSpec).call();
assertTrue(ref.isPresent());
assertEquals(refName, ref.get().getName());
assertEquals(RevObjectTestSupport.hashString(refName), ref.get().getObjectId());
}
代码示例来源:origin: locationtech/geogig
public @Test void prepareUpToDateNoConflicts() {
PRStatus result = prepare();
assertTrue(result.getReport().isPresent());
MergeScenarioReport mergeReport = result.getReport().get();
assertNotNull(mergeReport);
assertTrue(result.getMergeCommit().isPresent());
ObjectId mergeCommitId = result.getMergeCommit().get();
GeogigTransaction prtx = getTransaction();
Optional<Ref> mergeRef = request.resolveMergeRef(prtx);
assertTrue(mergeRef.isPresent());
assertEquals(mergeCommitId, mergeRef.get().getObjectId());
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
public TestData mergeNoFF(String branchToMerge, String mergeCommitMessage) {
ObjectId branchHead = getContext().command(RefParse.class).setName(branchToMerge).call()
.get().getObjectId();
MergeReport report = getContext().command(MergeOp.class).setNoFastForward(true)
.setMessage(mergeCommitMessage).addCommit(branchHead).call();
RevCommit mergeCommit = report.getMergeCommit();
checkState(mergeCommit.getParentIds().size() == 2);
LOG.debug(mergeCommit.toString());
return this;
}
代码示例来源:origin: locationtech/geogig
@Test
public void testRebaseNoCommits() throws Exception {
Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();
exception.expect(IllegalStateException.class);
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(master.get().getObjectId()))
.call();
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Test
public void testRebaseNoCommits() throws Exception {
Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();
exception.expect(IllegalStateException.class);
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(master.get().getObjectId()))
.call();
}
代码示例来源:origin: locationtech/geogig
@Test
public void testCreateBranch() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).setMessage("Commit1").call();
geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true).call();
Optional<Ref> branch1 = geogig.command(RefParse.class).setName("branch1").call();
assertTrue(branch1.isPresent());
Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();
assertEquals(master.get().getObjectId(), branch1.get().getObjectId());
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Test
public void testCreateBranch() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).setMessage("Commit1").call();
geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true).call();
Optional<Ref> branch1 = geogig.command(RefParse.class).setName("branch1").call();
assertTrue(branch1.isPresent());
Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();
assertEquals(master.get().getObjectId(), branch1.get().getObjectId());
}
代码示例来源:origin: locationtech/geogig
private void fakeUpToDate() {
Remote remote = request.buildRemote();
GeogigTransaction tx = request.getTransaction(origin.getRepo().context());
tx.command(FetchOp.class).setFetchIndexes(true).addRemote(remote).call();
Ref remoteBranchState = clone.getRef(request.getRemoteBranch());
Ref localRemoteBranchState = tx.command(RefParse.class).setName(request.getOriginRef())
.call().get();
assertEquals(remoteBranchState.getObjectId(), localRemoteBranchState.getObjectId());
}
}
代码示例来源:origin: locationtech/geogig
@Test
public void testRebaseNoUpstreamCommit() throws Exception {
Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();
insertAndAdd(points1);
geogig.command(CommitOp.class).setMessage("commit for " + idP1).call();
exception.expect(IllegalStateException.class);
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(master.get().getObjectId()))
.call();
}
代码示例来源:origin: locationtech/geogig
@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);
}
代码示例来源:origin: locationtech/geogig
@Given("^I have a merge conflict state$")
public void I_have_a_merge_conflict_state() throws Throwable {
I_have_conflicting_branches();
Ref branch = localRepo.geogigCLI.getGeogig(Hints.readOnly()).command(RefParse.class)
.setName("branch1").call().get();
try {
localRepo.geogigCLI.getGeogig(Hints.readWrite()).command(MergeOp.class)
.addCommit(branch.getObjectId()).call();
fail();
} catch (MergeConflictsException e) {
}
}
代码示例来源:origin: locationtech/geogig
@Test
public void testSymRef() {
Ref testRef = new Ref(Ref.REFS_PREFIX + "commit1",
ObjectId.valueOf("abc123000000000000001234567890abcdef0000"));
SymRef symRef = new SymRef("TestRef", testRef);
assertEquals(testRef.getName(), symRef.getTarget());
String symRefString = symRef.toString();
assertEquals("TestRef -> " + "[" + testRef.getName() + " -> "
+ testRef.getObjectId().toString() + "]", symRefString);
}
}
代码示例来源:origin: locationtech/geogig
@Test
public void testConstructorAndMutators() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
Ref branch = geogig.command(BranchCreateOp.class).setName("branch1").call();
geogig.command(UpdateSymRef.class).setDelete(false).setName(Ref.HEAD)
.setNewValue("refs/heads/branch1").setOldValue(Ref.MASTER)
.setReason("this is a test").call();
Optional<ObjectId> branchId = geogig.command(RevParse.class).setRefSpec(Ref.HEAD).call();
assertTrue(branch.getObjectId().equals(branchId.get()));
}
代码示例来源:origin: locationtech/geogig
@Test
public void testOrphan() throws Exception {
insertAndAdd(points1);
geogig.command(CommitOp.class).setMessage("Commit1").call();
Ref branch1 = geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true)
.setOrphan(true).call();
assertEquals(ObjectId.NULL, branch1.getObjectId());
assertEquals(Ref.HEADS_PREFIX + "branch1", branch1.getName());
}
}
内容来源于网络,如有侵权,请联系作者删除!