GitRepository.commit_files: add edit argument
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Wed, 5 Feb 2014 14:11:42 +0000 (16:11 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Mar 2015 08:07:45 +0000 (10:07 +0200)
In order to be able to spawn an editor, similarly to other commitX
methods in GitRepository.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py

index 343b6d0f7e19375a2d44e0337bbfd022c8da1efc..91c7dc258e7f0ecfce65db1237dd311069143d1c 100644 (file)
@@ -1468,7 +1468,8 @@ class GitRepository(object):
         """
         self._commit(msg=msg, args=['-a'], author_info=author_info, edit=edit)
 
-    def commit_files(self, files, msg, author_info=None, committer_info=None):
+    def commit_files(self, files, msg, author_info=None, committer_info=None,
+                     edit=False):
         """
         Commit the given files to the repository
 
@@ -1480,11 +1481,13 @@ class GitRepository(object):
         @type author_info: L{GitModifier}
         @param committer_info: committer information
         @type committer_info: L{GitModifier}
+        @param edit: whether to spawn an editor to edit the commit info
+        @type edit: C{bool}
         """
-        if isinstance(files, six.string_types):
-            files = [ files ]
-        self._commit(msg=msg, args=files, author_info=author_info,
-                     committer_info=committer_info)
+        args = GitArgs('--')
+        args.add(files)
+        self._commit(msg=msg, args=args.args, author_info=author_info,
+                     committer_info=committer_info, edit=edit)
 
     def create_tree(self, unpack_dir):
         """