Package org.eclipse.jgit.treewalk

Examples of org.eclipse.jgit.treewalk.FileTreeIteratorWithTimeControl


      lastFile = new File(db.getWorkTree(), "2." + i);
      FileUtils.createNewFile(lastFile);
      if (i % 4 == 0)
        fsTick(lastFile);
    }
    FileTreeIteratorWithTimeControl fileIt = new FileTreeIteratorWithTimeControl(
        db, modTimes);
    NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
    tw.addTree(fileIt);
    tw.setRecursive(true);
    FileTreeIterator t;
View Full Code Here


    // wait to ensure that file-modTimes and therefore index entry modTime
    // doesn't match the modtime of index-file after next persistance
    modTimes.add(valueOf(fsTick(lastFile)));

    // now add both files to the index. No racy git expected
    resetIndex(new FileTreeIteratorWithTimeControl(db, modTimes));

    assertEquals(
        "[a, mode:100644, time:t0, length:1, content:a]" +
        "[b, mode:100644, time:t0, length:1, content:b]",
        indexState(SMUDGE | MOD_TIME | LENGTH | CONTENT));

    // Remember the last modTime of index file. All modifications times of
    // further modification are translated to this value so it looks that
    // files have been modified in the same time slot as the index file
    modTimes.add(Long.valueOf(db.getIndexFile().lastModified()));

    // modify one file
    addToWorkDir("a", "a2");
    // now update the index the index. 'a' has to be racily clean -- because
    // it's modification time is exactly the same as the previous index file
    // mod time.
    resetIndex(new FileTreeIteratorWithTimeControl(db, modTimes));

    db.readDirCache();
    // although racily clean a should not be reported as being dirty
    assertEquals(
        "[a, mode:100644, time:t1, smudged, length:0, content:a2]" +
View Full Code Here

      lastFile = new File(db.getWorkTree(), "2." + i);
      lastFile.createNewFile();
      if (i % 4 == 0)
        fsTick(lastFile);
    }
    FileTreeIteratorWithTimeControl fileIt = new FileTreeIteratorWithTimeControl(
        db, modTimes);
    NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
    tw.reset();
    tw.addTree(fileIt);
    tw.setRecursive(true);
View Full Code Here

  }

  private void addToIndex(TreeSet<Long> modTimes)
      throws FileNotFoundException, IOException {
    DirCacheBuilder builder = db.lockDirCache().builder();
    FileTreeIterator fIt = new FileTreeIteratorWithTimeControl(
        db, modTimes);
    DirCacheEntry dce;
    while (!fIt.eof()) {
      dce = new DirCacheEntry(fIt.getEntryPathString());
      dce.setFileMode(fIt.getEntryFileMode());
      dce.setLastModified(fIt.getEntryLastModified());
      dce.setLength((int) fIt.getEntryLength());
      dce.setObjectId(fIt.getEntryObjectId());
      builder.add(dce);
      fIt.next(1);
    }
    builder.commit();
  }
View Full Code Here

TOP

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

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.