Pass refs to ls-remote
This will fix the issue of parsing large output locally
Change-Id: I9a5cf1238147a02c92a3fca53eab9bd57f9d16b4
diff --git a/project.py b/project.py
index 5297a5c..855bd60 100755
--- a/project.py
+++ b/project.py
@@ -2270,8 +2270,8 @@
if self._allrefs:
raise GitError('%s cherry-pick %s ' % (self.name, rev))
- def _LsRemote(self):
- cmd = ['ls-remote']
+ def _LsRemote(self, refs):
+ cmd = ['ls-remote', self.remote.name, refs]
p = GitCommand(self, cmd, capture_stdout=True)
if p.Wait() == 0:
if hasattr(p.stdout, 'decode'):
diff --git a/subcmds/download.py b/subcmds/download.py
index 384af78..dba70ff 100755
--- a/subcmds/download.py
+++ b/subcmds/download.py
@@ -62,9 +62,10 @@
ps_id = int(m.group(2))
else:
ps_id = 1
- regex = r'refs/changes/%2.2d/%d/(\d+)' % (chg_id % 100, chg_id)
- output = project._LsRemote()
+ refs = 'refs/changes/%2.2d/%d/' % (chg_id % 100, chg_id)
+ output = project._LsRemote(refs + '*')
if output:
+ regex = refs + r'(\d+)'
rcomp = re.compile(regex, re.I)
for line in output.splitlines():
match = rcomp.search(line)