update, revsets and dashes in tag names

Matt Mackall mpm at selenic.com
Sun Jan 15 19:14:01 UTC 2012


On Sun, 2012-01-15 at 11:42 +0100, Dennis Brakhane wrote:
> On Fri, Jan 13, 2012 at 10:17 PM, Matt Mackall <mpm at selenic.com> wrote:
> > The last time this came up, no useful suggestions surfaced.
> 
> Should I take this as "your proposal was already discussed last
> time/is too ugly to be useful"?

There wasn't a proposal in the email I was responding to. But I've gone
back and read it on Markmail:

http://markmail.org/message/5eicc4373wo5nruq

You observe:

        I currently can't think (for update) of a useful revset
        specification that does include a dash (or plus sign), that does
        not also include at least a parenthesis (or space):
        
        "xxx-yyy" -> useless, simply write xxx instead.
        "author(me)-file(foo)" -> (kinda) useful, update to the most
        recent changeset by me that didn't involve file "foo"

Indeed, most of the things that generate multi-element sets require
parens, but there are a couple important exceptions: range operators and
aliases.

First note that the current fix for "I want crazy characters in my
symbols" is to use quoting:

$ hg log -r '"this is an obnoxious tag +-/"::'
abort: unknown revision 'this is an obnoxious tag +-/'!

..which is basically mandatory if you want to use a space. It's
documented thusly:

    Identifiers such as branch names must be quoted with single or double
    quotes if they contain characters outside of "[._a-zA-Z0-9\x80-\xff]" or
    if they match one of the predefined predicates.

Now admittedly, the most common variant of this question involves '-',
so perhaps that needs more attention.

A patch like this:

diff -r feca25e563aa mercurial/revset.py
--- a/mercurial/revset.py	Fri Jan 13 22:16:01 2012 +0100
+++ b/mercurial/revset.py	Sun Jan 15 11:33:35 2012 -0600
@@ -81,3 +81,3 @@
                 d = program[pos]
-                if not (d.isalnum() or d in "._" or ord(d) > 127):
+                if not (d.isalnum() or d in "._-" or ord(d) > 127):
                     break

would make us distinguish between "foo-bar" (symbol) and "foo -
bar" (expression) and gives a more obvious diagnostic:

 abort: unknown revision 'foo-bar'!

because obviously adding spaces will make that go away if you really
meant "foo - bar".

Which brings us to the $10000 question: is this going to break any
existing users of revsets? Remember, the standard is NOT "is this a fair
trade-off", it's "does this negatively impact anyone and/or any tool
that was using Mercurial reasonably?" If there are power users out there
who've written "myalias-myotheralias" in their corporate build script
and they have to come to work during their vacation to deal with this
change, that's Not Cool™.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial-devel mailing list