Exemplo n.º 1
0
        public static Commit Create(string message, Commit parent, Tree tree, Author author, Author committer, DateTimeOffset time)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("message must not be null or empty");
            }
            if (tree == null)
            {
                throw new ArgumentException("tree must not be null");
            }
            var repo       = tree.Repository;
            var corecommit = new CoreCommit(repo._internal_repo);

            if (parent != null)
            {
                corecommit.ParentIds = new GitSharp.Core.ObjectId[] { parent._id }
            }
            ;
            corecommit.Author    = new GitSharp.Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
            corecommit.Committer = new GitSharp.Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
            corecommit.Message   = message;
            corecommit.TreeEntry = tree.InternalTree;
            corecommit.Encoding  = ExtractOverridenEncodingCommitFromConfig(repo);
            corecommit.Save();
            return(new Commit(repo, corecommit));
        }
Exemplo n.º 2
0
 internal Commit(Repository repo, CoreCommit internal_commit)
     : base(repo, internal_commit.CommitId)
 {
     _internal_commit = internal_commit;
 }
Exemplo n.º 3
0
 internal Commit(Repository repo, CoreCommit internal_commit)
     : base(repo, internal_commit.CommitId)
 {
     _internal_commit = internal_commit;
 }
Exemplo n.º 4
0
 public static Commit Create(string message, Commit parent, Tree tree, Author author, Author committer, DateTimeOffset time)
 {
     if (string.IsNullOrEmpty(message))
         throw new ArgumentException("message must not be null or empty");
     if (tree == null)
         throw new ArgumentException("tree must not be null");
     var repo = tree.Repository;
     var corecommit = new CoreCommit(repo._internal_repo);
     if (parent != null)
         corecommit.ParentIds = new GitSharp.Core.ObjectId[] { parent._id };
     corecommit.Author = new GitSharp.Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
     corecommit.Committer = new GitSharp.Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
     corecommit.Message = message;
     corecommit.TreeEntry = tree.InternalTree;
     corecommit.Encoding = ExtractOverridenEncodingCommitFromConfig(repo);
     corecommit.Save();
     return new Commit(repo, corecommit);
 }