changeset 5186:4bac3454beef

evolve: drop 4.5 compatibility for patch in tryimportone()
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 07 Mar 2020 02:26:49 +0700
parents c111d5db3713
children 4230f046ddb9
files hgext3rd/evolve/__init__.py
diffstat 1 files changed, 2 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Sat Mar 07 02:03:28 2020 +0700
+++ b/hgext3rd/evolve/__init__.py	Sat Mar 07 02:26:49 2020 +0700
@@ -276,7 +276,6 @@
     lock as lockmod,
     logcmdutil,
     node,
-    patch,
     pycompat,
     revset,
     scmutil,
@@ -793,21 +792,8 @@
 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
     expected = {b'node': None}
-    if not util.safehasattr(hunk, 'get'): # hg < 4.6
-        oldextract = patch.extract
-
-        def extract(*args, **kwargs):
-            ret = oldextract(*args, **kwargs)
-            _getnodefrompatch(ret, expected)
-            return ret
-        try:
-            patch.extract = extract
-            ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
-        finally:
-            patch.extract = oldextract
-    else:
-        _getnodefrompatch(hunk, expected)
-        ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
+    _getnodefrompatch(hunk, expected)
+    ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
     created = ret[1]
     if (opts[b'obsolete'] and None not in (created, expected[b'node'])
         and created != expected[b'node']):