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

Augie Fackler raf at durin42.com
Wed Oct 14 09:01:26 CDT 2015


On Tue, Oct 13, 2015 at 05:41:47PM -0500, Matt Mackall wrote:
> # 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

Queued, thanks.

Congratulations on becoming the mq maintainer!

>
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list