Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevObject


      }
    }
  }

  private void process(final ObjectId id) throws TransportException {
    final RevObject obj;
    try {
      if (id instanceof RevObject) {
        obj = (RevObject) id;
        if (obj.has(COMPLETE))
          return;
        revWalk.parseHeaders(obj);
      } else {
        obj = revWalk.parseAny(id);
        if (obj.has(COMPLETE))
          return;
      }
    } catch (IOException e) {
      throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e);
    }

    switch (obj.getType()) {
    case Constants.OBJ_BLOB:
      processBlob(obj);
      break;
    case Constants.OBJ_TREE:
      processTree(obj);
View Full Code Here


        revWalk.lookupAny(idBuffer, sType).add(COMPLETE);
        continue;

      case Constants.OBJ_TREE: {
        treeWalk.getObjectId(idBuffer, 0);
        final RevObject o = revWalk.lookupAny(idBuffer, sType);
        if (!o.has(COMPLETE)) {
          o.add(COMPLETE);
          treeWalk.enterSubtree();
        }
        continue;
      }
      default:
View Full Code Here

  private ObjectIdRef doPeel(final Ref leaf) throws MissingObjectException,
      IOException {
    RevWalk rw = new RevWalk(getRepository());
    try {
      RevObject obj = rw.parseAny(leaf.getObjectId());
      if (obj instanceof RevTag) {
        return new ObjectIdRef.PeeledTag(leaf.getStorage(), leaf
            .getName(), leaf.getObjectId(), rw.peel(obj).copy());
      } else {
        return new ObjectIdRef.PeeledNonTag(leaf.getStorage(), leaf
View Full Code Here

      if (cmd.getType() == ReceiveCommand.Type.DELETE)
        continue;
      ow.markStart(ow.parseAny(cmd.getNewId()));
    }
    for (final ObjectId have : advertisedHaves) {
      RevObject o = ow.parseAny(have);
      ow.markUninteresting(o);

      if (checkReferencedIsReachable && !baseObjects.isEmpty()) {
        o = ow.peel(o);
        if (o instanceof RevCommit)
          o = ((RevCommit) o).getTree();
        if (o instanceof RevTree)
          ow.markUninteresting(o);
      }
    }

    RevCommit c;
    while ((c = ow.next()) != null) {
      if (checkReferencedIsReachable //
          && !c.has(RevFlag.UNINTERESTING) //
          && !providedObjects.contains(c))
        throw new MissingObjectException(c, Constants.TYPE_COMMIT);
    }

    RevObject o;
    while ((o = ow.nextObject()) != null) {
      if (o.has(RevFlag.UNINTERESTING))
        continue;

      if (checkReferencedIsReachable) {
        if (providedObjects.contains(o))
          continue;
        else
          throw new MissingObjectException(o, o.getType());
      }

      if (o instanceof RevBlob && !db.hasObject(o))
        throw new MissingObjectException(o, Constants.TYPE_BLOB);
    }

    if (checkReferencedIsReachable) {
      for (ObjectId id : baseObjects) {
        o = ow.parseAny(id);
        if (!o.has(RevFlag.UNINTERESTING))
          throw new MissingObjectException(o, o.getType());
      }
    }
  }
View Full Code Here

          continue;
        }

        // Is this possibly a non-fast-forward style update?
        //
        RevObject oldObj, newObj;
        try {
          oldObj = walk.parseAny(cmd.getOldId());
        } catch (IOException e) {
          cmd.setResult(Result.REJECTED_MISSING_OBJECT, cmd
              .getOldId().name());
View Full Code Here

    int haveCnt = 0;
    AsyncRevObjectQueue q = walk.parseAny(toParse, needMissing);
    try {
      for (;;) {
        RevObject obj;
        try {
          obj = q.next();
        } catch (MissingObjectException notFound) {
          ObjectId id = notFound.getObjectId();
          if (wantIds.contains(id)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, id.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg, notFound);
          }
          continue;
        }
        if (obj == null)
          break;

        // If the object is still found in wantIds, the want
        // list wasn't parsed earlier, and was done in this batch.
        //
        if (wantIds.remove(obj)) {
          if (!advertised.contains(obj)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, obj.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg);
          }

          if (!obj.has(WANT)) {
            obj.add(WANT);
            wantAll.add(obj);
          }

          if (!(obj instanceof RevCommit))
            obj.add(SATISFIED);

          if (obj instanceof RevTag) {
            RevObject target = walk.peel(obj);
            if (target instanceof RevCommit) {
              if (!target.has(WANT)) {
                target.add(WANT);
                wantAll.add(target);
              }
            }
          }
View Full Code Here

          // If the object was already requested, skip it.
          if (wantAll.isEmpty()) {
            if (wantIds.contains(objectId))
              continue;
          } else {
            RevObject obj = rw.lookupOrNull(objectId);
            if (obj != null && obj.has(WANT))
              continue;
          }

          if (!ref.isPeeled())
            ref = db.peel(ref);
View Full Code Here

    try {
      Map<String, Ref> map = repository.getRefDatabase().getRefs(refs);
      RevWalk rw = new RevWalk(repository);
      for (Entry<String, Ref> entry : map.entrySet()) {
        Ref ref = entry.getValue();
        RevObject object = rw.parseAny(ref.getObjectId());
        String name = entry.getKey();
        if (fullName && !StringUtils.isEmpty(refs)) {
          name = refs + name;
        }
        list.add(new RefModel(name, ref, object));
View Full Code Here

      Git gitClient = Git.open(repository.getDirectory());
      TagCommand tagCommand = gitClient.tag();
      tagCommand.setTagger(tagger);
      tagCommand.setMessage(message);
      if (objectId != null) {
        RevObject revObj = getCommit(repository, objectId);
        tagCommand.setObjectId(revObj);
      }
      tagCommand.setName(tag);
      Ref call = tagCommand.call();
      return call != null ? true : false;
View Full Code Here

   * @throws IOException
   */
  private void removeReferenced(Map<ObjectId, File> id2File,
      ObjectWalk w) throws MissingObjectException,
      IncorrectObjectTypeException, IOException {
    RevObject ro = w.next();
    while (ro != null) {
      if (id2File.remove(ro.getId()) != null)
        if (id2File.isEmpty())
          return;
      ro = w.next();
    }
    ro = w.nextObject();
    while (ro != null) {
      if (id2File.remove(ro.getId()) != null)
        if (id2File.isEmpty())
          return;
      ro = w.nextObject();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.revwalk.RevObject

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.