[PATHC] util: don't overwrite os-specific functions with general ones
Sune Foldager
cryo at cyanite.org
Sat Apr 4 16:26:38 UTC 2009
As Mads Kiilerich noted on IRC a few days ago, some of the
windows-specific utility functions defined in win32.py, are subsequently
overwritten by util.py, because the latter imports the specific
functions before it defines the general ones. The patch moves the
functions in question up above the import. Perhaps we should simply move
the import to the bottom, though?
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1238861563 -7200
# Node ID 7781d901ee477e1d1c5ef8692d5511a019a25290
# Parent a969b1470987b78c38e4fae757a9b1dd2e3b48e6
util: don't overwrite os-specific functions with general ones
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -776,6 +776,19 @@
# want to add "foo/bar/baz" before checking if there's a "foo/.hg"
self.auditeddir.update(prefixes)
+def nlinks(pathname):
+ """Return number of hardlinks for the given file."""
+ return os.lstat(pathname).st_nlink
+
+if hasattr(os, 'link'):
+ os_link = os.link
+else:
+ def os_link(src, dst):
+ raise OSError(0, _("Hardlinks not supported"))
+
+def lookup_reg(key, name=None, scope=None):
+ return None
+
if os.name == 'nt':
from windows import *
def expand_glob(pats):
@@ -817,16 +830,6 @@
pass
return posixfile(pathname).read()
-def nlinks(pathname):
- """Return number of hardlinks for the given file."""
- return os.lstat(pathname).st_nlink
-
-if hasattr(os, 'link'):
- os_link = os.link
-else:
- def os_link(src, dst):
- raise OSError(0, _("Hardlinks not supported"))
-
def fstat(fp):
'''stat file object that may not have fileno method.'''
try:
@@ -962,8 +965,6 @@
'''Are we running in a GUI?'''
return os.name == "nt" or os.name == "mac" or os.environ.get("DISPLAY")
-def lookup_reg(key, name=None, scope=None):
- return None
def mktempcopy(name, emptyok=False, createmode=None):
"""Create a temporary file with the same contents from name
More information about the Mercurial-devel
mailing list