Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevTree


        return repository;
    }

    public static ObjectId getFileObjectId(Repository repository, String fileNameWithPath) throws IOException {
        TreeWalk treeWalk = new TreeWalk(repository);
        RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
        if( revTree == null ){
            return ObjectId.zeroId();
        }
        treeWalk.addTree(revTree);
        treeWalk.setRecursive(false);
View Full Code Here


        return treeWalk.getObjectId(0);
    }

    private static ObjectId getFirstFoundREADMEfileObjectId(Repository repository) throws IOException {
        TreeWalk treeWalk = new TreeWalk(repository);
        RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
        if( revTree == null ){
            return ObjectId.zeroId();
        }
        treeWalk.addTree(revTree);
        treeWalk.setRecursive(false);
View Full Code Here

        pullRequest.toProject = project;
        return pullRequest;
    }

    private byte[] getRawFile(Repository repository, String path) throws IOException {
        RevTree tree = new RevWalk(repository).parseTree(repository.resolve(Constants.HEAD));
        TreeWalk treeWalk = TreeWalk.forPath(repository, path, tree);
        if (treeWalk.isSubtree()) {
            return null;
        } else {
            return repository.open(treeWalk.getObjectId(0)).getBytes();
View Full Code Here

        if (objectId == null) {
            return false;
        }

        RevWalk revWalk = new RevWalk(repository);
        RevTree revTree = revWalk.parseTree(objectId);
        TreeWalk treeWalk = new TreeWalk(repository);
        treeWalk.addTree(revTree);

        treeWalk.setRecursive(true);
        treeWalk.setFilter(PathFilter.create(path));
View Full Code Here

            Logger.debug("GitRepository : init Project - No Head commit");
            return null;
        }

        RevWalk revWalk = new RevWalk(repository);
        RevTree revTree = revWalk.parseTree(headCommit);
        TreeWalk treeWalk = new TreeWalk(repository);
        treeWalk.addTree(revTree);

        if (path.isEmpty()) {
            return treeAsJson(path, treeWalk, headCommit);
View Full Code Here

     * @return null if the {@code path} denotes a directory; the contents otherwise.
     * @throws IOException
     */
    @Override
    public byte[] getRawFile(String revision, String path) throws IOException {
        RevTree tree = new RevWalk(repository).parseTree(repository.resolve(revision));
        TreeWalk treeWalk = TreeWalk.forPath(repository, path, tree);
        if (treeWalk.isSubtree()) {
            return null;
        } else {
            return repository.open(treeWalk.getObjectId(0)).getBytes();
View Full Code Here

        TreeWalk treeWalk = new TreeWalk(repository);
        RevWalk walk = new RevWalk(repository);
        try {
            ObjectId from = repository.resolve(fromBranch);
            ObjectId to = repository.resolve(toBranch);
            RevTree fromTree = walk.parseTree(from);
            RevTree toTree = walk.parseTree(to);

            treeWalk.addTree(toTree);
            treeWalk.addTree(fromTree);

            ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

        DiffFormatter formatter = new DiffFormatter(NullOutputStream.INSTANCE);
        formatter.setRepository(fakeRepo);
        formatter.setDetectRenames(true);

        AbstractTreeIterator treeParserA, treeParserB;
        RevTree treeA = null, treeB = null;

        if (commitA != null) {
            treeA = new RevWalk(repositoryA).parseTree(commitA);
            treeParserA = new CanonicalTreeParser();
            ((CanonicalTreeParser) treeParserA).reset(reader, treeA);
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

      if (stashCommit.getParentCount() != 2)
        throw new JGitInternalException(MessageFormat.format(
            JGitText.get().stashCommitMissingTwoParents,
            stashId.name()));

      RevTree stashWorkingTree = stashCommit.getTree();
      RevTree stashIndexTree = revWalk.parseCommit(
          stashCommit.getParent(1)).getTree();
      RevTree stashHeadTree = revWalk.parseCommit(
          stashCommit.getParent(0)).getTree();

      CanonicalTreeParser stashWorkingIter = new CanonicalTreeParser();
      stashWorkingIter.reset(reader, stashWorkingTree);
      CanonicalTreeParser stashIndexIter = new CanonicalTreeParser();
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.