Patchwork [1,of,9,V2] largefiles: wrap "rebase.rebase" for functions using it directly

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 5, 2014, 2:34 p.m.
Message ID <9b6c3947b4a79d19097a.1415198050@feefifofum>
Download mbox | patch
Permalink /patch/6580/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Nov. 5, 2014, 2:34 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1415197487 -32400
#      Wed Nov 05 23:24:47 2014 +0900
# Node ID 9b6c3947b4a79d19097a168e377c9cb2c7c959b8
# Parent  832b7ef275c855f6f68d59b9dd8fc539ee1dd4a2
largefiles: wrap "rebase.rebase" for functions using it directly

Before this patch, largefiles extension wraps only "rebase" in the
command table by "extensions.wrapcommand". But there are some
functions using "rebase.rebase" directly.

Without special care for them, largefiles extension can't work
correctly with such functions. In addition to it, "special care" often
becomes complicated and awkward. For example:

  - "unshelve" can't get correct result of "rebase.rebase", because of
    lack of special care

  - special care for "hg pull --rebase" causes issue3861

This patch wraps "rebase.rebase" for functions using it directly.

For simplicity, this patch keeps 'special care for "hg pull --rebase"'.
It is removed in the subsequent patch.
Martin von Zweigbergk - Nov. 5, 2014, 4:57 p.m.
On Wed Nov 05 2014 at 6:35:01 AM FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
wrote:

> diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
> --- a/hgext/largefiles/uisetup.py
> +++ b/hgext/largefiles/uisetup.py
> @@ -169,6 +169,8 @@
>          if name == 'rebase':
>              extensions.wrapcommand(getattr(module, 'cmdtable'), 'rebase',
>                  overrides.overriderebase)
> +            extensions.wrapfunction(module, 'rebase',
> +                                    overrides.overriderebase)
>

Do we still need to wrap the command or is it enough to wrap the function?
Does the command call the function?
Martin von Zweigbergk - Nov. 5, 2014, 6:17 p.m.
On Wed Nov 05 2014 at 8:57:44 AM Martin von Zweigbergk <
martinvonz@google.com> wrote:

> On Wed Nov 05 2014 at 6:35:01 AM FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> wrote:
>
>> diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
>> --- a/hgext/largefiles/uisetup.py
>> +++ b/hgext/largefiles/uisetup.py
>> @@ -169,6 +169,8 @@
>>          if name == 'rebase':
>>              extensions.wrapcommand(getattr(module, 'cmdtable'),
>> 'rebase',
>>                  overrides.overriderebase)
>> +            extensions.wrapfunction(module, 'rebase',
>> +                                    overrides.overriderebase)
>>
>
> Do we still need to wrap the command or is it enough to wrap the function?
> Does the command call the function?
>
>

I now see how it works (the function is simply stored in the cmdtable), so
please ignore my question.

Patch

diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -169,6 +169,8 @@ 
         if name == 'rebase':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'rebase',
                 overrides.overriderebase)
+            extensions.wrapfunction(module, 'rebase',
+                                    overrides.overriderebase)
         if name == 'transplant':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'transplant',
                 overrides.overridetransplant)