diff options
Diffstat (limited to 'subcmds/init.py')
| -rw-r--r-- | subcmds/init.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 5ba4d794..fbc406e2 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -20,7 +20,7 @@ from color import Coloring | |||
| 20 | from command import InteractiveCommand, MirrorSafeCommand | 20 | 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, MIN_GIT_VERSION | 23 | from git_command import git_require, MIN_GIT_VERSION |
| 24 | 24 | ||
| 25 | class Init(InteractiveCommand, MirrorSafeCommand): | 25 | class Init(InteractiveCommand, MirrorSafeCommand): |
| 26 | common = True | 26 | common = True |
| @@ -85,19 +85,6 @@ to update the working directory files. | |||
| 85 | dest='no_repo_verify', action='store_true', | 85 | dest='no_repo_verify', action='store_true', |
| 86 | help='do not verify repo source code') | 86 | help='do not verify repo source code') |
| 87 | 87 | ||
| 88 | def _CheckGitVersion(self): | ||
| 89 | ver_str = git.version() | ||
| 90 | if not ver_str.startswith('git version '): | ||
| 91 | print >>sys.stderr, 'error: "%s" unsupported' % ver_str | ||
| 92 | sys.exit(1) | ||
| 93 | |||
| 94 | ver_str = ver_str[len('git version '):].strip() | ||
| 95 | ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3])) | ||
| 96 | if ver_act < MIN_GIT_VERSION: | ||
| 97 | need = '.'.join(map(lambda x: str(x), MIN_GIT_VERSION)) | ||
| 98 | print >>sys.stderr, 'fatal: git %s or later required' % need | ||
| 99 | sys.exit(1) | ||
| 100 | |||
| 101 | def _SyncManifest(self, opt): | 88 | def _SyncManifest(self, opt): |
| 102 | m = self.manifest.manifestProject | 89 | m = self.manifest.manifestProject |
| 103 | is_new = not m.Exists | 90 | is_new = not m.Exists |
| @@ -214,7 +201,7 @@ to update the working directory files. | |||
| 214 | gc.SetString('color.ui', 'auto') | 201 | gc.SetString('color.ui', 'auto') |
| 215 | 202 | ||
| 216 | def Execute(self, opt, args): | 203 | def Execute(self, opt, args): |
| 217 | self._CheckGitVersion() | 204 | git_require(MIN_GIT_VERSION, fail=True) |
| 218 | self._SyncManifest(opt) | 205 | self._SyncManifest(opt) |
| 219 | self._LinkManifest(opt.manifest_name) | 206 | self._LinkManifest(opt.manifest_name) |
| 220 | 207 | ||
