mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-26 20:17:52 +00:00
info: print superproject revision
Bug: 416589884 Change-Id: I5d1c709518d76d777a7f07c4c774569773c5a265 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478205 Lint: Scott Lee <ddoman@google.com> Tested-by: Scott Lee <ddoman@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Scott Lee <ddoman@google.com>
This commit is contained in:
@ -129,6 +129,29 @@ class Superproject:
|
|||||||
"""Set the _print_messages attribute."""
|
"""Set the _print_messages attribute."""
|
||||||
self._print_messages = value
|
self._print_messages = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def commit_id(self):
|
||||||
|
"""Returns the commit ID of the superproject checkout."""
|
||||||
|
cmd = ["rev-parse", self.revision]
|
||||||
|
p = GitCommand(
|
||||||
|
None, # project
|
||||||
|
cmd,
|
||||||
|
gitdir=self._work_git,
|
||||||
|
bare=True,
|
||||||
|
capture_stdout=True,
|
||||||
|
capture_stderr=True,
|
||||||
|
)
|
||||||
|
retval = p.Wait()
|
||||||
|
if retval != 0:
|
||||||
|
self._LogWarning(
|
||||||
|
"git rev-parse call failed, command: git {}, "
|
||||||
|
"return code: {}, stderr: {}",
|
||||||
|
cmd,
|
||||||
|
p.stdwerr,
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
return p.stdout
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def project_commit_ids(self):
|
def project_commit_ids(self):
|
||||||
"""Returns a dictionary of projects and their commit ids."""
|
"""Returns a dictionary of projects and their commit ids."""
|
||||||
@ -276,7 +299,7 @@ class Superproject:
|
|||||||
Works only in git repositories.
|
Works only in git repositories.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
data: data returned from 'git ls-tree ...' instead of None.
|
data: data returned from 'git ls-tree ...'. None on error.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(self._work_git):
|
if not os.path.exists(self._work_git):
|
||||||
self._LogWarning(
|
self._LogWarning(
|
||||||
@ -306,6 +329,7 @@ class Superproject:
|
|||||||
retval,
|
retval,
|
||||||
p.stderr,
|
p.stderr,
|
||||||
)
|
)
|
||||||
|
return None
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def Sync(self, git_event_log):
|
def Sync(self, git_event_log):
|
||||||
|
@ -102,6 +102,10 @@ class Info(PagedCommand):
|
|||||||
self.heading("Manifest groups: ")
|
self.heading("Manifest groups: ")
|
||||||
self.headtext(manifestGroups)
|
self.headtext(manifestGroups)
|
||||||
self.out.nl()
|
self.out.nl()
|
||||||
|
sp = self.manifest.superproject
|
||||||
|
srev = sp.commit_id if sp and sp.commit_id else "None"
|
||||||
|
self.heading("Superproject revision: ")
|
||||||
|
self.headtext(srev)
|
||||||
|
|
||||||
self.printSeparator()
|
self.printSeparator()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user