Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.CanonicalTreeParser


        final ObjectId id = repo.resolve( name );
        if ( id == null )
        {
            throw new IllegalArgumentException( name );
        }
        final CanonicalTreeParser p = new CanonicalTreeParser();
        final ObjectReader or = repo.newObjectReader();
        try
        {
            p.reset( or, new RevWalk( repo ).parseTree( id ) );
            return p;
        }
        finally
        {
            or.release();
View Full Code Here


          hIdx = treeWalk.addTree(treeId);
        }
        treeWalk.setRecursive(true);
        while (treeWalk.next()) {
          String path = treeWalk.getPathString();
          CanonicalTreeParser hTree = null;
          if (hIdx != -1) {
            hTree = treeWalk.getTree(hIdx, CanonicalTreeParser.class);
          }
          if (!path.startsWith(ticketPath)) {
            // add entries from HEAD for all other paths
            if (hTree != null) {
              final DirCacheEntry entry = new DirCacheEntry(path);
              entry.setObjectId(hTree.getEntryObjectId());
              entry.setFileMode(hTree.getEntryFileMode());

              // add to temporary in-core index
              builder.add(entry);
            }
          }
View Full Code Here

      int hIdx = tw.addTree(treeId);
      tw.setRecursive(true);

      while (tw.next()) {
        String path = tw.getPathString();
        CanonicalTreeParser hTree = null;
        if (hIdx != -1) {
          hTree = tw.getTree(hIdx, CanonicalTreeParser.class);
        }
        if (!ignorePaths.contains(path)) {
          // add all other tree entries
          if (hTree != null) {
            final DirCacheEntry entry = new DirCacheEntry(path);
            entry.setObjectId(hTree.getEntryObjectId());
            entry.setFileMode(hTree.getEntryFileMode());
            list.add(entry);
          }
        }
      }
    } finally {
View Full Code Here

        hIdx = treeWalk.addTree(new RevWalk(repo).parseTree(headId));
      treeWalk.setRecursive(true);

      while (treeWalk.next()) {
        String path = treeWalk.getPathString();
        CanonicalTreeParser hTree = null;
        if (hIdx != -1)
          hTree = treeWalk.getTree(hIdx, CanonicalTreeParser.class);
        if (!ignorePaths.contains(path)) {
          // add entries from HEAD for all other paths
          if (hTree != null) {
            // create a new DirCacheEntry with data retrieved from
            // HEAD
            final DirCacheEntry dcEntry = new DirCacheEntry(path);
            dcEntry.setObjectId(hTree.getEntryObjectId());
            dcEntry.setFileMode(hTree.getEntryFileMode());

            // add to temporary in-core index
            dcBuilder.add(dcEntry);
          }
        }
View Full Code Here

          hIdx = treeWalk.addTree(treeId);
        }
        treeWalk.setRecursive(true);
        while (treeWalk.next()) {
          String path = treeWalk.getPathString();
          CanonicalTreeParser hTree = null;
          if (hIdx != -1) {
            hTree = treeWalk.getTree(hIdx, CanonicalTreeParser.class);
          }
          if (!path.startsWith(ticketPath)) {
            // add entries from HEAD for all other paths
            if (hTree != null) {
              final DirCacheEntry entry = new DirCacheEntry(path);
              entry.setObjectId(hTree.getEntryObjectId());
              entry.setFileMode(hTree.getEntryFileMode());

              // add to temporary in-core index
              builder.add(entry);
            }
          }
View Full Code Here

      int hIdx = tw.addTree(treeId);
      tw.setRecursive(true);

      while (tw.next()) {
        String path = tw.getPathString();
        CanonicalTreeParser hTree = null;
        if (hIdx != -1) {
          hTree = tw.getTree(hIdx, CanonicalTreeParser.class);
        }
        if (!ignorePaths.contains(path)) {
          // add all other tree entries
          if (hTree != null) {
            final DirCacheEntry entry = new DirCacheEntry(path);
            entry.setObjectId(hTree.getEntryObjectId());
            entry.setFileMode(hTree.getEntryFileMode());
            list.add(entry);
          }
        }
      }
    } finally {
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

      throw new CmdLineException(e.getMessage());
    }
    if (id == null)
      throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));

    final CanonicalTreeParser p = new CanonicalTreeParser();
    final ObjectReader curs = clp.getRepository().newObjectReader();
    try {
      p.reset(curs, clp.getRevWalk().parseTree(id));
    } catch (MissingObjectException e) {
      throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
    } catch (IncorrectObjectTypeException e) {
      throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
    } catch (IOException e) {
View Full Code Here

  @SuppressWarnings("nls")
  @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

  private AbstractTreeIterator getTreeIterator(String name)
      throws IOException {
    final ObjectId id = db.resolve(name);
    if (id == null)
      throw new IllegalArgumentException(name);
    final CanonicalTreeParser p = new CanonicalTreeParser();
    final ObjectReader or = db.newObjectReader();
    try {
      p.reset(or, new RevWalk(db).parseTree(id));
      return p;
    } finally {
      or.release();
    }
  }
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.