import: grab the expected node value on the fly
We no longer parse the patch beforehand this will reduce inconsistency with
newer API.
--- a/hgext3rd/evolve/__init__.py Tue Apr 17 17:58:12 2018 +0200
+++ b/hgext3rd/evolve/__init__.py Tue Apr 17 18:10:53 2018 +0200
@@ -878,16 +878,22 @@
_('mark the old node as obsoleted by '
'the created commit')))
+def _getnodefrompatch(patch, dest):
+ patchnode = patch.get('nodeid')
+ if patchnode is not None:
+ dest['node'] = node.bin(patchnode)
+
@eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
expected = {'node': None}
- extracted = patch.extract(ui, hunk)
- expectednode = extracted.get('nodeid')
- if expectednode is not None:
- expected['node'] = node.bin(expectednode)
oldextract = patch.extract
+
+ def extract(*args, **kwargs):
+ ret = oldextract(*args, **kwargs)
+ _getnodefrompatch(ret, expected)
+ return ret
try:
- patch.extract = lambda ui, hunk: extracted
+ patch.extract = extract
ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
finally:
patch.extract = oldextract