[PATCH 1 of 2] bundle2: add some debugging information to the not-a-bundle error

Siddharth Agarwal sid0 at fb.com
Tue Jun 27 21:38:42 UTC 2017


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1498599055 25200
#      Tue Jun 27 14:30:55 2017 -0700
# Node ID 8b59a6d6f77927cc7b40b282056278829ca398b3
# Parent  eb4c49f55f1f0d7719f514c16bec54515eb54f62
bundle2: add some debugging information to the not-a-bundle error

I found this useful while trying to debug wireproto-related issues.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -678,6 +678,9 @@ def getunbundler(ui, fp, magicstring=Non
         magicstring = changegroup.readexactly(fp, 4)
     magic, version = magicstring[0:2], magicstring[2:4]
     if magic != 'HG':
+        ui.debug(
+            "error: invalid magic: %r (version %r), should be 'HG'\n"
+            % (magic, version))
         raise error.Abort(_('not a Mercurial bundle'))
     unbundlerclass = formatmap.get(version)
     if unbundlerclass is None:


More information about the Mercurial-devel mailing list