changeset 26654:30657909b2ba

mq: use cmdutil.revert instead of hg.revert It's the last user.
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Oct 2015 03:37:09 -0500
parents cffc4f7c6c36
children f3c6540f2cd1
files hgext/mq.py mercurial/hg.py tests/test-mq-qpush-fail.t
diffstat 3 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Sep 30 21:48:53 2015 -0700
+++ b/hgext/mq.py	Mon Oct 12 03:37:09 2015 -0500
@@ -1428,9 +1428,9 @@
             except AbortNoCleanup:
                 raise
             except: # re-raises
-                self.ui.warn(_('cleaning up working directory...'))
-                node = repo.dirstate.p1()
-                hg.revert(repo, node, None)
+                self.ui.warn(_('cleaning up working directory...\n'))
+                cmdutil.revert(self.ui, repo, repo['.'],
+                               repo.dirstate.parents(), no_backup=True)
                 # only remove unknown files that we know we touched or
                 # created while patching
                 for f in all_files:
--- a/mercurial/hg.py	Wed Sep 30 21:48:53 2015 -0700
+++ b/mercurial/hg.py	Mon Oct 12 03:37:09 2015 -0500
@@ -766,10 +766,6 @@
     recurse()
     return 0 # exit code is zero since we found outgoing changes
 
-def revert(repo, node, choose):
-    """revert changes to revision in node without updating dirstate"""
-    return mergemod.update(repo, node, False, True, choose)[3] > 0
-
 def verify(repo):
     """verify the consistency of a repository"""
     ret = verifymod.verify(repo)
--- a/tests/test-mq-qpush-fail.t	Wed Sep 30 21:48:53 2015 -0700
+++ b/tests/test-mq-qpush-fail.t	Mon Oct 12 03:37:09 2015 -0500
@@ -56,7 +56,9 @@
   applying bad-patch
   transaction abort!
   rollback completed
-  cleaning up working directory...done
+  cleaning up working directory...
+  reverting foo
+  done
   abort: decoding near '\xe9': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
   [255]
   $ hg parents