Mercurial > evolve
changeset 3671:c82f0d5740b4
import: use a less direct approach to store the expected node
This will help later refactoring.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 17 Apr 2018 17:58:12 +0200 |
parents | 1043e9c54355 |
children | f4d5ef9ba074 |
files | hgext3rd/evolve/__init__.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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: