org.locationtech.geogig.model.Ref.peel()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中org.locationtech.geogig.model.Ref.peel方法的一些代码示例,展示了Ref.peel的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ref.peel方法的具体详情如下:
包路径:org.locationtech.geogig.model.Ref
类名称:Ref
方法名:peel

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

  1. protected @Override java.util.Optional<Ref> _call() {
  2. Ref head = command(RefParse.class).setName(branchName).call().orNull();
  3. if (head != null && Ref.HEAD.equals(branchName) && (head instanceof SymRef)) {
  4. head = head.peel();
  5. }
  6. return Optional.ofNullable(head);
  7. }

代码示例来源:origin: locationtech/geogig

  1. private Ref toLocal(Ref remoteRef) {
  2. Optional<String> localName = remote.mapToRemote(remoteRef.getName());
  3. Preconditions.checkArgument(localName.isPresent(), "Can't map %s to local ref using %s",
  4. remoteRef.getName(), remote.getFetchSpec());
  5. Ref localRef;
  6. if (remoteRef instanceof SymRef) {
  7. Ref target = toLocal(remoteRef.peel());
  8. localRef = new SymRef(localName.get(), target);
  9. } else {
  10. localRef = new Ref(localName.get(), remoteRef.getObjectId());
  11. }
  12. return localRef;
  13. }

代码示例来源:origin: locationtech/geogig

  1. private Ref toRemote(Ref localRef) {
  2. Optional<String> remoteName = remote.mapToLocal(localRef.getName());
  3. Preconditions.checkArgument(remoteName.isPresent(), "Can't map %s to remote ref using %s",
  4. localRef.getName(), remote.getFetchSpec());
  5. Ref remoteRef;
  6. if (localRef instanceof SymRef) {
  7. Ref target = toRemote(localRef.peel());
  8. remoteRef = new SymRef(remoteName.get(), target);
  9. } else {
  10. remoteRef = new Ref(remoteName.get(), localRef.getObjectId());
  11. }
  12. return remoteRef;
  13. }

代码示例来源:origin: locationtech/geogig

  1. private static Set<ObjectId> veifyRepositoryContents(Repository repo,
  2. Map<String, Ref> allRefs) {
  3. Set<ObjectId> allIds = Sets.newConcurrentHashSet();
  4. for (Ref ref : allRefs.values()) {
  5. if (ref instanceof SymRef) {
  6. Ref target = ref.peel();
  7. assertTrue(format("symref points to a non existent ref: %s", ref),
  8. allRefs.containsKey(target.getName()));
  9. } else {
  10. Stack<String> pathToObject = new Stack<>();
  11. pathToObject.push(ref.getName());
  12. verifyAllReachableContents(repo, ref.getObjectId(), pathToObject, allIds);
  13. pathToObject.pop();
  14. }
  15. }
  16. return allIds;
  17. }

代码示例来源:origin: org.locationtech.geogig/geogig-remoting

  1. .call().orNull();
  2. if (currRemoteHead instanceof SymRef) {
  3. currentBranch = currRemoteHead.peel().localName();

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. /**
  2. * Verifies that all the reachable objects from all the refs in the repo exist in the repo's
  3. * database
  4. */
  5. public static Set<ObjectId> verifyRepositoryContents(Repository repo) {
  6. Map<String, Ref> allRefs = Maps.uniqueIndex(repo.command(ForEachRef.class).call(),
  7. (r) -> r.getName());
  8. allRefs = Maps.filterKeys(allRefs,
  9. (k) -> !k.equals(Ref.STAGE_HEAD) && !k.equals(Ref.WORK_HEAD));
  10. Set<ObjectId> allIds = Sets.newConcurrentHashSet();
  11. for (Ref ref : allRefs.values()) {
  12. if (ref instanceof SymRef) {
  13. Ref target = ref.peel();
  14. assertTrue(format("symref points to a non existent ref: %s", ref),
  15. allRefs.containsKey(target.getName()));
  16. } else {
  17. Stack<String> pathToObject = new Stack<>();
  18. pathToObject.push(ref.getName());
  19. verifyAllReachableContents(repo, ref.getObjectId(), pathToObject, allIds);
  20. pathToObject.pop();
  21. }
  22. }
  23. return allIds;
  24. }

代码示例来源:origin: locationtech/geogig

  1. Ref rhead = remoteHeadRef.get();
  2. if (rhead instanceof SymRef) {
  3. currentBranch = rhead.peel().localName();
  4. } else {

代码示例来源:origin: locationtech/geogig

  1. checkArgument(headRef.isPresent() && headRef.get() instanceof SymRef,
  2. "Cannot rename detached HEAD.");
  3. oldBranch = command(RefParse.class).setName(headRef.get().peel().localName()).call();
  4. } else {
  5. oldBranch = command(RefParse.class).setName(oldBranchName).call();

代码示例来源:origin: locationtech/geogig

  1. checkState(currHead instanceof SymRef, "Can't revert from detached HEAD");
  2. checkState(!currHead.getObjectId().isNull(), "HEAD has no history.");
  3. currentBranch = currHead.peel().getName();
  4. revertHead = currHead.getObjectId();

代码示例来源:origin: locationtech/geogig

  1. String refName = target.peel().getName();
  2. command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(refName).call();
  3. checkoutResult.setNewRef(targetRef.get());

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. String refName = target.peel().getName();
  2. command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(refName).call();
  3. result.setNewRef(targetRef.get());

代码示例来源:origin: org.locationtech.geogig/geogig-remoting

  1. throw new IllegalStateException();
  2. Ref want = cr.getNewRef().peel();

代码示例来源:origin: locationtech/geogig

  1. remoteRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
  2. cloneRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());

代码示例来源:origin: org.locationtech.geogig/geogig-remoting

  1. remoteRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());
  2. cloneRepo.command(RefParse.class).setName("HEAD").call().get().peel().localName());

代码示例来源:origin: locationtech/geogig

  1. public @Test void prepareAndManuallyResolveAllConflicts() {
  2. createConflicts(TestData.point1, TestData.line1, TestData.poly1);
  3. PRStatus result = prepare();
  4. assertEquals(3, result.getNumConflicts());
  5. final UUID transactionId = request.getTransactionId();
  6. origin.resumeTransaction(transactionId);
  7. assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());
  8. //@formatter:off
  9. SimpleFeature c1 = TestData.clone(TestData.point1); c1.setAttribute("sp", "manually set");
  10. SimpleFeature c2 = TestData.clone(TestData.line1); c2.setAttribute("sp", "manually set");
  11. SimpleFeature c3 = TestData.clone(TestData.poly1); c3.setAttribute("sp", "manually set");
  12. //@formatter:on
  13. Context context = clone.checkout("issuerBranch").getContext();
  14. try {
  15. PullResult pres = context.command(PullOp.class).addRefSpec("master").call();
  16. fail("Expected MergeConflictsException , got " + pres);
  17. } catch (MergeConflictsException e) {
  18. assertEquals(3, e.getReport().getConflicts());
  19. clone.insert(c1, c2, c3).add().commit("manual conflict fix");
  20. }
  21. result = prepare();
  22. assertTrue(result.getMergeCommit().isPresent());
  23. assertTrue(result.getReport().isPresent());
  24. GeogigTransaction prtx = getTransaction();
  25. Optional<Ref> mergeRef = request.resolveMergeRef(prtx);
  26. assertTrue(mergeRef.isPresent());
  27. assertEquals(result.getMergeCommit().get(), mergeRef.get().getObjectId());
  28. }

代码示例来源:origin: locationtech/geogig

  1. assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());

代码示例来源:origin: locationtech/geogig

  1. assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName());

相关文章