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