manifest: Only support -o option on XML formatted manifest

If the manifest isn't a single file format manifest, the -o option
makes no sense, as you cannot export multiple files to a single
stream for display or redirection.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2009-05-19 18:17:51 -07:00
parent 050e4fd591
commit 67f4563acb

View File

@ -17,6 +17,7 @@ import os
import sys
from command import PagedCommand
from manifest_xml import XmlManifest
def _doc(name):
r = os.path.dirname(__file__)
@ -31,7 +32,7 @@ class Manifest(PagedCommand):
common = False
helpSummary = "Manifest inspection utility"
helpUsage = """
%prog [-o {-|NAME.xml} [-r]]
%prog [options]
"""
_xmlHelp = """
@ -50,6 +51,7 @@ in a Git repository for use during future 'repo init' invocations.
return help
def _Options(self, p):
if isinstance(self.manifest, XmlManifest):
p.add_option('-r', '--revision-as-HEAD',
dest='peg_rev', action='store_true',
help='Save revisions as current HEAD')
@ -73,7 +75,8 @@ in a Git repository for use during future 'repo init' invocations.
if args:
self.Usage()
if opt.output_file is not None:
if isinstance(self.manifest, XmlManifest) \
and opt.output_file is not None:
self._Output(opt)
return