本文整理汇总了Java中org.eclipse.jgit.dircache.DirCacheEntry.setLastModified方法的典型用法代码示例。如果您正苦于以下问题:Java DirCacheEntry.setLastModified方法的具体用法?Java DirCacheEntry.setLastModified怎么用?Java DirCacheEntry.setLastModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.dircache.DirCacheEntry
的用法示例。
在下文中一共展示了DirCacheEntry.setLastModified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildDirCache
import org.eclipse.jgit.dircache.DirCacheEntry; //导入方法依赖的package包/类
private void buildDirCache(TreeWalk walk, DirCacheBuilder builder)
throws MissingObjectException, IncorrectObjectTypeException,
CorruptObjectException, IOException {
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();
entry.setLastModified(indexEntry.getLastModified());
entry.setLength(indexEntry.getLength());
}
builder.add(entry);
}
}
示例2: testResetConflict
import org.eclipse.jgit.dircache.DirCacheEntry; //导入方法依赖的package包/类
public void testResetConflict () throws Exception {
File file = new File(workDir, "file");
write(file, "init");
File[] files = new File[] { file };
add(files);
commit(files);
DirCache index = repository.lockDirCache();
DirCacheBuilder builder = index.builder();
DirCacheEntry e = index.getEntry(file.getName());
DirCacheEntry e1 = new DirCacheEntry(file.getName(), 1);
e1.setCreationTime(e.getCreationTime());
e1.setFileMode(e.getFileMode());
e1.setLastModified(e.getLastModified());
e1.setLength(e.getLength());
e1.setObjectId(e.getObjectId());
builder.add(e1);
builder.finish();
builder.commit();
GitClient client = getClient(workDir);
Map<File, GitStatus> status = client.getStatus(files, NULL_PROGRESS_MONITOR);
assertTrue(status.get(file).isConflict());
assertEquals(GitConflictDescriptor.Type.BOTH_DELETED, status.get(file).getConflictDescriptor().getType());
client.reset(files, "HEAD", true, NULL_PROGRESS_MONITOR);
status = client.getStatus(files, NULL_PROGRESS_MONITOR);
assertFalse(status.get(file).isConflict());
}