public virtual void Test002_NewIdent()
		{
			PersonIdent p = new PersonIdent("A U Thor", "*****@*****.**", Sharpen.Extensions.CreateDate
				(1142878501000L), Sharpen.Extensions.GetTimeZone("GMT+0230"));
			NUnit.Framework.Assert.AreEqual("A U Thor", p.GetName());
			NUnit.Framework.Assert.AreEqual("*****@*****.**", p.GetEmailAddress());
			NUnit.Framework.Assert.AreEqual(1142878501000L, p.GetWhen().GetTime());
			NUnit.Framework.Assert.AreEqual("A U Thor <*****@*****.**> 1142878501 +0230", 
				p.ToExternalString());
		}
        public virtual void Test002_NewIdent()
        {
            PersonIdent p = new PersonIdent("A U Thor", "*****@*****.**", Sharpen.Extensions.CreateDate
                                                (1142878501000L), Sharpen.Extensions.GetTimeZone("GMT+0230"));

            NUnit.Framework.Assert.AreEqual("A U Thor", p.GetName());
            NUnit.Framework.Assert.AreEqual("*****@*****.**", p.GetEmailAddress());
            NUnit.Framework.Assert.AreEqual(1142878501000L, p.GetWhen().GetTime());
            NUnit.Framework.Assert.AreEqual("A U Thor <*****@*****.**> 1142878501 +0230",
                                            p.ToExternalString());
        }
        public virtual void Test001_NewIdent()
        {
            var timeZoneId = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
                                ? "Eastern Standard Time"
                                : "EST";
            PersonIdent p = new PersonIdent("A U Thor", "*****@*****.**", Sharpen.Extensions.CreateDate
                                                (1142878501000L), Sharpen.Extensions.GetTimeZone(timeZoneId));

            NUnit.Framework.Assert.AreEqual("A U Thor", p.GetName());
            NUnit.Framework.Assert.AreEqual("*****@*****.**", p.GetEmailAddress());
            NUnit.Framework.Assert.AreEqual(1142878501000L, p.GetWhen().GetTime());
            NUnit.Framework.Assert.AreEqual("A U Thor <*****@*****.**> 1142878501 -0500",
                                            p.ToExternalString());
        }
Beispiel #4
0
		private byte[] Encode(ObjectId oldId, ObjectId newId, PersonIdent ident, string message
			)
		{
			StringBuilder r = new StringBuilder();
			r.Append(ObjectId.ToString(oldId));
			r.Append(' ');
			r.Append(ObjectId.ToString(newId));
			r.Append(' ');
			r.Append(ident.ToExternalString());
			r.Append('\t');
			r.Append(message);
			r.Append('\n');
			return Constants.Encode(r.ToString());
		}
Beispiel #5
0
        //
        //
        //
        //
        //
        //
        /// <summary>Compute a Change-Id.</summary>
        /// <remarks>Compute a Change-Id.</remarks>
        /// <param name="treeId">The id of the tree that would be committed</param>
        /// <param name="firstParentId">parent id of previous commit or null</param>
        /// <param name="author">
        /// the
        /// <see cref="NGit.PersonIdent">NGit.PersonIdent</see>
        /// for the presumed author and time
        /// </param>
        /// <param name="committer">
        /// the
        /// <see cref="NGit.PersonIdent">NGit.PersonIdent</see>
        /// for the presumed committer and time
        /// </param>
        /// <param name="message">The commit message</param>
        /// <returns>
        /// the change id SHA1 string (without the 'I') or null if the
        /// message is not complete enough
        /// </returns>
        /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
        public static ObjectId ComputeChangeId(ObjectId treeId, ObjectId firstParentId, PersonIdent
			 author, PersonIdent committer, string message)
        {
            string cleanMessage = Clean(message);
            if (cleanMessage.Length == 0)
            {
                return null;
            }
            StringBuilder b = new StringBuilder();
            b.Append("tree ");
            b.Append(ObjectId.ToString(treeId));
            b.Append("\n");
            if (firstParentId != null)
            {
                b.Append("parent ");
                b.Append(ObjectId.ToString(firstParentId));
                b.Append("\n");
            }
            b.Append("author ");
            b.Append(author.ToExternalString());
            b.Append("\n");
            b.Append("committer ");
            b.Append(committer.ToExternalString());
            b.Append("\n\n");
            b.Append(cleanMessage);
            return new ObjectInserter.Formatter().IdFor(Constants.OBJ_COMMIT, Sharpen.Runtime.GetBytesForString
                (b.ToString(), Constants.CHARACTER_ENCODING));
        }