From patchwork Tue Jun 27 21:38:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 2] bundle2: add some debugging information to the not-a-bundle error From: Siddharth Agarwal X-Patchwork-Id: 21788 Message-Id: <8b59a6d6f77927cc7b40.1498599522@devvm31800.prn1.facebook.com> To: Date: Tue, 27 Jun 2017 14:38:42 -0700 # HG changeset patch # User Siddharth Agarwal # 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: