# HG changeset patch # User Yuya Nishihara # Date 2017-05-04 08:13:12 # Node ID c942c83ac2ecda4cf07e0b0f6cd4fe0fe356e8bc # Parent b16cb0a27377acf68d1be09a1c94f1e37d211fc4 debugcommands: use temporary dict for its command table Instead, load the table by commands.py so the debug commands should always be populated. The table in debugcommands.py is unnamed so extension authors wouldn't be confused to wrap debugcommands.table in place of commands.table. diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py +++ b/hgext/largefiles/uisetup.py @@ -21,7 +21,6 @@ from mercurial import ( cmdutil, commands, copies, - debugcommands, exchange, extensions, filemerge, @@ -40,11 +39,6 @@ from . import ( ) def uisetup(ui): - # TODO: debugcommands should use a separate command table - # Side-effect of accessing is debugcommands module is guaranteed to be - # imported and commands.table is populated. - debugcommands.command - # Disable auto-status for some commands which assume that all # files in the result are under Mercurial's control diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -26,6 +26,7 @@ from . import ( changegroup, cmdutil, copies, + debugcommands as debugcommandsmod, destutil, dirstateguard, discovery, @@ -59,6 +60,7 @@ from . import ( release = lockmod.release table = {} +table.update(debugcommandsmod.command._table) command = registrar.command(table) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -32,7 +32,6 @@ from . import ( changegroup, cmdutil, color, - commands, context, dagparser, dagutil, @@ -71,9 +70,7 @@ from . import ( release = lockmod.release -# We reuse the command table from commands because it is easier than -# teaching dispatch about multiple tables. -command = registrar.command(commands.table) +command = registrar.command() @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) def debugancestor(ui, repo, *args): diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -25,7 +25,6 @@ from . import ( cmdutil, color, commands, - debugcommands, demandimport, encoding, error, @@ -750,10 +749,6 @@ def _dispatch(req): rpath = _earlygetopt(["-R", "--repository", "--repo"], args) path, lui = _getlocal(ui, rpath) - # Side-effect of accessing is debugcommands module is guaranteed to be - # imported and commands.table is populated. - debugcommands.command - uis = {ui, lui} if req.repo: