Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevTree


      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


            }
          }
        }
        break;
      case ':': {
        RevTree tree;
        if (ref == null) {
          // We might not yet have parsed the left hand side.
          ObjectId id;
          try {
            if (i == 0)
              id = resolve(rw, Constants.HEAD);
            else
              id = resolve(rw, new String(rev, 0, i));
          } catch (RevisionSyntaxException badSyntax) {
            throw new RevisionSyntaxException(revstr);
          }
          if (id == null)
            return null;
          tree = rw.parseTree(id);
        } else {
          tree = rw.parseTree(ref);
        }

        if (i == rev.length - i)
          return tree.copy();

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

      }

      MarkupProcessor processor = new MarkupProcessor(settings);
      String [] encodings = settings.getStrings(Keys.web.blobEncodings).toArray(new String[0]);

      RevTree tree = commit.getTree();

      String res = resource;
      if (res.endsWith("/")) {
        res = res.substring(0, res.length() - 1);
      }
View Full Code Here

    if (!hasCommits(repository)) {
      return list;
    }
    List<RefModel> noteBranches = getNoteBranches(repository, true, -1);
    for (RefModel notesRef : noteBranches) {
      RevTree notesTree = JGitUtils.getCommit(repository, notesRef.getName()).getTree();
      // flat notes list
      String notePath = commit.getName();
      String text = getStringContent(repository, notesTree, notePath);
      if (!StringUtils.isEmpty(text)) {
        List<RevCommit> history = getRevLog(repository, notesRef.getName(), notePath, 0, -1);
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

    public TestVersionResult determineVersions(final String fetchRevision) throws StoreException.ReadException {
        try {
            final RevWalk walk = new RevWalk(git.getRepository());
            final ObjectId commitId = ObjectId.fromString(fetchRevision);
            final RevCommit headTree = walk.parseCommit(commitId);
            final RevTree tree = headTree.getTree();

            // now use a TreeWalk to iterate over all files in the Tree recursively
            // you can set Filters to narrow down the results if needed
            TreeWalk treeWalk = new TreeWalk(git.getRepository());
            treeWalk.addTree(tree);
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 = new DirCacheCheckout(repo, headTree,
          repo.lockDirCache(), newCommit.getTree());
      dco.setFailOnConflict(true);
      try {
        dco.checkout();
View Full Code Here

    if (!hasCommits(repository)) {
      return list;
    }
    List<RefModel> noteBranches = getNoteBranches(repository, true, -1);
    for (RefModel notesRef : noteBranches) {
      RevTree notesTree = JGitUtils.getCommit(repository, notesRef.getName()).getTree();
      // flat notes list
      String notePath = commit.getName();
      String text = getStringContent(repository, notesTree, notePath);
      if (!StringUtils.isEmpty(text)) {
        List<RevCommit> history = getRevLog(repository, notesRef.getName(), notePath, 0, -1);
View Full Code Here

      }
      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());
          rw.dispose();
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.