Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.ObjectWalk


      if (++n > maxCount && maxCount >= 0)
        break;
      show(c);
    }
    if (walk instanceof ObjectWalk) {
      final ObjectWalk ow = (ObjectWalk) walk;
      for (;;) {
        final RevObject obj = ow.nextObject();
        if (obj == null)
          break;
        show(ow, obj);
      }
    }
View Full Code Here


      // There are new/modified refs! Check which loose objects are now
      // referenced by these modified refs (or their reflogentries).
      // Remove these loose objects
      // from the deletionCandidates. When the last candidate is removed
      // leave this method.
      ObjectWalk w = new ObjectWalk(repo);
      try {
        for (Ref cr : newRefs.values())
          w.markStart(w.parseAny(cr.getObjectId()));
        if (lastPackedRefs != null)
          for (Ref lpr : lastPackedRefs.values())
            w.markUninteresting(w.parseAny(lpr.getObjectId()));
        removeReferenced(deletionCandidates, w);
      } finally {
        w.dispose();
      }
    }

    if (deletionCandidates.isEmpty())
      return;

    // Since we have not left the method yet there are still
    // deletionCandidates. Last chance for these objects not to be pruned is
    // that they are referenced by reflog entries. Even refs which currently
    // point to the same object as during last repack() may have
    // additional reflog entries not handled during last repack()
    ObjectWalk w = new ObjectWalk(repo);
    try {
      for (Ref ar : getAllRefs().values())
        for (ObjectId id : listRefLogObjects(ar, lastRepackTime))
          w.markStart(w.parseAny(id));
      if (lastPackedRefs != null)
        for (Ref lpr : lastPackedRefs.values())
          w.markUninteresting(w.parseAny(lpr.getObjectId()));
      removeReferenced(deletionCandidates, w);
    } finally {
      w.dispose();
    }

    if (deletionCandidates.isEmpty())
      return;
View Full Code Here

      if (wantAll.isEmpty()) {
        pw.preparePack(pm, wantIds, commonBase);
      } else {
        walk.reset();

        ObjectWalk ow = walk.toObjectWalkWithSameObjects();
        pw.preparePack(pm, ow, wantAll, commonBase);
        rw = ow;
      }

      if (options.contains(OPTION_INCLUDE_TAG) && refs != null) {
View Full Code Here

    }
  }

  private boolean askForIsComplete() throws TransportException {
    try {
      final ObjectWalk ow = new ObjectWalk(transport.local);
      try {
        for (final ObjectId want : askFor.keySet())
          ow.markStart(ow.parseAny(want));
        for (final Ref ref : localRefs().values())
          ow.markUninteresting(ow.parseAny(ref.getObjectId()));
        ow.checkConnectivity();
      } finally {
        ow.release();
      }
      return true;
    } catch (MissingObjectException e) {
      return false;
    } catch (IOException e) {
View Full Code Here

   * @throws IncorrectObjectTypeException
   * @throws IOException
   */
  public void fsck(RevObject... tips) throws MissingObjectException,
      IncorrectObjectTypeException, IOException {
    ObjectWalk ow = new ObjectWalk(db);
    if (tips.length != 0) {
      for (RevObject o : tips)
        ow.markStart(ow.parseAny(o));
    } else {
      for (Ref r : db.getAllRefs().values())
        ow.markStart(ow.parseAny(r.getObjectId()));
    }

    ObjectChecker oc = new ObjectChecker();
    for (;;) {
      final RevCommit o = ow.next();
      if (o == null)
        break;

      final byte[] bin = db.open(o, o.getType()).getCachedBytes();
      oc.checkCommit(bin);
      assertHash(o, bin);
    }

    for (;;) {
      final RevObject o = ow.nextObject();
      if (o == null)
        break;

      final byte[] bin = db.open(o, o.getType()).getCachedBytes();
      oc.check(o.getType(), bin);
View Full Code Here

   *             when some I/O problem occur during reading objects.
   */
  public void preparePack(ProgressMonitor countingMonitor,
      Set<? extends ObjectId> want,
      Set<? extends ObjectId> have) throws IOException {
    ObjectWalk ow;
    if (shallowPack)
      ow = new DepthWalk.ObjectWalk(reader, depth);
    else
      ow = new ObjectWalk(reader);
    preparePack(countingMonitor, ow, want, have);
  }
View Full Code Here

    return Math.max(next, minCommits);
  }

  PackWriterBitmapWalker newBitmapWalker() {
    return new PackWriterBitmapWalker(
        new ObjectWalk(reader), bitmapIndex, null);
  }
View Full Code Here

      baseObjects = parser.getBaseObjectIds();
      providedObjects = parser.getNewObjectIds();
    }
    parser = null;

    final ObjectWalk ow = new ObjectWalk(db);
    ow.setRetainBody(false);
    if (baseObjects != null) {
      ow.sort(RevSort.TOPO);
      if (!baseObjects.isEmpty())
        ow.sort(RevSort.BOUNDARY, true);
    }

    for (final ReceiveCommand cmd : commands) {
      if (cmd.getResult() != Result.NOT_ATTEMPTED)
        continue;
      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 (baseObjects != null && !baseObjects.isEmpty()) {
        o = ow.peel(o);
        if (o instanceof RevCommit)
          o = ((RevCommit) o).getTree();
        if (o instanceof RevTree)
          ow.markUninteresting(o);
      }
    }

    checking.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN);
    RevCommit c;
    while ((c = ow.next()) != null) {
      checking.update(1);
      if (providedObjects != null //
          && !c.has(RevFlag.UNINTERESTING) //
          && !providedObjects.contains(c))
        throw new MissingObjectException(c, Constants.TYPE_COMMIT);
    }

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

      if (providedObjects != null) {
        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);
    }
    checking.endTask();

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

      if (wantAll.isEmpty()) {
        pw.preparePack(pm, wantIds, commonBase);
      } else {
        walk.reset();

        ObjectWalk ow = walk.toObjectWalkWithSameObjects();
        pw.preparePack(pm, ow, wantAll, commonBase);
        rw = ow;
      }

      if (options.contains(OPTION_INCLUDE_TAG) && refs != null) {
View Full Code Here

   * @throws IncorrectObjectTypeException
   * @throws IOException
   */
  public void fsck(RevObject... tips) throws MissingObjectException,
      IncorrectObjectTypeException, IOException {
    ObjectWalk ow = new ObjectWalk(db);
    if (tips.length != 0) {
      for (RevObject o : tips)
        ow.markStart(ow.parseAny(o));
    } else {
      for (Ref r : db.getAllRefs().values())
        ow.markStart(ow.parseAny(r.getObjectId()));
    }

    ObjectChecker oc = new ObjectChecker();
    for (;;) {
      final RevCommit o = ow.next();
      if (o == null)
        break;

      final byte[] bin = db.open(o, o.getType()).getCachedBytes();
      oc.checkCommit(bin);
      assertHash(o, bin);
    }

    for (;;) {
      final RevObject o = ow.nextObject();
      if (o == null)
        break;

      final byte[] bin = db.open(o, o.getType()).getCachedBytes();
      oc.check(o.getType(), bin);
View Full Code Here

TOP

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

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.