--- a/hgext3rd/topic/revset.py Wed Sep 12 12:02:17 2018 +0200
+++ b/hgext3rd/topic/revset.py Tue Sep 04 19:30:19 2018 +0800
@@ -24,7 +24,7 @@
revsetpredicate = registrar.revsetpredicate()
def getstringstrict(x, err):
- if x and (x[0] == 'string'):
+ if x and x[0] == 'string':
return x[1]
raise error.ParseError(err)
@@ -51,25 +51,19 @@
else:
kind, pattern, matcher = mkmatcher(topic)
+ if topic.startswith('literal:') and pattern not in repo.topics:
+ raise error.RepoLookupError("topic '%s' does not exist" % pattern)
+
def matches(r):
topic = repo[r].topic()
if not topic:
return False
return matcher(topic)
- if kind == 'literal':
- # note: falls through to the revset case if no topic with this name
- # exists and pattern kind is not specified explicitly
-
- if pattern not in repo.topics and topic.startswith('literal:'):
- raise error.RepoLookupError("topic '%s' does not exist"
- % pattern)
- return (subset & mutable).filter(matches)
- else:
- return (subset & mutable).filter(matches)
+ return (subset & mutable).filter(matches)
s = revset.getset(repo, revset.fullreposet(repo), x)
- topics = set(repo[r].topic() for r in s)
+ topics = {repo[r].topic() for r in s}
topics.discard('')
def matches(r):