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>
diff --git a/subcmds/manifest.py b/subcmds/manifest.py
index 072c9ff..d9f242e 100644
--- a/subcmds/manifest.py
+++ b/subcmds/manifest.py
@@ -25,7 +25,7 @@
common = False
helpSummary = "Manifest inspection utility"
helpUsage = """
-%prog [-o {-|NAME.xml} [-r]]
+%prog [-o {-|NAME.xml}] [-m MANIFEST.xml] [-r]
"""
_helpDescription = """
@@ -50,6 +50,8 @@
p.add_option('-r', '--revision-as-HEAD',
dest='peg_rev', action='store_true',
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',
default=True, action='store_false',
help='If in -r mode, do not write the upstream field. '
@@ -62,6 +64,10 @@
metavar='-|NAME.xml')
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 == '-':
fd = sys.stdout
else: