Save() public method

public Save ( ) : void
return void
Example #1
0
        public void test022_createCommitTag()
        {
            ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
            var almostEmptyTree = new Tree(db);
            almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false));
            ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);

            var almostEmptyCommit = new Commit(db)
                                        {
                                            Author = new PersonIdent(jauthor, 1154236443000L, -2*60),
                                            Committer = new PersonIdent(jauthor, 1154236443000L, -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, 1154236443000L, -4*60),
                            Message = "test022 tagged\n"
                        };

            t.Save();
            Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.TagId.Name);

            Tag mapTag = db.MapTag("test022");
            Assert.AreEqual("commit", mapTag.TagType);
            Assert.AreEqual("test022 tagged\n", mapTag.Message);
            Assert.AreEqual(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.Author);
            Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.Id.Name);
        }
Example #2
0
        public void test020_createBlobTag()
        {
            ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
            var t = new Tag(db)
                        {
                            Id = emptyId,
                            TagType = "blob",
                            TagName = "test020",
                            Author = new PersonIdent(jauthor, 1154236443000L, -4*60),
                            Message = "test020 tagged\n"
                        };
            t.Save();
            Assert.AreEqual("6759556b09fbb4fd8ae5e315134481cc25d46954", t.TagId.Name);

            Tag MapTag = db.MapTag("test020");
            Assert.AreEqual("blob", MapTag.TagType);
            Assert.AreEqual("test020 tagged\n", MapTag.Message);
            Assert.AreEqual(new PersonIdent(jauthor, 1154236443000L, -4 * 60), MapTag.Author);
            Assert.AreEqual("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", MapTag.Id.Name);
        }
Example #3
0
        public void test021_createTreeTag()
        {
            ObjectId emptyId = new ObjectWriter(db).WriteBlob(new byte[0]);
            var almostEmptyTree = new Tree(db);
            almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false));
            ObjectId almostEmptyTreeId = new ObjectWriter(db).WriteTree(almostEmptyTree);

            var t = new Tag(db)
                        {
                            Id = almostEmptyTreeId,
                            TagType = "tree",
                            TagName = "test021",
                            Author = new PersonIdent(jauthor, 1154236443000L, -4*60),
                            Message = "test021 tagged\n"
                        };

            t.Save();
            Assert.AreEqual("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.TagId.Name);

            Tag MapTag = db.MapTag("test021");
            Assert.AreEqual("tree", MapTag.TagType);
            Assert.AreEqual("test021 tagged\n", MapTag.Message);
            Assert.AreEqual(new PersonIdent(jauthor, 1154236443000L, -4 * 60), MapTag.Author);
            Assert.AreEqual("417c01c8795a35b8e835113a85a5c0c1c77f67fb", MapTag.Id.Name);
        }
Example #4
0
        public void test020b_createBlobPlainTag()
        {
            test020_createBlobTag();
            var t = new Tag(db)
                        {
                            TagName = "test020b",
                            Id = ObjectId.FromString("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")
                        };
            t.Save();

            Tag MapTag = db.MapTag("test020b");
            Assert.AreEqual("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", MapTag.Id.Name);

            // We do not repeat the plain tag test for other object types
        }