Mercurial > hg
comparison mercurial/subrepo.py @ 23522:49a58b33d1ce
subrepo: extend git version check to 3 digits
This allows more flexibility when a version check is required.
Some git features are introduced in a version where only
the 3rd digit changes.
author | Mathias De Maré <mathias.demare@gmail.com> |
---|---|
date | Wed, 10 Dec 2014 08:41:21 +0100 |
parents | f5de2a82b77e |
children | 01a8dfc79cdc |
comparison
equal
deleted
inserted
replaced
23521:f5de2a82b77e | 23522:49a58b33d1ce |
---|---|
1134 elif versionstatus == 'warning': | 1134 elif versionstatus == 'warning': |
1135 self._ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) | 1135 self._ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) |
1136 | 1136 |
1137 @staticmethod | 1137 @staticmethod |
1138 def _gitversion(out): | 1138 def _gitversion(out): |
1139 m = re.search(r'^git version (\d+)\.(\d+)\.(\d+)', out) | |
1140 if m: | |
1141 return (int(m.group(1)), int(m.group(2)), int(m.group(3))) | |
1142 | |
1139 m = re.search(r'^git version (\d+)\.(\d+)', out) | 1143 m = re.search(r'^git version (\d+)\.(\d+)', out) |
1140 if m: | 1144 if m: |
1141 return (int(m.group(1)), int(m.group(2))) | 1145 return (int(m.group(1)), int(m.group(2)), 0) |
1142 | 1146 |
1143 return -1 | 1147 return -1 |
1144 | 1148 |
1145 @staticmethod | 1149 @staticmethod |
1146 def _checkversion(out): | 1150 def _checkversion(out): |
1170 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, | 1174 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, |
1171 # despite the docstring comment. For now, error on 1.4.0, warn on | 1175 # despite the docstring comment. For now, error on 1.4.0, warn on |
1172 # 1.5.0 but attempt to continue. | 1176 # 1.5.0 but attempt to continue. |
1173 if version == -1: | 1177 if version == -1: |
1174 return 'unknown' | 1178 return 'unknown' |
1175 if version < (1, 5): | 1179 if version < (1, 5, 0): |
1176 return 'abort' | 1180 return 'abort' |
1177 elif version < (1, 6): | 1181 elif version < (1, 6, 0): |
1178 return 'warning' | 1182 return 'warning' |
1179 return 'ok' | 1183 return 'ok' |
1180 | 1184 |
1181 def _gitcommand(self, commands, env=None, stream=False): | 1185 def _gitcommand(self, commands, env=None, stream=False): |
1182 return self._gitdir(commands, env=env, stream=stream)[0] | 1186 return self._gitdir(commands, env=env, stream=stream)[0] |