Patchwork [topic-ext] compat: tolerate missing rebase extension

login
register
mail settings
Submitter timeless
Date July 8, 2016, 5:01 p.m.
Message ID <3966e3562da5738339d5.1467997286@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/15774/
State Accepted
Headers show

Comments

timeless - July 8, 2016, 5:01 p.m.
# HG changeset patch
# User timeless@gmail.com
# Date 1467997183 0
#      Fri Jul 08 16:59:43 2016 +0000
# Node ID 3966e3562da5738339d5a5aad138b9ce33d37734
# Parent  c5d4e856ad0e971e055913269acc5a6a313d3c2e
compat: tolerate missing rebase extension
Jun Wu - July 8, 2016, 5:36 p.m.
Looks good to me. Marked as Pre-Reviewed.

Excerpts from timeless's message of 2016-07-08 17:01:26 +0000:
> # HG changeset patch
> # User timeless@gmail.com
> # Date 1467997183 0
> #      Fri Jul 08 16:59:43 2016 +0000
> # Node ID 3966e3562da5738339d5a5aad138b9ce33d37734
> # Parent  c5d4e856ad0e971e055913269acc5a6a313d3c2e
> compat: tolerate missing rebase extension
> 
> diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/__init__.py
> --- a/hgext3rd/topic/__init__.py    Wed May 11 16:22:52 2016 +0200
> +++ b/hgext3rd/topic/__init__.py    Fri Jul 08 16:59:43 2016 +0000
> @@ -320,8 +320,11 @@
>      def newmakeextrafn(orig, copiers):
>          return orig(copiers + [savetopic])
>  
> -    rebase = extensions.find("rebase")
> -    extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
> +    try:
> +        rebase = extensions.find("rebase")
> +        extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
> +    except KeyError:
> +        pass
>  
>  ## preserve topic during import/export
>  
> diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/destination.py
> --- a/hgext3rd/topic/destination.py    Wed May 11 16:22:52 2016 +0200
> +++ b/hgext3rd/topic/destination.py    Fri Jul 08 16:59:43 2016 +0000
> @@ -94,7 +94,10 @@
>      """run a uisetup time to install all destinations wrapping"""
>      if util.safehasattr(destutil, '_destmergebranch'):
>          extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
> -    rebase = extensions.find('rebase')
> +    try:
> +        rebase = extensions.find('rebase')
> +    except KeyError:
> +        rebase = None
>      if (util.safehasattr(rebase, '_destrebase')
>              # logic not shared with merge yet < hg-3.8
>              and not util.safehasattr(rebase, '_definesets')):
Pierre-Yves David - July 13, 2016, 4:28 p.m.
Pushed, thanks.

On 07/08/2016 07:36 PM, Jun Wu wrote:
> Looks good to me. Marked as Pre-Reviewed.
> 
> Excerpts from timeless's message of 2016-07-08 17:01:26 +0000:
>> # HG changeset patch
>> # User timeless@gmail.com
>> # Date 1467997183 0
>> #      Fri Jul 08 16:59:43 2016 +0000
>> # Node ID 3966e3562da5738339d5a5aad138b9ce33d37734
>> # Parent  c5d4e856ad0e971e055913269acc5a6a313d3c2e
>> compat: tolerate missing rebase extension
>>
>> diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/__init__.py
>> --- a/hgext3rd/topic/__init__.py    Wed May 11 16:22:52 2016 +0200
>> +++ b/hgext3rd/topic/__init__.py    Fri Jul 08 16:59:43 2016 +0000
>> @@ -320,8 +320,11 @@
>>      def newmakeextrafn(orig, copiers):
>>          return orig(copiers + [savetopic])
>>  
>> -    rebase = extensions.find("rebase")
>> -    extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
>> +    try:
>> +        rebase = extensions.find("rebase")
>> +        extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
>> +    except KeyError:
>> +        pass
>>  
>>  ## preserve topic during import/export
>>  
>> diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/destination.py
>> --- a/hgext3rd/topic/destination.py    Wed May 11 16:22:52 2016 +0200
>> +++ b/hgext3rd/topic/destination.py    Fri Jul 08 16:59:43 2016 +0000
>> @@ -94,7 +94,10 @@
>>      """run a uisetup time to install all destinations wrapping"""
>>      if util.safehasattr(destutil, '_destmergebranch'):
>>          extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
>> -    rebase = extensions.find('rebase')
>> +    try:
>> +        rebase = extensions.find('rebase')
>> +    except KeyError:
>> +        rebase = None
>>      if (util.safehasattr(rebase, '_destrebase')
>>              # logic not shared with merge yet < hg-3.8
>>              and not util.safehasattr(rebase, '_definesets')):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Wed May 11 16:22:52 2016 +0200
+++ b/hgext3rd/topic/__init__.py	Fri Jul 08 16:59:43 2016 +0000
@@ -320,8 +320,11 @@ 
     def newmakeextrafn(orig, copiers):
         return orig(copiers + [savetopic])
 
-    rebase = extensions.find("rebase")
-    extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
+    try:
+        rebase = extensions.find("rebase")
+        extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
+    except KeyError:
+        pass
 
 ## preserve topic during import/export
 
diff -r c5d4e856ad0e -r 3966e3562da5 hgext3rd/topic/destination.py
--- a/hgext3rd/topic/destination.py	Wed May 11 16:22:52 2016 +0200
+++ b/hgext3rd/topic/destination.py	Fri Jul 08 16:59:43 2016 +0000
@@ -94,7 +94,10 @@ 
     """run a uisetup time to install all destinations wrapping"""
     if util.safehasattr(destutil, '_destmergebranch'):
         extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
-    rebase = extensions.find('rebase')
+    try:
+        rebase = extensions.find('rebase')
+    except KeyError:
+        rebase = None
     if (util.safehasattr(rebase, '_destrebase')
             # logic not shared with merge yet < hg-3.8
             and not util.safehasattr(rebase, '_definesets')):