diff mercurial/hg.py @ 421:43b8da7420a9

[PATCH] rename under the other OS -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] rename under the other OS From: K Thananchayan <thananck@yahoo.com> Rename fails under windows if dest file exists. This patch add a rename method to util module that removes the dest file and retries if initial attempt fails. manifest hash: 2744d9fd1717e15133b411a269df909fa8ec0faf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNzDywK+sNU5EO8RAsPBAJ9NQN3bTuJvTem5x+utGnoMkhYc0QCbBFSJ PoMP69H1UnVE6drFlnlFE0s= =pePw -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 21 Jun 2005 19:36:35 -0800
parents dbe86d465e09
children 183c87d4e1a0
line wrap: on
line diff
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -338,7 +338,7 @@ def opener(base):
             else:
                 if s.st_nlink > 1:
                     file(f + ".tmp", "wb").write(file(f, "rb").read())
-                    os.rename(f+".tmp", f)
+                    util.rename(f+".tmp", f)
 
         return file(f, mode)
 
@@ -482,7 +482,7 @@ class localrepository:
             self.ui.status("attempting to rollback last transaction\n")
             transaction.rollback(self.opener, self.join("undo"))
             self.dirstate = None
-            os.rename(self.join("undo.dirstate"), self.join("dirstate"))
+            util.rename(self.join("undo.dirstate"), self.join("dirstate"))
             self.dirstate = dirstate(self.opener, self.ui, self.root)
         else:
             self.ui.warn("no undo information available\n")