diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1428,9 +1428,9 @@ class queue(object): 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 --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -766,10 +766,6 @@ def outgoing(ui, repo, dest, opts): 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 --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t --- a/tests/test-mq-qpush-fail.t +++ b/tests/test-mq-qpush-fail.t @@ -56,7 +56,9 @@ test qpush on empty series 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