Patchwork [evolve-ext] evolve: fix for evolve:96cb98989d57. _filterederror was moved from context

login
register
mail settings
Submitter James Reynolds
Date April 20, 2018, 7:42 p.m.
Message ID <4b4d9ced1462587eb1e8.1524253346@James-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/31207/
State Accepted
Headers show

Comments

James Reynolds - April 20, 2018, 7:42 p.m.
# HG changeset patch
# User James Reynolds <james.glenn.reynolds@gmail.com>
# Date 1524253036 14400
#      Fri Apr 20 15:37:16 2018 -0400
# Node ID 4b4d9ced1462587eb1e8a912d8915acbffd85f6b
# Parent  29c413a7dfb542e80aa0a8900718a3aa62d5aa04
evolve: fix for evolve:96cb98989d57. _filterederror was moved from context
to scmutil in hg:ecd3f6909184. This patch should handle both cases to retain
compatability for versions less then 4.6 (context) and 4.6 and above (scmutil)
Boris Feld - April 23, 2018, 11:56 a.m.
The bug has been fixed in another way. We dropped support for hg 4.6 as 
core has all the information.

Thank you for the bug report.


On 20/04/2018 20:42, James Reynolds wrote:
> # HG changeset patch
> # User James Reynolds <james.glenn.reynolds@gmail.com>
> # Date 1524253036 14400
> #      Fri Apr 20 15:37:16 2018 -0400
> # Node ID 4b4d9ced1462587eb1e8a912d8915acbffd85f6b
> # Parent  29c413a7dfb542e80aa0a8900718a3aa62d5aa04
> evolve: fix for evolve:96cb98989d57. _filterederror was moved from context
> to scmutil in hg:ecd3f6909184. This patch should handle both cases to retain
> compatability for versions less then 4.6 (context) and 4.6 and above (scmutil)
>
> diff -r 29c413a7dfb5 -r 4b4d9ced1462 hgext3rd/evolve/__init__.py
> --- a/hgext3rd/evolve/__init__.py	Thu Apr 19 16:27:13 2018 +0200
> +++ b/hgext3rd/evolve/__init__.py	Fri Apr 20 15:37:16 2018 -0400
> @@ -720,8 +720,13 @@
>   
>       ui.warn("(%s)\n" % solvemsg)
>   
> -if util.safehasattr(context, '_filterederror'): # <= hg-4.5
> -    @eh.wrapfunction(scmutil, '_filterederror')
> +if util.safehasattr(context, '_filterederror') or util.safehasattr(scmutil, '_filterederror'):
> +    if util.safehasattr(context, '_filterederror'): # <= hg-4.5
> +        _module = context
> +    else:
> +        _module = scmutil # >= hg-4.6
> +
> +    @eh.wrapfunction(_module, '_filterederror')
>       def evolve_filtererror(original, repo, changeid):
>           """build an exception to be raised about a filtered changeid
>   
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff -r 29c413a7dfb5 -r 4b4d9ced1462 hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Thu Apr 19 16:27:13 2018 +0200
+++ b/hgext3rd/evolve/__init__.py	Fri Apr 20 15:37:16 2018 -0400
@@ -720,8 +720,13 @@ 
 
     ui.warn("(%s)\n" % solvemsg)
 
-if util.safehasattr(context, '_filterederror'): # <= hg-4.5
-    @eh.wrapfunction(scmutil, '_filterederror')
+if util.safehasattr(context, '_filterederror') or util.safehasattr(scmutil, '_filterederror'):
+    if util.safehasattr(context, '_filterederror'): # <= hg-4.5
+        _module = context
+    else:
+        _module = scmutil # >= hg-4.6
+
+    @eh.wrapfunction(_module, '_filterederror')
     def evolve_filtererror(original, repo, changeid):
         """build an exception to be raised about a filtered changeid