Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevTree


        RevCommit commit = revWalk.parseCommit(lastCommitId);

        System.out.println("Time of commit (seconds since epoch): " + commit.getCommitTime());

        // and using commit's tree find the path
        RevTree tree = commit.getTree();
        System.out.println("Having tree: " + tree);
        return tree;
    }
View Full Code Here


      MissingObjectException,
      IncorrectObjectTypeException {
    // from the commit we can build the tree which allows us to construct the TreeParser
    RevWalk walk = new RevWalk(repository);
    RevCommit commit = walk.parseCommit(ObjectId.fromString(objectId));
    RevTree tree = walk.parseTree(commit.getTree().getId());

    CanonicalTreeParser oldTreeParser = new CanonicalTreeParser();
    ObjectReader oldReader = repository.newObjectReader();
    try {
      oldTreeParser.reset(oldReader, tree.getId());
    } finally {
      oldReader.release();
    }

    walk.dispose();
View Full Code Here

        RevCommit commit = walk.parseCommit(head.getObjectId());
        System.out.println("Commit: " + commit);

        // a commit points to a tree
        RevTree tree = walk.parseTree(commit.getTree().getId());
        System.out.println("Found Tree: " + tree);

        walk.dispose();

        repository.close();
View Full Code Here

        // a RevWalk allows to walk over commits based on some filtering that is defined
        RevWalk revWalk = new RevWalk(repository);
        RevCommit commit = revWalk.parseCommit(lastCommitId);
        // and using commit's tree find the path
        RevTree tree = commit.getTree();
        System.out.println("Having tree: " + tree);

        // now try to find a specific file
        TreeWalk treeWalk = new TreeWalk(repository);
        treeWalk.addTree(tree);
View Full Code Here

    }

    private static int countFiles(Repository repository, ObjectId commitID, String name) throws IOException {
        RevWalk revWalk = new RevWalk(repository);
        RevCommit commit = revWalk.parseCommit(commitID);
        RevTree tree = commit.getTree();
        System.out.println("Having tree: " + tree);

        // now try to find a specific file
        TreeWalk treeWalk = new TreeWalk(repository);
        treeWalk.addTree(tree);
View Full Code Here

            IncorrectObjectTypeException {
        // from the commit we can build the tree which allows us to construct the TreeParser
        Ref head = repository.getRef(ref);
        RevWalk walk = new RevWalk(repository);
        RevCommit commit = walk.parseCommit(head.getObjectId());
        RevTree tree = walk.parseTree(commit.getTree().getId());

        CanonicalTreeParser oldTreeParser = new CanonicalTreeParser();
        ObjectReader oldReader = repository.newObjectReader();
        try {
            oldTreeParser.reset(oldReader, tree.getId());
        } finally {
            oldReader.release();
        }

        walk.dispose();
View Full Code Here

      RevWalk revWalk = new RevWalk(repo);
      AnyObjectId headId = headRef.getObjectId();
      RevCommit headCommit = headId == null ? null : revWalk
          .parseCommit(headId);
      RevCommit newCommit = revWalk.parseCommit(branch);
      RevTree headTree = headCommit == null ? null : headCommit.getTree();
      DirCacheCheckout dco;
      DirCache dc = repo.lockDirCache();
      try {
        dco = new DirCacheCheckout(repo, headTree, dc,
            newCommit.getTree());
View Full Code Here

    public void before() {
    }

    @Override
    public void visit(RevCommit revCommit) throws Exception {
        RevTree revTree = revCommit.getTree();
        TreeWalk treeWalk = new TreeWalk(context.getRepository());
        treeWalk.addTree(revTree);
        treeWalk.setRecursive(true);
        while (treeWalk.next()) {
            ObjectId objectId = treeWalk.getObjectId(0);
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

          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

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.