# HG changeset patch # User Pierre-Yves David # Date 1470949246 -7200 # Node ID b4be34677fda8975bf664eeb4b8d9a9ad6c17c2d # Parent d3429d25e0cb698d348edb6a67a64f8b9e6eeda3 continue: ensure we hold the wlock before writing file to disk A hack in 'hg evolve --continue' involve writing a 'graftstate' file. We take the wlock before doing so. diff -r d3429d25e0cb -r b4be34677fda hgext/evolve.py --- a/hgext/evolve.py Tue Aug 09 00:37:58 2016 +0200 +++ b/hgext/evolve.py Thu Aug 11 23:00:46 2016 +0200 @@ -1794,14 +1794,18 @@ raise error.Abort('no evolve to continue') orig = repo[state['current']] # XXX This is a terrible terrible hack, please get rid of it. - repo.opener.write('graftstate', orig.hex() + '\n') + lock = repo.wlock() try: - graftcmd = commands.table['graft'][0] - ret = graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) - _evolvestatedelete(repo) - return ret + repo.opener.write('graftstate', orig.hex() + '\n') + try: + graftcmd = commands.table['graft'][0] + ret = graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) + _evolvestatedelete(repo) + return ret + finally: + util.unlinkpath(repo.join('graftstate'), ignoremissing=True) finally: - util.unlinkpath(repo.join('graftstate'), ignoremissing=True) + lock.release() cmdutil.bailifchanged(repo)