Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Ref


   * @throws RefNotFoundException
   * @throws IOException
   */
  public RevCommit tryFastForward(RevCommit newCommit)
      throws RefNotFoundException, IOException {
    Ref head = repo.getRef(Constants.HEAD);
    if (head == null || head.getObjectId() == null)
      throw new RefNotFoundException(MessageFormat.format(
          JGitText.get().refNotResolved, Constants.HEAD));

    ObjectId headId = head.getObjectId();
    if (headId == null)
      throw new RefNotFoundException(MessageFormat.format(
          JGitText.get().refNotResolved, Constants.HEAD));
    RevCommit headCommit = walk.lookupCommit(headId);
    if (walk.isMergedInto(newCommit, headCommit))
      return newCommit;

    String headName;
    if (head.isSymbolic())
      headName = head.getTarget().getName();
    else
      headName = "detached HEAD";
    return tryFastForward(headName, headCommit, newCommit);
  }
View Full Code Here


  }

  @Override
  public Ref get(Object key) {
    String name = toRefName((String) key);
    Ref ref = resolved.get(name);
    if (ref == null)
      ref = loose.get(name);
    if (ref == null)
      ref = packed.get(name);
    return ref;
View Full Code Here

      resolved = RefList.emptyList();
    }

    int idx = loose.find(name);
    if (0 <= idx) {
      Ref prior = loose.get(name);
      loose = loose.set(idx, value);
      return prior;
    } else {
      Ref prior = get(keyName);
      loose = loose.add(idx, value);
      sizeIsValid = false;
      return prior;
    }
  }
View Full Code Here

  }

  @Override
  public Ref remove(Object key) {
    String name = toRefName((String) key);
    Ref res = null;
    int idx;
    if (0 <= (idx = packed.find(name))) {
      res = packed.get(name);
      packed = packed.remove(idx);
      sizeIsValid = false;
View Full Code Here

      throw new NoSuchElementException();
    }

    public Entry<String, Ref> peek() {
      if (packedIdx < packed.size() && looseIdx < loose.size()) {
        Ref p = packed.get(packedIdx);
        Ref l = loose.get(looseIdx);
        int cmp = RefComparator.compareTo(p, l);
        if (cmp < 0) {
          packedIdx++;
          return toEntry(p);
        }
View Full Code Here

      return null;
    }

    private Ref resolveLoose(final Ref l) {
      if (resolvedIdx < resolved.size()) {
        Ref r = resolved.get(resolvedIdx);
        int cmp = RefComparator.compareTo(l, r);
        if (cmp == 0) {
          resolvedIdx++;
          return r;
        } else if (cmp > 0) {
View Full Code Here

    public Ref getValue() {
      return ref;
    }

    public Ref setValue(Ref value) {
      Ref prior = put(getKey(), value);
      ref = value;
      return prior;
    }
View Full Code Here

    public boolean equals(Object obj) {
      if (obj instanceof Map.Entry) {
        final Object key = ((Map.Entry) obj).getKey();
        final Object val = ((Map.Entry) obj).getValue();
        if (key instanceof String && val instanceof Ref) {
          final Ref r = (Ref) val;
          if (r.getName().equals(ref.getName())) {
            final ObjectId a = r.getObjectId();
            final ObjectId b = ref.getObjectId();
            if (a != null && b != null && AnyObjectId.equals(a, b))
              return true;
          }
        }
View Full Code Here

      avail.put(r.getObjectId(), r);

    final Collection<Ref> wants = new ArrayList<Ref>(askFor.values());
    askFor.clear();
    for (final Ref want : wants) {
      final Ref newRef = avail.get(want.getObjectId());
      if (newRef != null) {
        askFor.put(newRef.getObjectId(), newRef);
      } else {
        removeFetchHeadRecord(want.getObjectId());
        removeTrackingRefUpdate(want.getObjectId());
      }
    }
View Full Code Here

    }
  }

  private void expandSingle(final RefSpec spec, final Set<Ref> matched)
      throws TransportException {
    final Ref src = conn.getRef(spec.getSource());
    if (src == null) {
      throw new TransportException(MessageFormat.format(JGitText.get().remoteDoesNotHaveSpec, spec.getSource()));
    }
    if (matched.add(src))
      want(src, spec);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.Ref

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.