本文整理汇总了C#中Repository.NewObjectInserter方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.NewObjectInserter方法的具体用法?C# Repository.NewObjectInserter怎么用?C# Repository.NewObjectInserter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository.NewObjectInserter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
/// <exception cref="System.IO.FileNotFoundException"></exception>
/// <exception cref="System.IO.IOException"></exception>
internal static DirCacheEditor.PathEdit Add(Repository db, FilePath workdir, string
path)
{
ObjectInserter inserter = db.NewObjectInserter();
FilePath f = new FilePath(workdir, path);
ObjectId id = inserter.Insert(Constants.OBJ_BLOB, IOUtil.ReadFully(f));
return new _PathEdit_81(f, id, path);
}
示例2: WriteBlob
/// <exception cref="System.IO.IOException"></exception>
private RevObject WriteBlob(Repository repo, string data)
{
RevWalk revWalk = new RevWalk(repo);
byte[] bytes = Constants.Encode(data);
ObjectInserter inserter = repo.NewObjectInserter();
ObjectId id;
try
{
id = inserter.Insert(Constants.OBJ_BLOB, bytes);
inserter.Flush();
}
finally
{
inserter.Release();
}
try
{
Parse(id);
NUnit.Framework.Assert.Fail("Object " + id.Name + " should not exist in test repository"
);
}
catch (MissingObjectException)
{
}
// Ok
return revWalk.LookupBlob(id);
}
示例3: WriteTree
/// <summary>Construct a WriteTree for a given directory</summary>
/// <param name="sourceDirectory"></param>
/// <param name="db"></param>
public WriteTree(FilePath sourceDirectory, Repository db) : base(sourceDirectory)
{
inserter = db.NewObjectInserter();
}
示例4: WalkFetchConnection
internal WalkFetchConnection(WalkTransport t, WalkRemoteObjectDatabase w)
{
NGit.Transport.Transport wt = (NGit.Transport.Transport)t;
local = wt.local;
objCheck = wt.IsCheckFetchedObjects() ? new ObjectChecker() : null;
inserter = local.NewObjectInserter();
reader = local.NewObjectReader();
remotes = new AList<WalkRemoteObjectDatabase>();
remotes.AddItem(w);
unfetchedPacks = new List<WalkFetchConnection.RemotePack>();
packsConsidered = new HashSet<string>();
noPacksYet = new List<WalkRemoteObjectDatabase>();
noPacksYet.AddItem(w);
noAlternatesYet = new List<WalkRemoteObjectDatabase>();
noAlternatesYet.AddItem(w);
fetchErrors = new Dictionary<ObjectId, IList<Exception>>();
packLocks = new AList<PackLock>(4);
revWalk = new RevWalk(reader);
revWalk.SetRetainBody(false);
treeWalk = new TreeWalk(reader);
COMPLETE = revWalk.NewFlag("COMPLETE");
IN_WORK_QUEUE = revWalk.NewFlag("IN_WORK_QUEUE");
LOCALLY_SEEN = revWalk.NewFlag("LOCALLY_SEEN");
localCommitQueue = new DateRevQueue();
workQueue = new List<ObjectId>();
}
示例5: NoteMapMerger
/// <summary>
/// Constructs a NoteMapMerger with custom
/// <see cref="NoteMerger">NoteMerger</see>
/// and custom
/// <see cref="NGit.Merge.MergeStrategy">NGit.Merge.MergeStrategy</see>
/// .
/// </summary>
/// <param name="db">Git repository</param>
/// <param name="noteMerger">note merger for merging conflicting changes on a note</param>
/// <param name="nonNotesMergeStrategy">merge strategy for merging non-note entries</param>
public NoteMapMerger(Repository db, NoteMerger noteMerger, MergeStrategy nonNotesMergeStrategy
)
{
this.db = db;
this.reader = db.NewObjectReader();
this.inserter = db.NewObjectInserter();
this.noteMerger = noteMerger;
this.nonNotesMergeStrategy = nonNotesMergeStrategy;
this.objectIdPrefix = new MutableObjectId();
}