##// END OF EJS Templates
subrepo: warn user if Git is not version 1.6.0 or higher
Benjamin Pollack -
r17024:33b05777 stable
parent child Browse files
Show More
@@ -840,7 +840,6 b' class svnsubrepo(abstractsubrepo):'
840
840
841 class gitsubrepo(abstractsubrepo):
841 class gitsubrepo(abstractsubrepo):
842 def __init__(self, ctx, path, state):
842 def __init__(self, ctx, path, state):
843 # TODO add git version check.
844 self._state = state
843 self._state = state
845 self._ctx = ctx
844 self._ctx = ctx
846 self._path = path
845 self._path = path
@@ -848,6 +847,22 b' class gitsubrepo(abstractsubrepo):'
848 self._abspath = ctx._repo.wjoin(path)
847 self._abspath = ctx._repo.wjoin(path)
849 self._subparent = ctx._repo
848 self._subparent = ctx._repo
850 self._ui = ctx._repo.ui
849 self._ui = ctx._repo.ui
850 self._ensuregit()
851
852 def _ensuregit(self):
853 out, err = self._gitnodir(['--version'])
854 m = re.search(r'^git version (\d+)\.(\d+)\.(\d+)', out)
855 if not m:
856 self._ui.warn(_('cannot retrieve git version'))
857 return
858 version = (int(m.group(1)), m.group(2), m.group(3))
859 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases,
860 # despite the docstring comment. For now, error on 1.4.0, warn on
861 # 1.5.0 but attempt to continue.
862 if version < (1, 5, 0):
863 raise util.Abort(_('git subrepo requires at least 1.6.0 or later'))
864 elif version < (1, 6, 0):
865 self._ui.warn(_('git subrepo requires at least 1.6.0 or later'))
851
866
852 def _gitcommand(self, commands, env=None, stream=False):
867 def _gitcommand(self, commands, env=None, stream=False):
853 return self._gitdir(commands, env=env, stream=stream)[0]
868 return self._gitdir(commands, env=env, stream=stream)[0]
General Comments 0
You need to be logged in to leave comments. Login now