Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 422:10c43444a38e
[PATCH] Enables lock work under the other 'OS'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[PATCH] Enables lock work under the other 'OS'
From: K Thananchayan <thananck@yahoo.com>
os.symlink is not supported under Windows. This patch
introduces util.mklockf, util.getlowner that use
regular files under Winodws but symlink under unix.
tweaked by mpm:
- changed function names
- fixed to work on UNIX
manifest hash: 6f650a78a3b203dcad2f861582500b6b4036599a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCuN5sywK+sNU5EO8RAva8AJ9L9z/JHRAJS1bix48ZzSpn9ZUyPwCffhmg
UfLSFBmd5tPDDi3mgsrdDEA=
=ZYS9
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Tue, 21 Jun 2005 19:43:40 -0800 |
parents | 43b8da7420a9 |
children | e8af362cfb01 |
comparison
equal
deleted
inserted
replaced
421:43b8da7420a9 | 422:10c43444a38e |
---|---|
16 | 16 |
17 # Platfor specific varients | 17 # Platfor specific varients |
18 if os.name == 'nt': | 18 if os.name == 'nt': |
19 def pconvert(path): | 19 def pconvert(path): |
20 return path.replace("\\", "/") | 20 return path.replace("\\", "/") |
21 | |
22 def makelock(info, pathname): | |
23 ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) | |
24 os.write(ld, info) | |
25 os.close(ld) | |
26 | |
27 def readlock(pathname): | |
28 return file(pathname).read() | |
21 else: | 29 else: |
22 def pconvert(path): | 30 def pconvert(path): |
23 return path | 31 return path |
24 | 32 |
33 def makelock(info, pathname): | |
34 os.symlink(info, pathname) | |
35 | |
36 def readlock(pathname): | |
37 return os.readlink(pathname) | |
38 | |
39 |