Mercurial > hg-stable
changeset 27337:9a17576103a4
mpatch: use absolute_import
While I was here, I removed the try..except around importing cStringIO
because cStringIO should always be importable on modern Python versions.
We already do an unconditional import in other files.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 12 Dec 2015 13:37:56 -0500 |
parents | 80214358ac88 |
children | 810337ae1b76 |
files | mercurial/pure/mpatch.py tests/test-check-py3-compat.t |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pure/mpatch.py Sat Dec 12 13:35:41 2015 -0500 +++ b/mercurial/pure/mpatch.py Sat Dec 12 13:37:56 2015 -0500 @@ -5,11 +5,12 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +from __future__ import absolute_import + +import cStringIO import struct -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO + +StringIO = cStringIO.StringIO # This attempts to apply a series of patches in time proportional to # the total size of the patches, rather than patches * len(text). This
--- a/tests/test-check-py3-compat.t Sat Dec 12 13:35:41 2015 -0500 +++ b/tests/test-check-py3-compat.t Sat Dec 12 13:37:56 2015 -0500 @@ -122,7 +122,6 @@ mercurial/manifest.py not using absolute_import mercurial/mdiff.py not using absolute_import mercurial/patch.py not using absolute_import - mercurial/pure/mpatch.py not using absolute_import mercurial/pure/osutil.py not using absolute_import mercurial/pure/parsers.py not using absolute_import mercurial/pvec.py not using absolute_import