Patchwork clonebundle: update hook arguments (BC)

login
register
mail settings
Submitter via Mercurial-devel
Date June 20, 2017, 11:28 p.m.
Message ID <8dd6087bc108e13f7da4.1498001338@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21547/
State Accepted
Headers show

Comments

via Mercurial-devel - June 20, 2017, 11:28 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497935677 25200
#      Mon Jun 19 22:14:37 2017 -0700
# Node ID 8dd6087bc108e13f7da4e7f8419dd726cbb790ee
# Parent  6d79e9109908c2cb468c9eeaf8869aa1926fbea8
clonebundle: update hook arguments (BC)

By calling applybundle() with 'clonebundles' and the url instead of
calling processbundle(), the hooks will get different arguments:
HG_SOURCE will be 'clonebundles' instead of 'bundle2' and HG_URL will
be the url instead of 'bundle2'. This is consistent with the bundle1
behavior and seems like a bug fix, but I'm marking it BC anyway.
Gregory Szorc - June 21, 2017, 2:54 a.m.
On Tue, Jun 20, 2017 at 4:28 PM, Martin von Zweigbergk <
martinvonz@google.com> wrote:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1497935677 25200
> #      Mon Jun 19 22:14:37 2017 -0700
> # Node ID 8dd6087bc108e13f7da4e7f8419dd726cbb790ee
> # Parent  6d79e9109908c2cb468c9eeaf8869aa1926fbea8
> clonebundle: update hook arguments (BC)
>

Queued, thanks.

Also, I was curious what applybundle() does and the todo comment in it
is... special. So perhaps there is more refactor work left for this bundle
APIs.


>
> By calling applybundle() with 'clonebundles' and the url instead of
> calling processbundle(), the hooks will get different arguments:
> HG_SOURCE will be 'clonebundles' instead of 'bundle2' and HG_URL will
> be the url instead of 'bundle2'. This is consistent with the bundle1
> behavior and seems like a bug fix, but I'm marking it BC anyway.
>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1997,7 +1997,7 @@
>              cg = readbundle(ui, fh, 'stream')
>
>              if isinstance(cg, bundle2.unbundle20):
> -                bundle2.processbundle(repo, cg, lambda: tr)
> +                bundle2.applybundle(repo, cg, tr, 'clonebundles', url)
>              elif isinstance(cg, streamclone.streamcloneapplier):
>                  cg.apply(repo)
>              else:
>
via Mercurial-devel - June 21, 2017, 5:10 a.m.
On Tue, Jun 20, 2017 at 7:54 PM, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> On Tue, Jun 20, 2017 at 4:28 PM, Martin von Zweigbergk
> <martinvonz@google.com> wrote:
>>
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@google.com>
>> # Date 1497935677 25200
>> #      Mon Jun 19 22:14:37 2017 -0700
>> # Node ID 8dd6087bc108e13f7da4e7f8419dd726cbb790ee
>> # Parent  6d79e9109908c2cb468c9eeaf8869aa1926fbea8
>> clonebundle: update hook arguments (BC)
>
>
> Queued, thanks.
>
> Also, I was curious what applybundle() does and the todo comment in it is...
> special.

Unfortunately not so special (search for "somewhere" and "massive" for
more examples).

> So perhaps there is more refactor work left for this bundle APIs.

Definitely. I've sent a bunch of patches in the last week or so. I
hope to send more.

>
>>
>>
>> By calling applybundle() with 'clonebundles' and the url instead of
>> calling processbundle(), the hooks will get different arguments:
>> HG_SOURCE will be 'clonebundles' instead of 'bundle2' and HG_URL will
>> be the url instead of 'bundle2'. This is consistent with the bundle1
>> behavior and seems like a bug fix, but I'm marking it BC anyway.
>>
>> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
>> --- a/mercurial/exchange.py
>> +++ b/mercurial/exchange.py
>> @@ -1997,7 +1997,7 @@
>>              cg = readbundle(ui, fh, 'stream')
>>
>>              if isinstance(cg, bundle2.unbundle20):
>> -                bundle2.processbundle(repo, cg, lambda: tr)
>> +                bundle2.applybundle(repo, cg, tr, 'clonebundles', url)
>>              elif isinstance(cg, streamclone.streamcloneapplier):
>>                  cg.apply(repo)
>>              else:
>
>

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1997,7 +1997,7 @@ 
             cg = readbundle(ui, fh, 'stream')
 
             if isinstance(cg, bundle2.unbundle20):
-                bundle2.processbundle(repo, cg, lambda: tr)
+                bundle2.applybundle(repo, cg, tr, 'clonebundles', url)
             elif isinstance(cg, streamclone.streamcloneapplier):
                 cg.apply(repo)
             else: