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

login
register
mail settings
Submitter Siddharth Agarwal
Date June 27, 2017, 9:38 p.m.
Message ID <8b59a6d6f77927cc7b40.1498599522@devvm31800.prn1.facebook.com>
Download mbox | patch
Permalink /patch/21788/
State Accepted
Headers show

Comments

Siddharth Agarwal - June 27, 2017, 9:38 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.
Yuya Nishihara - June 29, 2017, 1:13 p.m.
On Tue, 27 Jun 2017 14:38:42 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@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

Queued, thanks.

Patch

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: