--- 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