From cf7c0834cfc24c5c9584695c657c6baf97d0fbb3 Mon Sep 17 00:00:00 2001 From: Akshay Verma Date: Thu, 15 Mar 2018 21:56:30 +0530 Subject: Download latest patch when no patch is specified When someone does "repo download -c " without specifying a patch number, by default patch 1 is downloaded. An alternative is to look for the latest patch and download the same when no explicit patch is given. This commit does the same by identifying the latest patch using "git ls-remote". Change-Id: Ia5fa7364415f53a3d9436df4643e38f3c90ded58 --- project.py | 10 ++++++++++ 1 file changed, 10 insertions(+) mode change 100644 => 100755 project.py (limited to 'project.py') diff --git a/project.py b/project.py old mode 100644 new mode 100755 index e4682e6a..5297a5cb --- a/project.py +++ b/project.py @@ -2270,6 +2270,16 @@ class Project(object): if self._allrefs: raise GitError('%s cherry-pick %s ' % (self.name, rev)) + def _LsRemote(self): + cmd = ['ls-remote'] + p = GitCommand(self, cmd, capture_stdout=True) + if p.Wait() == 0: + if hasattr(p.stdout, 'decode'): + return p.stdout.decode('utf-8') + else: + return p.stdout + return None + def _Revert(self, rev): cmd = ['revert'] cmd.append('--no-edit') -- cgit v1.2.3-54-g00ecf