Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.ObjectWalk


      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


   *             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

    }
  }

  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 : transport.local.getAllRefs().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

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

    final ObjectWalk ow = new ObjectWalk(db);
    ow.setRetainBody(false);
    if (checkReferencedIsReachable) {
      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 (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

   * Recalculates source, destination and ancestor Rev commits
   *
   * @throws IOException
   */
  public void updateRevs() throws IOException {
    ObjectWalk ow = new ObjectWalk(repo);
    try {
      srcRevCommit = getCommit(srcRev, ow);
      dstRevCommit = getCommit(dstRev, ow);
    } finally {
      ow.release();
    }

    if (this.dstRevCommit != null && this.srcRevCommit != null)
      this.ancestorRevCommit = getCommonAncestor(repo, this.srcRevCommit,
          this.dstRevCommit);
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

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

    }
  }

  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

      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

      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);
      }
    }

    RevCommit c;
    while ((c = ow.next()) != null) {
      if (providedObjects != null //
          && !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 (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);
    }

    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

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.