Mercurial > python-hglib
comparison hglib/client.py @ 145:f3c430afa598
hglib: abstract out use of cStringIO.StringIO (issue4520)
The cStringIO module does not exist in Python 3, but io.BytesIO does.
This change prepares for the use of io.BytesIO when available by
replacing all uses of cStringIO.StringIO with an object named BytesIO.
author | Brett Cannon <brett@python.org> |
---|---|
date | Fri, 13 Mar 2015 11:31:54 -0400 |
parents | fe74d5599539 |
children | 8d7bf729a4db |
comparison
equal
deleted
inserted
replaced
144:3c59643a2bc3 | 145:f3c430afa598 |
---|---|
1 import subprocess, os, struct, cStringIO, re, datetime | 1 import subprocess, os, struct, re, datetime |
2 from cStringIO import StringIO as BytesIO | |
2 import hglib, error, util, templates, merge, context | 3 import hglib, error, util, templates, merge, context |
3 | 4 |
4 from util import b, cmdbuilder | 5 from util import b, cmdbuilder |
5 | 6 |
6 class revision(tuple): | 7 class revision(tuple): |
160 received so far | 161 received so far |
161 | 162 |
162 input is used to reply to bulk data requests by the server | 163 input is used to reply to bulk data requests by the server |
163 It receives the max number of bytes to return | 164 It receives the max number of bytes to return |
164 """ | 165 """ |
165 out, err = cStringIO.StringIO(), cStringIO.StringIO() | 166 out, err = BytesIO(), BytesIO() |
166 outchannels = {b('o') : out.write, b('e') : err.write} | 167 outchannels = {b('o') : out.write, b('e') : err.write} |
167 | 168 |
168 inchannels = {} | 169 inchannels = {} |
169 if prompt is not None: | 170 if prompt is not None: |
170 def func(size): | 171 def func(size): |