patch: use absolute_import
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 21 Dec 2015 21:33:52 -0800
changeset 27485 60183975b5bc
parent 27484 0d7635dca691
child 27486 5bfd01a3c2a9
patch: use absolute_import
mercurial/patch.py
tests/test-check-py3-compat.t
--- a/mercurial/patch.py	Mon Dec 21 21:26:14 2015 -0800
+++ b/mercurial/patch.py	Mon Dec 21 21:33:52 2015 -0800
@@ -6,14 +6,36 @@
 # 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 collections
-import cStringIO, email, os, errno, re, posixpath, copy
-import tempfile, zlib, shutil
+import copy
+import email
+import errno
+import os
+import posixpath
+import re
+import shutil
+import tempfile
+import zlib
 
-from i18n import _
-from node import hex, short
-import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
-import pathutil
+from .i18n import _
+from .node import (
+    hex,
+    short,
+)
+from . import (
+    base85,
+    copies,
+    diffhelpers,
+    encoding,
+    error,
+    mdiff,
+    pathutil,
+    scmutil,
+    util,
+)
 
 gitre = re.compile('diff --git a/(.*) b/(.*)')
 tabsplitter = re.compile(r'(\t+|[^\t]+)')
@@ -1446,7 +1468,7 @@
 
     '''
 
-    import crecord as crecordmod
+    from . import crecord as crecordmod
     newhunks = []
     for c in hunks:
         if isinstance(c, crecordmod.uihunk):
--- a/tests/test-check-py3-compat.t	Mon Dec 21 21:26:14 2015 -0800
+++ b/tests/test-check-py3-compat.t	Mon Dec 21 21:33:52 2015 -0800
@@ -117,7 +117,6 @@
   mercurial/lsprofcalltree.py requires print_function
   mercurial/mail.py requires print_function
   mercurial/manifest.py not using absolute_import
-  mercurial/patch.py not using absolute_import
   mercurial/pvec.py not using absolute_import
   mercurial/py3kcompat.py not using absolute_import
   setup.py not using absolute_import