Mercurial > hg > evolve
changeset 1818:b4be34677fda
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.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 11 Aug 2016 23:00:46 +0200 |
parents | d3429d25e0cb |
children | 2672f36d668e |
files | hgext/evolve.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -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)