Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.IncorrectObjectTypeException


   */
  public RevCommit getBaseCommit(final int aIdx, final int bIdx)
      throws IncorrectObjectTypeException,
      IOException {
    if (sourceCommits[aIdx] == null)
      throw new IncorrectObjectTypeException(sourceObjects[aIdx],
          Constants.TYPE_COMMIT);
    if (sourceCommits[bIdx] == null)
      throw new IncorrectObjectTypeException(sourceObjects[bIdx],
          Constants.TYPE_COMMIT);
    walk.reset();
    walk.setRevFilter(RevFilter.MERGE_BASE);
    walk.markStart(sourceCommits[aIdx]);
    walk.markStart(sourceCommits[bIdx]);
View Full Code Here


              } else if (item.equals("commit")) {
                ref = rw.parseCommit(ref);
              } else if (item.equals("blob")) {
                ref = rw.peel(ref);
                if (!(ref instanceof RevBlob))
                  throw new IncorrectObjectTypeException(ref,
                      Constants.TYPE_BLOB);
              } else if (item.equals("")) {
                ref = rw.peel(ref);
              } else
                throw new RevisionSyntaxException(revstr);
            else
              throw new RevisionSyntaxException(revstr);
            break;
          default:
            ref = rw.parseAny(ref);
            if (ref instanceof RevCommit) {
              RevCommit commit = ((RevCommit) ref);
              if (commit.getParentCount() == 0)
                ref = null;
              else
                ref = commit.getParent(0);
            } else
              throw new IncorrectObjectTypeException(ref,
                  Constants.TYPE_COMMIT);

          }
        } else {
          ref = rw.peel(ref);
          if (ref instanceof RevCommit) {
            RevCommit commit = ((RevCommit) ref);
            if (commit.getParentCount() == 0)
              ref = null;
            else
              ref = commit.getParent(0);
          } else
            throw new IncorrectObjectTypeException(ref,
                Constants.TYPE_COMMIT);
        }
        break;
      case '~':
        if (ref == null) {
          ref = parseSimple(rw, new String(rev, 0, i));
          if (ref == null)
            return null;
        }
        ref = rw.peel(ref);
        if (!(ref instanceof RevCommit))
          throw new IncorrectObjectTypeException(ref,
              Constants.TYPE_COMMIT);
        int l;
        for (l = i + 1; l < rev.length; ++l) {
          if (!Character.isDigit(rev[l]))
            break;
View Full Code Here

            obj.flags = SEEN;
            objects.add(obj);
            return obj;
          }
          if (!(obj instanceof RevBlob))
            throw new IncorrectObjectTypeException(obj, OBJ_BLOB);
          obj.flags = flags = obj.flags | SEEN;
          if ((flags & UNINTERESTING) == 0)
            return obj;
          if (boundary)
            return obj;
          continue;

        case TYPE_TREE:
          if (obj == null) {
            obj = new RevTree(idBuffer);
            obj.flags = SEEN;
            objects.add(obj);
            return enterTree(obj);
          }
          if (!(obj instanceof RevTree))
            throw new IncorrectObjectTypeException(obj, OBJ_TREE);
          obj.flags = flags = obj.flags | SEEN;
          if ((flags & UNINTERESTING) == 0)
            return enterTree(obj);
          if (boundary)
            return enterTree(obj);
View Full Code Here

  public RevCommit parseCommit(final AnyObjectId id)
      throws MissingObjectException, IncorrectObjectTypeException,
      IOException {
    RevObject c = peel(parseAny(id));
    if (!(c instanceof RevCommit))
      throw new IncorrectObjectTypeException(id.toObjectId(),
          Constants.TYPE_COMMIT);
    return (RevCommit) c;
  }
View Full Code Here

    final RevTree t;
    if (c instanceof RevCommit)
      t = ((RevCommit) c).getTree();
    else if (!(c instanceof RevTree))
      throw new IncorrectObjectTypeException(id.toObjectId(),
          Constants.TYPE_TREE);
    else
      t = (RevTree) c;
    parseHeaders(t);
    return t;
View Full Code Here

   */
  public RevTag parseTag(final AnyObjectId id) throws MissingObjectException,
      IncorrectObjectTypeException, IOException {
    RevObject c = parseAny(id);
    if (!(c instanceof RevTag))
      throw new IncorrectObjectTypeException(id.toObjectId(),
          Constants.TYPE_TAG);
    return (RevTag) c;
  }
View Full Code Here

      if (typeHint == OBJ_ANY)
        throw new MissingObjectException(objectId.copy(), "unknown");
      throw new MissingObjectException(objectId.copy(), typeHint);
    }
    if (typeHint != OBJ_ANY && ldr.getType() != typeHint)
      throw new IncorrectObjectTypeException(objectId.copy(), typeHint);
    return ldr;
  }
View Full Code Here

              } else if (item.equals("commit")) {
                ref = rw.parseCommit(ref);
              } else if (item.equals("blob")) {
                ref = rw.peel(ref);
                if (!(ref instanceof RevBlob))
                  throw new IncorrectObjectTypeException(ref,
                      Constants.TYPE_BLOB);
              } else if (item.equals("")) {
                ref = rw.peel(ref);
              } else
                throw new RevisionSyntaxException(revstr);
            else
              throw new RevisionSyntaxException(revstr);
            break;
          default:
            ref = rw.parseAny(ref);
            if (ref instanceof RevCommit) {
              RevCommit commit = ((RevCommit) ref);
              if (commit.getParentCount() == 0)
                ref = null;
              else
                ref = commit.getParent(0);
            } else
              throw new IncorrectObjectTypeException(ref,
                  Constants.TYPE_COMMIT);

          }
        } else {
          ref = rw.peel(ref);
          if (ref instanceof RevCommit) {
            RevCommit commit = ((RevCommit) ref);
            if (commit.getParentCount() == 0)
              ref = null;
            else
              ref = commit.getParent(0);
          } else
            throw new IncorrectObjectTypeException(ref,
                Constants.TYPE_COMMIT);
        }
        break;
      case '~':
        if (ref == null) {
          ref = parseSimple(rw, new String(rev, 0, i));
          if (ref == null)
            return null;
        }
        ref = rw.peel(ref);
        if (!(ref instanceof RevCommit))
          throw new IncorrectObjectTypeException(ref,
              Constants.TYPE_COMMIT);
        int l;
        for (l = i + 1; l < rev.length; ++l) {
          if (!Character.isDigit(rev[l]))
            break;
View Full Code Here

  public RevCommit parseCommit(final AnyObjectId id)
      throws MissingObjectException, IncorrectObjectTypeException,
      IOException {
    RevObject c = peel(parseAny(id));
    if (!(c instanceof RevCommit))
      throw new IncorrectObjectTypeException(id.toObjectId(),
          Constants.TYPE_COMMIT);
    return (RevCommit) c;
  }
View Full Code Here

    final RevTree t;
    if (c instanceof RevCommit)
      t = ((RevCommit) c).getTree();
    else if (!(c instanceof RevTree))
      throw new IncorrectObjectTypeException(id.toObjectId(),
          Constants.TYPE_TREE);
    else
      t = (RevTree) c;
    parseHeaders(t);
    return t;
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.IncorrectObjectTypeException

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.