comparison mercurial/subrepo.py @ 20815:6a2acb0d9352 stable

subrepo: only retrieve the first two components of the Git version This makes the version detection compatible with Git versions like '1.9-rc0'. We only cared about the first two components of the version anyway.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 20 Mar 2014 19:37:01 -0700
parents 427d672c0e4e
children 0c32fafd4b3b
comparison
equal deleted inserted replaced
20784:7f4cf938643d 20815:6a2acb0d9352
1115 except OSError, e: 1115 except OSError, e:
1116 if e.errno != 2 or os.name != 'nt': 1116 if e.errno != 2 or os.name != 'nt':
1117 raise 1117 raise
1118 self._gitexecutable = 'git.cmd' 1118 self._gitexecutable = 'git.cmd'
1119 out, err = self._gitnodir(['--version']) 1119 out, err = self._gitnodir(['--version'])
1120 m = re.search(r'^git version (\d+)\.(\d+)\.(\d+)', out) 1120 m = re.search(r'^git version (\d+)\.(\d+)', out)
1121 if not m: 1121 if not m:
1122 self._ui.warn(_('cannot retrieve git version')) 1122 self._ui.warn(_('cannot retrieve git version'))
1123 return 1123 return
1124 version = (int(m.group(1)), m.group(2), m.group(3)) 1124 version = (int(m.group(1)), m.group(2))
1125 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, 1125 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases,
1126 # despite the docstring comment. For now, error on 1.4.0, warn on 1126 # despite the docstring comment. For now, error on 1.4.0, warn on
1127 # 1.5.0 but attempt to continue. 1127 # 1.5.0 but attempt to continue.
1128 if version < (1, 5, 0): 1128 if version < (1, 5):
1129 raise util.Abort(_('git subrepo requires at least 1.6.0 or later')) 1129 raise util.Abort(_('git subrepo requires at least 1.6.0 or later'))
1130 elif version < (1, 6, 0): 1130 elif version < (1, 6):
1131 self._ui.warn(_('git subrepo requires at least 1.6.0 or later')) 1131 self._ui.warn(_('git subrepo requires at least 1.6.0 or later'))
1132 1132
1133 def _gitcommand(self, commands, env=None, stream=False): 1133 def _gitcommand(self, commands, env=None, stream=False):
1134 return self._gitdir(commands, env=env, stream=stream)[0] 1134 return self._gitdir(commands, env=env, stream=stream)[0]
1135 1135