[PATCH] util, posix: eliminate encodinglower and encodingupper
Adrian Buehlmann
adrian at cadifra.com
Wed Jul 18 08:12:48 CDT 2012
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1342615318 -7200
# Node ID 608ffa7a070f27d6b296e335fa200bbf4b1dfc2d
# Parent afd75476939e0a229816e6683607fbe5ab222c11
util, posix: eliminate encodinglower and encodingupper
2ebe3d0ce91d claims this was needed "to avoid cyclic dependency", but there is
no cyclic dependency.
windows.py already imports encoding, posix.py can import it too, so we can
simply use encoding.upper in windows.py and in posix.py.
(this is a partial backout of 2ebe3d0ce91d)
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -6,6 +6,7 @@
# GNU General Public License version 2 or any later version.
from i18n import _
+import encoding
import os, sys, errno, stat, getpass, pwd, grp, tempfile, unicodedata
posixfile = open
@@ -164,9 +165,6 @@
st2 = os.lstat(fpath2)
return st1.st_dev == st2.st_dev
-encodinglower = None
-encodingupper = None
-
# os.path.normcase is a no-op, which doesn't help us on non-native filesystems
def normcase(path):
return path.lower()
@@ -255,7 +253,7 @@
pathlen = len(path)
if (pathlen == 0) or (path[0] != os.sep):
# treat as relative
- return encodingupper(path)
+ return encoding.upper(path)
# to preserve case of mountpoint part
for mp in cygwinmountpoints:
@@ -266,9 +264,9 @@
if mplen == pathlen: # mount point itself
return mp
if path[mplen] == os.sep:
- return mp + encodingupper(path[mplen:])
+ return mp + encoding.upper(path[mplen:])
- return encodingupper(path)
+ return encoding.upper(path)
# Cygwin translates native ACLs to POSIX permissions,
# but these translations are not supported by native
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -24,9 +24,6 @@
else:
import posix as platform
-platform.encodinglower = encoding.lower
-platform.encodingupper = encoding.upper
-
cachestat = platform.cachestat
checkexec = platform.checkexec
checklink = platform.checklink
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -130,11 +130,8 @@
def normpath(path):
return pconvert(os.path.normpath(path))
-encodinglower = None
-encodingupper = None
-
def normcase(path):
- return encodingupper(path)
+ return encoding.upper(path)
def realpath(path):
'''
More information about the Mercurial-devel
mailing list