Show More
@@ -1,6 +1,5 b'' | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 |
|
2 | |||
3 | import _winreg |
|
|||
4 | import os |
|
3 | import os | |
5 |
|
4 | |||
6 | from . import ( |
|
5 | from . import ( | |
@@ -8,6 +7,12 b' from . import (' | |||||
8 | util, |
|
7 | util, | |
9 | ) |
|
8 | ) | |
10 |
|
9 | |||
|
10 | try: | |||
|
11 | import _winreg as winreg | |||
|
12 | winreg.CloseKey | |||
|
13 | except ImportError: | |||
|
14 | import winreg | |||
|
15 | ||||
11 | def systemrcpath(): |
|
16 | def systemrcpath(): | |
12 | '''return default os-specific hgrc search path''' |
|
17 | '''return default os-specific hgrc search path''' | |
13 | rcpath = [] |
|
18 | rcpath = [] | |
@@ -23,7 +28,7 b' def systemrcpath():' | |||||
23 | rcpath.append(os.path.join(progrcd, f)) |
|
28 | rcpath.append(os.path.join(progrcd, f)) | |
24 | # else look for a system rcpath in the registry |
|
29 | # else look for a system rcpath in the registry | |
25 | value = util.lookupreg('SOFTWARE\\Mercurial', None, |
|
30 | value = util.lookupreg('SOFTWARE\\Mercurial', None, | |
26 |
|
|
31 | winreg.HKEY_LOCAL_MACHINE) | |
27 | if not isinstance(value, str) or not value: |
|
32 | if not isinstance(value, str) or not value: | |
28 | return rcpath |
|
33 | return rcpath | |
29 | value = util.localpath(value) |
|
34 | value = util.localpath(value) |
@@ -7,7 +7,6 b'' | |||||
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import _winreg |
|
|||
11 | import errno |
|
10 | import errno | |
12 | import msvcrt |
|
11 | import msvcrt | |
13 | import os |
|
12 | import os | |
@@ -22,6 +21,12 b' from . import (' | |||||
22 | win32, |
|
21 | win32, | |
23 | ) |
|
22 | ) | |
24 |
|
23 | |||
|
24 | try: | |||
|
25 | import _winreg as winreg | |||
|
26 | winreg.CloseKey | |||
|
27 | except ImportError: | |||
|
28 | import winreg | |||
|
29 | ||||
25 | executablepath = win32.executablepath |
|
30 | executablepath = win32.executablepath | |
26 | getuser = win32.getuser |
|
31 | getuser = win32.getuser | |
27 | hidewindow = win32.hidewindow |
|
32 | hidewindow = win32.hidewindow | |
@@ -432,12 +437,12 b' def lookupreg(key, valname=None, scope=N' | |||||
432 | LOCAL_MACHINE). |
|
437 | LOCAL_MACHINE). | |
433 | ''' |
|
438 | ''' | |
434 | if scope is None: |
|
439 | if scope is None: | |
435 |
scope = ( |
|
440 | scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE) | |
436 | elif not isinstance(scope, (list, tuple)): |
|
441 | elif not isinstance(scope, (list, tuple)): | |
437 | scope = (scope,) |
|
442 | scope = (scope,) | |
438 | for s in scope: |
|
443 | for s in scope: | |
439 | try: |
|
444 | try: | |
440 |
val = |
|
445 | val = winreg.QueryValueEx(winreg.OpenKey(s, key), valname)[0] | |
441 | # never let a Unicode string escape into the wild |
|
446 | # never let a Unicode string escape into the wild | |
442 | return encoding.tolocal(val.encode('UTF-8')) |
|
447 | return encoding.tolocal(val.encode('UTF-8')) | |
443 | except EnvironmentError: |
|
448 | except EnvironmentError: |
@@ -146,7 +146,7 b'' | |||||
146 | mercurial/revlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
146 | mercurial/revlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
147 | mercurial/revset.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
147 | mercurial/revset.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
148 | mercurial/scmutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
148 | mercurial/scmutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
149 |
mercurial/scmwindows.py: error importing |
|
149 | mercurial/scmwindows.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
150 | mercurial/similar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
150 | mercurial/similar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
151 | mercurial/simplemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
151 | mercurial/simplemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
152 | mercurial/sshpeer.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
152 | mercurial/sshpeer.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
@@ -167,7 +167,7 b'' | |||||
167 | mercurial/url.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) |
|
167 | mercurial/url.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob) | |
168 | mercurial/verify.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob) |
|
168 | mercurial/verify.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob) | |
169 | mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) |
|
169 | mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) | |
170 |
mercurial/windows.py: error importing module: <ImportError> No module named ' |
|
170 | mercurial/windows.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) | |
171 | mercurial/wireproto.py: error importing module: <TypeError> a bytes-like object is required, not 'str' (line *) (glob) |
|
171 | mercurial/wireproto.py: error importing module: <TypeError> a bytes-like object is required, not 'str' (line *) (glob) | |
172 |
|
172 | |||
173 | #endif |
|
173 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now