From 1920cf03245ee3d750de77bd773f1bfab53d204b Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 27 Jun 2017 14:30:55 -0700 Subject: [PATCH] bundle2: add some debugging information to the not-a-bundle error I found this useful while trying to debug wireproto-related issues. --- mercurial/bundle2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py index 111729e8b4..3e8db9232e 100644 --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -678,6 +678,9 @@ def getunbundler(ui, fp, magicstring=None): 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: