Patchwork [STABLE] unbundle: cleanly abort on unknown bundle2 feature

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 25, 2015, 8:46 p.m.
Message ID <0b61757d647d473e8339.1443213977@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10643/
State Superseded
Headers show

Comments

Pierre-Yves David - Sept. 25, 2015, 8:46 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1443213049 25200
#      Fri Sep 25 13:30:49 2015 -0700
# Branch stable
# Node ID 0b61757d647d473e8339be449b20cccd0084df3c
# Parent  0dda3692ec9b6b9e220ad7afa1434b553f8f62c0
unbundle: cleanly abort on unknown bundle2 feature

The exception wasn't caught and resulted in a traceback.
Matt Mackall - Sept. 26, 2015, 3:03 a.m.
On Fri, 2015-09-25 at 13:46 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1443213049 25200
> #      Fri Sep 25 13:30:49 2015 -0700
> # Branch stable
> # Node ID 0b61757d647d473e8339be449b20cccd0084df3c
> # Parent  0dda3692ec9b6b9e220ad7afa1434b553f8f62c0
> unbundle: cleanly abort on unknown bundle2 feature

Queued for stable, thanks. Test case?
Augie Fackler - Sept. 26, 2015, 3:06 a.m.
> On Sep 25, 2015, at 11:03 PM, Matt Mackall <mpm@selenic.com> wrote:
> 
> On Fri, 2015-09-25 at 13:46 -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1443213049 25200
>> #      Fri Sep 25 13:30:49 2015 -0700
>> # Branch stable
>> # Node ID 0b61757d647d473e8339be449b20cccd0084df3c
>> # Parent  0dda3692ec9b6b9e220ad7afa1434b553f8f62c0
>> unbundle: cleanly abort on unknown bundle2 feature
> 
> Queued for stable, thanks. Test case?

The version he sent for default (flag contains DUP) contains a test.

> 
> --
> Mathematics is the supreme nostalgia of our time.
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Sept. 26, 2015, 10:13 a.m.
On 09/25/2015 08:06 PM, Augie Fackler wrote:
>
>> On Sep 25, 2015, at 11:03 PM, Matt Mackall <mpm@selenic.com> wrote:
>>
>> On Fri, 2015-09-25 at 13:46 -0700, Pierre-Yves David wrote:
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>>> # Date 1443213049 25200
>>> #      Fri Sep 25 13:30:49 2015 -0700
>>> # Branch stable
>>> # Node ID 0b61757d647d473e8339be449b20cccd0084df3c
>>> # Parent  0dda3692ec9b6b9e220ad7afa1434b553f8f62c0
>>> unbundle: cleanly abort on unknown bundle2 feature
>>
>> Queued for stable, thanks. Test case?
>
> The version he sent for default (flag contains DUP) contains a test.

A test was easier on default. The default version actually rely on the 6 
patches series that start with:

- changegroup: use a different compression key for BZ in HG10

I'll push the default version of this patch once this series it taken

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6370,10 +6370,16 @@  def unbundle(ui, repo, fname1, *fnames, 
             if isinstance(gen, bundle2.unbundle20):
                 tr = repo.transaction('unbundle')
                 try:
                     op = bundle2.processbundle(repo, gen, lambda: tr)
                     tr.close()
+                except error.UnsupportedPartError as exc:
+                    raise util.Abort(_('%s: unknown bundle feature, %s')
+                                     % (fname, exc),
+                                     hint=_("see https://mercurial.selenic.com/"
+                                            "wiki/BundleFeature for more "
+                                            "information"))
                 finally:
                     if tr:
                         tr.release()
                 changes = [r.get('result', 0)
                            for r in op.records['changegroup']]