本文整理汇总了C#中NGit.Tree.Format方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.Format方法的具体用法?C# Tree.Format怎么用?C# Tree.Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit.Tree
的用法示例。
在下文中一共展示了Tree.Format方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertTree
/// <exception cref="System.IO.IOException"></exception>
private ObjectId InsertTree(Tree tree)
{
ObjectInserter oi = db.NewObjectInserter();
try
{
ObjectId id = oi.Insert(Constants.OBJ_TREE, tree.Format());
oi.Flush();
return id;
}
finally
{
oi.Release();
}
}
示例2: EndVisitTree
/// <exception cref="System.IO.IOException"></exception>
public override void EndVisitTree(Tree t)
{
base.EndVisitTree(t);
try
{
t.SetId(inserter.Insert(Constants.OBJ_TREE, t.Format()));
inserter.Flush();
}
finally
{
inserter.Release();
}
}
示例3: TestEmptyTreeCorruption
public virtual void TestEmptyTreeCorruption()
{
ObjectId bId = ObjectId.FromString("abbbfafe3129f85747aba7bfac992af77134c607");
RevTree tree_root;
RevTree tree_A;
RevTree tree_AB;
RevCommit b;
{
Tree root = new Tree(db);
Tree A = root.AddTree("A");
FileTreeEntry B = root.AddFile("B");
B.SetId(bId);
Tree A_A = A.AddTree("A");
Tree A_B = A.AddTree("B");
ObjectInserter inserter = db.NewObjectInserter();
try
{
A_A.SetId(inserter.Insert(Constants.OBJ_TREE, A_A.Format()));
A_B.SetId(inserter.Insert(Constants.OBJ_TREE, A_B.Format()));
A.SetId(inserter.Insert(Constants.OBJ_TREE, A.Format()));
root.SetId(inserter.Insert(Constants.OBJ_TREE, root.Format()));
inserter.Flush();
}
finally
{
inserter.Release();
}
tree_root = rw.ParseTree(root.GetId());
tree_A = rw.ParseTree(A.GetId());
tree_AB = rw.ParseTree(A_A.GetId());
NUnit.Framework.Assert.AreSame(tree_AB, rw.ParseTree(A_B.GetId()));
b = Commit(rw.ParseTree(root.GetId()));
}
MarkStart(b);
AssertCommit(b, objw.Next());
NUnit.Framework.Assert.IsNull(objw.Next());
NUnit.Framework.Assert.AreSame(tree_root, objw.NextObject());
NUnit.Framework.Assert.AreSame(tree_A, objw.NextObject());
NUnit.Framework.Assert.AreSame(tree_AB, objw.NextObject());
NUnit.Framework.Assert.AreSame(rw.LookupBlob(bId), objw.NextObject());
NUnit.Framework.Assert.IsNull(objw.NextObject());
}
示例4: TestMissingSubtree_DetectFileAdded_FileModified
public virtual void TestMissingSubtree_DetectFileAdded_FileModified()
{
ObjectInserter inserter = db.NewObjectInserter();
ObjectId aFileId = inserter.Insert(Constants.OBJ_BLOB, Constants.Encode("a"));
ObjectId bFileId = inserter.Insert(Constants.OBJ_BLOB, Constants.Encode("b"));
ObjectId cFileId1 = inserter.Insert(Constants.OBJ_BLOB, Constants.Encode("c-1"));
ObjectId cFileId2 = inserter.Insert(Constants.OBJ_BLOB, Constants.Encode("c-2"));
// Create sub-a/empty, sub-c/empty = hello.
ObjectId oldTree;
{
Tree root = new Tree(db);
{
Tree subA = root.AddTree("sub-a");
subA.AddFile("empty").SetId(aFileId);
subA.SetId(inserter.Insert(Constants.OBJ_TREE, subA.Format()));
}
{
Tree subC = root.AddTree("sub-c");
subC.AddFile("empty").SetId(cFileId1);
subC.SetId(inserter.Insert(Constants.OBJ_TREE, subC.Format()));
}
oldTree = inserter.Insert(Constants.OBJ_TREE, root.Format());
}
// Create sub-a/empty, sub-b/empty, sub-c/empty.
ObjectId newTree;
{
Tree root = new Tree(db);
{
Tree subA = root.AddTree("sub-a");
subA.AddFile("empty").SetId(aFileId);
subA.SetId(inserter.Insert(Constants.OBJ_TREE, subA.Format()));
}
{
Tree subB = root.AddTree("sub-b");
subB.AddFile("empty").SetId(bFileId);
subB.SetId(inserter.Insert(Constants.OBJ_TREE, subB.Format()));
}
{
Tree subC = root.AddTree("sub-c");
subC.AddFile("empty").SetId(cFileId2);
subC.SetId(inserter.Insert(Constants.OBJ_TREE, subC.Format()));
}
newTree = inserter.Insert(Constants.OBJ_TREE, root.Format());
}
inserter.Flush();
inserter.Release();
TreeWalk tw = new TreeWalk(db);
tw.Reset(oldTree, newTree);
tw.Recursive = true;
tw.Filter = TreeFilter.ANY_DIFF;
NUnit.Framework.Assert.IsTrue(tw.Next());
NUnit.Framework.Assert.AreEqual("sub-b/empty", tw.PathString);
NUnit.Framework.Assert.AreEqual(FileMode.MISSING, tw.GetFileMode(0));
NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE, tw.GetFileMode(1));
NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, tw.GetObjectId(0));
NUnit.Framework.Assert.AreEqual(bFileId, tw.GetObjectId(1));
NUnit.Framework.Assert.IsTrue(tw.Next());
NUnit.Framework.Assert.AreEqual("sub-c/empty", tw.PathString);
NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE, tw.GetFileMode(0));
NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE, tw.GetFileMode(1));
NUnit.Framework.Assert.AreEqual(cFileId1, tw.GetObjectId(0));
NUnit.Framework.Assert.AreEqual(cFileId2, tw.GetObjectId(1));
NUnit.Framework.Assert.IsFalse(tw.Next());
}