Mercurial > hg-stable
changeset 5738:2a54e2b177b6
bisect: use proper locking when updating bisect.state
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Dec 2007 23:55:40 -0600 |
parents | 6c8df073c3ee |
children | 45fa7b1c5d4c |
files | hgext/hbisect.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/hbisect.py Thu Dec 27 23:55:40 2007 -0600 +++ b/hgext/hbisect.py Thu Dec 27 23:55:40 2007 -0600 @@ -132,10 +132,15 @@ state['skip'].append(node) # save state - f = repo.opener("bisect.state", "w") - for kind in state: - for node in state[kind]: - f.write("%s %s\n" % (kind, hg.hex(node))) + f = repo.opener("bisect.state", "w", atomictemp=True) + wlock = repo.wlock() + try: + for kind in state: + for node in state[kind]: + f.write("%s %s\n" % (kind, hg.hex(node))) + f.rename() + finally: + del wlock if not state['good'] or not state['bad']: return