[PATCH topic-ext] topics: add listnames hook so completion works

Matt Mackall mpm at selenic.com
Mon Jun 15 16:58:24 CDT 2015


# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1434405404 18000
#      Mon Jun 15 16:56:44 2015 -0500
# Node ID ca2b4e5329fe018fc1279694cc89f74a7d6f4ccd
# Parent  375b9ccb7f25fde4dcf2b61a29ff282396544abe
topics: add listnames hook so completion works

diff -r 375b9ccb7f25 -r ca2b4e5329fe src/topic/__init__.py
--- a/src/topic/__init__.py	Fri Jun 12 16:49:46 2015 -0500
+++ b/src/topic/__init__.py	Mon Jun 15 16:56:44 2015 -0500
@@ -62,10 +62,11 @@
         def currenttopic(self):
             return self.vfs.tryread('topic')
 
+    repo.__class__ = topicrepo
     if util.safehasattr(repo, 'names'):
         repo.names.addnamespace(namespaces.namespace(
-            'topics', 'topic', namemap=_namemap, nodemap=_nodemap))
-    repo.__class__ = topicrepo
+            'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
+            listnames=lambda repo: repo.topics))
 
 @command('topics [TOPIC]', [
     ('', 'clear', False, 'clear active topic if any'),
diff -r 375b9ccb7f25 -r ca2b4e5329fe tests/test-topic.t
--- a/tests/test-topic.t	Fri Jun 12 16:49:46 2015 -0500
+++ b/tests/test-topic.t	Mon Jun 15 16:56:44 2015 -0500
@@ -263,6 +263,12 @@
      fran
    * narf
      query
+  $ hg debugnamecomplete
+  default
+  fran
+  narf
+  query
+  tip
   $ hg phase --public narf
 
 POSSIBLE BUG: narf topic stays alive even though we just made all


More information about the Mercurial-devel mailing list