[PATCH 1 of 2 STABLE] subrepo: warn user if Git is not version 1.6.0 or higher
Augie Fackler
raf at durin42.com
Tue Jun 12 14:39:27 UTC 2012
On Jun 12, 2012, at 10:25 AM, Benjamin Pollack wrote:
> # HG changeset patch
> # User Benjamin Pollack <benjamin at bitquabit.com>
> # Date 1339507735 14400
> # Branch stable
> # Node ID 837053114bd0cac99add9128156d898f27d2e5b1
> # Parent 15159abc5ab68050e9a19cc1c74240a937dd1a85
> subrepo: warn user if Git is not version 1.6.0 or higher
>
> diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> --- a/mercurial/subrepo.py
> +++ b/mercurial/subrepo.py
> @@ -840,7 +840,6 @@
>
> class gitsubrepo(abstractsubrepo):
> def __init__(self, ctx, path, state):
> - # TODO add git version check.
> self._state = state
> self._ctx = ctx
> self._path = path
> @@ -848,6 +847,17 @@
> self._abspath = ctx._repo.wjoin(path)
> self._subparent = ctx._repo
> self._ui = ctx._repo.ui
> + self._ensuregit()
> +
> + def _ensuregit(self):
> + out = self._gitcommand(['--version'])
> + m = re.search(r'^git version (\d+)\.(\d+)\.(\d+)', out)
> + if not m:
> + self._ui.warn(_('cannot retrieve git version'))
> + return
> + version = (int(m.group(1)), m.group(2), m.group(3))
> + if version < (1, 6, 0):
> + self._ui.warn(_('git subrepo support requires git 1.6.0 or later'))
Should this be an abort rather than a warning? What level of working will this produce?
>
> def _gitcommand(self, commands, env=None, stream=False):
> return self._gitdir(commands, env=env, stream=stream)[0]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list