diff options
author | Shawn O. Pearce <sop@google.com> | 2009-06-03 14:16:14 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-07-03 11:00:16 -0700 |
commit | 050e4fd591537811e6e62b2e9ba1ce83e520e550 (patch) | |
tree | 05ca13bcc8713675eba7c896f7e75e1cb76e1bbb /subcmds/manifest.py | |
parent | 60e679209a5495393ef584efaaad287fc8b77c51 (diff) | |
download | git-repo-050e4fd591537811e6e62b2e9ba1ce83e520e550.tar.gz |
manifest: Only display XML help on XML manifest
Some of the help text is only related to the XML formatted manifest,
so only display that text if that is the current format.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds/manifest.py')
-rw-r--r-- | subcmds/manifest.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/subcmds/manifest.py b/subcmds/manifest.py index 4374a9d0..4415b99e 100644 --- a/subcmds/manifest.py +++ b/subcmds/manifest.py | |||
@@ -18,13 +18,22 @@ import sys | |||
18 | 18 | ||
19 | from command import PagedCommand | 19 | from command import PagedCommand |
20 | 20 | ||
21 | def _doc(name): | ||
22 | r = os.path.dirname(__file__) | ||
23 | r = os.path.dirname(r) | ||
24 | fd = open(os.path.join(r, 'docs', 'manifest_xml.txt')) | ||
25 | try: | ||
26 | return fd.read() | ||
27 | finally: | ||
28 | fd.close() | ||
29 | |||
21 | class Manifest(PagedCommand): | 30 | class Manifest(PagedCommand): |
22 | common = False | 31 | common = False |
23 | helpSummary = "Manifest inspection utility" | 32 | helpSummary = "Manifest inspection utility" |
24 | helpUsage = """ | 33 | helpUsage = """ |
25 | %prog [-o {-|NAME.xml} [-r]] | 34 | %prog [-o {-|NAME.xml} [-r]] |
26 | """ | 35 | """ |
27 | _helpDescription = """ | 36 | _xmlHelp = """ |
28 | 37 | ||
29 | With the -o option, exports the current manifest for inspection. | 38 | With the -o option, exports the current manifest for inspection. |
30 | The manifest and (if present) local_manifest.xml are combined | 39 | The manifest and (if present) local_manifest.xml are combined |
@@ -35,13 +44,9 @@ in a Git repository for use during future 'repo init' invocations. | |||
35 | 44 | ||
36 | @property | 45 | @property |
37 | def helpDescription(self): | 46 | def helpDescription(self): |
38 | help = self._helpDescription + '\n' | 47 | help = '' |
39 | r = os.path.dirname(__file__) | 48 | if isinstance(self.manifest, XmlManifest): |
40 | r = os.path.dirname(r) | 49 | help += self._xmlHelp + '\n' + _doc('manifest_xml.txt') |
41 | fd = open(os.path.join(r, 'docs', 'manifest-format.txt')) | ||
42 | for line in fd: | ||
43 | help += line | ||
44 | fd.close() | ||
45 | return help | 50 | return help |
46 | 51 | ||
47 | def _Options(self, p): | 52 | def _Options(self, p): |