##// END OF EJS Templates
py3: manually import pycompat.open into files that need it...
Gregory Szorc -
r43355:eef9a2d6 default
parent child Browse files
Show More
@@ -15,6 +15,7 b' import os'
15 import time
15 import time
16
16
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 from mercurial.pycompat import open
18 from mercurial import (
19 from mercurial import (
19 cmdutil,
20 cmdutil,
20 encoding,
21 encoding,
@@ -15,6 +15,7 b' import shlex'
15 import subprocess
15 import subprocess
16
16
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 from mercurial.pycompat import open
18 from mercurial import (
19 from mercurial import (
19 encoding,
20 encoding,
20 error,
21 error,
@@ -11,6 +11,7 b' import os'
11 import shutil
11 import shutil
12
12
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial.pycompat import open
14 from mercurial import (
15 from mercurial import (
15 encoding,
16 encoding,
16 error,
17 error,
@@ -12,6 +12,7 b' import re'
12 import socket
12 import socket
13
13
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15 from mercurial.pycompat import open
15 from mercurial import (
16 from mercurial import (
16 encoding,
17 encoding,
17 error,
18 error,
@@ -11,6 +11,7 b' import os'
11 import re
11 import re
12
12
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial.pycompat import open
14 from mercurial import (
15 from mercurial import (
15 encoding,
16 encoding,
16 error,
17 error,
@@ -23,6 +23,7 b' import re'
23 import time
23 import time
24
24
25 from mercurial.i18n import _
25 from mercurial.i18n import _
26 from mercurial.pycompat import open
26 from mercurial import (
27 from mercurial import (
27 bookmarks,
28 bookmarks,
28 context,
29 context,
@@ -11,6 +11,7 b' import os'
11 import re
11 import re
12
12
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial.pycompat import open
14 from mercurial import (
15 from mercurial import (
15 error,
16 error,
16 pycompat,
17 pycompat,
@@ -8,6 +8,7 b' import re'
8 import xml.dom.minidom
8 import xml.dom.minidom
9
9
10 from mercurial.i18n import _
10 from mercurial.i18n import _
11 from mercurial.pycompat import open
11 from mercurial import (
12 from mercurial import (
12 encoding,
13 encoding,
13 error,
14 error,
@@ -13,6 +13,7 b' import hashlib'
13 import os
13 import os
14
14
15 from mercurial.i18n import _
15 from mercurial.i18n import _
16 from mercurial.pycompat import open
16 from mercurial import (
17 from mercurial import (
17 error,
18 error,
18 linelog as linelogmod,
19 linelog as linelogmod,
@@ -10,6 +10,7 b' import contextlib'
10 import os
10 import os
11
11
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13 from mercurial.pycompat import open
13 from mercurial import (
14 from mercurial import (
14 error,
15 error,
15 extensions,
16 extensions,
@@ -13,6 +13,7 b' import os'
13 import struct
13 import struct
14
14
15 from mercurial.node import hex
15 from mercurial.node import hex
16 from mercurial.pycompat import open
16 from mercurial import (
17 from mercurial import (
17 error as hgerror,
18 error as hgerror,
18 pycompat,
19 pycompat,
@@ -117,7 +117,7 b' import weakref'
117
117
118 from mercurial.i18n import _
118 from mercurial.i18n import _
119 from mercurial.node import hex
119 from mercurial.node import hex
120
120 from mercurial.pycompat import open
121 from mercurial import (
121 from mercurial import (
122 context,
122 context,
123 encoding,
123 encoding,
@@ -206,6 +206,7 b' import os'
206 import struct
206 import struct
207
207
208 from mercurial.i18n import _
208 from mercurial.i18n import _
209 from mercurial.pycompat import open
209 from mercurial import (
210 from mercurial import (
210 bundle2,
211 bundle2,
211 cmdutil,
212 cmdutil,
@@ -103,6 +103,8 b' from mercurial.node import ('
103
103
104 from mercurial.i18n import _
104 from mercurial.i18n import _
105
105
106 from mercurial.pycompat import open
107
106 from mercurial.utils import (
108 from mercurial.utils import (
107 procutil,
109 procutil,
108 stringutil,
110 stringutil,
@@ -11,6 +11,7 b' import os'
11 import subprocess
11 import subprocess
12 import tempfile
12 import tempfile
13
13
14 from mercurial.pycompat import open
14 from mercurial import (
15 from mercurial import (
15 node,
16 node,
16 pycompat,
17 pycompat,
@@ -16,6 +16,7 b' import stat'
16
16
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 from mercurial.node import hex
18 from mercurial.node import hex
19 from mercurial.pycompat import open
19
20
20 from mercurial import (
21 from mercurial import (
21 dirstate,
22 dirstate,
@@ -10,6 +10,7 b''
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13 from mercurial.pycompat import open
13 from mercurial import util
14 from mercurial import util
14
15
15 from . import (
16 from . import (
@@ -14,6 +14,8 b' import os'
14
14
15 from mercurial.i18n import _
15 from mercurial.i18n import _
16
16
17 from mercurial.pycompat import open
18
17 from mercurial.hgweb import webcommands
19 from mercurial.hgweb import webcommands
18
20
19 from mercurial import (
21 from mercurial import (
@@ -8,6 +8,7 b' import os'
8 import re
8 import re
9
9
10 from mercurial.i18n import _
10 from mercurial.i18n import _
11 from mercurial.pycompat import open
11
12
12 from mercurial import (
13 from mercurial import (
13 error,
14 error,
@@ -76,6 +76,7 b' from mercurial.node import ('
76 nullrev,
76 nullrev,
77 short,
77 short,
78 )
78 )
79 from mercurial.pycompat import open
79 from mercurial import (
80 from mercurial import (
80 cmdutil,
81 cmdutil,
81 commands,
82 commands,
@@ -83,6 +83,7 b' import os'
83 import socket
83 import socket
84
84
85 from mercurial.i18n import _
85 from mercurial.i18n import _
86 from mercurial.pycompat import open
86 from mercurial import (
87 from mercurial import (
87 cmdutil,
88 cmdutil,
88 commands,
89 commands,
@@ -24,6 +24,7 b' from mercurial.node import ('
24 nullrev,
24 nullrev,
25 short,
25 short,
26 )
26 )
27 from mercurial.pycompat import open
27 from mercurial import (
28 from mercurial import (
28 bookmarks,
29 bookmarks,
29 cmdutil,
30 cmdutil,
@@ -18,6 +18,7 b' import errno'
18 import re
18 import re
19
19
20 from mercurial.i18n import _
20 from mercurial.i18n import _
21 from mercurial.pycompat import open
21 from mercurial import (
22 from mercurial import (
22 config,
23 config,
23 error,
24 error,
@@ -12,6 +12,7 b' import os'
12 import stat
12 import stat
13
13
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15 from mercurial.pycompat import open
15 from mercurial import (
16 from mercurial import (
16 error,
17 error,
17 hg,
18 hg,
@@ -132,6 +132,7 b' import traceback'
132
132
133 from mercurial.node import hex
133 from mercurial.node import hex
134 from mercurial.i18n import _
134 from mercurial.i18n import _
135 from mercurial.pycompat import open
135 from mercurial import (
136 from mercurial import (
136 changegroup,
137 changegroup,
137 changelog,
138 changelog,
@@ -9,6 +9,7 b' import struct'
9 import time
9 import time
10
10
11 from mercurial.i18n import _
11 from mercurial.i18n import _
12 from mercurial.pycompat import open
12 from mercurial import (
13 from mercurial import (
13 node as nodemod,
14 node as nodemod,
14 policy,
15 policy,
@@ -9,6 +9,7 b' import time'
9
9
10 from mercurial.i18n import _
10 from mercurial.i18n import _
11 from mercurial.node import bin, hex
11 from mercurial.node import bin, hex
12 from mercurial.pycompat import open
12 from mercurial import (
13 from mercurial import (
13 error,
14 error,
14 pycompat,
15 pycompat,
@@ -12,6 +12,7 b' import zlib'
12
12
13 from mercurial.node import bin, hex, nullid, short
13 from mercurial.node import bin, hex, nullid, short
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15 from mercurial.pycompat import open
15 from mercurial import (
16 from mercurial import (
16 error,
17 error,
17 filelog,
18 filelog,
@@ -14,6 +14,7 b' import zlib'
14
14
15 from mercurial.i18n import _
15 from mercurial.i18n import _
16 from mercurial.node import bin, hex, nullid
16 from mercurial.node import bin, hex, nullid
17 from mercurial.pycompat import open
17 from mercurial import (
18 from mercurial import (
18 changegroup,
19 changegroup,
19 changelog,
20 changelog,
@@ -15,6 +15,7 b' import struct'
15 import tempfile
15 import tempfile
16
16
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 from mercurial.pycompat import open
18 from mercurial import (
19 from mercurial import (
19 error,
20 error,
20 node,
21 node,
@@ -18,6 +18,7 b' from __future__ import absolute_import'
18 import os
18 import os
19
19
20 from mercurial.i18n import _
20 from mercurial.i18n import _
21 from mercurial.pycompat import open
21 from mercurial import (
22 from mercurial import (
22 bundlerepo,
23 bundlerepo,
23 cmdutil,
24 cmdutil,
@@ -172,7 +172,7 b' if sys.version_info[0] >= 3:'
172 l = (
172 l = (
173 b'; from mercurial.pycompat import '
173 b'; from mercurial.pycompat import '
174 b'delattr, getattr, hasattr, setattr, '
174 b'delattr, getattr, hasattr, setattr, '
175 b'open, unicode\n'
175 b'unicode\n'
176 )
176 )
177 for u in tokenize.tokenize(io.BytesIO(l).readline):
177 for u in tokenize.tokenize(io.BytesIO(l).readline):
178 if u.type in (tokenize.ENCODING, token.ENDMARKER):
178 if u.type in (tokenize.ENCODING, token.ENDMARKER):
@@ -221,7 +221,7 b' if sys.version_info[0] >= 3:'
221 # ``replacetoken`` or any mechanism that changes semantics of module
221 # ``replacetoken`` or any mechanism that changes semantics of module
222 # loading is changed. Otherwise cached bytecode may get loaded without
222 # loading is changed. Otherwise cached bytecode may get loaded without
223 # the new transformation mechanisms applied.
223 # the new transformation mechanisms applied.
224 BYTECODEHEADER = b'HG\x00\x0c'
224 BYTECODEHEADER = b'HG\x00\x0d'
225
225
226 class hgloader(importlib.machinery.SourceFileLoader):
226 class hgloader(importlib.machinery.SourceFileLoader):
227 """Custom module loader that transforms source code.
227 """Custom module loader that transforms source code.
@@ -17,6 +17,7 b' import zlib'
17
17
18 from .i18n import _
18 from .i18n import _
19 from .node import nullrev
19 from .node import nullrev
20 from .pycompat import open
20
21
21 from . import (
22 from . import (
22 error,
23 error,
@@ -18,6 +18,7 b' from .node import ('
18 nullrev,
18 nullrev,
19 short,
19 short,
20 )
20 )
21 from .pycompat import open
21
22
22 from . import (
23 from . import (
23 error,
24 error,
@@ -19,6 +19,7 b' from .node import ('
19 nullrev,
19 nullrev,
20 short,
20 short,
21 )
21 )
22 from .pycompat import open
22
23
23 from . import (
24 from . import (
24 bookmarks,
25 bookmarks,
@@ -22,6 +22,7 b' from .node import ('
22 wdirhex,
22 wdirhex,
23 wdirrev,
23 wdirrev,
24 )
24 )
25 from .pycompat import open
25 from . import (
26 from . import (
26 archival,
27 archival,
27 bookmarks,
28 bookmarks,
@@ -23,6 +23,7 b' from .node import ('
23 wdirfilenodeids,
23 wdirfilenodeids,
24 wdirhex,
24 wdirhex,
25 )
25 )
26 from .pycompat import open
26 from . import (
27 from . import (
27 copies,
28 copies,
28 dagop,
29 dagop,
@@ -16,6 +16,7 b' import re'
16 import signal
16 import signal
17
17
18 from .i18n import _
18 from .i18n import _
19 from .pycompat import open
19 from . import (
20 from . import (
20 encoding,
21 encoding,
21 error,
22 error,
@@ -32,6 +32,7 b' from .node import ('
32 nullrev,
32 nullrev,
33 short,
33 short,
34 )
34 )
35 from .pycompat import open
35 from . import (
36 from . import (
36 bundle2,
37 bundle2,
37 changegroup,
38 changegroup,
@@ -18,6 +18,7 b' from .i18n import ('
18 _,
18 _,
19 gettext,
19 gettext,
20 )
20 )
21 from .pycompat import open
21
22
22 from . import (
23 from . import (
23 cmdutil,
24 cmdutil,
@@ -18,6 +18,7 b' from .node import ('
18 nullid,
18 nullid,
19 short,
19 short,
20 )
20 )
21 from .pycompat import open
21
22
22 from . import (
23 from . import (
23 encoding,
24 encoding,
@@ -14,6 +14,7 b' import mimetypes'
14 import os
14 import os
15 import stat
15 import stat
16
16
17 from ..pycompat import open
17 from .. import (
18 from .. import (
18 encoding,
19 encoding,
19 pycompat,
20 pycompat,
@@ -17,6 +17,7 b' import traceback'
17 import wsgiref.validate
17 import wsgiref.validate
18
18
19 from ..i18n import _
19 from ..i18n import _
20 from ..pycompat import open
20
21
21 from .. import (
22 from .. import (
22 encoding,
23 encoding,
@@ -13,6 +13,7 b' from __future__ import absolute_import'
13 import os
13 import os
14
14
15 from .i18n import _
15 from .i18n import _
16 from .pycompat import open
16 from . import (
17 from . import (
17 pycompat,
18 pycompat,
18 util,
19 util,
@@ -19,6 +19,7 b' import socket'
19 import time
19 import time
20
20
21 from .i18n import _
21 from .i18n import _
22 from .pycompat import open
22 from . import (
23 from . import (
23 encoding,
24 encoding,
24 error,
25 error,
@@ -13,6 +13,7 b' import os'
13 import re
13 import re
14
14
15 from .i18n import _
15 from .i18n import _
16 from .pycompat import open
16 from . import (
17 from . import (
17 encoding,
18 encoding,
18 error,
19 error,
@@ -24,6 +24,7 b' from .node import ('
24 hex,
24 hex,
25 short,
25 short,
26 )
26 )
27 from .pycompat import open
27 from . import (
28 from . import (
28 copies,
29 copies,
29 diffhelper,
30 diffhelper,
@@ -21,6 +21,7 b' import tempfile'
21 import unicodedata
21 import unicodedata
22
22
23 from .i18n import _
23 from .i18n import _
24 from .pycompat import open
24 from . import (
25 from . import (
25 encoding,
26 encoding,
26 error,
27 error,
@@ -10,6 +10,7 b' from __future__ import absolute_import, '
10 import contextlib
10 import contextlib
11
11
12 from .i18n import _
12 from .i18n import _
13 from .pycompat import open
13 from . import (
14 from . import (
14 encoding,
15 encoding,
15 error,
16 error,
@@ -354,6 +354,7 b' else:'
354 sysstr = identity
354 sysstr = identity
355 strurl = identity
355 strurl = identity
356 bytesurl = identity
356 bytesurl = identity
357 open = open
357
358
358 # this can't be parsed on Python 3
359 # this can't be parsed on Python 3
359 exec(b'def raisewithtb(exc, tb):\n' b' raise exc, None, tb\n')
360 exec(b'def raisewithtb(exc, tb):\n' b' raise exc, None, tb\n')
@@ -10,6 +10,7 b' from __future__ import absolute_import'
10 import os
10 import os
11
11
12 from .i18n import _
12 from .i18n import _
13 from .pycompat import open
13
14
14 from . import (
15 from . import (
15 chgserver,
16 chgserver,
@@ -28,6 +28,7 b' import itertools'
28 import stat
28 import stat
29
29
30 from .i18n import _
30 from .i18n import _
31 from .pycompat import open
31 from . import (
32 from . import (
32 bookmarks,
33 bookmarks,
33 bundle2,
34 bundle2,
@@ -114,6 +114,7 b' import sys'
114 import threading
114 import threading
115 import time
115 import time
116
116
117 from .pycompat import open
117 from . import (
118 from . import (
118 encoding,
119 encoding,
119 pycompat,
120 pycompat,
@@ -12,6 +12,7 b' import os'
12 import struct
12 import struct
13
13
14 from .i18n import _
14 from .i18n import _
15 from .pycompat import open
15 from .interfaces import repository
16 from .interfaces import repository
16 from . import (
17 from . import (
17 cacheutil,
18 cacheutil,
@@ -19,6 +19,7 b' import tarfile'
19 import xml.dom.minidom
19 import xml.dom.minidom
20
20
21 from .i18n import _
21 from .i18n import _
22 from .pycompat import open
22 from . import (
23 from . import (
23 cmdutil,
24 cmdutil,
24 encoding,
25 encoding,
@@ -22,6 +22,7 b' import traceback'
22
22
23 from .i18n import _
23 from .i18n import _
24 from .node import hex
24 from .node import hex
25 from .pycompat import open
25
26
26 from . import (
27 from . import (
27 color,
28 color,
@@ -35,6 +35,7 b' import traceback'
35 import warnings
35 import warnings
36
36
37 from .thirdparty import attr
37 from .thirdparty import attr
38 from .pycompat import open
38 from hgdemandimport import tracing
39 from hgdemandimport import tracing
39 from . import (
40 from . import (
40 encoding,
41 encoding,
@@ -20,6 +20,7 b' import sys'
20 import time
20 import time
21
21
22 from ..i18n import _
22 from ..i18n import _
23 from ..pycompat import open
23
24
24 from .. import (
25 from .. import (
25 encoding,
26 encoding,
General Comments 0
You need to be logged in to leave comments. Login now