Show More
@@ -103,7 +103,7 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 pycompat. |
|
|
106 | if pycompat.iswindows: | |
|
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,7 +254,7 def issvnurl(ui, url): | |||
|
254 | 254 | try: |
|
255 | 255 | proto, path = url.split('://', 1) |
|
256 | 256 | if proto == 'file': |
|
257 |
if (pycompat. |
|
|
257 | if (pycompat.iswindows and path[:1] == '/' | |
|
258 | 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) |
@@ -74,7 +74,7 def _usercachedir(ui): | |||
|
74 | 74 | path = ui.configpath(longname, 'usercache', None) |
|
75 | 75 | if path: |
|
76 | 76 | return path |
|
77 |
if pycompat. |
|
|
77 | if pycompat.iswindows: | |
|
78 | 78 | appdata = encoding.environ.get('LOCALAPPDATA',\ |
|
79 | 79 | encoding.environ.get('APPDATA')) |
|
80 | 80 | if appdata: |
@@ -51,7 +51,7 from mercurial import ( | |||
|
51 | 51 | testedwith = 'ships-with-hg-core' |
|
52 | 52 | |
|
53 | 53 | def uisetup(ui): |
|
54 |
if pycompat. |
|
|
54 | if pycompat.iswindows: | |
|
55 | 55 | # no fork on Windows, but we can create a detached process |
|
56 | 56 | # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx |
|
57 | 57 | # No stdlib constant exists for this value |
@@ -116,7 +116,7 def extsetup(ui): | |||
|
116 | 116 | schemes.update(dict(ui.configitems('schemes'))) |
|
117 | 117 | t = templater.engine(lambda x: x) |
|
118 | 118 | for scheme, url in schemes.items(): |
|
119 |
if (pycompat. |
|
|
119 | if (pycompat.iswindows and len(scheme) == 1 and scheme.isalpha() | |
|
120 | 120 | and os.path.exists('%s:\\' % scheme)): |
|
121 | 121 | raise error.Abort(_('custom scheme %s:// conflicts with drive ' |
|
122 | 122 | 'letter %s:\\\n') % (scheme, scheme.upper())) |
@@ -190,7 +190,7 def extsetup(ui): | |||
|
190 | 190 | if _encoding.lower() in problematic_encodings.split(): |
|
191 | 191 | for f in funcs.split(): |
|
192 | 192 | wrapname(f, wrapper) |
|
193 |
if pycompat. |
|
|
193 | if pycompat.iswindows: | |
|
194 | 194 | for f in winfuncs.split(): |
|
195 | 195 | wrapname(f, wrapper) |
|
196 | 196 | wrapname("mercurial.util.listdir", wrapperforlistdir) |
@@ -210,7 +210,7 def _modesetup(ui): | |||
|
210 | 210 | mode = ui.config('color', 'pagermode', mode) |
|
211 | 211 | |
|
212 | 212 | realmode = mode |
|
213 |
if pycompat. |
|
|
213 | if pycompat.iswindows: | |
|
214 | 214 | from . import win32 |
|
215 | 215 | |
|
216 | 216 | term = encoding.environ.get('TERM') |
@@ -379,7 +379,7 def colorlabel(ui, msg, label): | |||
|
379 | 379 | return msg |
|
380 | 380 | |
|
381 | 381 | w32effects = None |
|
382 |
if pycompat. |
|
|
382 | if pycompat.iswindows: | |
|
383 | 383 | import ctypes |
|
384 | 384 | |
|
385 | 385 | _kernel32 = ctypes.windll.kernel32 |
@@ -2072,7 +2072,7 def debugssl(ui, repo, source=None, **op | |||
|
2072 | 2072 | If the update succeeds, retry the original operation. Otherwise, the cause |
|
2073 | 2073 | of the SSL error is likely another issue. |
|
2074 | 2074 | ''' |
|
2075 |
if pycompat. |
|
|
2075 | if not pycompat.iswindows: | |
|
2076 | 2076 | raise error.Abort(_('certificate chain building is only possible on ' |
|
2077 | 2077 | 'Windows')) |
|
2078 | 2078 |
@@ -266,7 +266,7 def openlog(opt, default): | |||
|
266 | 266 | class MercurialHTTPServer(_mixin, httpservermod.httpserver, object): |
|
267 | 267 | |
|
268 | 268 | # SO_REUSEADDR has broken semantics on windows |
|
269 |
if pycompat. |
|
|
269 | if pycompat.iswindows: | |
|
270 | 270 | allow_reuse_address = 0 |
|
271 | 271 | |
|
272 | 272 | def __init__(self, ui, app, addr, handler, **kwargs): |
@@ -29,7 +29,7 except NameError: | |||
|
29 | 29 | unicode = str |
|
30 | 30 | |
|
31 | 31 | _languages = None |
|
32 |
if (pycompat. |
|
|
32 | if (pycompat.iswindows | |
|
33 | 33 | and 'LANGUAGE' not in encoding.environ |
|
34 | 34 | and 'LC_ALL' not in encoding.environ |
|
35 | 35 | and 'LC_MESSAGES' not in encoding.environ |
@@ -64,7 +64,7 def listdir(path, stat=False, skip=None) | |||
|
64 | 64 | result.append((fn, _mode_to_kind(st.st_mode))) |
|
65 | 65 | return result |
|
66 | 66 | |
|
67 | if pycompat.osname != 'nt': | |
|
67 | if not pycompat.iswindows: | |
|
68 | 68 | posixfile = open |
|
69 | 69 | |
|
70 | 70 | _SCM_RIGHTS = 0x01 |
@@ -15,7 +15,7 from . import ( | |||
|
15 | 15 | util, |
|
16 | 16 | ) |
|
17 | 17 | |
|
18 |
if pycompat. |
|
|
18 | if pycompat.iswindows: | |
|
19 | 19 | from . import scmwindows as scmplatform |
|
20 | 20 | else: |
|
21 | 21 | from . import scmposix as scmplatform |
@@ -41,7 +41,7 from . import ( | |||
|
41 | 41 | vfs, |
|
42 | 42 | ) |
|
43 | 43 | |
|
44 |
if pycompat. |
|
|
44 | if pycompat.iswindows: | |
|
45 | 45 | from . import scmwindows as scmplatform |
|
46 | 46 | else: |
|
47 | 47 | from . import scmposix as scmplatform |
@@ -291,7 +291,7 def checkportabilityalert(ui): | |||
|
291 | 291 | val = ui.config('ui', 'portablefilenames') |
|
292 | 292 | lval = val.lower() |
|
293 | 293 | bval = util.parsebool(val) |
|
294 |
abort = pycompat. |
|
|
294 | abort = pycompat.iswindows or lval == 'abort' | |
|
295 | 295 | warn = bval or lval == 'warn' |
|
296 | 296 | if bval is None and not (warn or abort or lval == 'ignore'): |
|
297 | 297 | raise error.ConfigError( |
@@ -477,7 +477,7 def wrapsocket(sock, keyfile, certfile, | |||
|
477 | 477 | 'for more info)\n')) |
|
478 | 478 | |
|
479 | 479 | elif (e.reason == 'CERTIFICATE_VERIFY_FAILED' and |
|
480 |
pycompat. |
|
|
480 | pycompat.iswindows): | |
|
481 | 481 | |
|
482 | 482 | ui.warn(_('(the full certificate chain may not be available ' |
|
483 | 483 | 'locally; see "hg help debugssl")\n')) |
@@ -717,7 +717,7 def _defaultcacerts(ui): | |||
|
717 | 717 | # because we'll get a certificate verification error later and the lack |
|
718 | 718 | # of loaded CA certificates will be the reason why. |
|
719 | 719 | # Assertion: this code is only called if certificates are being verified. |
|
720 |
if pycompat. |
|
|
720 | if pycompat.iswindows: | |
|
721 | 721 | if not _canloaddefaultcerts: |
|
722 | 722 | ui.warn(_('(unable to load Windows CA certificates; see ' |
|
723 | 723 | 'https://mercurial-scm.org/wiki/SecureConnections for ' |
@@ -749,7 +749,7 def _defaultcacerts(ui): | |||
|
749 | 749 | # / is writable on Windows. Out of an abundance of caution make sure |
|
750 | 750 | # we're not on Windows because paths from _systemcacerts could be installed |
|
751 | 751 | # by non-admin users. |
|
752 |
assert pycompat. |
|
|
752 | assert not pycompat.iswindows | |
|
753 | 753 | |
|
754 | 754 | # Try to find CA certificates in well-known locations. We print a warning |
|
755 | 755 | # when using a found file because we don't want too much silent magic |
@@ -1347,7 +1347,7 class gitsubrepo(abstractsubrepo): | |||
|
1347 | 1347 | if e.errno != errno.ENOENT: |
|
1348 | 1348 | raise error.Abort(genericerror % ( |
|
1349 | 1349 | self._path, encoding.strtolocal(e.strerror))) |
|
1350 |
elif pycompat. |
|
|
1350 | elif pycompat.iswindows: | |
|
1351 | 1351 | try: |
|
1352 | 1352 | self._gitexecutable = 'git.cmd' |
|
1353 | 1353 | out, err = self._gitnodir(['--version']) |
@@ -1041,7 +1041,7 class ui(object): | |||
|
1041 | 1041 | # gracefully and tell the user about their broken pager. |
|
1042 | 1042 | shell = any(c in command for c in "|&;<>()$`\\\"' \t\n*?[#~=%") |
|
1043 | 1043 | |
|
1044 |
if pycompat. |
|
|
1044 | if pycompat.iswindows and not shell: | |
|
1045 | 1045 | # Window's built-in `more` cannot be invoked with shell=False, but |
|
1046 | 1046 | # its `more.com` can. Hide this implementation detail from the |
|
1047 | 1047 | # user so we can also get sane bad PAGER behavior. MSYS has |
@@ -92,7 +92,7 def isatty(fp): | |||
|
92 | 92 | if isatty(stdout): |
|
93 | 93 | stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1) |
|
94 | 94 | |
|
95 |
if pycompat. |
|
|
95 | if pycompat.iswindows: | |
|
96 | 96 | from . import windows as platform |
|
97 | 97 | stdout = platform.winstdout(stdout) |
|
98 | 98 | else: |
@@ -1348,7 +1348,7 def checkwinfilename(path): | |||
|
1348 | 1348 | return _("filename ends with '%s', which is not allowed " |
|
1349 | 1349 | "on Windows") % t |
|
1350 | 1350 | |
|
1351 |
if pycompat. |
|
|
1351 | if pycompat.iswindows: | |
|
1352 | 1352 | checkosfilename = checkwinfilename |
|
1353 | 1353 | timer = time.clock |
|
1354 | 1354 | else: |
@@ -1572,7 +1572,7 def gui(): | |||
|
1572 | 1572 | # pure build; use a safe default |
|
1573 | 1573 | return True |
|
1574 | 1574 | else: |
|
1575 |
return pycompat. |
|
|
1575 | return pycompat.iswindows or encoding.environ.get("DISPLAY") | |
|
1576 | 1576 | |
|
1577 | 1577 | def mktempcopy(name, emptyok=False, createmode=None): |
|
1578 | 1578 | """Create a temporary file with the same contents from name |
@@ -543,7 +543,7 class backgroundfilecloser(object): | |||
|
543 | 543 | |
|
544 | 544 | # Only Windows/NTFS has slow file closing. So only enable by default |
|
545 | 545 | # on that platform. But allow to be enabled elsewhere for testing. |
|
546 |
defaultenabled = pycompat. |
|
|
546 | defaultenabled = pycompat.iswindows | |
|
547 | 547 | enabled = ui.configbool('worker', 'backgroundclose', defaultenabled) |
|
548 | 548 | |
|
549 | 549 | if not enabled: |
General Comments 0
You need to be logged in to leave comments.
Login now