diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -6,7 +6,6 @@ # GNU General Public License version 2 or any later version. from __future__ import absolute_import -import cStringIO import errno import os import re @@ -24,7 +23,7 @@ from . import ( cvsps, ) -StringIO = cStringIO.StringIO +stringio = util.stringio checktool = common.checktool commit = common.commit converter_source = common.converter_source @@ -228,7 +227,7 @@ class convert_cvs(converter_source): # file-objects returned by socket.makefile() do not handle # large read() requests very well. chunksize = 65536 - output = StringIO() + output = stringio() while count > 0: data = fp.read(min(count, chunksize)) if not data: diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -18,7 +18,6 @@ # source. from __future__ import absolute_import -import cStringIO import os import re import time @@ -36,6 +35,8 @@ from mercurial import ( scmutil, util, ) +stringio = util.stringio + from mercurial.i18n import _ from . import common mapfile = common.mapfile @@ -137,7 +138,7 @@ class mercurial_sink(common.converter_si self.before() def _rewritetags(self, source, revmap, data): - fp = cStringIO.StringIO() + fp = stringio() for line in data.splitlines(): s = line.split(' ', 1) if len(s) != 2: @@ -152,7 +153,7 @@ class mercurial_sink(common.converter_si return fp.getvalue() def _rewritesubstate(self, source, data): - fp = cStringIO.StringIO() + fp = stringio() for line in data.splitlines(): s = line.split(' ', 1) if len(s) != 2: diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -4,7 +4,6 @@ from __future__ import absolute_import import cPickle as pickle -import cStringIO import os import re import sys @@ -24,7 +23,7 @@ from mercurial.i18n import _ from . import common -StringIO = cStringIO.StringIO +stringio = util.stringio propertycache = util.propertycache commandline = common.commandline @@ -986,7 +985,7 @@ class svn_source(converter_source): if self.module != new_module: self.module = new_module self.reparent(self.module) - io = StringIO() + io = stringio() info = svn.ra.get_file(self.ra, file, revnum, io) data = io.getvalue() # ra.get_file() seems to keep a reference on the input buffer diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -65,7 +65,6 @@ You can set patchbomb to always ask for ''' from __future__ import absolute_import -import cStringIO import email as emailmod import errno import os @@ -83,6 +82,7 @@ from mercurial import ( scmutil, util, ) +stringio = util.stringio from mercurial.i18n import _ cmdtable = {} @@ -228,7 +228,7 @@ def _getpatches(repo, revs, **opts): if r == prev and (repo[None].files() or repo[None].deleted()): ui.warn(_('warning: working directory has ' 'uncommitted changes\n')) - output = cStringIO.StringIO() + output = stringio() cmdutil.export(repo, [r], fp=output, opts=patch.difffeatureopts(ui, opts, git=True)) yield output.getvalue().split('\n') @@ -721,7 +721,7 @@ def email(ui, repo, *revs, **opts): if not mbox: # Exim does not remove the Bcc field del m['Bcc'] - fp = cStringIO.StringIO() + fp = stringio() generator = emailmod.Generator.Generator(fp, mangle_from_=False) generator.flatten(m, 0) sendmail(sender_addr, to + bcc + cc, fp.getvalue()) diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -7,7 +7,6 @@ from __future__ import absolute_import -import cStringIO import gzip import os import struct @@ -26,6 +25,7 @@ from . import ( scmutil, util, ) +stringio = util.stringio # from unzip source code: _UNX_IFREG = 0x8000 @@ -172,7 +172,7 @@ class tarit(object): i.size = 0 else: i.mode = mode - data = cStringIO.StringIO(data) + data = stringio(data) self.z.addfile(i, data) def done(self): diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -7,7 +7,6 @@ from __future__ import absolute_import -import cStringIO import errno import os import re @@ -46,6 +45,7 @@ from . import ( templater, util, ) +stringio = util.stringio def ishunk(x): hunkclasses = (crecordmod.uihunk, patch.recordhunk) @@ -211,7 +211,7 @@ def dorecord(ui, repo, commitfunc, cmdsu util.copyfile(repo.wjoin(f), tmpname, copystat=True) backups[f] = tmpname - fp = cStringIO.StringIO() + fp = stringio() for c in chunks: fname = c.filename() if fname in backups: @@ -3298,7 +3298,7 @@ def _performrevert(repo, parents, ctx, a newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) # Apply changes - fp = cStringIO.StringIO() + fp = stringio() for c in chunks: c.write(fp) dopatch = fp.tell() diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -10,7 +10,6 @@ from __future__ import absolute_import -import cStringIO import locale import os import re @@ -25,6 +24,7 @@ from . import ( patch as patchmod, util, ) +stringio = util.stringio # This is required for ncurses to display non-ASCII characters in default user # locale encoding correctly. --immerrr @@ -238,7 +238,7 @@ class uiheader(patchnode): def prettystr(self): - x = cStringIO.StringIO() + x = stringio() self.pretty(x) return x.getvalue() @@ -449,7 +449,7 @@ class uihunk(patchnode): pretty = write def prettystr(self): - x = cStringIO.StringIO() + x = stringio() self.pretty(x) return x.getvalue() @@ -1506,7 +1506,7 @@ are you sure you want to review/edit and return None # write the initial patch - patch = cStringIO.StringIO() + patch = stringio() patch.write(diffhelptext + hunkhelptext) chunk.header.write(patch) chunk.write(patch) diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -990,8 +990,7 @@ def _runcommand(ui, options, cmd, cmdfun output = ui.config('profiling', 'output') if output == 'blackbox': - import StringIO - fp = StringIO.StringIO() + fp = util.stringio() elif output: path = ui.expandpath(output) fp = open(path, 'wb') diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py +++ b/mercurial/hgweb/protocol.py @@ -7,7 +7,6 @@ from __future__ import absolute_import -import cStringIO import cgi import urllib import zlib @@ -20,6 +19,7 @@ from .. import ( util, wireproto, ) +stringio = util.stringio HGTYPE = 'application/mercurial-0.1' HGERRTYPE = 'application/hg-error' @@ -66,7 +66,7 @@ class webproto(wireproto.abstractserverp fp.write(s) def redirect(self): self.oldio = self.ui.fout, self.ui.ferr - self.ui.ferr = self.ui.fout = cStringIO.StringIO() + self.ui.ferr = self.ui.fout = stringio() def restore(self): val = self.ui.fout.getvalue() self.ui.ferr, self.ui.fout = self.oldio diff --git a/mercurial/httpclient/__init__.py b/mercurial/httpclient/__init__.py --- a/mercurial/httpclient/__init__.py +++ b/mercurial/httpclient/__init__.py @@ -41,7 +41,6 @@ from __future__ import absolute_import # Many functions in this file have too many arguments. # pylint: disable=R0913 -import cStringIO import errno import httplib import logging diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -8,7 +8,6 @@ from __future__ import absolute_import -import cStringIO import collections import copy import email @@ -37,6 +36,7 @@ from . import ( scmutil, util, ) +stringio = util.stringio gitre = re.compile('diff --git a/(.*) b/(.*)') tabsplitter = re.compile(r'(\t+|[^\t]+)') @@ -60,7 +60,7 @@ def split(stream): return len(l) == 2 and ' ' not in l[0] def chunk(lines): - return cStringIO.StringIO(''.join(lines)) + return stringio(''.join(lines)) def hgsplit(stream, cur): inheader = True @@ -93,7 +93,7 @@ def split(stream): def mimesplit(stream, cur): def msgfp(m): - fp = cStringIO.StringIO() + fp = stringio() g = email.Generator.Generator(fp, mangle_from_=False) g.flatten(m) fp.seek(0) @@ -246,7 +246,7 @@ def extract(ui, fileobj): ui.debug('found patch at byte %d\n' % m.start(0)) diffs_seen += 1 - cfp = cStringIO.StringIO() + cfp = stringio() for line in payload[:m.start(0)].splitlines(): if line.startswith('# HG changeset patch') and not hgpatch: ui.debug('patch generated by hg export\n') @@ -1057,7 +1057,7 @@ the hunk is left unchanged. continue # Remove comment lines patchfp = open(patchfn) - ncpatchfp = cStringIO.StringIO() + ncpatchfp = stringio() for line in patchfp: if not line.startswith('#'): ncpatchfp.write(line) @@ -1440,7 +1440,8 @@ def reversehunks(hunks): ... hunkscomingfromfilterpatch.extend(h.hunks) >>> reversedhunks = reversehunks(hunkscomingfromfilterpatch) - >>> fp = cStringIO.StringIO() + >>> from . import util + >>> fp = util.stringio() >>> for c in reversedhunks: ... c.write(fp) >>> fp.seek(0) @@ -1553,7 +1554,7 @@ def parsepatch(originalchunks): } p = parser() - fp = cStringIO.StringIO() + fp = stringio() fp.write(''.join(originalchunks)) fp.seek(0) @@ -1732,7 +1733,7 @@ def scangitpatch(lr, firstline): pos = lr.fp.tell() fp = lr.fp except IOError: - fp = cStringIO.StringIO(lr.fp.read()) + fp = stringio(lr.fp.read()) gitlr = linereader(fp) gitlr.push(firstline) gitpatches = readgitpatch(gitlr) diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py --- a/mercurial/pure/mpatch.py +++ b/mercurial/pure/mpatch.py @@ -7,10 +7,10 @@ from __future__ import absolute_import -import cStringIO import struct -StringIO = cStringIO.StringIO +from . import pycompat +stringio = pycompat.stringio class mpatchError(Exception): """error raised when a delta cannot be decoded @@ -66,7 +66,7 @@ def patches(a, bins): if not tl: return a - m = StringIO() + m = stringio() # load our original text m.write(a) diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -7,11 +7,12 @@ from __future__ import absolute_import -import cStringIO import struct import zlib from .node import nullid +from . import pycompat +stringio = pycompat.stringio _pack = struct.pack _unpack = struct.unpack @@ -90,7 +91,7 @@ def parse_dirstate(dmap, copymap, st): def pack_dirstate(dmap, copymap, pl, now): now = int(now) - cs = cStringIO.StringIO() + cs = stringio() write = cs.write write("".join(pl)) for f, e in dmap.iteritems(): diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -10,7 +10,6 @@ from __future__ import absolute_import import base64 -import cStringIO import httplib import os import socket @@ -25,6 +24,7 @@ from . import ( sslutil, util, ) +stringio = util.stringio class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): def __init__(self, ui): @@ -273,7 +273,7 @@ def _generic_proxytunnel(self): res.length = None res.chunked = 0 res.will_close = 1 - res.msg = httplib.HTTPMessage(cStringIO.StringIO()) + res.msg = httplib.HTTPMessage(stringio()) return False res.msg = httplib.HTTPMessage(res.fp) diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -74,153 +74,129 @@ $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (, line *) (glob) doc/hgmanpage.py: invalid syntax: invalid syntax (, line *) (glob) - hgext/acl.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) hgext/automv.py: error importing module: invalid syntax (commands.py, line *) (line *) (glob) - hgext/blackbox.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + hgext/blackbox.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/bugzilla.py: error importing module: No module named 'urlparse' (line *) (glob) - hgext/censor.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + hgext/censor.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/chgserver.py: error importing module: No module named 'SocketServer' (line *) (glob) - hgext/children.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/churn.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/clonebundles.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + hgext/children.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/churn.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/clonebundles.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/color.py: invalid syntax: invalid syntax (, line *) (glob) hgext/convert/bzr.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) hgext/convert/common.py: error importing module: No module named 'cPickle' (line *) (glob) - hgext/convert/convcmd.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/convert/cvs.py: error importing module: No module named 'cStringIO' (line *) (glob) + hgext/convert/convcmd.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) + hgext/convert/cvs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) hgext/convert/cvsps.py: error importing module: No module named 'cPickle' (line *) (glob) - hgext/convert/darcs.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/convert/darcs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) hgext/convert/filemap.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) - hgext/convert/git.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/convert/gnuarch.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/convert/hg.py: error importing module: No module named 'cStringIO' (line *) (glob) - hgext/convert/monotone.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/convert/p*.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/convert/git.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) + hgext/convert/gnuarch.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) + hgext/convert/hg.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/convert/monotone.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) + hgext/convert/p*.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) hgext/convert/subversion.py: error importing module: No module named 'cPickle' (line *) (glob) hgext/convert/transport.py: error importing module: No module named 'svn.client' (line *) (glob) - hgext/eol.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/extdiff.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/factotum.py: error importing: No module named 'cStringIO' (error at url.py:*) (glob) + hgext/eol.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/extdiff.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/factotum.py: error importing: No module named 'httplib' (error at url.py:*) (glob) hgext/fetch.py: error importing module: invalid syntax (commands.py, line *) (line *) (glob) - hgext/fsmonitor/state.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/fsmonitor/watchmanclient.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/gpg.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/graphlog.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/hgcia.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/hgk.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/highlight/highlight.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/fsmonitor/watchmanclient.py: error importing module: Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob) + hgext/gpg.py: error importing module: invalid syntax (commands.py, line *) (line *) (glob) + hgext/graphlog.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/hgcia.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/hgk.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/histedit.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) - hgext/keyword.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/largefiles/basestore.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/largefiles/lfcommands.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/largefiles/lfutil.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/keyword.py: error importing: No module named 'BaseHTTPServer' (error at common.py:*) (glob) + hgext/largefiles/basestore.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) + hgext/largefiles/lfcommands.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) + hgext/largefiles/lfutil.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/largefiles/localstore.py: error importing module: No module named 'lfutil' (line *) (glob) - hgext/largefiles/overrides.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/largefiles/overrides.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) hgext/largefiles/proto.py: error importing module: No module named 'urllib2' (line *) (glob) hgext/largefiles/remotestore.py: error importing module: No module named 'urllib2' (line *) (glob) - hgext/largefiles/reposetup.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/largefiles/reposetup.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/largefiles/uisetup.py: error importing module: invalid syntax (archival.py, line *) (line *) (glob) hgext/largefiles/wirestore.py: error importing module: No module named 'lfutil' (line *) (glob) - hgext/mq.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/notify.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/pager.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/patchbomb.py: error importing module: No module named 'cStringIO' (line *) (glob) - hgext/purge.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/rebase.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - hgext/record.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/relink.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/schemes.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - hgext/share.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + hgext/mq.py: error importing module: invalid syntax (commands.py, line *) (line *) (glob) + hgext/notify.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/pager.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/patchbomb.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/purge.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/rebase.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) + hgext/record.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/relink.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/schemes.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + hgext/share.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/shelve.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) - hgext/strip.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + hgext/strip.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/transplant.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) - hgext/win*text.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) mercurial/archival.py: invalid syntax: invalid syntax (, line *) (glob) - mercurial/bookmarks.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/branchmap.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/branchmap.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/bundle*.py: invalid syntax: invalid syntax (, line *) (glob) mercurial/bundlerepo.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) mercurial/byterange.py: error importing module: No module named 'urllib2' (line *) (glob) - mercurial/changegroup.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/changelog.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/cmdutil.py: error importing module: No module named 'cStringIO' (line *) (glob) + mercurial/changegroup.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/changelog.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/cmdutil.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/commands.py: invalid syntax: invalid syntax (, line *) (glob) mercurial/commandserver.py: error importing module: No module named 'SocketServer' (line *) (glob) - mercurial/config.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/context.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/copies.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/crecord.py: error importing module: No module named 'cStringIO' (line *) (glob) - mercurial/destutil.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/dirstate.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/discovery.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/dispatch.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + mercurial/context.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/copies.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/crecord.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/dirstate.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/discovery.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/dispatch.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/exchange.py: error importing module: No module named 'urllib2' (line *) (glob) - mercurial/extensions.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - mercurial/filelog.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/filemerge.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/fileset.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/extensions.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/filelog.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/filemerge.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/fileset.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/formatter.py: error importing module: No module named 'cPickle' (line *) (glob) - mercurial/graphmod.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/help.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - mercurial/hg.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/graphmod.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/help.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/hg.py: error importing: invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) mercurial/hgweb/common.py: error importing module: No module named 'BaseHTTPServer' (line *) (glob) mercurial/hgweb/hgweb_mod.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) mercurial/hgweb/hgwebdir_mod.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) - mercurial/hgweb/protocol.py: error importing module: No module named 'cStringIO' (line *) (glob) + mercurial/hgweb/protocol.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) mercurial/hgweb/request.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) mercurial/hgweb/server.py: error importing module: No module named 'BaseHTTPServer' (line *) (glob) mercurial/hgweb/webcommands.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) mercurial/hgweb/webutil.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) mercurial/hgweb/wsgicgi.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) - mercurial/hook.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) + mercurial/hook.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/httpclient/_readers.py: error importing module: No module named 'httplib' (line *) (glob) mercurial/httpconnection.py: error importing module: No module named 'urllib2' (line *) (glob) mercurial/httppeer.py: error importing module: No module named 'httplib' (line *) (glob) mercurial/keepalive.py: error importing module: No module named 'httplib' (line *) (glob) - mercurial/localrepo.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/lock.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/mail.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/manifest.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/match.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/mdiff.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/merge.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/minirst.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/namespaces.py: error importing: No module named 'cStringIO' (error at patch.py:*) (glob) - mercurial/obsolete.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/patch.py: error importing module: No module named 'cStringIO' (line *) (glob) - mercurial/pathutil.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/peer.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/pure/mpatch.py: error importing module: No module named 'cStringIO' (line *) (glob) - mercurial/pure/parsers.py: error importing module: No module named 'cStringIO' (line *) (glob) - mercurial/pushkey.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/pvec.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/registrar.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/localrepo.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/mail.py: error importing module: module 'email' has no attribute 'Header' (line *) (glob) + mercurial/manifest.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/merge.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/namespaces.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/patch.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/pure/mpatch.py: error importing module: cannot import name 'pycompat' (line *) (glob) + mercurial/pure/parsers.py: error importing module: No module named 'mercurial.pure.node' (line *) (glob) mercurial/repair.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) - mercurial/repoview.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/revlog.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/revset.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/scmutil.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/revlog.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/revset.py: error importing module: 'dict' object has no attribute 'iteritems' (line *) (glob) + mercurial/scmutil.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/scmwindows.py: error importing module: No module named '_winreg' (line *) (glob) - mercurial/similar.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/simplemerge.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/sshpeer.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/sshserver.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - mercurial/sslutil.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) + mercurial/simplemerge.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/sshpeer.py: error importing: invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob) + mercurial/sshserver.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/statichttprepo.py: error importing module: No module named 'urllib2' (line *) (glob) - mercurial/store.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/streamclone.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/subrepo.py: error importing: No module named 'cStringIO' (error at cmdutil.py:*) (glob) - mercurial/tagmerge.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/tags.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/templatefilters.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/templatekw.py: error importing: No module named 'cStringIO' (error at patch.py:*) (glob) - mercurial/templater.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/transaction.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/ui.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/unionrepo.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) - mercurial/url.py: error importing module: No module named 'cStringIO' (line *) (glob) - mercurial/util.py: error importing: No module named 'cStringIO' (error at parsers.py:*) (glob) - mercurial/verify.py: error importing: No module named 'cStringIO' (error at mpatch.py:*) (glob) + mercurial/store.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/streamclone.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/subrepo.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/templatefilters.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/templatekw.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/templater.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/ui.py: error importing: No module named 'cPickle' (error at formatter.py:*) (glob) + mercurial/unionrepo.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) + mercurial/url.py: error importing module: No module named 'httplib' (line *) (glob) + mercurial/verify.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) mercurial/win*.py: error importing module: No module named 'msvcrt' (line *) (glob) mercurial/windows.py: error importing module: No module named '_winreg' (line *) (glob) mercurial/wireproto.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) diff --git a/tests/test-hgweb-no-path-info.t b/tests/test-hgweb-no-path-info.t --- a/tests/test-hgweb-no-path-info.t +++ b/tests/test-hgweb-no-path-info.t @@ -18,14 +18,17 @@ should be used from d74fc8dec2b4 onward > from __future__ import absolute_import > import os > import sys - > from StringIO import StringIO > from mercurial.hgweb import ( > hgweb, > hgwebdir, > ) + > from mercurial import ( + > util, + > ) + > stringio = util.stringio > - > errors = StringIO() - > input = StringIO() + > errors = stringio() + > input = stringio() > > def startrsp(status, headers): > print '---- STATUS' @@ -59,11 +62,11 @@ should be used from d74fc8dec2b4 onward > print '---- ERRORS' > print errors.getvalue() > - > output = StringIO() + > output = stringio() > env['QUERY_STRING'] = 'style=atom' > process(hgweb('.', name='repo')) > - > output = StringIO() + > output = stringio() > env['QUERY_STRING'] = 'style=raw' > process(hgwebdir({'repo': '.'})) > EOF diff --git a/tests/test-hgweb-no-request-uri.t b/tests/test-hgweb-no-request-uri.t --- a/tests/test-hgweb-no-request-uri.t +++ b/tests/test-hgweb-no-request-uri.t @@ -18,14 +18,17 @@ should be used from d74fc8dec2b4 onward > from __future__ import absolute_import > import os > import sys - > from StringIO import StringIO > from mercurial.hgweb import ( > hgweb, > hgwebdir, > ) + > from mercurial import ( + > util, + > ) + > stringio = util.stringio > - > errors = StringIO() - > input = StringIO() + > errors = stringio() + > input = stringio() > > def startrsp(status, headers): > print '---- STATUS' @@ -58,22 +61,22 @@ should be used from d74fc8dec2b4 onward > print '---- ERRORS' > print errors.getvalue() > - > output = StringIO() + > output = stringio() > env['PATH_INFO'] = '/' > env['QUERY_STRING'] = 'style=atom' > process(hgweb('.', name = 'repo')) > - > output = StringIO() + > output = stringio() > env['PATH_INFO'] = '/file/tip/' > env['QUERY_STRING'] = 'style=raw' > process(hgweb('.', name = 'repo')) > - > output = StringIO() + > output = stringio() > env['PATH_INFO'] = '/' > env['QUERY_STRING'] = 'style=raw' > process(hgwebdir({'repo': '.'})) > - > output = StringIO() + > output = stringio() > env['PATH_INFO'] = '/repo/file/tip/' > env['QUERY_STRING'] = 'style=raw' > process(hgwebdir({'repo': '.'})) diff --git a/tests/test-hgweb-non-interactive.t b/tests/test-hgweb-non-interactive.t --- a/tests/test-hgweb-non-interactive.t +++ b/tests/test-hgweb-non-interactive.t @@ -10,16 +10,17 @@ by the WSGI standard and strictly implem > from __future__ import absolute_import > import os > import sys - > from StringIO import StringIO > from mercurial import ( > dispatch, > hg, > ui as uimod, + > util, > ) > ui = uimod.ui > from mercurial.hgweb.hgweb_mod import ( > hgweb, > ) + > stringio = util.stringio > > class FileLike(object): > def __init__(self, real): @@ -35,9 +36,9 @@ by the WSGI standard and strictly implem > return self.real.readline() > > sys.stdin = FileLike(sys.stdin) - > errors = StringIO() - > input = StringIO() - > output = StringIO() + > errors = stringio() + > input = stringio() + > output = stringio() > > def startrsp(status, headers): > print '---- STATUS' diff --git a/tests/test-simplemerge.py b/tests/test-simplemerge.py --- a/tests/test-simplemerge.py +++ b/tests/test-simplemerge.py @@ -36,8 +36,7 @@ class Merge3(simplemerge.Merge3Text): CantReprocessAndShowBase = simplemerge.CantReprocessAndShowBase def split_lines(t): - from cStringIO import StringIO - return StringIO(t).readlines() + return util.stringio(t).readlines() ############################################################ # test case data from the gnu diffutils manual diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py --- a/tests/test-wireproto.py +++ b/tests/test-wireproto.py @@ -1,9 +1,10 @@ from __future__ import absolute_import, print_function -import StringIO from mercurial import ( + util, wireproto, ) +stringio = util.stringio class proto(object): def __init__(self, args): @@ -25,7 +26,7 @@ class clientpeer(wireproto.wirepeer): return wireproto.dispatch(self.serverrepo, proto(args), cmd) def _callstream(self, cmd, **args): - return StringIO.StringIO(self._call(cmd, **args)) + return stringio(self._call(cmd, **args)) @wireproto.batchable def greet(self, name):