evolve: drop 4.5 compatibility for patch in tryimportone()
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 07 Mar 2020 02:26:49 +0700
changeset 5186 4bac3454beef
parent 5185 c111d5db3713
child 5187 4230f046ddb9
evolve: drop 4.5 compatibility for patch in tryimportone()
hgext3rd/evolve/__init__.py
--- 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']):