##// END OF EJS Templates
py3: use pickle directly...
Gregory Szorc -
r50110:df56e6bd default
parent child Browse files
Show More
@@ -446,8 +446,6 b' commonpypats = ['
446 ),
446 ),
447 (r'^import urlparse', "don't use urlparse, use util.urlreq"),
447 (r'^import urlparse', "don't use urlparse, use util.urlreq"),
448 (r'^import xmlrpclib', "don't use xmlrpclib, use util.xmlrpclib"),
448 (r'^import xmlrpclib', "don't use xmlrpclib, use util.xmlrpclib"),
449 (r'^import cPickle', "don't use cPickle, use util.pickle"),
450 (r'^import pickle', "don't use pickle, use util.pickle"),
451 (r'^import httplib', "don't use httplib, use util.httplib"),
449 (r'^import httplib', "don't use httplib, use util.httplib"),
452 (r'^import BaseHTTPServer', "use util.httpserver instead"),
450 (r'^import BaseHTTPServer', "use util.httpserver instead"),
453 (
451 (
@@ -10,6 +10,7 b' import base64'
10 import datetime
10 import datetime
11 import errno
11 import errno
12 import os
12 import os
13 import pickle
13 import re
14 import re
14 import shlex
15 import shlex
15 import subprocess
16 import subprocess
@@ -25,7 +26,6 b' from mercurial import ('
25 )
26 )
26 from mercurial.utils import procutil
27 from mercurial.utils import procutil
27
28
28 pickle = util.pickle
29 propertycache = util.propertycache
29 propertycache = util.propertycache
30
30
31
31
@@ -8,6 +8,7 b' from __future__ import absolute_import'
8
8
9 import functools
9 import functools
10 import os
10 import os
11 import pickle
11 import re
12 import re
12
13
13 from mercurial.i18n import _
14 from mercurial.i18n import _
@@ -25,8 +26,6 b' from mercurial.utils import ('
25 stringutil,
26 stringutil,
26 )
27 )
27
28
28 pickle = util.pickle
29
30
29
31 class logentry(object):
30 class logentry(object):
32 """Class logentry has the following attributes:
31 """Class logentry has the following attributes:
@@ -6,6 +6,7 b' from __future__ import absolute_import'
6 import codecs
6 import codecs
7 import locale
7 import locale
8 import os
8 import os
9 import pickle
9 import re
10 import re
10 import xml.dom.minidom
11 import xml.dom.minidom
11
12
@@ -26,7 +27,6 b' from mercurial.utils import ('
26
27
27 from . import common
28 from . import common
28
29
29 pickle = util.pickle
30 stringio = util.stringio
30 stringio = util.stringio
31 propertycache = util.propertycache
31 propertycache = util.propertycache
32 urlerr = util.urlerr
32 urlerr = util.urlerr
@@ -202,6 +202,7 b' except ImportError:'
202
202
203 import functools
203 import functools
204 import os
204 import os
205 import pickle
205 import struct
206 import struct
206
207
207 from mercurial.i18n import _
208 from mercurial.i18n import _
@@ -245,7 +246,6 b' from mercurial.utils import ('
245 urlutil,
246 urlutil,
246 )
247 )
247
248
248 pickle = util.pickle
249 cmdtable = {}
249 cmdtable = {}
250 command = registrar.command(cmdtable)
250 command = registrar.command(cmdtable)
251
251
@@ -110,6 +110,7 b' from __future__ import absolute_import, '
110 import contextlib
110 import contextlib
111 import itertools
111 import itertools
112 import os
112 import os
113 import pickle
113
114
114 from .i18n import _
115 from .i18n import _
115 from .node import (
116 from .node import (
@@ -133,8 +134,6 b' from .utils import ('
133 stringutil,
134 stringutil,
134 )
135 )
135
136
136 pickle = util.pickle
137
138
137
139 def isprintable(obj):
138 def isprintable(obj):
140 """Check if the given object can be directly passed in to formatter's
139 """Check if the given object can be directly passed in to formatter's
@@ -76,7 +76,6 b' b85encode = base85.b85encode'
76
76
77 cookielib = pycompat.cookielib
77 cookielib = pycompat.cookielib
78 httplib = pycompat.httplib
78 httplib = pycompat.httplib
79 pickle = pycompat.pickle
80 safehasattr = pycompat.safehasattr
79 safehasattr = pycompat.safehasattr
81 socketserver = pycompat.socketserver
80 socketserver = pycompat.socketserver
82 bytesio = pycompat.bytesio
81 bytesio = pycompat.bytesio
@@ -9,6 +9,7 b' from __future__ import absolute_import'
9
9
10 import errno
10 import errno
11 import os
11 import os
12 import pickle
12 import signal
13 import signal
13 import sys
14 import sys
14 import threading
15 import threading
@@ -27,7 +28,6 b' from . import ('
27 error,
28 error,
28 pycompat,
29 pycompat,
29 scmutil,
30 scmutil,
30 util,
31 )
31 )
32
32
33
33
@@ -256,7 +256,7 b' def _posixworker(ui, func, staticargs, a'
256 os.close(w)
256 os.close(w)
257 os.close(rfd)
257 os.close(rfd)
258 for result in func(*(staticargs + (pargs,))):
258 for result in func(*(staticargs + (pargs,))):
259 os.write(wfd, util.pickle.dumps(result))
259 os.write(wfd, pickle.dumps(result))
260 return 0
260 return 0
261
261
262 ret = scmutil.callcatch(ui, workerfunc)
262 ret = scmutil.callcatch(ui, workerfunc)
@@ -292,7 +292,7 b' def _posixworker(ui, func, staticargs, a'
292 while openpipes > 0:
292 while openpipes > 0:
293 for key, events in selector.select():
293 for key, events in selector.select():
294 try:
294 try:
295 res = util.pickle.load(_blockingreader(key.fileobj))
295 res = pickle.load(_blockingreader(key.fileobj))
296 if hasretval and res[0]:
296 if hasretval and res[0]:
297 retval.update(res[1])
297 retval.update(res[1])
298 else:
298 else:
@@ -316,8 +316,8 b' hg status -A:'
316
316
317 $ hg status -A -Tpickle > pickle
317 $ hg status -A -Tpickle > pickle
318 >>> from __future__ import print_function
318 >>> from __future__ import print_function
319 >>> import pickle
319 >>> from mercurial import util
320 >>> from mercurial import util
320 >>> pickle = util.pickle
321 >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb")))
321 >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb")))
322 >>> for s, p in data: print("%s %s" % (s, p))
322 >>> for s, p in data: print("%s %s" % (s, p))
323 ! deleted
323 ! deleted
@@ -7,6 +7,7 b' from __future__ import absolute_import'
7 import contextlib
7 import contextlib
8 import errno
8 import errno
9 import os
9 import os
10 import pickle
10 import signal
11 import signal
11 import subprocess
12 import subprocess
12 import sys
13 import sys
@@ -336,7 +337,7 b' class TestStdio(unittest.TestCase):'
336 proc.stdin.close()
337 proc.stdin.close()
337
338
338 def post_child_check():
339 def post_child_check():
339 err = util.pickle.load(err_f)
340 err = pickle.load(err_f)
340 self.assertEqual(err.errno, errno.EPIPE)
341 self.assertEqual(err.errno, errno.EPIPE)
341 self.assertEqual(err.strerror, "Broken pipe")
342 self.assertEqual(err.strerror, "Broken pipe")
342
343
General Comments 0
You need to be logged in to leave comments. Login now