[PATCH] mq: use cmdutil.revert instead of hg.revert

Matt Mackall mpm at selenic.com
Tue Oct 13 22:41:47 UTC 2015


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1444639029 18000
#      Mon Oct 12 03:37:09 2015 -0500
# Node ID 83142dc96ccbddcf4a2d6f1c883d83c143aca84e
# Parent  79d86ab65c9def3fdd65ec972bc5fa89688a19ff
mq: use cmdutil.revert instead of hg.revert

It's the last user.

diff -r 79d86ab65c9d -r 83142dc96ccb hgext/mq.py
--- a/hgext/mq.py	Wed Oct 14 02:49:17 2015 +0900
+++ 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:
diff -r 79d86ab65c9d -r 83142dc96ccb mercurial/hg.py
--- a/mercurial/hg.py	Wed Oct 14 02:49:17 2015 +0900
+++ 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)
diff -r 79d86ab65c9d -r 83142dc96ccb tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t	Wed Oct 14 02:49:17 2015 +0900
+++ 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


More information about the Mercurial-devel mailing list