Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevTree


      PatchFormatter df = new PatchFormatter(os);
      df.setRepository(repository);
      df.setDiffComparator(cmp);
      df.setDetectRenames(true);

      RevTree commitTree = commit.getTree();
      RevTree baseTree;
      if (baseCommit == null) {
        if (commit.getParentCount() > 0) {
          final RevWalk rw = new RevWalk(repository);
          RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
          baseTree = parent.getTree();
View Full Code Here


      DiffStatFormatter df = new DiffStatFormatter(commit.getName());
      df.setRepository(repository);
      df.setDiffComparator(cmp);
      df.setDetectRenames(true);

      RevTree commitTree = commit.getTree();
      RevTree baseTree;
      if (baseCommit == null) {
        if (commit.getParentCount() > 0) {
          final RevWalk rw = new RevWalk(repository);
          RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
          baseTree = parent.getTree();
View Full Code Here

      ObjectId treeId = db.resolve(BRANCH + "^{tree}");
      if (treeId == null) {
        return null;
      }
      rw = new RevWalk(db);
      RevTree tree = rw.lookupTree(treeId);
      if (tree != null) {
        return JGitUtils.getStringContent(db, tree, file, Constants.ENCODING);
      }
    } catch (IOException e) {
      log.error("failed to read " + file, e);
View Full Code Here

    // retrieve the attachment content
    Repository db = repositoryManager.getRepository(repository.name);
    try {
      String attachmentPath = toAttachmentPath(ticketId, attachment.name);
      RevTree tree = JGitUtils.getCommit(db, BRANCH).getTree();
      byte[] content = JGitUtils.getByteContent(db, tree, attachmentPath, false);
      attachment.content = content;
      attachment.size = content.length;
      return attachment;
    } finally {
View Full Code Here

   * @return tree
   * @throws IOException
   */
  private RevTree getTree(final RevWalk walk, final RevCommit commit)
      throws IOException {
    final RevTree tree = commit.getTree();
    if (tree != null) {
      return tree;
    }
    walk.parseHeaders(commit);
    return commit.getTree();
View Full Code Here

  @Override
  public boolean include(final RevWalk walker, final RevCommit commit)
      throws IOException {
    final TreeWalk walk = new TreeWalk(walker.getObjectReader());
    walk.addTree(commit.getTree());
    RevTree tree = null;
    for (RevCommit parent : commit.getParents()) {
      tree = parent.getTree();
      if (tree == null) {
        walker.parseHeaders(parent);
        tree = parent.getTree();
View Full Code Here

   * @return tree
   * @throws IOException
   */
  protected static RevTree getTree(final RevWalk walk, final RevCommit commit)
      throws IOException {
    final RevTree tree = commit.getTree();
    if (tree != null)
      return tree;
    walk.parseHeaders(commit);
    return commit.getTree();
  }
View Full Code Here

    }
    return true;
  }

  private void showDiff(RevCommit c) throws IOException {
    final RevTree a = c.getParentCount() > 0 ? c.getParent(0).getTree()
        : null;
    final RevTree b = c.getTree();

    if (showNameAndStatusOnly)
      Diff.nameStatus(outw, diffFmt.scan(a, b));
    else {
      outw.flush();
View Full Code Here

          i = m;
        } else
          throw new RevisionSyntaxException(revstr);
        break;
      case ':': {
        RevTree tree;
        if (rev == null) {
          if (name == null)
            name = new String(revChars, done, i);
          if (name.equals("")) //$NON-NLS-1$
            name = Constants.HEAD;
          rev = parseSimple(rw, name);
          name = null;
        }
        if (rev == null)
          return null;
        tree = rw.parseTree(rev);
        if (i == revChars.length - 1)
          return tree.copy();

        TreeWalk tw = TreeWalk.forPath(rw.getObjectReader(),
            new String(revChars, i + 1, revChars.length - i - 1),
            tree);
        return tw != null ? tw.getObjectId(0) : null;
View Full Code Here

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

    final RevTree c;
    try {
      c = clp.getRevWalk().parseTree(id);
    } catch (MissingObjectException e) {
      throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
    } catch (IncorrectObjectTypeException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.revwalk.RevTree

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.