merge with i18n stable
authorWagner Bruna <wbruna@softwareexpress.com.br>
Fri, 22 Jun 2012 10:14:21 -0300
branchstable
changeset 17039 b21139a7bb1b
parent 17026 f8af57c00a29 (diff)
parent 17038 d393d7c71443 (current diff)
child 17040 4e173efed628
merge with i18n
--- 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:
--- 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
--- 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