diff mercurial/dispatch.py @ 30401:869d660b8669

debugcommands: introduce standalone module for debug commands commands.py is our largest .py file by nearly 2x. Debug commands live in a world of their own. So let's extract them to their own module. We start with "debugancestor." We currently reuse the commands table with commands.py and have a hack in dispatch.py for loading debugcommands.py. In the future, we could potentially use a separate commands table and avoid the import of debugcommands.py.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 17 Aug 2016 21:07:38 -0700
parents b19c2679289c
children 7f2b18c34c02
line wrap: on
line diff
--- a/mercurial/dispatch.py	Mon Nov 14 23:17:15 2016 +0000
+++ b/mercurial/dispatch.py	Wed Aug 17 21:07:38 2016 -0700
@@ -26,6 +26,7 @@
 from . import (
     cmdutil,
     commands,
+    debugcommands,
     demandimport,
     encoding,
     error,
@@ -768,6 +769,10 @@
 
     # (reposetup is handled in hg.repository)
 
+    # Side-effect of accessing is debugcommands module is guaranteed to be
+    # imported and commands.table is populated.
+    debugcommands.command
+
     addaliases(lui, commands.table)
 
     # All aliases and commands are completely defined, now.