Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.IncorrectObjectTypeException


   */
  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


              } else if (item.equals("commit")) {
                rev = rw.parseCommit(rev);
              } else if (item.equals("blob")) {
                rev = rw.peel(rev);
                if (!(rev instanceof RevBlob))
                  throw new IncorrectObjectTypeException(rev,
                      Constants.TYPE_BLOB);
              } else if (item.equals("")) {
                rev = rw.peel(rev);
              } else
                throw new RevisionSyntaxException(revstr);
            else
              throw new RevisionSyntaxException(revstr);
            done = k;
            break;
          default:
            rev = rw.parseAny(rev);
            if (rev instanceof RevCommit) {
              RevCommit commit = ((RevCommit) rev);
              if (commit.getParentCount() == 0)
                rev = null;
              else
                rev = commit.getParent(0);
            } else
              throw new IncorrectObjectTypeException(rev,
                  Constants.TYPE_COMMIT);
          }
        } else {
          rev = rw.peel(rev);
          if (rev instanceof RevCommit) {
            RevCommit commit = ((RevCommit) rev);
            if (commit.getParentCount() == 0)
              rev = null;
            else
              rev = commit.getParent(0);
          } else
            throw new IncorrectObjectTypeException(rev,
                Constants.TYPE_COMMIT);
        }
        done = i + 1;
        break;
      case '~':
        if (rev == null) {
          if (name == null)
            if (done == 0)
              name = new String(revChars, done, i);
            else {
              done = i + 1;
              break;
            }
          rev = parseSimple(rw, name);
          name = null;
          if (rev == null)
            return null;
        }
        rev = rw.peel(rev);
        if (!(rev instanceof RevCommit))
          throw new IncorrectObjectTypeException(rev,
              Constants.TYPE_COMMIT);
        int l;
        for (l = i + 1; l < revChars.length; ++l) {
          if (!Character.isDigit(revChars[l]))
            break;
View Full Code Here

   */
  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

  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

  @Override
  public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader)
      throws IncorrectObjectTypeException, IOException {
    if (currentSubtree == null)
      throw new IncorrectObjectTypeException(getEntryObjectId(),
          Constants.TYPE_TREE);
    return new DirCacheIterator(this, currentSubtree);
  }
View Full Code Here

    case Constants.OBJ_COMMIT:
      return mapTree(ObjectId.fromString(raw, 5));

    default:
      throw new IncorrectObjectTypeException(id, Constants.TYPE_TREE);
    }
  }
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

  @Override
  public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader)
      throws IncorrectObjectTypeException, IOException {
    if (currentSubtree == null)
      throw new IncorrectObjectTypeException(getEntryObjectId(),
          Constants.TYPE_TREE);
    return new DirCacheBuildIterator(this, currentSubtree);
  }
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.