revset: add "reversed" as a synonym for "reverse"

Matt Mackall mpm at selenic.com
Fri Oct 16 12:02:31 CDT 2015


On Tue, 2015-10-13 at 20:13 -0700, Daniel Colascione (SEATTLE) wrote:
> On 10/13/2015 08:22 AM, Augie Fackler wrote:
> > On Mon, Oct 12, 2015 at 02:12:55PM -0700, Daniel Colascione (SEATTLE) wrote:
> >> # HG changeset patch
> >> # User Daniel Colascione <dancol at fb.com>
> >> # Date 1444684285 25200
> >> #      Mon Oct 12 14:11:25 2015 -0700
> >> # Node ID 348e3483614878ac1049c836f4f3bb36127cae27
> >> # Parent  a3fcc8e3136bd19012d28b863d6bf4429948c573
> >> revset: add "reversed" as synonym for "reverse"
> > 
> > I'm hesitant to do this, what's the benefit?
> > 
> > I get that it matches Python, but I'm not sure that merits the
> > duplicated name. Besides, hg tells you what you meant:
> > 
> > augie$ hg log -r 'reversed(::@)'
> > hg: parse error: unknown identifier: reversed
> > (did you mean one of removes, reverse?)
> 
> I write a lot of Python. On the day I wrote this patch, I found myself
> typing "reversed" instead of "reverse" three times in a single day. Of
> course fixing the problem is trivial, but so is the patch, which can
> reduce annoyance without costing anything.

I'm basically fine with this idea because we've already got a bunch of
aliases for commands. This patch does however miss two things:

- not added to safesymbols (allowed for remote queries)
- appears twice in the help

The right way to implement this is probably something like we've done
for commands: add a smart decorator that knows how to insert a method
into all the relevant tables.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list