util: replace util.nulldev with os.devnull stable
authorRoss Lagerwall <rosslagerwall@gmail.com>
Sat, 04 Aug 2012 07:14:40 +0200
branchstable
changeset 17391 fc24c10424d2
parent 17389 59581b667cd7
child 17392 bdd248666dbc
util: replace util.nulldev with os.devnull Python since 2.4 has supported os.devnull so having util.nulldev is unnecessary.
hgext/convert/common.py
hgext/convert/gnuarch.py
mercurial/cmdutil.py
mercurial/posix.py
mercurial/util.py
mercurial/windows.py
--- a/hgext/convert/common.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/hgext/convert/common.py	Sat Aug 04 07:14:40 2012 +0200
@@ -276,9 +276,9 @@
                 pass
         cmdline = [util.shellquote(arg) for arg in cmdline]
         if not self.ui.debugflag:
-            cmdline += ['2>', util.nulldev]
+            cmdline += ['2>', os.devnull]
         if closestdin:
-            cmdline += ['<', util.nulldev]
+            cmdline += ['<', os.devnull]
         cmdline = ' '.join(cmdline)
         return cmdline
 
--- a/hgext/convert/gnuarch.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/hgext/convert/gnuarch.py	Sat Aug 04 07:14:40 2012 +0200
@@ -184,7 +184,7 @@
         cmdline = [self.execmd, cmd]
         cmdline += args
         cmdline = [util.shellquote(arg) for arg in cmdline]
-        cmdline += ['>', util.nulldev, '2>', util.nulldev]
+        cmdline += ['>', os.devnull, '2>', os.devnull]
         cmdline = util.quotecommand(' '.join(cmdline))
         self.ui.debug(cmdline, '\n')
         return os.system(cmdline)
--- a/mercurial/cmdutil.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/mercurial/cmdutil.py	Sat Aug 04 07:14:40 2012 +0200
@@ -515,7 +515,7 @@
         sys.stdout.flush()
         sys.stderr.flush()
 
-        nullfd = os.open(util.nulldev, os.O_RDWR)
+        nullfd = os.open(os.devnull, os.O_RDWR)
         logfilefd = nullfd
         if logfile:
             logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND)
--- a/mercurial/posix.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/mercurial/posix.py	Sat Aug 04 07:14:40 2012 +0200
@@ -10,7 +10,6 @@
 import os, sys, errno, stat, getpass, pwd, grp, tempfile, unicodedata
 
 posixfile = open
-nulldev = '/dev/null'
 normpath = os.path.normpath
 samestat = os.path.samestat
 oslink = os.link
--- a/mercurial/util.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/mercurial/util.py	Sat Aug 04 07:14:40 2012 +0200
@@ -45,7 +45,6 @@
 nlinks = platform.nlinks
 normpath = platform.normpath
 normcase = platform.normcase
-nulldev = platform.nulldev
 openhardlinks = platform.openhardlinks
 oslink = platform.oslink
 parsepatchoutput = platform.parsepatchoutput
--- a/mercurial/windows.py	Thu Aug 23 18:19:19 2012 -0500
+++ b/mercurial/windows.py	Sat Aug 04 07:14:40 2012 +0200
@@ -24,7 +24,6 @@
 testpid = win32.testpid
 unlink = win32.unlink
 
-nulldev = 'NUL:'
 umask = 0022
 
 # wrap osutil.posixfile to provide friendlier exceptions
@@ -174,7 +173,7 @@
     # Work around "popen spawned process may not write to stdout
     # under windows"
     # http://bugs.python.org/issue1366
-    command += " 2> %s" % nulldev
+    command += " 2> %s" % os.devnull
     return os.popen(quotecommand(command), mode)
 
 def explainexit(code):