[PATCH 07 of 21 WIP-PY3K] cmdutil: use cStringIO compat from py3kcompat

Matthew Turk matthewturk at gmail.com
Mon Oct 12 16:24:51 CDT 2015


# HG changeset patch
# User Matthew Turk <matthewturk at gmail.com>
# Date 1444683783 18000
#      Mon Oct 12 16:03:03 2015 -0500
# Node ID 6b6287818f97ed5b1bb434152c086e693c4c4c82
# Parent  bf7f4334097021c4f0b4228185699849cf35bfd8
cmdutil: use cStringIO compat from py3kcompat

diff -r bf7f43340970 -r 6b6287818f97 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon Oct 12 16:01:43 2015 -0500
+++ b/mercurial/cmdutil.py	Mon Oct 12 16:03:03 2015 -0500
@@ -9,7 +9,7 @@
 
 from .node import hex, bin, nullid, nullrev, short
 from .i18n import _
-import os, sys, errno, re, tempfile, cStringIO, shutil
+import os, sys, errno, re, tempfile, shutil
 from . import (
     util,
     scmutil,
@@ -36,6 +36,8 @@
     lock as lockmod
 )
 
+from .py3kcompat import StringIO
+
 def ishunk(x):
     hunkclasses = (crecordmod.uihunk, patch.recordhunk)
     return isinstance(x, hunkclasses)
@@ -188,7 +190,7 @@
                 shutil.copystat(repo.wjoin(f), tmpname)
                 backups[f] = tmpname
 
-            fp = cStringIO.StringIO()
+            fp = StringIO()
             for c in chunks:
                 fname = c.filename()
                 if fname in backups:
@@ -3190,7 +3192,7 @@
 
         newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
         # Apply changes
-        fp = cStringIO.StringIO()
+        fp = StringIO()
         for c in chunks:
             c.write(fp)
         dopatch = fp.tell()


More information about the Mercurial-devel mailing list