GitRepository.fetch: Add 'all_remotes' option
authorLingchaox Xin <lingchaox.xin@intel.com>
Wed, 7 Aug 2013 07:25:21 +0000 (15:25 +0800)
committerGuido Günther <agx@sigxcpu.org>
Wed, 4 Sep 2013 20:35:23 +0000 (22:35 +0200)
Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py
tests/test_GitRepository.py

index ea5deb0..41e6471 100644 (file)
@@ -1013,7 +1013,8 @@ class GitRepository(object):
         args = GitArgs('rm', name)
         self._git_command("remote", args.args)
 
-    def fetch(self, repo=None, tags=False, depth=0, refspec=None):
+    def fetch(self, repo=None, tags=False, depth=0, refspec=None,
+              all_remotes=False):
         """
         Download objects and refs from another repository.
 
@@ -1025,12 +1026,17 @@ class GitRepository(object):
         @type depth: C{int}
         @param refspec: refspec to use instead of the default from git config
         @type refspec: C{str}
+        @param all_remotes: fetch all remotes
+        @type all_remotes: C{bool}
         """
         args = GitArgs('--quiet')
         args.add_true(tags, '--tags')
         args.add_cond(depth, '--depth=%s' % depth)
-        args.add_cond(repo, repo)
-        args.add_cond(refspec, refspec)
+        if all_remotes:
+            args.add_true(all_remotes, '--all')
+        else:
+            args.add_cond(repo, repo)
+            args.add_cond(refspec, refspec)
 
         self._git_command("fetch", args.args)
 
index 2ee550e..699ecd4 100644 (file)
@@ -601,6 +601,7 @@ def test_fetch():
     >>> clone.fetch('foo')
     >>> clone.fetch('foo', tags=True)
     >>> clone.fetch('foo', refspec='refs/heads/master')
+    >>> clone.fetch(all_remotes=True)
     >>> clone.remove_remote_repo('foo')
     """