changeset 50987:727428c7e1fc

commands: add admin namespace In order to stop abusing the 'debug' namespace for non-debug command, it adds a new 'admin' namespace dedicated to 'admin' operations on a repository (i.e commands suitable for administration tasks). This namespace entry would be used to migrate in the future some existing commands from the 'debug' namespace, or other top level commands that may not be directly exposed to end users. (verify command is a perfect candidate for this case)
author Franck Bret <franck.bret@octobus.net>
date Wed, 25 Jan 2023 15:33:39 +0100
parents 8343947af6a7
children cf47b83d8ad0
files mercurial/admin/__init__.py mercurial/admin_commands.py mercurial/commands.py setup.py tests/test-alias.t
diffstat 4 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/admin_commands.py	Wed Jan 25 15:33:39 2023 +0100
@@ -0,0 +1,11 @@
+# admin_commands.py - command processing for admin* commands
+#
+# Copyright 2022 Mercurial Developers
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from . import registrar
+
+table = {}
+command = registrar.command(table)
--- a/mercurial/commands.py	Wed Aug 09 15:46:35 2023 +0200
+++ b/mercurial/commands.py	Wed Jan 25 15:33:39 2023 +0100
@@ -19,6 +19,7 @@
     wdirrev,
 )
 from . import (
+    admin_commands as admin_commands_mod,
     archival,
     bookmarks,
     bundle2,
@@ -75,6 +76,7 @@
 
 table = {}
 table.update(debugcommandsmod.command._table)
+table.update(admin_commands_mod.command._table)
 
 command = registrar.command(table)
 INTENT_READONLY = registrar.INTENT_READONLY
--- a/setup.py	Wed Aug 09 15:46:35 2023 +0200
+++ b/setup.py	Wed Jan 25 15:33:39 2023 +0100
@@ -1309,6 +1309,7 @@
 
 packages = [
     'mercurial',
+    'mercurial.admin',
     'mercurial.cext',
     'mercurial.cffi',
     'mercurial.defaultrc',
--- a/tests/test-alias.t	Wed Aug 09 15:46:35 2023 +0200
+++ b/tests/test-alias.t	Wed Jan 25 15:33:39 2023 +0100
@@ -68,17 +68,17 @@
 help
 
   $ hg help -c | grep myinit
-   myinit       This is my documented alias for init.
+   myinit        This is my documented alias for init.
   $ hg help -c | grep mycommit
-   mycommit     This is my alias with only doc.
+   mycommit      This is my alias with only doc.
   $ hg help -c | grep cleanstatus
   [1]
   $ hg help -c | grep lognull
-   lognull      Logs the null rev
+   lognull       Logs the null rev
   $ hg help -c | grep dln
   [1]
   $ hg help -c | grep recursivedoc
-   recursivedoc Logs the null rev in debug mode
+   recursivedoc  Logs the null rev in debug mode
   $ hg help myinit
   hg myinit [OPTIONS] [BLA] [BLE]
   
@@ -603,7 +603,7 @@
 help for a shell alias
 
   $ hg help -c | grep rebate
-   rebate       This is my alias which just prints something.
+   rebate        This is my alias which just prints something.
   $ hg help rebate
   hg rebate [MYARGS]