예제 #1
0
        public virtual void Test022_createCommitTag()
        {
            ObjectId emptyId         = InsertEmptyBlob();
            Tree     almostEmptyTree = new Tree(db);

            almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString
                                                           ("empty"), false));
            ObjectId almostEmptyTreeId = InsertTree(almostEmptyTree);

            NGit.CommitBuilder almostEmptyCommit = new NGit.CommitBuilder();
            almostEmptyCommit.Author = new PersonIdent(author, 1154236443000L, -2 * 60);
            // not exactly the same
            almostEmptyCommit.Committer = new PersonIdent(author, 1154236443000L, -2 * 60);
            almostEmptyCommit.Message   = "test022\n";
            almostEmptyCommit.TreeId    = almostEmptyTreeId;
            ObjectId   almostEmptyCommitId = InsertCommit(almostEmptyCommit);
            TagBuilder t = new TagBuilder();

            t.SetObjectId(almostEmptyCommitId, Constants.OBJ_COMMIT);
            t.SetTag("test022");
            t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
            t.SetMessage("test022 tagged\n");
            ObjectId actid = InsertTag(t);

            NUnit.Framework.Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", actid
                                            .Name);
            RevTag mapTag = ParseTag(actid);

            NUnit.Framework.Assert.AreEqual(Constants.OBJ_COMMIT, mapTag.GetObject().Type);
            NUnit.Framework.Assert.AreEqual("test022 tagged\n", mapTag.GetFullMessage());
            NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60),
                                            mapTag.GetTaggerIdent());
            NUnit.Framework.Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag
                                            .GetObject().Id.Name);
        }
예제 #2
0
        public virtual void Test021_createTreeTag()
        {
            ObjectId emptyId         = InsertEmptyBlob();
            Tree     almostEmptyTree = new Tree(db);

            almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString
                                                           ("empty"), false));
            ObjectId   almostEmptyTreeId = InsertTree(almostEmptyTree);
            TagBuilder t = new TagBuilder();

            t.SetObjectId(almostEmptyTreeId, Constants.OBJ_TREE);
            t.SetTag("test021");
            t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
            t.SetMessage("test021 tagged\n");
            ObjectId actid = InsertTag(t);

            NUnit.Framework.Assert.AreEqual("b0517bc8dbe2096b419d42424cd7030733f4abe5", actid
                                            .Name);
            RevTag mapTag = ParseTag(actid);

            NUnit.Framework.Assert.AreEqual(Constants.OBJ_TREE, mapTag.GetObject().Type);
            NUnit.Framework.Assert.AreEqual("test021 tagged\n", mapTag.GetFullMessage());
            NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60),
                                            mapTag.GetTaggerIdent());
            NUnit.Framework.Assert.AreEqual("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag
                                            .GetObject().Id.Name);
        }
예제 #3
0
 internal virtual long Timeof(RevObject o)
 {
     if (o is RevCommit)
     {
         return(((RevCommit)o).CommitTime);
     }
     if (o is RevTag)
     {
         RevTag      tag = (RevTag)o;
         PersonIdent who = tag.GetTaggerIdent();
         return(who != null?who.GetWhen().GetTime() : 0);
     }
     return(0);
 }
예제 #4
0
 internal virtual long Timeof(RevObject o)
 {
     if (o is RevCommit)
     {
         return(((RevCommit)o).CommitTime);
     }
     if (o is RevTag)
     {
         RevTag tag = (RevTag)o;
         try
         {
             this._enclosing.ParseBody(tag);
         }
         catch (IOException)
         {
             return(0);
         }
         PersonIdent who = tag.GetTaggerIdent();
         return(who != null?who.GetWhen().GetTime() : 0);
     }
     return(0);
 }
예제 #5
0
        public virtual void Test020_createBlobTag()
        {
            ObjectId   emptyId = InsertEmptyBlob();
            TagBuilder t       = new TagBuilder();

            t.SetObjectId(emptyId, Constants.OBJ_BLOB);
            t.SetTag("test020");
            t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
            t.SetMessage("test020 tagged\n");
            ObjectId actid = InsertTag(t);

            NUnit.Framework.Assert.AreEqual("6759556b09fbb4fd8ae5e315134481cc25d46954", actid
                                            .Name);
            RevTag mapTag = ParseTag(actid);

            NUnit.Framework.Assert.AreEqual(Constants.OBJ_BLOB, mapTag.GetObject().Type);
            NUnit.Framework.Assert.AreEqual("test020 tagged\n", mapTag.GetFullMessage());
            NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60),
                                            mapTag.GetTaggerIdent());
            NUnit.Framework.Assert.AreEqual("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag
                                            .GetObject().Id.Name);
        }