Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.CanonicalTreeParser


      if (head == null) {
        String msg = NLS.bind("Failed to generate diff for {0}, no HEAD", scope);
        statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
        return null;
      }
      CanonicalTreeParser p = new CanonicalTreeParser();
      ObjectReader reader = db.newObjectReader();
      try {
        p.reset(reader, head);
      } finally {
        reader.release();
      }
      oldTree = p;
      newTree = new DirCacheIterator(db.readDirCache());
View Full Code Here


  private AbstractTreeIterator getTreeIterator(Repository db, 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

          rw = new RevWalk(db);
          diffFormat = new DiffFormatter(NullOutputStream.INSTANCE);
          diffFormat.setRepository(db);
          if (filter != null)
            diffFormat.setPathFilter(filter);
          l = diffFormat.scan(new EmptyTreeIterator(), new CanonicalTreeParser(null, rw.getObjectReader(), revCommit.getTree()));
        } finally {
          diffFormat.release();
          rw.release();
        }
      }
View Full Code Here

          if (!filePath.equals("")) {
            PathFilter pathFilter = PathFilter.create(filePath);
            treeWalk.setFilter(pathFilter);
          }
          if (!treeWalk.next()) {
            CanonicalTreeParser canonicalTreeParser = treeWalk
                .getTree(0, CanonicalTreeParser.class);
            ArrayList<HashMap<String, Object>> contents = new ArrayList<HashMap<String, Object>>();
            if (canonicalTreeParser != null) {
              while (!canonicalTreeParser.eof()) {
                String path = canonicalTreeParser
                    .getEntryPathString();
                FileMode mode = canonicalTreeParser
                    .getEntryFileMode();
                listEntry(path, mode.equals(FileMode.TREE) ? "dir"
                            : "file", "0", path, projectName, head.getName(), git, contents);
                canonicalTreeParser.next();
              }
            }
            String response = JSONUtil.write(contents);
            resp.setContentType("application/json");
            resp.setHeader("Cache-Control", "no-cache");
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

   *            required.
   */
  public ObjectWalk(ObjectReader or) {
    super(or);
    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;
  }
View Full Code Here

  @Override
  protected void reset(final int retainFlags) {
    super.reset(retainFlags);
    pendingObjects = new BlockObjQueue();
    treeWalk = new CanonicalTreeParser();
    currentTree = null;
    last = null;
  }
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

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.