org.eclipse.jgit.lib.Ref.isPeeled()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(141)

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

Ref.isPeeled介绍

[英]Whether the Ref represents a peeled tag.
[中]Ref是否表示剥离的标签。

代码示例

代码示例来源:origin: jphp-group/jphp

public static ArrayMemory valueOf(Ref ref) {
  ArrayMemory memory = new ArrayMemory();
  memory.refOfIndex("name").assign(ref.getName());
  memory.refOfIndex("peeled").assign(ref.isPeeled());
  memory.refOfIndex("symbolic").assign(ref.isSymbolic());
  memory.refOfIndex("objectId").assign(valueOf(ref.getObjectId()));
  memory.refOfIndex("storage").assign(valueOf(ref.getStorage()));
  return memory;
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public boolean isPeeled() {
  return getLeaf().isPeeled();
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Create a command to create, update or delete a reference.
 * <p>
 * At least one of {@code oldRef} or {@code newRef} must be supplied.
 *
 * @param oldRef
 *            expected value. Null if the ref should not exist.
 * @param newRef
 *            desired value, must be peeled if not null and not symbolic.
 *            Null to delete the ref.
 */
public Command(@Nullable Ref oldRef, @Nullable Ref newRef) {
  this.oldRef = oldRef;
  this.newRef = newRef;
  this.cmd = null;
  this.result = NOT_ATTEMPTED;
  if (oldRef == null && newRef == null) {
    throw new IllegalArgumentException();
  }
  if (newRef != null && !newRef.isPeeled() && !newRef.isSymbolic()) {
    throw new IllegalArgumentException();
  }
  if (oldRef != null && newRef != null
      && !oldRef.getName().equals(newRef.getName())) {
    throw new IllegalArgumentException();
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public Ref peel(Ref ref) throws IOException {
  Ref oldLeaf = ref.getLeaf();
  if (oldLeaf.isPeeled() || oldLeaf.getObjectId() == null) {
    return ref;
  }
  return recreate(ref, doPeel(oldLeaf));
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

boolean peeled = false;
for (Ref r : refs) {
  if (r.getStorage().isPacked() && r.isPeeled()) {
    peeled = true;
    break;

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) {
  if (ref != null && !ref.isSymbolic()
      && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) {
    ed.add(new DeletePath(peeledPath(ref.getName())));
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

if (!ref.isPeeled()) {
  throw new IOException(JGitText.get().peeledRefIsRequired);
} else if (id1 == null) {
ObjectId id1 = ref.getObjectId();
ObjectId id2 = ref.getPeeledObjectId();
if (!ref.isPeeled()) {
  throw new IOException(JGitText.get().peeledRefIsRequired);
} else if (id1 == null || id2 == null) {

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Make sure a ref is peeled and has the Storage PACKED. If the given ref
 * has this attributes simply return it. Otherwise create a new peeled
 * {@link ObjectIdRef} where Storage is set to PACKED.
 *
 * @param f
 * @return a ref for Storage PACKED having the same name, id, peeledId as f
 * @throws MissingObjectException
 * @throws IOException
 */
private Ref peeledPackedRef(Ref f)
    throws MissingObjectException, IOException {
  if (f.getStorage().isPacked() && f.isPeeled()) {
    return f;
  }
  if (!f.isPeeled()) {
    f = peel(f);
  }
  ObjectId peeledObjectId = f.getPeeledObjectId();
  if (peeledObjectId != null) {
    return new ObjectIdRef.PeeledTag(PACKED, f.getName(),
        f.getObjectId(), peeledObjectId);
  } else {
    return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(),
        f.getObjectId());
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public Ref peel(Ref ref) throws IOException {
  final Ref leaf = ref.getLeaf();
  if (leaf.isPeeled() || leaf.getObjectId() == null)
    return ref;
  ObjectIdRef newLeaf = doPeel(leaf);
  // Try to remember this peeling in the cache, so we don't have to do
  // it again in the future, but only if the reference is unchanged.
  if (leaf.getStorage().isLoose()) {
    RefList<LooseRef> curList = looseRefs.get();
    int idx = curList.find(leaf.getName());
    if (0 <= idx && curList.get(idx) == leaf) {
      LooseRef asPeeled = ((LooseRef) leaf).peel(newLeaf);
      RefList<LooseRef> newList = curList.set(idx, asPeeled);
      looseRefs.compareAndSet(curList, newList);
    }
  }
  return recreate(ref, newLeaf);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public Ref peel(Ref ref) throws IOException {
  final Ref oldLeaf = ref.getLeaf();
  if (oldLeaf.isPeeled() || oldLeaf.getObjectId() == null)
    return ref;
  Ref newLeaf = doPeel(oldLeaf);
  RefCache cur = read();
  int idx = cur.ids.find(oldLeaf.getName());
  if (0 <= idx && cur.ids.get(idx) == oldLeaf) {
    RefList<Ref> newList = cur.ids.set(idx, newLeaf);
    cache.compareAndSet(cur, new RefCache(newList, cur));
    cachePeeledState(oldLeaf, newLeaf);
  }
  return recreate(ref, newLeaf);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

String peelPart = ""; //$NON-NLS-1$
  if (derefTags) {
    if (!ref.isPeeled() && repository != null) {
      ref = repository.getRefDatabase().peel(ref);
  continue;
if (!ref.isPeeled()) {
  if (repository == null)
    continue;

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public Ref peel(Ref ref) throws IOException {
  Ref i = ref.getLeaf();
  ObjectId id = i.getObjectId();
  if (i.isPeeled() || id == null) {
    return ref;
  }
  try (RevWalk rw = new RevWalk(repo)) {
    RevObject obj = rw.parseAny(id);
    if (obj instanceof RevTag) {
      ObjectId p = rw.peel(obj).copy();
      i = new ObjectIdRef.PeeledTag(PACKED, i.getName(), id, p);
    } else {
      i = new ObjectIdRef.PeeledNonTag(PACKED, i.getName(), id);
    }
  }
  return recreate(ref, i);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

if(!ref.isPeeled())
  ref = getRepository().getRefDatabase().peel(ref);

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

if (!ref.isPeeled())
  ref = db.getRefDatabase().peel(ref);

代码示例来源:origin: berlam/github-bucket

/** {@inheritDoc} */
@Override
public boolean isPeeled() {
  return getLeaf().isPeeled();
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

public boolean isPeeled() {
  return getLeaf().isPeeled();
}

代码示例来源:origin: berlam/github-bucket

/** {@inheritDoc} */
@Override
public Ref peel(Ref ref) throws IOException {
  Ref oldLeaf = ref.getLeaf();
  if (oldLeaf.isPeeled() || oldLeaf.getObjectId() == null) {
    return ref;
  }
  return recreate(ref, doPeel(oldLeaf));
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) {
  if (ref != null && !ref.isSymbolic()
      && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) {
    ed.add(new DeletePath(peeledPath(ref.getName())));
  }
}

代码示例来源:origin: berlam/github-bucket

private static void cleanupPeeledRef(DirCacheEditor ed, Ref ref) {
  if (ref != null && !ref.isSymbolic()
      && (!ref.isPeeled() || ref.getPeeledObjectId() != null)) {
    ed.add(new DeletePath(peeledPath(ref.getName())));
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

@Override
public Ref peel(Ref ref) throws IOException {
  final Ref oldLeaf = ref.getLeaf();
  if (oldLeaf.isPeeled() || oldLeaf.getObjectId() == null)
    return ref;
  Ref newLeaf = doPeel(oldLeaf);
  RefCache cur = read();
  int idx = cur.ids.find(oldLeaf.getName());
  if (0 <= idx && cur.ids.get(idx) == oldLeaf) {
    RefList<Ref> newList = cur.ids.set(idx, newLeaf);
    cache.compareAndSet(cur, new RefCache(newList, cur));
    cachePeeledState(oldLeaf, newLeaf);
  }
  return recreate(ref, newLeaf);
}

相关文章