Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.FileTreeIterator


   *            the id of the tree of the
   * @throws IOException
   */
  public DirCacheCheckout(Repository repo, DirCache dc,
      ObjectId mergeCommitTree) throws IOException {
    this(repo, null, dc, mergeCommitTree, new FileTreeIterator(repo));
  }
View Full Code Here


  private boolean isModifiedSubtree_IndexWorkingtree(String path)
      throws CorruptObjectException, IOException {
    NameConflictTreeWalk tw = new NameConflictTreeWalk(repo);
    try {
      tw.addTree(new DirCacheIterator(dc));
      tw.addTree(new FileTreeIterator(repo));
      tw.setRecursive(true);
      tw.setFilter(PathFilter.create(path));
      DirCacheIterator dcIt;
      WorkingTreeIterator wtIt;
      while (tw.next()) {
View Full Code Here

      if (paths.isEmpty())
        return;
      walk.setFilter(PathFilterGroup.createFromStrings(paths));

      DirCacheIterator iIter = new DirCacheIterator(this);
      FileTreeIterator fIter = new FileTreeIterator(repository);
      walk.addTree(iIter);
      walk.addTree(fIter);
      walk.setRecursive(true);
      while (walk.next()) {
        iIter = walk.getTree(0, DirCacheIterator.class);
        if (iIter == null)
          continue;
        fIter = walk.getTree(1, FileTreeIterator.class);
        if (fIter == null)
          continue;
        DirCacheEntry entry = iIter.getDirCacheEntry();
        if (entry.isSmudged() && iIter.idEqual(fIter)) {
          entry.setLength(fIter.getEntryLength());
          entry.setLastModified(fIter.getEntryLastModified());
        }
      }
    } finally {
      walk.release();
    }
View Full Code Here

          oldTree = p;
        }
        newTree = new DirCacheIterator(db.readDirCache());
      } else if (oldTree == null) {
        oldTree = new DirCacheIterator(db.readDirCache());
        newTree = new FileTreeIterator(db);
      } else if (newTree == null)
        newTree = new FileTreeIterator(db);

      TextProgressMonitor pm = new TextProgressMonitor();
      pm.setDelayStart(2, TimeUnit.SECONDS);
      diffFmt.setProgressMonitor(pm);
      diffFmt.setPathFilter(pathFilter);
View Full Code Here

  @Theory
  public void testInitiallyClean(IgnoreSubmoduleMode mode)
      throws IOException {
    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    assertFalse(indexDiff.diff());
  }
View Full Code Here

  public void testDirtyRootWorktree(IgnoreSubmoduleMode mode)
      throws IOException {
    writeTrashFile("fileInRoot", "2");

    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    assertTrue(indexDiff.diff());
  }
View Full Code Here

  @Theory
  public void testDirtySubmoduleWorktree(IgnoreSubmoduleMode mode)
      throws IOException {
    JGitTestUtil.writeTrashFile(submodule_db, "fileInSubmodule", "2");
    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    if (mode.equals(IgnoreSubmoduleMode.ALL)
        || mode.equals(IgnoreSubmoduleMode.DIRTY))
      assertFalse("diff should be false with mode=" + mode,
          indexDiff.diff());
View Full Code Here

    Git submoduleGit = Git.wrap(submodule_db);
    submoduleGit.add().addFilepattern("fileInSubmodule").call();
    submoduleGit.commit().setMessage("Modified fileInSubmodule").call();

    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    if (mode.equals(IgnoreSubmoduleMode.ALL))
      assertFalse("diff should be false with mode=" + mode,
          indexDiff.diff());
    else
View Full Code Here

    JGitTestUtil.writeTrashFile(submodule_db, "fileInSubmodule", "2");
    Git submoduleGit = Git.wrap(submodule_db);
    submoduleGit.add().addFilepattern("fileInSubmodule").call();

    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    if (mode.equals(IgnoreSubmoduleMode.ALL)
        || mode.equals(IgnoreSubmoduleMode.DIRTY))
      assertFalse("diff should be false with mode=" + mode,
          indexDiff.diff());
View Full Code Here

    Git submoduleGit = Git.wrap(submodule_db);
    submoduleGit.add().addFilepattern("fileInSubmodule").call();
    JGitTestUtil.writeTrashFile(submodule_db, "fileInSubmodule", "3");

    IndexDiff indexDiff = new IndexDiff(db, Constants.HEAD,
        new FileTreeIterator(db));
    indexDiff.setIgnoreSubmoduleMode(mode);
    if (mode.equals(IgnoreSubmoduleMode.ALL)
        || mode.equals(IgnoreSubmoduleMode.DIRTY))
      assertFalse("diff should be false with mode=" + mode,
          indexDiff.diff());
View Full Code Here

TOP

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

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.