Example #1
0
        /// <summary>Rename this entry.</summary>
        /// <remarks>Rename this entry.</remarks>
        /// <param name="n">The new name</param>
        /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
        public virtual void Rename(byte[] n)
        {
            Tree t = GetParent();

            if (t != null)
            {
                Delete();
            }
            nameUTF8 = n;
            if (t != null)
            {
                t.AddEntry(this);
            }
        }
Example #2
0
 public virtual void Test024_createCommitNonAscii()
 {
     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 commit = new NGit.CommitBuilder();
     commit.TreeId = almostEmptyTreeId;
     commit.Author = new PersonIdent("Joe H\u00e4cker", "*****@*****.**", 4294967295000L
         , 60);
     commit.Committer = new PersonIdent("Joe Hacker", "*****@*****.**", 4294967295000L
         , 60);
     commit.SetEncoding("ISO-8859-1");
     commit.Message = "\u00dcbergeeks";
     ObjectId cid = InsertCommit(commit);
     NUnit.Framework.Assert.AreEqual("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.Name
         );
 }
Example #3
0
 public virtual void Test023_createCommitNonAnullii()
 {
     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 commit = new NGit.CommitBuilder();
     commit.TreeId = almostEmptyTreeId;
     commit.Author = new PersonIdent("Joe H\u00e4cker", "*****@*****.**", 4294967295000L
         , 60);
     commit.Committer = new PersonIdent("Joe Hacker", "*****@*****.**", 4294967295000L
         , 60);
     commit.SetEncoding("UTF-8");
     commit.Message = "\u00dcbergeeks";
     ObjectId cid = InsertCommit(commit);
     NUnit.Framework.Assert.AreEqual("4680908112778718f37e686cbebcc912730b3154", cid.Name
         );
     RevCommit loadedCommit = ParseCommit(cid);
     NUnit.Framework.Assert.AreEqual(commit.Message, loadedCommit.GetFullMessage());
 }
Example #4
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);
 }
Example #5
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);
 }