summaryrefslogtreecommitdiff
path: root/gbp/git.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-22 13:54:16 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-23 16:18:53 +0200
commit83fd2c679fb4eb0aad0a05f95968603d04b3fab6 (patch)
tree15ebe72e6450d9d84c6716052b61d45c6fd3d047 /gbp/git.py
parenta65c430b9414e166d9b6d9731fab636f710565b5 (diff)
GitRepository: add commit and commit_all
to commit the current state of the index and all changes.
Diffstat (limited to 'gbp/git.py')
-rw-r--r--gbp/git.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 610a419..aba2dce 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -716,6 +716,34 @@ class GitRepository(object):
self._git_command("rm", args + paths)
+ def _commit(self, msg, args=[], author_info=None):
+ extra_env = author_info.get_author_env() if author_info else None
+ self._git_command("commit", args + ['-q', '-m', msg], extra_env=extra_env)
+
+
+ def commit(self, msg, author_info=None):
+ """
+ Commit currently staged files to the repository
+
+ @param msg: commit message
+ @type msg: string
+ @param author_info: authorship information
+ @type author_info: L{GitModifier}
+ """
+ self._commit(msg=msg, author_info=author_info)
+
+
+ def commit_all(self, msg, author_info=None):
+ """
+ Commit all changes to the repository
+ @param msg: commit message
+ @type msg: string
+ @param author_info: authorship information
+ @type author_info: L{GitModifier}
+ """
+ self._commit(msg=msg, args=['-a'], author_info=author_info)
+
+
def format_patches(self, start, end, output_dir):
"""
Output the commits between start and end as patches in output_dir