##// END OF EJS Templates
git: speed up extraction of git children call...
super-admin -
r1071:f2aec1d6 python3
parent child Browse files
Show More
@@ -944,17 +944,22 b' class GitRemote(RemoteBase):'
944 cache_on, context_uid, repo_id = self._cache_on(wire)
944 cache_on, context_uid, repo_id = self._cache_on(wire)
945 region = self._region(wire)
945 region = self._region(wire)
946
946
947 head = self.head(wire)
948
947 @region.conditional_cache_on_arguments(condition=cache_on)
949 @region.conditional_cache_on_arguments(condition=cache_on)
948 def _children(_repo_id, _commit_id):
950 def _children(_repo_id, _commit_id):
951
949 output, __ = self.run_git_command(
952 output, __ = self.run_git_command(
950 wire, ['rev-list', '--all', '--children'])
953 wire, ['rev-list', '--all', '--children', f'{commit_id}^..{head}'])
951
954
952 child_ids = []
955 child_ids = []
953 pat = re.compile(r'^%s' % commit_id)
956 pat = re.compile(r'^{}'.format(commit_id))
954 for l in output.splitlines():
957 for line in output.splitlines():
955 if pat.match(l):
958 line = safe_str(line)
956 found_ids = l.split(' ')[1:]
959 if pat.match(line):
960 found_ids = line.split(' ')[1:]
957 child_ids.extend(found_ids)
961 child_ids.extend(found_ids)
962 break
958
963
959 return child_ids
964 return child_ids
960 return _children(repo_id, commit_id)
965 return _children(repo_id, commit_id)
General Comments 0
You need to be logged in to leave comments. Login now