本文整理汇总了C#中GitIndex.checkout方法的典型用法代码示例。如果您正苦于以下问题:C# GitIndex.checkout方法的具体用法?C# GitIndex.checkout怎么用?C# GitIndex.checkout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitIndex
的用法示例。
在下文中一共展示了GitIndex.checkout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testCheckout
public void testCheckout()
{
// Prepare tree, remote it and checkout
var index = new GitIndex(db);
FileInfo aslashb = writeTrashFile("a/b", "data:a/b");
FileInfo acolonb = writeTrashFile("[email protected]", "data:a:b");
FileInfo adotb = writeTrashFile("a.b", "data:a.b");
index.add(trash, aslashb);
index.add(trash, acolonb);
index.add(trash, adotb);
index.write();
index.writeTree();
Delete(aslashb);
Delete(acolonb);
Delete(adotb);
Delete(Directory.GetParent(aslashb.FullName));
var index2 = new GitIndex(db);
Assert.AreEqual(0, index2.Members.Count);
index2.ReadTree(db.MapTree(ObjectId.FromString("0036d433dc4f10ec47b61abc3ec5033c78d34f84")));
index2.checkout(trash);
Assert.AreEqual("data:a/b", Content(aslashb));
Assert.AreEqual("data:a:b", Content(acolonb));
Assert.AreEqual("data:a.b", Content(adotb));
if (CanRunGitStatus)
{
Assert.AreEqual(0, System(trash, "git status"));
}
}
示例2: testCheckout
public void testCheckout()
{
// Prepare tree, remote it and checkout
var index = new GitIndex(db);
FileInfo aslashb = writeTrashFile("a/b", "data:a/b");
FileInfo acolonb = writeTrashFile("a:b", "data:a:b");
FileInfo adotb = writeTrashFile("a.b", "data:a.b");
index.add(trash, aslashb);
index.add(trash, acolonb);
index.add(trash, adotb);
index.write();
index.writeTree();
Delete(aslashb);
Delete(acolonb);
Delete(adotb);
Delete(Directory.GetParent(aslashb.FullName));
var index2 = new GitIndex(db);
Assert.AreEqual(0, index2.Members.Length);
index2.ReadTree(db.MapTree(ObjectId.FromString("c696abc3ab8e091c665f49d00eb8919690b3aec3")));
index2.checkout(trash);
Assert.AreEqual("data:a/b", Content(aslashb));
Assert.AreEqual("data:a:b", Content(acolonb));
Assert.AreEqual("data:a.b", Content(adotb));
if (CanRunGitStatus)
{
Assert.AreEqual(0, System(trash, "git status"));
}
}