Pass refs to ls-remote

This will fix the issue of parsing large output locally

Change-Id: I9a5cf1238147a02c92a3fca53eab9bd57f9d16b4
This commit is contained in:
Akshay Verma 2018-03-24 12:27:05 +05:30
parent cf7c0834cf
commit 0f2e45a3a6
2 changed files with 5 additions and 4 deletions

View File

@ -2270,8 +2270,8 @@ class Project(object):
if self._allrefs: if self._allrefs:
raise GitError('%s cherry-pick %s ' % (self.name, rev)) raise GitError('%s cherry-pick %s ' % (self.name, rev))
def _LsRemote(self): def _LsRemote(self, refs):
cmd = ['ls-remote'] cmd = ['ls-remote', self.remote.name, refs]
p = GitCommand(self, cmd, capture_stdout=True) p = GitCommand(self, cmd, capture_stdout=True)
if p.Wait() == 0: if p.Wait() == 0:
if hasattr(p.stdout, 'decode'): if hasattr(p.stdout, 'decode'):

View File

@ -62,9 +62,10 @@ If no project is specified try to use current directory as a project.
ps_id = int(m.group(2)) ps_id = int(m.group(2))
else: else:
ps_id = 1 ps_id = 1
regex = r'refs/changes/%2.2d/%d/(\d+)' % (chg_id % 100, chg_id) refs = 'refs/changes/%2.2d/%d/' % (chg_id % 100, chg_id)
output = project._LsRemote() output = project._LsRemote(refs + '*')
if output: if output:
regex = refs + r'(\d+)'
rcomp = re.compile(regex, re.I) rcomp = re.compile(regex, re.I)
for line in output.splitlines(): for line in output.splitlines():
match = rcomp.search(line) match = rcomp.search(line)