changeset 4329:cea5ba038a1d

use atomictemp files to write branch.cache
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 09 Apr 2007 04:24:17 -0300
parents 1083ae4b5f0e
children 1b9fc3f48861
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Apr 09 04:24:17 2007 -0300
+++ b/mercurial/localrepo.py	Mon Apr 09 04:24:17 2007 -0300
@@ -421,10 +421,11 @@
 
     def _writebranchcache(self, branches, tip, tiprev):
         try:
-            f = self.opener("branch.cache", "w")
+            f = self.opener("branch.cache", "w", atomictemp=True)
             f.write("%s %s\n" % (hex(tip), tiprev))
             for label, node in branches.iteritems():
                 f.write("%s %s\n" % (hex(node), label))
+            f.rename()
         except IOError:
             pass