protected void SetupContext() { _nicolai = new Author("Nicolai Meltveit", "*****@*****.**"); _repositoryUrl = "git://github.com/flyrev/Smeedee_dummy.git"; _localDirectory = "C:\\ennå_nyare\\"; _repo = new Repository(_localDirectory); }
public Commit CommitChanges(string message, Author author) { if (string.IsNullOrEmpty(message)) throw new ArgumentException("Commit message must not be null or empty!", "message"); if (string.IsNullOrEmpty(author.Name)) throw new ArgumentException("Author name must not be null or empty!", "author"); GitIndex.RereadIfNecessary(); var tree_id = GitIndex.writeTree(); // check if tree is different from current commit's tree var parent = _repo.CurrentBranch.CurrentCommit; if ((parent == null && GitIndex.Members.Count == 0) || (parent != null && parent.Tree._id == tree_id)) throw new InvalidOperationException("There are no changes to commit"); var commit = Commit.Create(message, parent, new Tree(_repo, tree_id), author); Ref.Update("HEAD", commit); return commit; }
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) { return Create(message, (parent == null ? new Commit[0] : new[] { parent }), tree, author, committer, time); }
public static Commit Create(string message, Commit parent, Tree tree, Author author) { return Create(message, parent, tree, author, author, DateTimeOffset.Now); }
/// <summary> /// Commit staged changes and update HEAD /// </summary> /// <param name="message">The commit message</param> /// <param name="author">The author of the content to be committed</param> /// <returns>Returns the newly created commit</returns> public Commit Commit(string message, Author author) { return Index.CommitChanges(message, author); }
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, Commit parent, Tree tree) { if (tree==null) throw new ArgumentException("tree must not be null"); var repo=tree.Repository; var author=new Author(repo.Config["user.name"], repo.Config["user.email"]); return Create(message, parent, tree, author, author, DateTimeOffset.Now); }
public HistoryProvider() { Author = new Author(Environment.UserName, "*****@*****.**"); }
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) { return(Create(message, (parent == null ? new Commit[0] : new[] { parent }), tree, author, committer, time)); }
public static Commit Create(string message, Commit parent, Tree tree, Author author) { return(Create(message, parent, tree, author, author, DateTimeOffset.Now)); }