# HG changeset patch # User Wagner Bruna # Date 1340370861 10800 # Node ID b21139a7bb1bcbdceb0bd03c970f9e6c27340a8c # Parent f8af57c00a29cb52c7561fad1f7ab2d9e68b96cf# Parent d393d7c714432f09092ab2cb165f1d284a1fa9e8 merge with i18n diff -r d393d7c71443 -r b21139a7bb1b hgext/rebase.py --- a/hgext/rebase.py Thu Jun 21 18:23:18 2012 +0200 +++ b/hgext/rebase.py Fri Jun 22 10:14:21 2012 -0300 @@ -565,10 +565,11 @@ def abort(repo, originalwd, target, state): 'Restore the repository to its original state' dstates = [s for s in state.values() if s != nullrev] - if [d for d in dstates if not repo[d].mutable()]: - repo.ui.warn(_("warning: immutable rebased changeset detected, " - "can't abort\n")) - return -1 + immutable = [d for d in dstates if not repo[d].mutable()] + if immutable: + raise util.Abort(_("can't abort rebase due to immutable changesets %s") + % ', '.join(str(repo[r]) for r in immutable), + hint=_('see hg help phases for details')) descendants = set() if dstates: diff -r d393d7c71443 -r b21139a7bb1b mercurial/subrepo.py --- a/mercurial/subrepo.py Thu Jun 21 18:23:18 2012 +0200 +++ b/mercurial/subrepo.py Fri Jun 22 10:14:21 2012 -0300 @@ -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,29 @@ self._abspath = ctx._repo.wjoin(path) self._subparent = ctx._repo self._ui = ctx._repo.ui + self._ensuregit() + + def _ensuregit(self): + try: + self._gitexecutable = 'git' + out, err = self._gitnodir(['--version']) + except OSError, e: + if e.errno != 2 or os.name != 'nt': + raise + self._gitexecutable = 'git.cmd' + out, err = self._gitnodir(['--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)) + # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, + # despite the docstring comment. For now, error on 1.4.0, warn on + # 1.5.0 but attempt to continue. + if version < (1, 5, 0): + raise util.Abort(_('git subrepo requires at least 1.6.0 or later')) + elif version < (1, 6, 0): + self._ui.warn(_('git subrepo requires at least 1.6.0 or later')) def _gitcommand(self, commands, env=None, stream=False): return self._gitdir(commands, env=env, stream=stream)[0] @@ -868,8 +890,8 @@ errpipe = None if self._ui.quiet: errpipe = open(os.devnull, 'w') - p = subprocess.Popen(['git'] + commands, bufsize=-1, cwd=cwd, env=env, - close_fds=util.closefds, + p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, + cwd=cwd, env=env, close_fds=util.closefds, stdout=subprocess.PIPE, stderr=errpipe) if stream: return p.stdout, None diff -r d393d7c71443 -r b21139a7bb1b tests/test-rebase-interruptions.t --- a/tests/test-rebase-interruptions.t Thu Jun 21 18:23:18 2012 +0200 +++ b/tests/test-rebase-interruptions.t Fri Jun 22 10:14:21 2012 -0300 @@ -248,7 +248,8 @@ Abort the rebasing: $ hg rebase --abort - warning: immutable rebased changeset detected, can't abort + abort: can't abort rebase due to immutable changesets 45396c49d53b + (see hg help phases for details) [255] $ hg tglogp