mq: use cmdutil.revert instead of hg.revert
authorMatt Mackall <mpm@selenic.com>
Mon, 12 Oct 2015 03:37:09 -0500
changeset 26654 30657909b2ba
parent 26653 cffc4f7c6c36
child 26655 f3c6540f2cd1
mq: use cmdutil.revert instead of hg.revert It's the last user.
hgext/mq.py
mercurial/hg.py
tests/test-mq-qpush-fail.t
--- 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