protected void SetupContext()
 {
     _nicolai = new Author("Nicolai Meltveit", "*****@*****.**");
     _repositoryUrl = "git://github.com/flyrev/Smeedee_dummy.git";
     _localDirectory = "C:\\ennå_nyare\\";
     _repo = new Repository(_localDirectory);
 }
示例#2
0
 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;
 }
示例#3
0
		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);
		}
示例#4
0
		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);
		}
示例#5
0
		public static Commit Create(string message, Commit parent, Tree tree, Author author)
		{
			return Create(message, parent, tree, author, author, DateTimeOffset.Now);
		}
示例#6
0
 /// <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);
 }
示例#7
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);
 }
示例#8
0
 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, "*****@*****.**");
 }
示例#10
0
        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));
        }
示例#11
0
 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));
 }
示例#12
0
 public static Commit Create(string message, Commit parent, Tree tree, Author author)
 {
     return(Create(message, parent, tree, author, author, DateTimeOffset.Now));
 }