update, revsets and dashes in tag names

Dennis Brakhane brakhane at googlemail.com
Mon Jan 30 13:46:54 CST 2012


(Sorry for the late reply, illness and a lot of other stuff got in the way)

On Mon, Jan 16, 2012 at 12:01 AM, Matt Mackall <mpm at selenic.com> wrote:
>> 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™.

I'm pretty sure it will break somewhere. Which is why I don't propose changing
the behaviour at all, but simply output a warning when ambigious rev specs
are used *in update* (or any other operation that takes exactly one
revision which have
slipped my mind atm). That way,build scripts still work, and they
would have to be
modified only to get rid of the warning.

I can't say I particularly like this "solution", but IMHO the bad and unexpected
behaviour regarding nonexistant tags with dashes ("foo-1" updates to tag foo-1,
"foo-2" updates to foo if no tag foo-2 exists, _without any hint to
the user that he is not at foo-2_)
warrants this.


>
> As it happens, this patch breaks some existing tests, because we use
> '0-0' to represent the empty set. So the above patch won't fly.
>
> So I think the most we can do is something like this:
>
> diff -r 1f26468bb2a4 mercurial/revset.py
> --- a/mercurial/revset.py       Fri Jan 13 22:16:01 2012 +0100
> +++ b/mercurial/revset.py       Sun Jan 15 16:48:56 2012 -0600
> @@ -134,7 +134,11 @@
>  def symbolset(repo, subset, x):
>     if x in symbols:
>         raise error.ParseError(_("can't use %s here") % x)
> -    return stringset(repo, subset, x)
> +    try:
> +        return stringset(repo, subset, x)
> +    except error.RepoLookupError:
> +        raise error.ParseError(_("unknown identifier '%s' (missing quotes?)")
> +                               % x)

As said above, I'm not really concerned about the case where "update
foo-bar" results
in an confusing error message "unknown rev 'foo'", it's the "foo-3"
case I worry about.
Sorry if I didn't make myself clear.

But maybe I should relax and we should simply tell people that naming
a tag "foo-1" is a really
bad idea. Using tags like "foo-v1" or "foo-1.1" would make the problem go away.


More information about the Mercurial-devel mailing list