summaryrefslogtreecommitdiff
path: root/git/remote.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2014-07-03 18:46:45 +1200
committerRobert Collins <rbtcollins@hp.com>2014-07-03 18:46:45 +1200
commit237d47b9d714fcc2eaedff68c6c0870ef3e0041a (patch)
treeda1bc140cf349500fefa7497df7169dc98cba01d /git/remote.py
parent5ae512e69f37e37431239c8da6ffa48c75684f87 (diff)
downloadgitpython-237d47b9d714fcc2eaedff68c6c0870ef3e0041a.tar.gz
Support multiple refspecs in fetch.
Git supports fetching many refs at once - support this in GitPython too for more efficient operations when selectively mirroring repositories.
Diffstat (limited to 'git/remote.py')
-rw-r--r--git/remote.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/git/remote.py b/git/remote.py
index 37ddd91b..b06c0686 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -583,6 +583,10 @@ class Remote(LazyMixin, Iterable):
See also git-push(1).
Taken from the git manual
+
+ Fetch supports multiple refspecs (as the
+ underlying git-fetch does) - supplying a list rather than a string
+ for 'refspec' will make use of this facility.
:param progress: See 'push' method
:param kwargs: Additional arguments to be passed to git-fetch
:return:
@@ -593,7 +597,11 @@ class Remote(LazyMixin, Iterable):
As fetch does not provide progress information to non-ttys, we cannot make
it available here unfortunately as in the 'push' method."""
kwargs = add_progress(kwargs, self.repo.git, progress)
- proc = self.repo.git.fetch(self, refspec, with_extended_output=True, as_process=True, v=True, **kwargs)
+ if isinstance(refspec, list):
+ args = refspec
+ else:
+ args = [refspec]
+ proc = self.repo.git.fetch(self, *args, with_extended_output=True, as_process=True, v=True, **kwargs)
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
def pull(self, refspec=None, progress=None, **kwargs):