[PATCH 4 of 4 V6 STABLE] revert: suggest --rev when working dir is clean

Adrian Buehlmann adrian at cadifra.com
Tue Jun 21 02:51:09 CDT 2011


On 2011-06-21 06:11, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1308626997 18000
> # Branch stable
> # Node ID 6be8fc98f63c2c767c664dc8079f1a6a8711f3c8
> # Parent  ee0ea22c40b86d58437630881ec5ea1815ebe354
> revert: suggest --rev when working dir is clean
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4199,6 +4199,9 @@
>                  hint = _('use --all to revert all files, or '
>                           "'hg update %s' to check out that revision"
>                           ) % ctx.rev()
> +        elif not dirty:
> +            hint = _('nothing changed, use --rev to revert to another'
> +                     'revision')
>          raise util.Abort(msg, hint=hint)
>  
>      mf = ctx.manifest()

IMHO that hint is a very bad idea. There is no need to entice newbies
into yet more disaster.

And there's no reason to abort if nothing was changed (other than Matt
saying he wants an abort...).

In my book (status quo):

  $ hg revert commands.py
  no changes needed to commands.py

fits quite nicely with (my proposal):

  $ hg revert
  nothing changed

Consider also (status quo):

  $ hg commit -mfoo
  nothing changed


More information about the Mercurial-devel mailing list