diff options
| author | Shawn O. Pearce <sop@google.com> | 2009-05-19 18:14:04 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-07-03 11:00:16 -0700 |
| commit | 446c4e5556a4c85621d61b3aba63d084300c6224 (patch) | |
| tree | 6a4e588e7fd73b1e714e2cc4f746a9ec915ae228 | |
| parent | 67f4563acb58af9e64fbfe8a2c9794b389a3debc (diff) | |
| download | git-repo-446c4e5556a4c85621d61b3aba63d084300c6224.tar.gz | |
init: Allow -m only on XML formatted manifest
If the manifest is the newer SubmoduleManifest style, then the -m
option makes no sense, as you cannot select a specific file within
the current branch.
Signed-off-by: Shawn O. Pearce <sop@google.com>
| -rw-r--r-- | subcmds/init.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 75a58f11..ec87d036 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -21,6 +21,7 @@ from command import InteractiveCommand, MirrorSafeCommand | |||
| 21 | from error import ManifestParseError | 21 | from error import ManifestParseError |
| 22 | from project import SyncBuffer | 22 | from project import SyncBuffer |
| 23 | from git_command import git_require, MIN_GIT_VERSION | 23 | from git_command import git_require, MIN_GIT_VERSION |
| 24 | from manifest_xml import XmlManifest | ||
| 24 | 25 | ||
| 25 | class Init(InteractiveCommand, MirrorSafeCommand): | 26 | class Init(InteractiveCommand, MirrorSafeCommand): |
| 26 | common = True | 27 | common = True |
| @@ -37,10 +38,6 @@ current working directory. | |||
| 37 | The optional -b argument can be used to select the manifest branch | 38 | The optional -b argument can be used to select the manifest branch |
| 38 | to checkout and use. If no branch is specified, master is assumed. | 39 | to checkout and use. If no branch is specified, master is assumed. |
| 39 | 40 | ||
| 40 | The optional -m argument can be used to specify an alternate manifest | ||
| 41 | to be used. If no manifest is specified, the manifest default.xml | ||
| 42 | will be used. | ||
| 43 | |||
| 44 | Switching Manifest Branches | 41 | Switching Manifest Branches |
| 45 | --------------------------- | 42 | --------------------------- |
| 46 | 43 | ||
| @@ -65,9 +62,11 @@ to update the working directory files. | |||
| 65 | g.add_option('-b', '--manifest-branch', | 62 | g.add_option('-b', '--manifest-branch', |
| 66 | dest='manifest_branch', | 63 | dest='manifest_branch', |
| 67 | help='manifest branch or revision', metavar='REVISION') | 64 | help='manifest branch or revision', metavar='REVISION') |
| 68 | g.add_option('-m', '--manifest-name', | 65 | if isinstance(self.manifest, XmlManifest) \ |
| 69 | dest='manifest_name', default='default.xml', | 66 | or not self.manifest.manifestProject.Exists: |
| 70 | help='initial manifest file', metavar='NAME.xml') | 67 | g.add_option('-m', '--manifest-name', |
| 68 | dest='manifest_name', default='default.xml', | ||
| 69 | help='initial manifest file', metavar='NAME.xml') | ||
| 71 | g.add_option('--mirror', | 70 | g.add_option('--mirror', |
| 72 | dest='mirror', action='store_true', | 71 | dest='mirror', action='store_true', |
| 73 | help='mirror the forrest') | 72 | help='mirror the forrest') |
| @@ -216,7 +215,8 @@ to update the working directory files. | |||
| 216 | def Execute(self, opt, args): | 215 | def Execute(self, opt, args): |
| 217 | git_require(MIN_GIT_VERSION, fail=True) | 216 | git_require(MIN_GIT_VERSION, fail=True) |
| 218 | self._SyncManifest(opt) | 217 | self._SyncManifest(opt) |
| 219 | self._LinkManifest(opt.manifest_name) | 218 | if isinstance(self.manifest, XmlManifest): |
| 219 | self._LinkManifest(opt.manifest_name) | ||
| 220 | 220 | ||
| 221 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: | 221 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: |
| 222 | self._ConfigureUser() | 222 | self._ConfigureUser() |
