mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
67f4563acb
commit
446c4e5556
@ -21,6 +21,7 @@ from command import InteractiveCommand, MirrorSafeCommand
|
||||
from error import ManifestParseError
|
||||
from project import SyncBuffer
|
||||
from git_command import git_require, MIN_GIT_VERSION
|
||||
from manifest_xml import XmlManifest
|
||||
|
||||
class Init(InteractiveCommand, MirrorSafeCommand):
|
||||
common = True
|
||||
@ -37,10 +38,6 @@ current working directory.
|
||||
The optional -b argument can be used to select the manifest branch
|
||||
to checkout and use. If no branch is specified, master is assumed.
|
||||
|
||||
The optional -m argument can be used to specify an alternate manifest
|
||||
to be used. If no manifest is specified, the manifest default.xml
|
||||
will be used.
|
||||
|
||||
Switching Manifest Branches
|
||||
---------------------------
|
||||
|
||||
@ -65,6 +62,8 @@ to update the working directory files.
|
||||
g.add_option('-b', '--manifest-branch',
|
||||
dest='manifest_branch',
|
||||
help='manifest branch or revision', metavar='REVISION')
|
||||
if isinstance(self.manifest, XmlManifest) \
|
||||
or not self.manifest.manifestProject.Exists:
|
||||
g.add_option('-m', '--manifest-name',
|
||||
dest='manifest_name', default='default.xml',
|
||||
help='initial manifest file', metavar='NAME.xml')
|
||||
@ -216,6 +215,7 @@ to update the working directory files.
|
||||
def Execute(self, opt, args):
|
||||
git_require(MIN_GIT_VERSION, fail=True)
|
||||
self._SyncManifest(opt)
|
||||
if isinstance(self.manifest, XmlManifest):
|
||||
self._LinkManifest(opt.manifest_name)
|
||||
|
||||
if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror:
|
||||
|
Loading…
Reference in New Issue
Block a user