[PATCH 5 of 5] bookmark: don't allow revsets as bookmark/branch/tag names

Yuya Nishihara yuya at tcha.org
Fri Jan 15 07:40:01 CST 2016


On Thu, 14 Jan 2016 13:16:33 -0500, timeless wrote:
> Yuya Nishihara wrote:
> > On Sun, 10 Jan 2016 12:57:52 -0600, timeless wrote:
> >> +    except error.ParseError:
> >> +        pass
> >> +    except error.RepoLookupError:
> >> +        pass
> >
> > Perhaps LookupError, Abort, etc. can happen.
> 
> I wish I had some way of knowing if they could.

Oh, exception specifications.

> > Do you really want to check all sort of revset expressions? From the test
> > output, it seems you just wanted to warn about conflicting names.
> 
> Oh, I didn't include my main case in my tests (added):
> 
> hg bookmark foo .^
> 
> specifically, that creates a bookmark named `.^` which conflicts with
> the revset `.^`.

Then, how about checking if new bookmark name is parsable as a revset?
revset.parse() won't raise arbitrary exceptions. Also, hg bookmark "not all()"
should match nothing, but it does shadow the expression.

 1. check name conflicts
    not found -> ok
    found in other namespace -> warn
 2. check revset conflicts
    syntax error -> ok
    parsed to symbol -> ok
    parsed to expression -> warn


More information about the Mercurial-devel mailing list