Mercurial > hg
changeset 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 | 6409d9a0df43 |
children | 512d76558bd4 |
files | mercurial/commands.py mercurial/util.py mercurial/version.py |
diffstat | 3 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Jun 24 22:51:39 2005 -0800 +++ b/mercurial/commands.py Fri Jun 24 22:58:14 2005 -0800 @@ -413,7 +413,6 @@ d = opts["base"] strip = opts["strip"] - quiet = ui.quiet and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch)
--- a/mercurial/util.py Fri Jun 24 22:51:39 2005 -0800 +++ b/mercurial/util.py Fri Jun 24 22:58:14 2005 -0800 @@ -16,6 +16,8 @@ # Platfor specific varients if os.name == 'nt': + nulldev = 'NUL:' + def is_exec(f, last): return last @@ -32,7 +34,10 @@ def readlock(pathname): return file(pathname).read() + else: + nulldev = '/dev/null' + def is_exec(f, last): return (os.stat(f).st_mode & 0100 != 0) @@ -57,5 +62,3 @@ def readlock(pathname): return os.readlink(pathname) - -
--- a/mercurial/version.py Fri Jun 24 22:51:39 2005 -0800 +++ b/mercurial/version.py Fri Jun 24 22:58:14 2005 -0800 @@ -13,6 +13,7 @@ import os.path import re import time +import util unknown_version = 'unknown' remembered_version = False @@ -37,7 +38,7 @@ """Store version information.""" global remembered_version if not version and os.path.isdir(".hg"): - f = os.popen("hg identify 2>/dev/null") # use real hg installation + f = os.popen("hg identify 2> %s" % util.nulldev) # use real hg installation ident = f.read()[:-1] if not f.close() and ident: ids = ident.split(' ', 1)