# HG changeset patch # User Gregory Szorc # Date 2015-12-12 18:37:56 # Node ID 9a17576103a449055c49f4b1fe8cd9601516871e # Parent 80214358ac8898e4a820c5194b5dbb588fa44179 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. diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py --- a/mercurial/pure/mpatch.py +++ b/mercurial/pure/mpatch.py @@ -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 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 @@ -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