##// END OF EJS Templates
git: use iterative fetch to prevent errors about too many arguments on very large repositories.
marcink -
r622:df15fe03 default
parent child Browse files
Show More
@@ -25,6 +25,7 b' import urllib'
25 import urllib2
25 import urllib2
26 from functools import wraps
26 from functools import wraps
27
27
28 import more_itertools
28 from dulwich import index, objects
29 from dulwich import index, objects
29 from dulwich.client import HttpGitClient, LocalGitClient
30 from dulwich.client import HttpGitClient, LocalGitClient
30 from dulwich.errors import (
31 from dulwich.errors import (
@@ -495,13 +496,16 b' class GitRemote(object):'
495 fetch_refs.append('{}:{}'.format(ref, ref))
496 fetch_refs.append('{}:{}'.format(ref, ref))
496 elif not refs:
497 elif not refs:
497 fetch_refs.append('{}:{}'.format(ref, ref))
498 fetch_refs.append('{}:{}'.format(ref, ref))
498
499 log.debug('Finished obtaining fetch refs, total: %s', len(fetch_refs))
499 if fetch_refs:
500 if fetch_refs:
500 _out, _err = self.run_git_command(
501 for chunk in more_itertools.chunked(fetch_refs, 1024 * 4):
501 wire, ['fetch', url, '--force', '--prune', '--'] + fetch_refs,
502 fetch_refs_chunks = list(chunk)
502 fail_on_stderr=False,
503 log.debug('Fetching %s refs from import url', len(fetch_refs_chunks))
503 _copts=self._remote_conf(config),
504 _out, _err = self.run_git_command(
504 extra_env={'GIT_TERMINAL_PROMPT': '0'})
505 wire, ['fetch', url, '--force', '--prune', '--'] + fetch_refs_chunks,
506 fail_on_stderr=False,
507 _copts=self._remote_conf(config),
508 extra_env={'GIT_TERMINAL_PROMPT': '0'})
505
509
506 return remote_refs
510 return remote_refs
507
511
General Comments 0
You need to be logged in to leave comments. Login now