Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.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 | 28511fc21073 |
children | 10c43444a38e |
comparison
equal
deleted
inserted
replaced
420:dbe86d465e09 | 421:43b8da7420a9 |
---|---|
5 # This software may be used and distributed according to the terms | 5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. | 6 # of the GNU General Public License, incorporated herein by reference. |
7 | 7 |
8 import os | 8 import os |
9 | 9 |
10 def rename(src, dst): | |
11 try: | |
12 os.rename(src, dst) | |
13 except: | |
14 os.unlink(dst) | |
15 os.rename(src, dst) | |
16 | |
17 # Platfor specific varients | |
10 if os.name == 'nt': | 18 if os.name == 'nt': |
11 def pconvert(path): | 19 def pconvert(path): |
12 return path.replace("\\", "/") | 20 return path.replace("\\", "/") |
13 else: | 21 else: |
14 def pconvert(path): | 22 def pconvert(path): |