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

Augie Fackler raf at durin42.com
Tue Jun 16 11:10:36 CDT 2015


On Mon, Jun 15, 2015 at 04:58:24PM -0500, Matt Mackall wrote:
> # 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
>

The test fails for me here:


+  ** Unknown exception encountered with possibly-broken third-party extension topic
+  ** which supports versions unknown of Mercurial.
+  ** Please disable topic and try your action again.
+  ** If that fixes the bug please report it to the extension author.
+  ** Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2]
+  ** Mercurial Distributed SCM (version 3.4.1+651-a69983942fb4)
+  ** Extensions loaded: rebase, topic
+  Traceback (most recent call last):
+    File "/opt/hg/bin/hg", line 43, in <module>
+      mercurial.dispatch.run()
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 30, in run
+      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 92, in dispatch
+      ret = _runcatch(req)
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 162, in _runcatch
+      return _dispatch(req)
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 894, in _dispatch
+      cmdpats, cmdoptions)
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 655, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 1011, in _runcommand
+      return checkargs()
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 980, in checkargs
+      return cmdfunc()
+    File "/opt/hg/lib/python/mercurial/dispatch.py", line 891, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
+    File "/opt/hg/lib/python/mercurial/util.py", line 793, in check
+      return func(*args, **kwargs)
+    File "/opt/hg/lib/python/mercurial/commands.py", line 2449, in debugnamecomplete
+      names.update(ns.listnames(repo))
+  TypeError: 'NoneType' object is not callable
+  [1]

Any idea what's up?

> +  default
> +  fran
> +  narf
> +  query
> +  tip
>    $ hg phase --public narf
>
>  POSSIBLE BUG: narf topic stays alive even though we just made all
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list