# HG changeset patch # User Pierre-Yves David # Date 1523982656 -7200 # Node ID 9c12b6520a20f5261c9029101d5b2f7b108e39e7 # Parent f4d5ef9ba074bf38610baf7a0492c2a3d8cc9342 import: adapt to fd1dd79cff20 With the latest state of the code, the patch is passed to "import try one" as parsed. diff -r f4d5ef9ba074 -r 9c12b6520a20 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue Apr 17 18:10:53 2018 +0200 +++ b/hgext3rd/evolve/__init__.py Tue Apr 17 18:30:56 2018 +0200 @@ -886,17 +886,21 @@ @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): expected = {'node': None} - oldextract = patch.extract + 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 + 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) - finally: - patch.extract = oldextract created = ret[1] if (opts['obsolete'] and None not in (created, expected['node']) and created != expected['node']):