Show More
@@ -164,8 +164,6 b' If ``pagermode`` is not defined, the ``m' | |||
|
164 | 164 | |
|
165 | 165 | from __future__ import absolute_import |
|
166 | 166 | |
|
167 | import os | |
|
168 | ||
|
169 | 167 | from mercurial.i18n import _ |
|
170 | 168 | from mercurial import ( |
|
171 | 169 | cmdutil, |
@@ -173,6 +171,7 b' from mercurial import (' | |||
|
173 | 171 | dispatch, |
|
174 | 172 | encoding, |
|
175 | 173 | extensions, |
|
174 | pycompat, | |
|
176 | 175 | subrepo, |
|
177 | 176 | ui as uimod, |
|
178 | 177 | util, |
@@ -257,7 +256,7 b' def _modesetup(ui, coloropt):' | |||
|
257 | 256 | |
|
258 | 257 | realmode = mode |
|
259 | 258 | if mode == 'auto': |
|
260 |
if |
|
|
259 | if pycompat.osname == 'nt': | |
|
261 | 260 | term = encoding.environ.get('TERM') |
|
262 | 261 | # TERM won't be defined in a vanilla cmd.exe environment. |
|
263 | 262 | |
@@ -583,7 +582,7 b' def _debugdisplaystyle(ui):' | |||
|
583 | 582 | ui.write(', '.join(ui.label(e, e) for e in effects.split())) |
|
584 | 583 | ui.write('\n') |
|
585 | 584 | |
|
586 |
if |
|
|
585 | if pycompat.osname != 'nt': | |
|
587 | 586 | w32effects = None |
|
588 | 587 | else: |
|
589 | 588 | import ctypes |
@@ -103,7 +103,7 b' def geturl(path):' | |||
|
103 | 103 | pass |
|
104 | 104 | if os.path.isdir(path): |
|
105 | 105 | path = os.path.normpath(os.path.abspath(path)) |
|
106 |
if |
|
|
106 | if pycompat.osname == 'nt': | |
|
107 | 107 | path = '/' + util.normpath(path) |
|
108 | 108 | # Module URL is later compared with the repository URL returned |
|
109 | 109 | # by svn API, which is UTF-8. |
@@ -254,8 +254,8 b' def issvnurl(ui, url):' | |||
|
254 | 254 | try: |
|
255 | 255 | proto, path = url.split('://', 1) |
|
256 | 256 | if proto == 'file': |
|
257 |
if ( |
|
|
258 | and path[2:6].lower() == '%3a/'): | |
|
257 | if (pycompat.osname == 'nt' and path[:1] == '/' | |
|
258 | and path[1:2].isalpha() and path[2:6].lower() == '%3a/'): | |
|
259 | 259 | path = path[:2] + ':/' + path[6:] |
|
260 | 260 | path = urlreq.url2pathname(path) |
|
261 | 261 | except ValueError: |
@@ -23,6 +23,7 b' from mercurial import (' | |||
|
23 | 23 | httpconnection, |
|
24 | 24 | match as matchmod, |
|
25 | 25 | node, |
|
26 | pycompat, | |
|
26 | 27 | scmutil, |
|
27 | 28 | util, |
|
28 | 29 | ) |
@@ -72,7 +73,7 b' def _usercachedir(ui):' | |||
|
72 | 73 | path = ui.configpath(longname, 'usercache', None) |
|
73 | 74 | if path: |
|
74 | 75 | return path |
|
75 |
if |
|
|
76 | if pycompat.osname == 'nt': | |
|
76 | 77 | appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) |
|
77 | 78 | if appdata: |
|
78 | 79 | return os.path.join(appdata, longname) |
@@ -80,7 +81,7 b' def _usercachedir(ui):' | |||
|
80 | 81 | home = os.getenv('HOME') |
|
81 | 82 | if home: |
|
82 | 83 | return os.path.join(home, 'Library', 'Caches', longname) |
|
83 |
elif |
|
|
84 | elif pycompat.osname == 'posix': | |
|
84 | 85 | path = os.getenv('XDG_CACHE_HOME') |
|
85 | 86 | if path: |
|
86 | 87 | return os.path.join(path, longname) |
@@ -88,7 +89,8 b' def _usercachedir(ui):' | |||
|
88 | 89 | if home: |
|
89 | 90 | return os.path.join(home, '.cache', longname) |
|
90 | 91 | else: |
|
91 |
raise error.Abort(_('unknown operating system: %s\n') |
|
|
92 | raise error.Abort(_('unknown operating system: %s\n') | |
|
93 | % pycompat.osname) | |
|
92 | 94 | raise error.Abort(_('unknown %s usercache location') % longname) |
|
93 | 95 | |
|
94 | 96 | def inusercache(ui, hash): |
@@ -50,6 +50,7 b' from mercurial import (' | |||
|
50 | 50 | error, |
|
51 | 51 | extensions, |
|
52 | 52 | hg, |
|
53 | pycompat, | |
|
53 | 54 | templater, |
|
54 | 55 | util, |
|
55 | 56 | ) |
@@ -114,7 +115,7 b' def extsetup(ui):' | |||
|
114 | 115 | schemes.update(dict(ui.configitems('schemes'))) |
|
115 | 116 | t = templater.engine(lambda x: x) |
|
116 | 117 | for scheme, url in schemes.items(): |
|
117 |
if ( |
|
|
118 | if (pycompat.osname == 'nt' and len(scheme) == 1 and scheme.isalpha() | |
|
118 | 119 | and os.path.exists('%s:\\' % scheme)): |
|
119 | 120 | raise error.Abort(_('custom scheme %s:// conflicts with drive ' |
|
120 | 121 | 'letter %s:\\\n') % (scheme, scheme.upper())) |
@@ -179,7 +179,7 b' def extsetup(ui):' | |||
|
179 | 179 | if _encoding.lower() in problematic_encodings.split(): |
|
180 | 180 | for f in funcs.split(): |
|
181 | 181 | wrapname(f, wrapper) |
|
182 |
if |
|
|
182 | if pycompat.osname == 'nt': | |
|
183 | 183 | for f in winfuncs.split(): |
|
184 | 184 | wrapname(f, wrapper) |
|
185 | 185 | wrapname("mercurial.osutil.listdir", wrapperforlistdir) |
General Comments 0
You need to be logged in to leave comments.
Login now