##// END OF EJS Templates
git: limit sync-fetch to tags/ and heads/ with default execution arguments
marcink -
r766:7807f9db default
parent child Browse files
Show More
@@ -584,14 +584,19 b' class GitRemote(RemoteBase):'
584 return remote_refs
584 return remote_refs
585
585
586 @reraise_safe_exceptions
586 @reraise_safe_exceptions
587 def sync_fetch(self, wire, url, refs=None):
587 def sync_fetch(self, wire, url, refs=None, all_refs=False):
588 repo = self._factory.repo(wire)
588 repo = self._factory.repo(wire)
589 if refs and not isinstance(refs, (list, tuple)):
589 if refs and not isinstance(refs, (list, tuple)):
590 refs = [refs]
590 refs = [refs]
591
591 config = self._wire_to_config(wire)
592 config = self._wire_to_config(wire)
592 # get all remote refs we'll use to fetch later
593 # get all remote refs we'll use to fetch later
594 cmd = ['ls-remote']
595 if not all_refs:
596 cmd += ['--heads', '--tags']
597 cmd += [url]
593 output, __ = self.run_git_command(
598 output, __ = self.run_git_command(
594 wire, ['ls-remote', url], fail_on_stderr=False,
599 wire, cmd, fail_on_stderr=False,
595 _copts=self._remote_conf(config),
600 _copts=self._remote_conf(config),
596 extra_env={'GIT_TERMINAL_PROMPT': '0'})
601 extra_env={'GIT_TERMINAL_PROMPT': '0'})
597
602
@@ -619,6 +624,7 b' class GitRemote(RemoteBase):'
619 elif not refs:
624 elif not refs:
620 fetch_refs.append('{}:{}'.format(ref, ref))
625 fetch_refs.append('{}:{}'.format(ref, ref))
621 log.debug('Finished obtaining fetch refs, total: %s', len(fetch_refs))
626 log.debug('Finished obtaining fetch refs, total: %s', len(fetch_refs))
627
622 if fetch_refs:
628 if fetch_refs:
623 for chunk in more_itertools.chunked(fetch_refs, 1024 * 4):
629 for chunk in more_itertools.chunked(fetch_refs, 1024 * 4):
624 fetch_refs_chunks = list(chunk)
630 fetch_refs_chunks = list(chunk)
General Comments 0
You need to be logged in to leave comments. Login now