Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
420:dbe86d465e09 | 421:43b8da7420a9 |
---|---|
336 if not os.path.isdir(d): | 336 if not os.path.isdir(d): |
337 os.makedirs(d) | 337 os.makedirs(d) |
338 else: | 338 else: |
339 if s.st_nlink > 1: | 339 if s.st_nlink > 1: |
340 file(f + ".tmp", "wb").write(file(f, "rb").read()) | 340 file(f + ".tmp", "wb").write(file(f, "rb").read()) |
341 os.rename(f+".tmp", f) | 341 util.rename(f+".tmp", f) |
342 | 342 |
343 return file(f, mode) | 343 return file(f, mode) |
344 | 344 |
345 return o | 345 return o |
346 | 346 |
480 lock = self.lock() | 480 lock = self.lock() |
481 if os.path.exists(self.join("undo")): | 481 if os.path.exists(self.join("undo")): |
482 self.ui.status("attempting to rollback last transaction\n") | 482 self.ui.status("attempting to rollback last transaction\n") |
483 transaction.rollback(self.opener, self.join("undo")) | 483 transaction.rollback(self.opener, self.join("undo")) |
484 self.dirstate = None | 484 self.dirstate = None |
485 os.rename(self.join("undo.dirstate"), self.join("dirstate")) | 485 util.rename(self.join("undo.dirstate"), self.join("dirstate")) |
486 self.dirstate = dirstate(self.opener, self.ui, self.root) | 486 self.dirstate = dirstate(self.opener, self.ui, self.root) |
487 else: | 487 else: |
488 self.ui.warn("no undo information available\n") | 488 self.ui.warn("no undo information available\n") |
489 | 489 |
490 def lock(self, wait = 1): | 490 def lock(self, wait = 1): |