本文整理汇总了C#中NGit.Treewalk.FileTreeIterator.GetEntryFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileTreeIterator.GetEntryFile方法的具体用法?C# FileTreeIterator.GetEntryFile怎么用?C# FileTreeIterator.GetEntryFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit.Treewalk.FileTreeIterator
的用法示例。
在下文中一共展示了FileTreeIterator.GetEntryFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetIndex
/// <summary>Resets the index to represent exactly some filesystem content.</summary>
/// <remarks>
/// Resets the index to represent exactly some filesystem content. E.g. the
/// following call will replace the index with the working tree content:
/// <p>
/// <code>resetIndex(new FileSystemIterator(db))</code>
/// <p>
/// This method can be used by testcases which first prepare a new commit
/// somewhere in the filesystem (e.g. in the working-tree) and then want to
/// have an index which matches their prepared content.
/// </remarks>
/// <param name="treeItr">
/// a
/// <see cref="NGit.Treewalk.FileTreeIterator">NGit.Treewalk.FileTreeIterator</see>
/// which determines which files should
/// go into the new index
/// </param>
/// <exception cref="System.IO.FileNotFoundException">System.IO.FileNotFoundException
/// </exception>
/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
protected internal virtual void ResetIndex(FileTreeIterator treeItr)
{
ObjectInserter inserter = db.NewObjectInserter();
DirCacheBuilder builder = db.LockDirCache().Builder();
DirCacheEntry dce;
while (!treeItr.Eof)
{
long len = treeItr.GetEntryLength();
dce = new DirCacheEntry(treeItr.EntryPathString);
dce.FileMode = treeItr.EntryFileMode;
dce.LastModified = treeItr.GetEntryLastModified();
dce.SetLength((int)len);
FileInputStream @in = new FileInputStream(treeItr.GetEntryFile());
dce.SetObjectId(inserter.Insert(Constants.OBJ_BLOB, len, @in));
@in.Close();
builder.Add(dce);
treeItr.Next(1);
}
builder.Commit();
inserter.Flush();
inserter.Release();
}
示例2: GetDirectoryFiles
IEnumerable<string> GetDirectoryFiles (DirectoryInfo dir)
{
FileTreeIterator iter = new FileTreeIterator (dir.FullName, RootRepository.FileSystem, WorkingTreeOptions.KEY.Parse(RootRepository.GetConfig()));
while (!iter.Eof) {
var file = iter.GetEntryFile ();
if (file != null && !iter.IsEntryIgnored ())
yield return file.GetPath ();
iter.Next (1);
}
}