changeset 4064:a2c0133006c6

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 01 Sep 2018 14:00:41 +0200
parents 00c65abf99cd
children fbc51e98cf13
files hgext3rd/topic/revset.py
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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)