1292 def _ensuregit(self): |
1292 def _ensuregit(self): |
1293 try: |
1293 try: |
1294 self._gitexecutable = 'git' |
1294 self._gitexecutable = 'git' |
1295 out, err = self._gitnodir(['--version']) |
1295 out, err = self._gitnodir(['--version']) |
1296 except OSError as e: |
1296 except OSError as e: |
1297 if e.errno != 2 or os.name != 'nt': |
1297 genericerror = _("error executing git for subrepo '%s': %s") |
1298 raise |
1298 notfoundhint = _("check git is installed and in your PATH") |
1299 self._gitexecutable = 'git.cmd' |
1299 if e.errno != errno.ENOENT: |
1300 out, err = self._gitnodir(['--version']) |
1300 raise error.Abort(genericerror % (self._path, e.strerror)) |
|
1301 elif os.name == 'nt': |
|
1302 try: |
|
1303 self._gitexecutable = 'git.cmd' |
|
1304 out, err = self._gitnodir(['--version']) |
|
1305 except OSError as e2: |
|
1306 if e2.errno == errno.ENOENT: |
|
1307 raise error.Abort(_("couldn't find 'git' or 'git.cmd'" |
|
1308 " for subrepo '%s'") % self._path, |
|
1309 hint=notfoundhint) |
|
1310 else: |
|
1311 raise error.Abort(genericerror % (self._path, |
|
1312 e2.strerror)) |
|
1313 else: |
|
1314 raise error.Abort(_("couldn't find git for subrepo '%s'") |
|
1315 % self._path, hint=notfoundhint) |
1301 versionstatus = self._checkversion(out) |
1316 versionstatus = self._checkversion(out) |
1302 if versionstatus == 'unknown': |
1317 if versionstatus == 'unknown': |
1303 self.ui.warn(_('cannot retrieve git version\n')) |
1318 self.ui.warn(_('cannot retrieve git version\n')) |
1304 elif versionstatus == 'abort': |
1319 elif versionstatus == 'abort': |
1305 raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) |
1320 raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) |