# HG changeset patch # User Pierre-Yves David # Date 1535831220 -7200 # Node ID 00c65abf99cde250df2e630161bcde00a73183af # Parent 6774820c8a2eac0b5a9cca5bacb20d4eac9f3967 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. diff -r 6774820c8a2e -r 00c65abf99cd hgext3rd/topic/revset.py --- 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