topic-revset: get the list of revset through the official localrepo API
This is simpler and faster. In addition we tighter the logic to be used in case
of empty topic. We do not need to fall back to revision search.
--- a/hgext3rd/topic/revset.py Sat Sep 01 21:47:00 2018 +0200
+++ b/hgext3rd/topic/revset.py Sat Sep 01 14:00:41 2018 +0200
@@ -61,17 +61,10 @@
# note: falls through to the revset case if no topic with this name
# exists and pattern kind is not specified explicitly
- alltopics = set([repo.currenttopic])
- for r in repo.unfiltered().set('all()'):
- alltopics.add(r.topic(force=True))
- alltopics.discard('')
-
- if pattern in alltopics:
- return (subset & mutable).filter(matches)
-
- if topic.startswith('literal:'):
+ 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)