From 237d47b9d714fcc2eaedff68c6c0870ef3e0041a Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Thu, 3 Jul 2014 18:46:45 +1200 Subject: 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. --- git/remote.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git/remote.py') 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): -- cgit v1.2.1