changeset 1857:a506ed8ab8da

topics: add listnames hook so completion works
author Matt Mackall <mpm@selenic.com>
date Mon, 15 Jun 2015 16:56:44 -0500
parents 7d7f5f9e2f8c
children 4ab1b854ce4e
files src/topic/__init__.py tests/test-topic.t
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/topic/__init__.py	Thu Jun 18 15:46:26 2015 -0400
+++ b/src/topic/__init__.py	Mon Jun 15 16:56:44 2015 -0500
@@ -63,10 +63,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'),
--- a/tests/test-topic.t	Thu Jun 18 15:46:26 2015 -0400
+++ 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