# HG changeset patch # User Raphaël Gomès # Date 2024-03-14 10:24:52 # Node ID d4095f7b000a79f96e77ff88b4fc923aae013df2 # Parent a5d8f261b71674cb5d0833bb605049fe073a966a admin-commands: move the chainsaw extension to the admin commands module Activating an extension is always a little bit of a chore and the long name, options and "chainsaw" bits are deterrent enough. This also allows us to help the discoverability for people looking for repo "administration" tools, with the widest semantic of "administration". diff --git a/hgext/chainsaw.py b/mercurial/admin/chainsaw.py rename from hgext/chainsaw.py rename to mercurial/admin/chainsaw.py --- a/hgext/chainsaw.py +++ b/mercurial/admin/chainsaw.py @@ -8,7 +8,7 @@ "Don't use a chainsaw to cut your food!" -The chainsaw extension provides commands that are so much geared towards a +The chainsaw is a collection of commands that are so much geared towards a specific use case in a specific context or environment that they are totally inappropriate and **really dangerous** in other contexts. @@ -21,25 +21,20 @@ variable (see :hg:`help scripting`). import shutil -from mercurial.i18n import _ -from mercurial import ( +from ..i18n import _ +from .. import ( cmdutil, commands, error, localrepo, registrar, ) -from mercurial.utils import ( +from ..utils import ( urlutil, ) cmdtable = {} command = registrar.command(cmdtable) -# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for -# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should -# be specifying the version(s) of Mercurial they are tested with, or -# leave the attribute unspecified. -testedwith = b'ships-with-hg-core' @command( diff --git a/mercurial/admin_commands.py b/mercurial/admin_commands.py --- a/mercurial/admin_commands.py +++ b/mercurial/admin_commands.py @@ -6,11 +6,12 @@ # GNU General Public License version 2 or any later version. from .i18n import _ -from .admin import verify +from .admin import chainsaw, verify from . import error, registrar, transaction table = {} +table.update(chainsaw.command._table) command = registrar.command(table) diff --git a/tests/test-chainsaw-update.t b/tests/test-chainsaw-update.t --- a/tests/test-chainsaw-update.t +++ b/tests/test-chainsaw-update.t @@ -5,11 +5,6 @@ Tests for the admin::chainsaw-update com setup ===== - $ cat >> $HGRCPATH << EOF - > [extensions] - > chainsaw= - > EOF - $ hg init src $ cd src $ echo 1 > root diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -3,6 +3,7 @@ Show all commands except debug commands abort add addremove + admin::chainsaw-update admin::verify annotate archive @@ -66,6 +67,7 @@ Show all commands that start with "a" abort add addremove + admin::chainsaw-update admin::verify annotate archive @@ -260,6 +262,7 @@ Show all commands + options abort: dry-run add: include, exclude, subrepos, dry-run addremove: similarity, subrepos, include, exclude, dry-run + admin::chainsaw-update: purge-unknown, purge-ignored, rev, source, dest, initial-clone-minimal admin::verify: check, option annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, line-range, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template archive: no-decode, prefix, rev, type, subrepos, include, exclude diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -412,6 +412,9 @@ Test short command list with verbose opt abort abort an unfinished operation (EXPERIMENTAL) add add the specified files on the next commit + admin::chainsaw-update, admin::chainsawupdate + pull and update to a given revision, no matter what, + (EXPERIMENTAL) annotate, blame show changeset information by line for each file clone make a copy of an existing repository @@ -2535,6 +2538,13 @@ Dish up an empty repo; serve it cold. add the specified files on the next commit + + admin::chainsaw-update + + + pull and update to a given revision, no matter what, (EXPERIMENTAL) + + annotate diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -2038,6 +2038,10 @@ help/ shows help topics "topic": "add" }, { + "summary": "pull and update to a given revision, no matter what, (EXPERIMENTAL)", + "topic": "admin::chainsaw-update" + }, + { "summary": "show changeset information by line for each file", "topic": "annotate" },