[PATCH 2 of 2] debug: print parsed bundle2 capabilities with debugcapabilities

Boris Feld boris.feld at octobus.net
Thu Nov 2 05:43:12 EDT 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1509379769 -3600
#      Mon Oct 30 17:09:29 2017 +0100
# Node ID d70fcb439e0b72e4124d209554be599952b85651
# Parent  dbbc24ac042afccea32d4ba05a887bf2040de5ca
# EXP-Topic debugcap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d70fcb439e0b
debug: print parsed bundle2 capabilities with debugcapabilities

The bundle2 capabilities are hard to read in their encoded form. We parse and
print them in a human friendly way.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -370,6 +370,14 @@ def debugcapabilities(ui, path, **opts):
     ui.write(('Main capabilities:\n'))
     for c in sorted(caps):
         ui.write(('  %s\n') % c)
+    b2caps = bundle2.bundle2caps(peer)
+    if b2caps:
+        ui.write(('Bundle2 capabilities:\n'))
+        for key, values in sorted(b2caps.iteritems()):
+            ui.write(('  %s\n') % key)
+            for v in values:
+                ui.write(('    %s\n') % v)
+
 @command('debugcheckstate', [], '')
 def debugcheckstate(ui, repo):
     """validate the correctness of the current dirstate"""
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -168,3 +168,25 @@ Test debugcapabilities command:
     lookup
     pushkey
     unbundle
+  Bundle2 capabilities:
+    HG20
+    changegroup
+      01
+      02
+    digests
+      md5
+      sha1
+      sha512
+    error
+      abort
+      unsupportedcontent
+      pushraced
+      pushkey
+    hgtagsfnodes
+    listkeys
+    phases
+      heads
+    pushkey
+    remote-changegroup
+      http
+      https


More information about the Mercurial-devel mailing list