[PATCH 1 of 2] debug: add a debugcapabilities commands
Boris Feld
boris.feld at octobus.net
Thu Nov 2 09:43:11 UTC 2017
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1509379696 -3600
# Mon Oct 30 17:08:16 2017 +0100
# Node ID dbbc24ac042afccea32d4ba05a887bf2040de5ca
# Parent 3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic debugcap
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r dbbc24ac042a
debug: add a debugcapabilities commands
This new debugcommand prints the capabilities of any remote in a human friendly
way. Improved bundle2 capabilities support will be introduced in the next
changesets.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -360,6 +360,16 @@ def debugbundle(ui, bundlepath, all=None
return _debugbundle2(ui, gen, all=all, **opts)
_debugchangegroup(ui, gen, all=all, **opts)
+ at command('debugcapabilities',
+ [], _('PATH'),
+ norepo=True)
+def debugcapabilities(ui, path, **opts):
+ """lists the capabilities of a remote peer"""
+ peer = hg.peer(ui, opts, path)
+ caps = peer.capabilities()
+ ui.write(('Main capabilities:\n'))
+ for c in sorted(caps):
+ ui.write((' %s\n') % c)
@command('debugcheckstate', [], '')
def debugcheckstate(ui, repo):
"""validate the correctness of the current dirstate"""
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -72,6 +72,7 @@ Show debug commands if there are no othe
debugapplystreamclonebundle
debugbuilddag
debugbundle
+ debugcapabilities
debugcheckstate
debugcolor
debugcommands
@@ -249,6 +250,7 @@ Show all commands + options
debugapplystreamclonebundle:
debugbuilddag: mergeable-file, overwritten-file, new-file
debugbundle: all, part-type, spec
+ debugcapabilities:
debugcheckstate:
debugcolor: style
debugcommands:
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -156,3 +156,15 @@ Test internal debugstacktrace command
from h hidden in g at:
debugstacktrace.py:6 in f
debugstacktrace.py:9 in g
+
+Test debugcapabilities command:
+
+ $ hg debugcapabilities ./debugrevlog/
+ Main capabilities:
+ branchmap
+ bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps
+ getbundle
+ known
+ lookup
+ pushkey
+ unbundle
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -895,6 +895,8 @@ Test list of internal help commands
builds a repo with a given DAG from scratch in the current
empty repo
debugbundle lists the contents of a bundle
+ debugcapabilities
+ lists the capabilities of a remote peer
debugcheckstate
validate the correctness of the current dirstate
debugcolor show available color, effects or style
More information about the Mercurial-devel
mailing list