Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevObject


      throws TransportException {
    final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>();
    for (final Ref r : want) {
      final ObjectId id = r.getObjectId();
      try {
        final RevObject obj = revWalk.parseAny(id);
        if (obj.has(COMPLETE))
          continue;
        if (inWorkQueue.add(id)) {
          obj.add(IN_WORK_QUEUE);
          workQueue.add(obj);
        }
      } catch (MissingObjectException e) {
        if (inWorkQueue.add(id))
          workQueue.add(id);
View Full Code Here


      }
    }
  }

  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

    AsyncRevObjectQueue q = walker.parseAny(all, true);
    try {
      for (;;) {
        try {
          RevObject o = q.next();
          if (o == null)
            break;

          if (tipToPack.containsKey(o))
            o.add(inCachedPack);

          if (have.contains(o)) {
            haveObjs.add(o);
            walker.markUninteresting(o);
          } else if (want.contains(o)) {
            o.add(include);
            wantObjs.add(o);
            walker.markStart(o);
          }
        } catch (MissingObjectException e) {
          if (ignoreMissingUninteresting
              && have.contains(e.getObjectId()))
            continue;
          throw e;
        }
      }
    } finally {
      q.release();
    }

    int typesToPrune = 0;
    final int maxBases = config.getDeltaSearchWindowSize();
    Set<RevTree> baseTrees = new HashSet<RevTree>();
    RevObject o;
    while ((o = walker.next()) != null) {
      if (o.has(inCachedPack)) {
        CachedPack pack = tipToPack.get(o);
        if (includesAllTips(pack, include, walker)) {
          useCachedPack(walker, keepOnRestart, //
              wantObjs, haveObjs, pack);

          countingMonitor.endTask();
          countingMonitor.beginTask(JGitText.get().countingObjects,
              ProgressMonitor.UNKNOWN);
          continue;
        }
      }

      if (o.has(RevFlag.UNINTERESTING)) {
        if (baseTrees.size() <= maxBases)
          baseTrees.add(((RevCommit) o).getTree());
        continue;
      }

      addObject(o, 0);
      countingMonitor.update(1);
    }

    for (CachedPack p : cachedPacks) {
      for (ObjectId d : p.hasObject(objectsLists[Constants.OBJ_COMMIT])) {
        if (baseTrees.size() <= maxBases)
          baseTrees.add(walker.lookupCommit(d).getTree());
        objectsMap.get(d).setEdge();
        typesToPrune |= 1 << Constants.OBJ_COMMIT;
      }
    }

    BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, //
        objectsMap, edgeObjects, reader);
    while ((o = walker.nextObject()) != null) {
      if (o.has(RevFlag.UNINTERESTING))
        continue;

      int pathHash = walker.getPathHashCode();
      byte[] pathBuf = walker.getPathBuffer();
      int pathLen = walker.getPathLength();

      bases.addBase(o.getType(), pathBuf, pathLen, pathHash);
      addObject(o, pathHash);
      countingMonitor.update(1);
    }

    for (CachedPack p : cachedPacks) {
View Full Code Here

      if (cmd.getType() == ReceiveCommand.Type.DELETE)
        continue;
      ow.markStart(ow.parseAny(cmd.getNewId()));
    }
    for (final Ref ref : refs.values()) {
      RevObject o = ow.parseAny(ref.getObjectId());
      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

  }

  class PlotRefComparator implements Comparator<Ref> {
    public int compare(Ref o1, Ref o2) {
      try {
        RevObject obj1 = parseAny(o1.getObjectId());
        RevObject obj2 = parseAny(o2.getObjectId());
        long t1 = timeof(obj1);
        long t2 = timeof(obj2);
        if (t1 > t2)
          return -1;
        if (t1 < t2)
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 TransportException {
    final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>();
    for (final Ref r : want) {
      final ObjectId id = r.getObjectId();
      try {
        final RevObject obj = revWalk.parseAny(id);
        if (obj.has(COMPLETE))
          continue;
        if (inWorkQueue.add(id)) {
          obj.add(IN_WORK_QUEUE);
          workQueue.add(obj);
        }
      } catch (MissingObjectException e) {
        if (inWorkQueue.add(id))
          workQueue.add(id);
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.