Patchwork [06,of,14,FIX-bundle2] applybundle: take url as argument

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 20, 2015, 2:36 p.m.
Message ID <6a047ac5272421588ec1.1445351782@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11189/
State Accepted
Commit dff05b3f47d22b52487457abcd4eff22797f4195
Headers show

Comments

Pierre-Yves David - Oct. 20, 2015, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1445349304 -7200
#      Tue Oct 20 15:55:04 2015 +0200
# Node ID 6a047ac5272421588ec1ac05bb27a37b97d02998
# Parent  629c8862faa83a0cb61a0279ae0af484f895e824
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 6a047ac52724
applybundle: take url as argument

We allow to specify the url to carry it to hooks. This get use closer to
'bundle1.apply(...)' and will also use to remove regression in multiple place
were we forget to pass the url to hooks.
Gregory Szorc - Oct. 20, 2015, 3:54 p.m.
On Tue, Oct 20, 2015 at 7:36 AM, Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1445349304 -7200
> #      Tue Oct 20 15:55:04 2015 +0200
> # Node ID 6a047ac5272421588ec1ac05bb27a37b97d02998
> # Parent  629c8862faa83a0cb61a0279ae0af484f895e824
> # EXP-Topic generaldelta
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r
> 6a047ac52724
> applybundle: take url as argument
>
> We allow to specify the url to carry it to hooks. This get use closer to
> 'bundle1.apply(...)' and will also use to remove regression in multiple
> place
> were we forget to pass the url to hooks.
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -300,15 +300,17 @@ def _notransaction():
>
>      Raise an exception to highlight the fact that no transaction was
> expected
>      to be created"""
>      raise TransactionUnavailable()
>
> -def applybundle(repo, unbundler, tr, source=None, op=None):
> +def applybundle(repo, unbundler, tr, source=None, url=None, op=None):
>      # transform me in unbundler.apply() as soon as the freeze is lifted
>      tr.hookargs['bundle2'] = '1'
>      if source is not None and 'source' not in tr.hookargs:
>          tr.hookargs['source'] = source
> +    if url is not None and 'source' not in tr.hookargs:
> +        tr.hookargs['url'] = source
>

Two typos where "source" should be "url"


>      return processbundle(repo, unbundler, lambda: tr, op=op)
>
>  def processbundle(repo, unbundler, transactiongetter=None, op=None):
>      """This function process a bundle, apply effect to/from a repo
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -300,15 +300,17 @@  def _notransaction():
 
     Raise an exception to highlight the fact that no transaction was expected
     to be created"""
     raise TransactionUnavailable()
 
-def applybundle(repo, unbundler, tr, source=None, op=None):
+def applybundle(repo, unbundler, tr, source=None, url=None, op=None):
     # transform me in unbundler.apply() as soon as the freeze is lifted
     tr.hookargs['bundle2'] = '1'
     if source is not None and 'source' not in tr.hookargs:
         tr.hookargs['source'] = source
+    if url is not None and 'source' not in tr.hookargs:
+        tr.hookargs['url'] = source
     return processbundle(repo, unbundler, lambda: tr, op=op)
 
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
     """This function process a bundle, apply effect to/from a repo