From 9d0473c1d1e6cadd986102712fff9196fff96212 Mon Sep 17 00:00:00 2001 From: firm1 Date: Mon, 24 Mar 2014 14:49:33 +0100 Subject: update commit function --- git/index/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git') diff --git a/git/index/base.py b/git/index/base.py index 3bd8634c..0c1b68d9 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -873,7 +873,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): return out - def commit(self, message, parent_commits=None, head=True): + def def commit(self, message, parent_commits=None, head=True, author=None, committer=None): """Commit the current default index file, creating a commit object. For more information on the arguments, see tree.commit. @@ -884,7 +884,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): :return: Commit object representing the new commit""" tree = self.write_tree() - return Commit.create_from_tree(self.repo, tree, message, parent_commits, head) + return Commit.create_from_tree(self.repo, tree, message, parent_commits, head, author=author, committer=committer) @classmethod def _flush_stdin_and_wait(cls, proc, ignore_stdout = False): -- cgit v1.2.1 From 5d602f267c32e1e917599d9bcdcfec4eef05d477 Mon Sep 17 00:00:00 2001 From: firm1 Date: Mon, 24 Mar 2014 14:52:44 +0100 Subject: add param to create_from_tree --- git/objects/commit.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'git') diff --git a/git/objects/commit.py b/git/objects/commit.py index cbfd5097..f1c2a23d 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -254,7 +254,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): @classmethod - def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False): + def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False, author=None, committer=None): """Commit the given tree, creating a commit object. :param repo: Repo object the commit should be part of @@ -299,8 +299,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): cr = repo.config_reader() env = os.environ - committer = Actor.committer(cr) - author = Actor.author(cr) + if author is None and committer is None: + committer = Actor.committer(cr) + author = Actor.author(cr) + elif author is None: + author = Actor.author(cr) + elif committer is None: + committer = Actor.committer(cr) # PARSE THE DATES unix_time = int(time()) -- cgit v1.2.1 From 28fdf05b1d7827744b7b70eeb1cc66d3afd38c82 Mon Sep 17 00:00:00 2001 From: firm1 Date: Mon, 24 Mar 2014 14:54:23 +0100 Subject: correct log reference --- git/refs/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git') diff --git a/git/refs/log.py b/git/refs/log.py index 9a719ec0..560ffd3e 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -247,7 +247,7 @@ class RefLog(list, Serializable): raise ValueError("Shas need to be given in binary format") #END handle sha type assure_directory_exists(filepath, is_file=True) - entry = RefLogEntry((bin_to_hex(oldbinsha), bin_to_hex(newbinsha), Actor.committer(config_reader), (int(time.time()), time.altzone), message)) + entry = RefLogEntry((bin_to_hex(oldbinsha), bin_to_hex(newbinsha), config_reader, (int(time.time()), time.altzone), message)) lf = LockFile(filepath) lf._obtain_lock_or_raise() -- cgit v1.2.1 From 4a7e7a769087b1790a18d6645740b5b670f5086b Mon Sep 17 00:00:00 2001 From: firm1 Date: Mon, 24 Mar 2014 14:56:02 +0100 Subject: Update symbolic.py --- git/refs/symbolic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git') diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index ef21950f..5374285e 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -355,7 +355,7 @@ class SymbolicReference(object): :param newbinsha: The sha the ref points to now. If None, our current commit sha will be used :return: added RefLogEntry instance""" - return RefLog.append_entry(self.repo.config_reader(), RefLog.path(self), oldbinsha, + return RefLog.append_entry(self.commit.committer, RefLog.path(self), oldbinsha, (newbinsha is None and self.commit.binsha) or newbinsha, message) -- cgit v1.2.1 From 3a1e0d7117b9e4ea4be3ef4895e8b2b4937ff98a Mon Sep 17 00:00:00 2001 From: firm1 Date: Wed, 9 Apr 2014 16:03:21 +0200 Subject: fix syntax error --- git/index/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git') diff --git a/git/index/base.py b/git/index/base.py index 0c1b68d9..160d21bf 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -873,7 +873,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): return out - def def commit(self, message, parent_commits=None, head=True, author=None, committer=None): + def commit(self, message, parent_commits=None, head=True, author=None, committer=None): """Commit the current default index file, creating a commit object. For more information on the arguments, see tree.commit. -- cgit v1.2.1