summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-25 20:55:06 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-26 10:00:54 +0200
commiteb093a782e25ab1c3d12edf1871647a3db08eb20 (patch)
tree18402c1dfb344868cf60aa56ecd0aee904db62fc
parent15c5abf132004d3cf8c2f8ea732c3f851c3967e6 (diff)
GitRepository: Add commit_files()
to directly commit a list of files.
-rw-r--r--gbp/git.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/gbp/git.py b/gbp/git.py
index d1c59cc..f191b10 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -856,10 +856,10 @@ class GitRepository(object):
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)
+ self._git_command("commit", ['-q', '-m', msg] + args, extra_env=extra_env)
- def commit(self, msg, author_info=None):
+ def commit_staged(self, msg, author_info=None):
"""
Commit currently staged files to the repository
@@ -870,7 +870,6 @@ class GitRepository(object):
"""
self._commit(msg=msg, author_info=author_info)
-
def commit_all(self, msg, author_info=None):
"""
Commit all changes to the repository
@@ -881,6 +880,20 @@ class GitRepository(object):
"""
self._commit(msg=msg, args=['-a'], author_info=author_info)
+ def commit_files(self, files, msg, author_info=None):
+ """
+ Commit the given files to the repository
+
+ @param files: file or files to commit
+ @type files: string or list
+ @param msg: commit message
+ @type msg: string
+ @param author_info: authorship information
+ @type author_info: L{GitModifier}
+ """
+ if type(files) in [type(''), type(u'')]:
+ files = [ files ]
+ self._commit(msg=msg, args=files, author_info=author_info)
def format_patches(self, start, end, output_dir):
"""