Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.AbstractTreeIterator


      filters.add(filter);
    filters.add(new SkipWorkTreeFilter(INDEX));
    filters.add(new IndexDiffFilter(INDEX, WORKDIR));
    treeWalk.setFilter(AndTreeFilter.create(filters));
    while (treeWalk.next()) {
      AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
          AbstractTreeIterator.class);
      DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX,
          DirCacheIterator.class);
      WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
          WorkingTreeIterator.class);

      if (dirCacheIterator != null) {
        final DirCacheEntry dirCacheEntry = dirCacheIterator
            .getDirCacheEntry();
        if (dirCacheEntry != null && dirCacheEntry.getStage() > 0) {
          conflicts.add(treeWalk.getPathString());
          continue;
        }
      }

      if (treeIterator != null) {
        if (dirCacheIterator != null) {
          if (!treeIterator.idEqual(dirCacheIterator)
              || treeIterator.getEntryRawMode()
              != dirCacheIterator.getEntryRawMode()) {
            // in repo, in index, content diff => changed
            changed.add(treeWalk.getPathString());
          }
        } else {
View Full Code Here


      walk.addTree(commit.getTree());
      walk.addTree(new DirCacheIterator(dc));
      walk.setRecursive(true);

      while (walk.next()) {
        AbstractTreeIterator cIter = walk.getTree(0,
            AbstractTreeIterator.class);
        if (cIter == null) {
          // Not in commit, don't add to new index
          continue;
        }

        final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath());
        entry.setFileMode(cIter.getEntryFileMode());
        entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());

        DirCacheIterator dcIter = walk.getTree(1,
            DirCacheIterator.class);
        if (dcIter != null && dcIter.idEqual(cIter)) {
          DirCacheEntry indexEntry = dcIter.getDirCacheEntry();
View Full Code Here

    }
  }

  private DirCacheEntry toEntry(final int stage, final TreeWalk tw) {
    final DirCacheEntry e = new DirCacheEntry(tw.getRawPath(), stage);
    final AbstractTreeIterator i;

    i = tw.getTree(0, AbstractTreeIterator.class);
    e.setFileMode(tw.getFileMode(0));
    e.setObjectIdFromRaw(i.idBuffer(), i.idOffset());
    return e;
  }
View Full Code Here

    private static boolean nonTree(final int mode) {
      return mode != 0 && !FileMode.TREE.equals(mode);
    }

    private void add(final int tree, final int stage) throws IOException {
      final AbstractTreeIterator i = getTree(tree);
      if (i != null) {
        if (FileMode.TREE.equals(tw.getRawMode(tree))) {
          builder.addTree(tw.getRawPath(), stage, reader, tw
              .getObjectId(tree));
        } else {
          final DirCacheEntry e;

          e = new DirCacheEntry(tw.getRawPath(), stage);
          e.setObjectIdFromRaw(i.idBuffer(), i.idOffset());
          e.setFileMode(tw.getFileMode(tree));
          builder.add(e);
        }
      }
    }
View Full Code Here

      filters.add(filter);
    filters.add(new SkipWorkTreeFilter(INDEX));
    filters.add(new IndexDiffFilter(INDEX, WORKDIR));
    treeWalk.setFilter(AndTreeFilter.create(filters));
    while (treeWalk.next()) {
      AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
          AbstractTreeIterator.class);
      DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX,
          DirCacheIterator.class);
      WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
          WorkingTreeIterator.class);

      if (treeIterator != null) {
        if (dirCacheIterator != null) {
          if (!treeIterator.idEqual(dirCacheIterator)
              || treeIterator.getEntryRawMode()
              != dirCacheIterator.getEntryRawMode()) {
            // in repo, in index, content diff => changed
            changed.add(treeWalk.getPathString());
          }
        } else {
View Full Code Here

    public DiffScmResult callDiff( Git git, ScmVersion startRevision, ScmVersion endRevision )
        throws IOException, GitAPIException, ScmException
    {

        AbstractTreeIterator oldTree = null;
        if ( startRevision != null && StringUtils.isNotEmpty( startRevision.getName().trim() ) )
        {
            String startRev = startRevision.getName().trim();
            oldTree = getTreeIterator( git.getRepository(), startRev );
        }

        AbstractTreeIterator newTree = null;
        if ( endRevision != null && StringUtils.isNotEmpty( endRevision.getName().trim() ) )
        {
            String endRev = endRevision.getName().trim();
            newTree = getTreeIterator( git.getRepository(), endRev );
        }
View Full Code Here

      filters.add(filter);
    filters.add(new SkipWorkTreeFilter(INDEX));
    filters.add(new IndexDiffFilter(INDEX, WORKDIR));
    treeWalk.setFilter(AndTreeFilter.create(filters));
    while (treeWalk.next()) {
      AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
          AbstractTreeIterator.class);
      DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX,
          DirCacheIterator.class);
      WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
          WorkingTreeIterator.class);

      if (treeIterator != null) {
        if (dirCacheIterator != null) {
          if (!treeIterator.idEqual(dirCacheIterator)
              || treeIterator.getEntryRawMode()
              != dirCacheIterator.getEntryRawMode()) {
            // in repo, in index, content diff => changed
            changed.add(treeWalk.getPathString());
          }
        } else {
View Full Code Here

    private static boolean nonTree(final int mode) {
      return mode != 0 && !FileMode.TREE.equals(mode);
    }

    private void add(final int tree, final int stage) throws IOException {
      final AbstractTreeIterator i = getTree(tree);
      if (i != null) {
        if (FileMode.TREE.equals(tw.getRawMode(tree))) {
          builder.addTree(tw.getRawPath(), stage, reader, tw
              .getObjectId(tree));
        } else {
          final DirCacheEntry e;

          e = new DirCacheEntry(tw.getRawPath(), stage);
          e.setObjectIdFromRaw(i.idBuffer(), i.idOffset());
          e.setFileMode(tw.getFileMode(tree));
          builder.add(e);
        }
      }
    }
View Full Code Here

    indexDiffFilter = new IndexDiffFilter(INDEX, WORKDIR);
    filters.add(indexDiffFilter);
    treeWalk.setFilter(AndTreeFilter.create(filters));
    fileModes.clear();
    while (treeWalk.next()) {
      AbstractTreeIterator treeIterator = treeWalk.getTree(TREE,
          AbstractTreeIterator.class);
      DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX,
          DirCacheIterator.class);
      WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
          WorkingTreeIterator.class);

      if (dirCacheIterator != null) {
        final DirCacheEntry dirCacheEntry = dirCacheIterator
            .getDirCacheEntry();
        if (dirCacheEntry != null) {
          int stage = dirCacheEntry.getStage();
          if (stage > 0) {
            String path = treeWalk.getPathString();
            addConflict(path, stage);
            continue;
          }
        }
      }

      if (treeIterator != null) {
        if (dirCacheIterator != null) {
          if (!treeIterator.idEqual(dirCacheIterator)
              || treeIterator.getEntryRawMode()
              != dirCacheIterator.getEntryRawMode()) {
            // in repo, in index, content diff => changed
            if (!isEntryGitLink(treeIterator)
                || !isEntryGitLink(dirCacheIterator)
                || ignoreSubmoduleMode != IgnoreSubmoduleMode.ALL)
View Full Code Here

        List<PathEdit> wtEdits = new ArrayList<PathEdit>();
        List<String> wtDeletes = new ArrayList<String>();
        List<DirCacheEntry> untracked = new ArrayList<DirCacheEntry>();
        boolean hasChanges = false;
        do {
          AbstractTreeIterator headIter = treeWalk.getTree(0,
              AbstractTreeIterator.class);
          DirCacheIterator indexIter = treeWalk.getTree(1,
              DirCacheIterator.class);
          WorkingTreeIterator wtIter = treeWalk.getTree(2,
              WorkingTreeIterator.class);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.treewalk.AbstractTreeIterator

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.