add --superproject-rev for repo status
If the option is given, repo status prints the superproject revision Change-Id: I5d1c709518d76d777a7f07c4c774569773c5a265 Bug: 416589884
This commit is contained in:
parent
8d37f61471
commit
b8d8cf98d4
3 changed files with 39 additions and 1 deletions
|
@ -129,6 +129,30 @@ 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:
|
||||||
|
data = p.stdout
|
||||||
|
else:
|
||||||
|
self._LogWarning(
|
||||||
|
"git rev-parse call failed, command: git {}, "
|
||||||
|
"return code: {}, stderr: {}",
|
||||||
|
cmd,
|
||||||
|
p.stdwerr,
|
||||||
|
)
|
||||||
|
return data
|
||||||
|
|
||||||
@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."""
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
|
||||||
.TH REPO "1" "July 2022" "repo status" "Repo Manual"
|
.TH REPO "1" "May 2025" "repo status" "Repo Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
repo \- repo status - manual page for repo status
|
repo \- repo status - manual page for repo status
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -21,6 +21,9 @@ number of CPU cores)
|
||||||
\fB\-o\fR, \fB\-\-orphans\fR
|
\fB\-o\fR, \fB\-\-orphans\fR
|
||||||
include objects in working directory outside of repo
|
include objects in working directory outside of repo
|
||||||
projects
|
projects
|
||||||
|
.TP
|
||||||
|
\fB\-\-superproject\-rev\fR
|
||||||
|
print the superproject reivsion
|
||||||
.SS Logging options:
|
.SS Logging options:
|
||||||
.TP
|
.TP
|
||||||
\fB\-v\fR, \fB\-\-verbose\fR
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
|
|
@ -87,6 +87,11 @@ the following meanings:
|
||||||
help="include objects in working directory outside of repo "
|
help="include objects in working directory outside of repo "
|
||||||
"projects",
|
"projects",
|
||||||
)
|
)
|
||||||
|
p.add_option(
|
||||||
|
"--superproject-rev",
|
||||||
|
action="store_true",
|
||||||
|
help="print the superproject reivsion",
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _StatusHelper(cls, quiet, local, project_idx):
|
def _StatusHelper(cls, quiet, local, project_idx):
|
||||||
|
@ -132,6 +137,12 @@ the following meanings:
|
||||||
outstring.append("".join([status_header, item, "/"]))
|
outstring.append("".join([status_header, item, "/"]))
|
||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
|
if opt.superproject_rev:
|
||||||
|
sp = self.manifest.superproject
|
||||||
|
srev = sp.commit_id if sp else "None"
|
||||||
|
print("Superproject Revision:", srev)
|
||||||
|
return
|
||||||
|
|
||||||
all_projects = self.GetProjects(
|
all_projects = self.GetProjects(
|
||||||
args, all_manifests=not opt.this_manifest_only
|
args, all_manifests=not opt.this_manifest_only
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue