本文整理了Java中org.locationtech.geogig.model.Ref.peel
方法的一些代码示例,展示了Ref.peel
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ref.peel
方法的具体详情如下:
包路径:org.locationtech.geogig.model.Ref
类名称:Ref
方法名:peel
[英]Returns the resolved ref this ref points to.
For regular refs, just returns this, SymRef return the ref they point to.
[中]返回此ref指向的已解析ref。
对于常规ref,只返回这个,SymRef返回它们指向的ref。
代码示例来源:origin: locationtech/geogig
protected @Override java.util.Optional<Ref> _call() {
Ref head = command(RefParse.class).setName(branchName).call().orNull();
if (head != null && Ref.HEAD.equals(branchName) && (head instanceof SymRef)) {
head = head.peel();
}
return Optional.ofNullable(head);
}
代码示例来源:origin: locationtech/geogig
private Ref toLocal(Ref remoteRef) {
Optional<String> localName = remote.mapToRemote(remoteRef.getName());
Preconditions.checkArgument(localName.isPresent(), "Can't map %s to local ref using %s",
remoteRef.getName(), remote.getFetchSpec());
Ref localRef;
if (remoteRef instanceof SymRef) {
Ref target = toLocal(remoteRef.peel());
localRef = new SymRef(localName.get(), target);
} else {
localRef = new Ref(localName.get(), remoteRef.getObjectId());
}
return localRef;
}
代码示例来源:origin: locationtech/geogig
private Ref toRemote(Ref localRef) {
Optional<String> remoteName = remote.mapToLocal(localRef.getName());
Preconditions.checkArgument(remoteName.isPresent(), "Can't map %s to remote ref using %s",
localRef.getName(), remote.getFetchSpec());
Ref remoteRef;
if (localRef instanceof SymRef) {
Ref target = toRemote(localRef.peel());
remoteRef = new SymRef(remoteName.get(), target);
} else {
remoteRef = new Ref(remoteName.get(), localRef.getObjectId());
}
return remoteRef;
}
代码示例来源:origin: locationtech/geogig
private static Set<ObjectId> veifyRepositoryContents(Repository repo,
Map<String, Ref> allRefs) {
Set<ObjectId> allIds = Sets.newConcurrentHashSet();
for (Ref ref : allRefs.values()) {
if (ref instanceof SymRef) {
Ref target = ref.peel();
assertTrue(format("symref points to a non existent ref: %s", ref),
allRefs.containsKey(target.getName()));
} else {
Stack<String> pathToObject = new Stack<>();
pathToObject.push(ref.getName());
verifyAllReachableContents(repo, ref.getObjectId(), pathToObject, allIds);
pathToObject.pop();
}
}
return allIds;
}
代码示例来源:origin: org.locationtech.geogig/geogig-remoting
.call().orNull();
if (currRemoteHead instanceof SymRef) {
currentBranch = currRemoteHead.peel().localName();
代码示例来源:origin: org.locationtech.geogig/geogig-core
/**
* Verifies that all the reachable objects from all the refs in the repo exist in the repo's
* database
*/
public static Set<ObjectId> verifyRepositoryContents(Repository repo) {
Map<String, Ref> allRefs = Maps.uniqueIndex(repo.command(ForEachRef.class).call(),
(r) -> r.getName());
allRefs = Maps.filterKeys(allRefs,
(k) -> !k.equals(Ref.STAGE_HEAD) && !k.equals(Ref.WORK_HEAD));
Set<ObjectId> allIds = Sets.newConcurrentHashSet();
for (Ref ref : allRefs.values()) {
if (ref instanceof SymRef) {
Ref target = ref.peel();
assertTrue(format("symref points to a non existent ref: %s", ref),
allRefs.containsKey(target.getName()));
} else {
Stack<String> pathToObject = new Stack<>();
pathToObject.push(ref.getName());
verifyAllReachableContents(repo, ref.getObjectId(), pathToObject, allIds);
pathToObject.pop();
}
}
return allIds;
}
代码示例来源:origin: locationtech/geogig
Ref rhead = remoteHeadRef.get();
if (rhead instanceof SymRef) {
currentBranch = rhead.peel().localName();
} else {
代码示例来源:origin: locationtech/geogig
checkArgument(headRef.isPresent() && headRef.get() instanceof SymRef,
"Cannot rename detached HEAD.");
oldBranch = command(RefParse.class).setName(headRef.get().peel().localName()).call();
} else {
oldBranch = command(RefParse.class).setName(oldBranchName).call();
代码示例来源:origin: locationtech/geogig
checkState(currHead instanceof SymRef, "Can't revert from detached HEAD");
checkState(!currHead.getObjectId().isNull(), "HEAD has no history.");
currentBranch = currHead.peel().getName();
revertHead = currHead.getObjectId();
代码示例来源:origin: locationtech/geogig
String refName = target.peel().getName();
command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(refName).call();
checkoutResult.setNewRef(targetRef.get());
代码示例来源:origin: org.locationtech.geogig/geogig-core
String refName = target.peel().getName();
command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(refName).call();
result.setNewRef(targetRef.get());
代码示例来源:origin: org.locationtech.geogig/geogig-remoting
throw new IllegalStateException();
Ref want = cr.getNewRef().peel();
代码示例来源:origin: locationtech/geogig
remoteRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
cloneRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
代码示例来源:origin: org.locationtech.geogig/geogig-remoting
remoteRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
cloneRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
代码示例来源:origin: locationtech/geogig
public @Test void prepareAndManuallyResolveAllConflicts() {
createConflicts(TestData.point1, TestData.line1, TestData.poly1);
PRStatus result = prepare();
assertEquals(3, result.getNumConflicts());
final UUID transactionId = request.getTransactionId();
origin.resumeTransaction(transactionId);
assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());
//@formatter:off
SimpleFeature c1 = TestData.clone(TestData.point1); c1.setAttribute("sp", "manually set");
SimpleFeature c2 = TestData.clone(TestData.line1); c2.setAttribute("sp", "manually set");
SimpleFeature c3 = TestData.clone(TestData.poly1); c3.setAttribute("sp", "manually set");
//@formatter:on
Context context = clone.checkout("issuerBranch").getContext();
try {
PullResult pres = context.command(PullOp.class).addRefSpec("master").call();
fail("Expected MergeConflictsException , got " + pres);
} catch (MergeConflictsException e) {
assertEquals(3, e.getReport().getConflicts());
clone.insert(c1, c2, c3).add().commit("manual conflict fix");
}
result = prepare();
assertTrue(result.getMergeCommit().isPresent());
assertTrue(result.getReport().isPresent());
GeogigTransaction prtx = getTransaction();
Optional<Ref> mergeRef = request.resolveMergeRef(prtx);
assertTrue(mergeRef.isPresent());
assertEquals(result.getMergeCommit().get(), mergeRef.get().getObjectId());
}
代码示例来源:origin: locationtech/geogig
assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());
代码示例来源:origin: locationtech/geogig
assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());
内容来源于网络,如有侵权,请联系作者删除!