Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.CanonicalTreeParser


      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();
      stashIndexIter.reset(reader, stashIndexTree);
      CanonicalTreeParser stashHeadIter = new CanonicalTreeParser();
      stashHeadIter.reset(reader, stashHeadTree);
      CanonicalTreeParser headIter = new CanonicalTreeParser();
      headIter.reset(reader, headTree);

      DirCache cache = repo.lockDirCache();
      DirCacheEditor editor = cache.editor();
      try {
        DirCacheIterator indexIter = new DirCacheIterator(cache);
View Full Code Here


      if (cached) {
        if (oldTree == null) {
          ObjectId head = repo.resolve(HEAD + "^{tree}");
          if (head == null)
            throw new NoHeadException(JGitText.get().cannotReadTree);
          CanonicalTreeParser p = new CanonicalTreeParser();
          ObjectReader reader = repo.newObjectReader();
          try {
            p.reset(reader, head);
          } finally {
            reader.release();
          }
          oldTree = p;
        }
View Full Code Here

      tw.setRecursive(true);

      while (tw.next()) {
        final String path = tw.getPathString();
        // DirCacheIterator dci = tw.getTree(0, DirCacheIterator.class);
        final CanonicalTreeParser tree = tw.getTree(1,
            CanonicalTreeParser.class);
        if (tree == null)
          // file is not in the commit, remove from index
          edit.add(new DirCacheEditor.DeletePath(path));
        else { // revert index to commit
          // it seams that there is concurrent access to tree
          // variable, therefore we need to keep references to
          // entryFileMode and entryObjectId in local
          // variables
          final FileMode entryFileMode = tree.getEntryFileMode();
          final ObjectId entryObjectId = tree.getEntryObjectId();
          edit.add(new DirCacheEditor.PathEdit(path) {
            @Override
            public void apply(DirCacheEntry ent) {
              ent.setFileMode(entryFileMode);
              ent.setObjectId(entryObjectId);
View Full Code Here

   *             a tree cannot be read to iterate through its entries.
   */
  public void addTree(final byte[] pathPrefix, final int stage,
      final ObjectReader reader, final AnyObjectId tree) throws IOException {
    final TreeWalk tw = new TreeWalk(reader);
    tw.addTree(new CanonicalTreeParser(pathPrefix, reader, tree
        .toObjectId()));
    tw.setRecursive(true);
    if (tw.next()) {
      final DirCacheEntry newEntry = toEntry(stage, tw);
      beforeAdd(newEntry);
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

    chunkByOrder = newListArray(5);
    infoByKey = new HashMap<ChunkKey, ChunkInfo>();
    dirtyMeta = new HashMap<ChunkKey, ChunkMeta>();
    chunkMeta = new HashMap<ChunkKey, ChunkMeta>();
    chunkEdges = new HashMap<ChunkKey, Edges>();
    treeParser = new CanonicalTreeParser();
    idBuffer = new MutableObjectId();
    objectMap = new ObjectIdSubclassMap<DhtInfo>();

    final int max = options.getParserCacheSize();
    chunkReadBackCache = new LinkedHashMap<ChunkKey, PackChunk>(max, 0.75f, true) {
View Full Code Here

      if (baseCommit == null) {
        checkIgnored = true;
        baseTreeIndex = tw.addTree(new AdaptableFileTreeIterator(
            repository, ResourcesPlugin.getWorkspace().getRoot()));
      } else
        baseTreeIndex = tw.addTree(new CanonicalTreeParser(null,
            repository.newObjectReader(), baseCommit.getTree()));
      int compareTreeIndex;
      if (!useIndex)
        compareTreeIndex = tw.addTree(new CanonicalTreeParser(null,
            repository.newObjectReader(), compareCommit.getTree()));
      else
        compareTreeIndex = tw.addTree(new DirCacheIterator(repository
            .readDirCache()));
View Full Code Here

      // compare workspace with something
      checkIgnored = true;
      baseTreeIndex = tw.addTree(new AdaptableFileTreeIterator(
          repository, ResourcesPlugin.getWorkspace().getRoot()));
    } else
      baseTreeIndex = tw.addTree(new CanonicalTreeParser(null, repository
          .newObjectReader(), baseCommit.getTree()));
    int compareTreeIndex;
    if (!useIndex)
      compareTreeIndex = tw.addTree(new CanonicalTreeParser(null,
          repository.newObjectReader(), compareCommit.getTree()));
    else
      // compare something with the index
      compareTreeIndex = tw.addTree(new DirCacheIterator(repository
          .readDirCache()));
View Full Code Here

        baselineCommit = rw.parseCommit(commitId);
        DiffConfig diffConfig = repository.getConfig().get(
            DiffConfig.KEY);
        if (diffConfig.getRenameDetectionType() != RenameDetectionType.FALSE) {
          TreeWalk walk = new TreeWalk(repository);
          CanonicalTreeParser baseLineIterator = new CanonicalTreeParser();
          baseLineIterator.reset(reader, baselineCommit.getTree());
          walk.addTree(baseLineIterator);
          walk.addTree(new DirCacheIterator(repository.readDirCache()));
          List<DiffEntry> diffs = DiffEntry.scan(walk, true);
          RenameDetector renameDetector = new RenameDetector(
              repository);
View Full Code Here

        // 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

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.