# HG changeset patch
# User Simon Heimberg <sim...@besonet.ch>
# Date 1243410000 -7200
# Node ID a703c9b518d5fe94002f30bd5b5b7ae73792016e
# Parent  62587c4f0e577faca23d03048c3ad6a070660001
shlib: use repo.opener with atomic file for writing status file

like this, there is never a partialy written file

diff -r 62587c4f0e57 -r a703c9b518d5 thgutil/shlib.py
--- a/thgutil/shlib.py  Mit Jun 10 12:24:31 2009 +0200
+++ b/thgutil/shlib.py  Mit Mai 27 09:40:00 2009 +0200
@@ -92,12 +92,12 @@
             dirstatus[dirname(fn)] = 'm'
         for fn in removed + deleted:
             dirstatus[dirname(fn)] = 'r'
-        f = open(repo.join("thgstatus"), 'wb')
+        f = repo.opener('thgstatus', 'wb', atomictemp=True)
         for dn in sorted(dirstatus):
             s = dirstatus[dn]
             f.write(s + dn + '\n')
             ui.note("%s %s\n" % (s, dn))
-        f.close()
+        f.rename()
 
 else:
     def shell_notify(paths):

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to