From eb093a782e25ab1c3d12edf1871647a3db08eb20 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 25 Oct 2011 20:55:06 +0200 Subject: GitRepository: Add commit_files() to directly commit a list of files. --- gbp/git.py | 19 ++++++++++++++++--- 1 file 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): """ -- cgit v1.2.3