public StringBuilder WriteTo(StringBuilder sb)
        {
            if (Parents != null && Parents.Length > 0)
            {
                // Sort parent CommitIDs in order:
                CommitID[] parents = new CommitID[Parents.Length];
                for (int i = 0; i < parents.Length; ++i)
                {
                    parents[i] = Parents[i];
                }
                Array.Sort(parents, new CommitID.Comparer());

                for (int i = 0; i < parents.Length; ++i)
                {
                    sb.AppendFormat("parent {0}\n", parents[i]);
                }
            }

            sb.AppendFormat("tree {0}\n", TreeID);
            sb.AppendFormat("committer {0}\n", Committer);

            // NOTE: date parsing will result in an inexact DateTimeOffset from what was created with, but it
            // is close enough because the SHA-1 hash is calculated using the DateTimeOffset.ToString(), so
            // only the ToString() representations of the DateTimeOffsets need to match.
            sb.AppendFormat("date {0}\n\n", DateCommitted.ToString());
            sb.AppendFormat(Message ?? String.Empty);

            return(sb);
        }
 public Builder(
     RefName pName
     , CommitID pCommitID
     )
 {
     this.Name     = pName;
     this.CommitID = pCommitID;
 }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            string strValue = value as string;

            if (strValue != null)
            {
                return(CommitID.TryParse(strValue).Value);
            }

            return(base.ConvertFrom(context, culture, value));
        }
 public Builder(
     TagName pName
     , CommitID pCommitID
     , string pTagger
     , DateTimeOffset pDateTagged
     , string pMessage
     )
 {
     this.Name       = pName;
     this.CommitID   = pCommitID;
     this.Tagger     = pTagger;
     this.DateTagged = pDateTagged;
     this.Message    = pMessage;
 }
 public Builder(
     CommitID pID
     , TreeID pTreeID
     , string pCommitter
     , DateTimeOffset pDateCommitted
     , string pMessage
     )
 {
     this.ID            = pID;
     this.TreeID        = pTreeID;
     this.Committer     = pCommitter;
     this.DateCommitted = pDateCommitted;
     this.Message       = pMessage;
 }
Example #6
0
        public StringBuilder WriteTo(StringBuilder sb)
        {
            sb.AppendFormat("commit {0}\n", CommitID.ToString());
            sb.AppendFormat("name {0}\n", Name.ToString());
            sb.AppendFormat("tagger {0}\n", Tagger);
            sb.AppendFormat("date {0}\n\n", DateTagged.ToString());

            if (!String.IsNullOrEmpty(Message))
            {
                sb.Append(Message);
            }

            return(sb);
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (typeof(string) == destinationType)
            {
                return(((CommitID)value).ToString());
            }
            else if (typeof(Errorable <CommitID>) == destinationType)
            {
                string strValue = value as string;
                if (strValue != null)
                {
                    return(CommitID.TryParse(strValue));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
 public Builder(Ref imm)
 {
     this.Name     = imm.Name;
     this.CommitID = imm.CommitID;
 }
 public Ref(Builder b)
 {
     this.Name     = b.Name;
     this.CommitID = b.CommitID;
 }
Example #10
0
 public CommitTree(CommitID rootID, ImmutableContainer <CommitID, ICommit> commits)
 {
     this.RootID  = rootID;
     this.Commits = commits;
 }