Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.CanonicalTreeParser


      tw.addTree(commit.getTree());
      tw.setFilter(PathFilterGroup.createFromStrings(filepaths));
      tw.setRecursive(true);

      while (tw.next()) {
        final CanonicalTreeParser tree = tw.getTree(1,
            CanonicalTreeParser.class);
        // only keep file in index if it's in the commit
        if (tree != null) {
            // revert index to commit
          DirCacheEntry entry = new DirCacheEntry(tw.getRawPath());
          entry.setFileMode(tree.getEntryFileMode());
          entry.setObjectId(tree.getEntryObjectId());
          builder.add(entry);
        }
      }

      builder.commit();
View Full Code Here


   */
  public ObjectWalk(ObjectReader or) {
    super(or);
    rootObjects = new ArrayList<RevObject>();
    pendingObjects = new BlockObjQueue();
    treeWalk = new CanonicalTreeParser();
  }
View Full Code Here

      return o;
    }
  }

  private CanonicalTreeParser enter(RevObject tree) throws IOException {
    CanonicalTreeParser p = treeWalk.createSubtreeIterator0(reader, tree);
    if (p.eof()) {
      // We can't tolerate the subtree being an empty tree, as
      // that will break us out early before we visit all names.
      // If it is, advance to the parent's next record.
      //
      return treeWalk.next();
View Full Code Here

  @Override
  public void dispose() {
    super.dispose();
    pendingObjects = new BlockObjQueue();
    treeWalk = new CanonicalTreeParser();
    currentTree = null;
    last = null;
    firstCommit = null;
    lastCommit = null;
  }
View Full Code Here

    for (RevObject obj : rootObjects)
      obj.flags &= ~IN_PENDING;

    rootObjects = new ArrayList<RevObject>();
    pendingObjects = new BlockObjQueue();
    treeWalk = new CanonicalTreeParser();
    currentTree = null;
    last = null;
    firstCommit = null;
    lastCommit = null;
  }
View Full Code Here

   * @throws IOException
   *             the tree object is not found or cannot be read.
   */
  protected AbstractTreeIterator openTree(final AnyObjectId treeId)
      throws IncorrectObjectTypeException, IOException {
    return new CanonicalTreeParser(null, reader, treeId);
  }
View Full Code Here

   *             a tree cannot be read to iterate through its entries.
   */
  public void addTree(final byte[] pathPrefix, final int stage,
      final ObjectReader reader, final AnyObjectId tree) throws IOException {
    final TreeWalk tw = new TreeWalk(reader);
    tw.addTree(new CanonicalTreeParser(pathPrefix, reader, tree
        .toObjectId()));
    tw.setRecursive(true);
    if (tw.next()) {
      final DirCacheEntry newEntry = toEntry(stage, tw);
      beforeAdd(newEntry);
View Full Code Here

  @Override
  public String toString() {
    byte[] raw = toByteArray();

    CanonicalTreeParser p = new CanonicalTreeParser();
    p.reset(raw);

    StringBuilder r = new StringBuilder();
    r.append("Tree={");
    if (!p.eof()) {
      r.append('\n');
      try {
        new ObjectChecker().checkTree(raw);
      } catch (CorruptObjectException error) {
        r.append("*** ERROR: ").append(error.getMessage()).append("\n");
        r.append('\n');
      }
    }
    while (!p.eof()) {
      final FileMode mode = p.getEntryFileMode();
      r.append(mode);
      r.append(' ');
      r.append(Constants.typeString(mode.getObjectType()));
      r.append(' ');
      r.append(p.getEntryObjectId().name());
      r.append(' ');
      r.append(p.getEntryPathString());
      r.append('\n');
      p.next();
    }
    r.append("}");
    return r.toString();
  }
View Full Code Here

    objectsMap = objects;
    edgeObjects = edges;

    alreadyProcessed = new IntSet();
    treeCache = new ObjectIdSubclassMap<TreeWithData>();
    parser = new CanonicalTreeParser();
    idBuf = new MutableObjectId();
  }
View Full Code Here

   *             trees cannot be read or file contents cannot be read.
   */
  public List<DiffEntry> scan(RevTree a, RevTree b) throws IOException {
    assertHaveRepository();

    CanonicalTreeParser aParser = new CanonicalTreeParser();
    CanonicalTreeParser bParser = new CanonicalTreeParser();

    aParser.reset(reader, a);
    bParser.reset(reader, b);

    return scan(aParser, bParser);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.treewalk.CanonicalTreeParser

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.