From patchwork Sat Dec 12 18:47:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7,of,9] mpatch: use absolute_import From: Gregory Szorc X-Patchwork-Id: 11989 Message-Id: To: mercurial-devel@selenic.com Date: Sat, 12 Dec 2015 13:47:50 -0500 # HG changeset patch # User Gregory Szorc # Date 1449945476 18000 # Sat Dec 12 13:37:56 2015 -0500 # Node ID aa1cc2e14aa1425b261a706f4e1232ae852735cf # Parent 3316f0cee2f31025baf33174d426f4da659d7cb1 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 @@ -4,13 +4,14 @@ # # 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 # means rather than shuffling strings around, we shuffle around 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 @@ -121,9 +121,8 @@ mercurial/mail.py requires print_function 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 mercurial/py3kcompat.py not using absolute_import