本文整理汇总了C#中Tree.AddEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.AddEntry方法的具体用法?C# Tree.AddEntry怎么用?C# Tree.AddEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.AddEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test024_createCommitNonAscii
public void test024_createCommitNonAscii()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
var almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Constants.encodeASCII("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
var commit = new Commit(db)
{
TreeId = almostEmptyTreeId,
Author = new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295L, 60),
Committer = new PersonIdent("Joe Hacker", "[email protected]", 4294967295L, 60),
Encoding = Encoding.GetEncoding("ISO-8859-1"),
Message = "\u00dcbergeeks"
};
ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
var s = new Inspector(db).Inspect(cid);
Assert.AreEqual("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.ToString());
}
示例2: test023_createCommitNonAnullii
public void test023_createCommitNonAnullii()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
var almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Constants.encodeASCII("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
var commit = new Commit(db)
{
TreeId = almostEmptyTreeId,
Author = new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295L, 60),
Committer = new PersonIdent("Joe Hacker", "[email protected]", 4294967295L, 60),
Encoding = Constants.CHARSET,
Message = "\u00dcbergeeks"
};
ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
Assert.AreEqual("4680908112778718f37e686cbebcc912730b3154", cid.ToString());
}
示例3: test022_createCommitTag
public void test022_createCommitTag()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
var almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Constants.encodeASCII("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
var almostEmptyCommit = new Commit(db)
{
Author = new PersonIdent(jauthor, 1154236443L, -2*60),
Committer = new PersonIdent(jauthor, 1154236443L, -2*60),
Message = "test022\n",
TreeId = almostEmptyTreeId
};
ObjectId almostEmptyCommitId = new ObjectWriter(db).WriteCommit(almostEmptyCommit);
var t = new Tag(db)
{
Id = almostEmptyCommitId,
TagType = "commit",
TagName = "test022",
Author = new PersonIdent(jauthor, 1154236443L, -4*60),
Message = "test022 tagged\n"
};
t.Save();
Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.TagId.ToString());
Tag mapTag = db.MapTag("test022");
Assert.AreEqual("commit", mapTag.TagType);
Assert.AreEqual("test022 tagged\n", mapTag.Message);
Assert.AreEqual(new PersonIdent(jauthor, 1154236443L, -4 * 60), mapTag.Author);
Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.Id.ToString());
}
示例4: test021_createTreeTag
public void test021_createTreeTag()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
var almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Encoding.ASCII.GetBytes("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
var t = new Tag(db)
{
Id = almostEmptyTreeId,
TagType = "tree",
TagName = "test021",
Author = new PersonIdent(jauthor, 1154236443L, -4*60),
Message = "test021 tagged\n"
};
t.Save();
Assert.AreEqual("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.TagId.ToString());
Tag MapTag = db.MapTag("test021");
Assert.AreEqual("tree", MapTag.TagType);
Assert.AreEqual("test021 tagged\n", MapTag.Message);
Assert.AreEqual(new PersonIdent(jauthor, 1154236443L, -4 * 60), MapTag.Author);
Assert.AreEqual("417c01c8795a35b8e835113a85a5c0c1c77f67fb", MapTag.Id.ToString());
}
示例5: test023_createCommitNonAnullii
public void test023_createCommitNonAnullii()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
Tree almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Encoding.ASCII.GetBytes("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
Commit commit = new Commit(db);
commit.TreeId = (almostEmptyTreeId);
commit.Author = (new PersonIdent("Joe H\u00e4cker", "[email protected]", 4294967295L, 60));
commit.Committer = (new PersonIdent("Joe Hacker", "[email protected]", 4294967295L, 60));
commit.setEncoding("UTF-8");
commit.Message = ("\u00dcbergeeks");
ObjectId cid = new ObjectWriter(db).WriteCommit(commit);
Assert.AreEqual("4680908112778718f37e686cbebcc912730b3154", cid.ToString());
}
示例6: test022_createCommitTag
public void test022_createCommitTag()
{
ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
Tree almostEmptyTree = new Tree(db);
almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Encoding.ASCII.GetBytes("empty"), false));
ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);
Commit almostEmptyCommit = new Commit(db);
almostEmptyCommit.Author = (new PersonIdent(jauthor, 1154236443L, -2 * 60)); // not exactly the same
almostEmptyCommit.Committer = (new PersonIdent(jauthor, 1154236443L, -2 * 60));
almostEmptyCommit.Message = ("test022\n");
almostEmptyCommit.TreeId = (almostEmptyTreeId);
ObjectId almostEmptyCommitId = new ObjectWriter(db).WriteCommit(almostEmptyCommit);
Tag t = new Tag(db);
t.Id = (almostEmptyCommitId);
t.TagType = ("commit");
t.TagName = ("test022");
t.Author = (new PersonIdent(jauthor, 1154236443L, -4 * 60));
t.Message = ("test022 tagged\n");
t.Save();
Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.TagId.ToString());
Tag MapTag = db.MapTag("test022");
Assert.AreEqual("commit", MapTag.TagType);
Assert.AreEqual("test022 tagged\n", MapTag.Message);
Assert.AreEqual(new PersonIdent(jauthor, 1154236443L, -4 * 60), MapTag.Author);
Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", MapTag.Id.ToString());
}