debug: print parsed bundle2 capabilities with debugcapabilities
authorBoris Feld <boris.feld@octobus.net>
Mon, 30 Oct 2017 17:09:29 +0100
changeset 34960 762ea8a1f5e7
parent 34959 7ee2d859f720
child 34961 a7e49a5b3e6f
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.
mercurial/debugcommands.py
tests/test-debugcommands.t
--- a/mercurial/debugcommands.py	Mon Oct 30 17:08:16 2017 +0100
+++ b/mercurial/debugcommands.py	Mon Oct 30 17:09:29 2017 +0100
@@ -370,6 +370,14 @@
     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"""
--- a/tests/test-debugcommands.t	Mon Oct 30 17:08:16 2017 +0100
+++ b/tests/test-debugcommands.t	Mon Oct 30 17:09:29 2017 +0100
@@ -168,3 +168,25 @@
     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