# HG changeset patch # User Pierre-Yves David # Date 1523980692 -7200 # Node ID c82f0d5740b4955606301ff8f5a4e09f7718379b # Parent 1043e9c5435555fbb3e3b2862ef6384caf567114 import: use a less direct approach to store the expected node This will help later refactoring. diff -r 1043e9c54355 -r c82f0d5740b4 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue Apr 17 15:45:58 2018 +0200 +++ b/hgext3rd/evolve/__init__.py Tue Apr 17 17:58:12 2018 +0200 @@ -880,10 +880,11 @@ @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): + expected = {'node': None} extracted = patch.extract(ui, hunk) - expected = extracted.get('nodeid') - if expected is not None: - expected = node.bin(expected) + expectednode = extracted.get('nodeid') + if expectednode is not None: + expected['node'] = node.bin(expectednode) oldextract = patch.extract try: patch.extract = lambda ui, hunk: extracted @@ -891,12 +892,12 @@ finally: patch.extract = oldextract created = ret[1] - if (opts['obsolete'] and None not in (created, expected) - and created != expected): + if (opts['obsolete'] and None not in (created, expected['node']) + and created != expected['node']): tr = repo.transaction('import-obs') try: metadata = {'user': ui.username()} - repo.obsstore.create(tr, expected, (created,), + repo.obsstore.create(tr, expected['node'], (created,), metadata=metadata) tr.close() finally: