Mercurial > evolve
diff hgext3rd/topic/revset.py @ 4063:00c65abf99cd
topic-revset: strictly read string
Making a clear distinction between string and symbol passed to topic is
important when it comes to empty topic. Filtering an empty topic name is
harmless. Searching a non existent revision is not.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 01 Sep 2018 21:47:00 +0200 |
parents | ad4194399b47 |
children | a2c0133006c6 |
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py Sat Sep 01 21:45:15 2018 +0200 +++ b/hgext3rd/topic/revset.py Sat Sep 01 21:47:00 2018 +0200 @@ -23,6 +23,11 @@ revsetpredicate = registrar.revsetpredicate() +def getstringstrict(x, err): + if x and (x[0] == 'string'): + return x[1] + raise error.ParseError(err) + @revsetpredicate('topic([string or set])') def topicset(repo, subset, x): """All changesets with the specified topic or the topics of the given @@ -39,7 +44,7 @@ return (subset & mutable).filter(lambda r: bool(repo[r].topic())) try: - topic = revset.getstring(args[0], '') + topic = getstringstrict(args[0], '') except error.ParseError: # not a string, but another revset pass