Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 461:9ae0034f2772
[PATCH] /dev/null for other OS
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[PATCH] /dev/null for other OS
From: K Thananchayan <thananck@yahoo.com>
Null device name is platform dependent. Introduce util.nulldev
- - platform dependent constant and use it instead of '/dev/null'
manifest hash: 95a1bfdb712c53ef97aaff73f7f4c87e9299cf59
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCvQCGywK+sNU5EO8RAiRBAKCcXasCCFT2+6wgklkgqIt4l3UwugCeKWii
h/8iRYEw8Rp8B67abiFiwyY=
=L3Mk
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Fri, 24 Jun 2005 22:58:14 -0800 |
parents | e8af362cfb01 |
children | 50da4bb9cab6 |
comparison
equal
deleted
inserted
replaced
460:6409d9a0df43 | 461:9ae0034f2772 |
---|---|
14 os.unlink(dst) | 14 os.unlink(dst) |
15 os.rename(src, dst) | 15 os.rename(src, dst) |
16 | 16 |
17 # Platfor specific varients | 17 # Platfor specific varients |
18 if os.name == 'nt': | 18 if os.name == 'nt': |
19 nulldev = 'NUL:' | |
20 | |
19 def is_exec(f, last): | 21 def is_exec(f, last): |
20 return last | 22 return last |
21 | 23 |
22 def set_exec(f, mode): | 24 def set_exec(f, mode): |
23 pass | 25 pass |
30 os.write(ld, info) | 32 os.write(ld, info) |
31 os.close(ld) | 33 os.close(ld) |
32 | 34 |
33 def readlock(pathname): | 35 def readlock(pathname): |
34 return file(pathname).read() | 36 return file(pathname).read() |
37 | |
35 else: | 38 else: |
39 nulldev = '/dev/null' | |
40 | |
36 def is_exec(f, last): | 41 def is_exec(f, last): |
37 return (os.stat(f).st_mode & 0100 != 0) | 42 return (os.stat(f).st_mode & 0100 != 0) |
38 | 43 |
39 def set_exec(f, mode): | 44 def set_exec(f, mode): |
40 s = os.stat(f).st_mode | 45 s = os.stat(f).st_mode |
55 def makelock(info, pathname): | 60 def makelock(info, pathname): |
56 os.symlink(info, pathname) | 61 os.symlink(info, pathname) |
57 | 62 |
58 def readlock(pathname): | 63 def readlock(pathname): |
59 return os.readlink(pathname) | 64 return os.readlink(pathname) |
60 | |
61 |