public static Commit Create(string message, IEnumerable<Commit> parents, 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 Core.Commit(repo._internal_repo); if (parents != null) corecommit.ParentIds = parents.Select(parent => parent._id).ToArray(); corecommit.Author = new Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes); corecommit.Committer = new Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes); corecommit.Message = message; corecommit.TreeEntry = tree.InternalTree; corecommit.Encoding = GetCommitEncoding(repo); corecommit.Save(); return new Commit(repo, corecommit); }
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)); }
/// <summary> /// Calculates the Unix time representation of a given DateTimeOffset. /// Unix time representation are the seconds since 1970.1.1 00:00:00 GMT. C# has a different representation: 100 nanosecs since 0001.1.1 12:00:00. /// </summary> /// <returns></returns> public static int ToUnixTime(this DateTimeOffset dateTimeOffset) { return((int)(dateTimeOffset.ToMillisecondsSinceEpoch() / 1000)); }
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); }
public static Commit Create(string message, IEnumerable <Commit> parents, 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 Core.Commit(repo._internal_repo); if (parents != null) { corecommit.ParentIds = parents.Select(parent => parent._id).ToArray(); } corecommit.Author = new Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes); corecommit.Committer = new Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes); corecommit.Message = message; corecommit.TreeEntry = tree.InternalTree; corecommit.Encoding = GetCommitEncoding(repo); corecommit.Save(); return(new Commit(repo, corecommit)); }