manifest: support optional --manifest-name

Still use the repo manifest by default as before, but gives us
the option of overriding it to support e.g.: using a subset of
the full manifest.

Change-Id: Ia42cd1cb3a0a58929d31bb01c9724e9d31f68730
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256372
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Sean McAllister <smcallis@google.com>
This commit is contained in:
Sean McAllister 2020-02-20 13:49:01 -07:00
parent dcbfadf814
commit d38300c756

View File

@ -25,7 +25,7 @@ class Manifest(PagedCommand):
common = False common = False
helpSummary = "Manifest inspection utility" helpSummary = "Manifest inspection utility"
helpUsage = """ helpUsage = """
%prog [-o {-|NAME.xml} [-r]] %prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]
""" """
_helpDescription = """ _helpDescription = """
@ -50,6 +50,8 @@ in a Git repository for use during future 'repo init' invocations.
p.add_option('-r', '--revision-as-HEAD', p.add_option('-r', '--revision-as-HEAD',
dest='peg_rev', action='store_true', dest='peg_rev', action='store_true',
help='Save revisions as current HEAD') help='Save revisions as current HEAD')
p.add_option('-m', '--manifest-name',
help='temporary manifest to use for this sync', metavar='NAME.xml')
p.add_option('--suppress-upstream-revision', dest='peg_rev_upstream', p.add_option('--suppress-upstream-revision', dest='peg_rev_upstream',
default=True, action='store_false', default=True, action='store_false',
help='If in -r mode, do not write the upstream field. ' help='If in -r mode, do not write the upstream field. '
@ -62,6 +64,10 @@ in a Git repository for use during future 'repo init' invocations.
metavar='-|NAME.xml') metavar='-|NAME.xml')
def _Output(self, opt): def _Output(self, opt):
# If alternate manifest is specified, override the manifest file that we're using.
if opt.manifest_name:
self.manifest.Override(opt.manifest_name, False)
if opt.output_file == '-': if opt.output_file == '-':
fd = sys.stdout fd = sys.stdout
else: else: