[PATCH 2 of 4 V6 STABLE] revert: be more helpful on uncommitted merges

Na'Tosha Bard natosha at unity3d.com
Tue Jun 21 06:36:25 CDT 2011


On Tue, Jun 21, 2011 at 10:17 AM, Adrian Buehlmann <adrian at cadifra.com>wrote:

> On 2011-06-21 06:11, Kevin Bullock wrote:
> > # HG changeset patch
> > # User Kevin Bullock <kbullock at ringworld.org>
> > # Date 1308626671 18000
> > # Branch stable
> > # Node ID 59f92ee58bc1ff014d11d009ab8e39ae86fb5af7
> > # Parent  10a8c14a8fdca3d00fee266b3af949f2bd5d74e5
> > revert: be more helpful on uncommitted merges
> >
> >  BEFORE:
> >    $ hg revert
> >    abort: no files or directories specified
> >    (use --all to discard all changes)
> >
> >  AFTER:
> >    $ hg revert
> >    abort: no files or directories specified
> >    (use --all to discard all changes, or 'hg update -C .' to cancel
> uncommitted merge)
> >
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -4181,8 +4181,12 @@
> >      parent, p2 = repo.dirstate.parents()
> >
> >      if not pats and not opts.get('all'):
> > -        raise util.Abort(_('no files or directories specified'),
> > -                         hint=_('use --all to discard all changes'))
> > +        msg = _('no files or directories specified')
> > +        hint = _('use --all to discard all changes')
> > +        if p2 != nullid:
> > +            hint = _('use --all to discard all changes, or '
> > +                     "'hg update -C .' to cancel uncommitted merge")
> > +        raise util.Abort(msg, hint=hint)
> >
> >      ctx = scmutil.revsingle(repo, opts.get('rev'))
> >      node = ctx.node()
> > diff --git a/tests/test-confused-revert.t b/tests/test-confused-revert.t
> > --- a/tests/test-confused-revert.t
> > +++ b/tests/test-confused-revert.t
> > @@ -60,7 +60,7 @@
> >
> >    $ hg revert
> >    abort: no files or directories specified
> > -  (use --all to discard all changes)
> > +  (use --all to discard all changes, or 'hg update -C .' to cancel
> uncommitted merge)
>
> This would be nice and I don't care that much about the length of this
> hint, but Matt's proposed
>
>     (uncommitted merge, use --all to discard all changes)
>
> would be an improvement over the status quo too, so I would take either
> of them instead of getting nothing changed.
>
> Other ideas:
>
>     (use --all to discard all changes or 'hg update -C .' to discard the
> pending merge)
>
>
I think both Kevin and Adrian's poposals for this message are excellent,
though I slightly prefer Kevin's version.  Both are clear, concise, and
helpful to the user.

Cheers,
N.

-- 
*Na'Tosha Bard*
Build & Infrastructure Developer | Unity Technologies

*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110621/f29511bf/attachment.htm>


More information about the Mercurial-devel mailing list