diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -13,26 +13,47 @@ This contains helper routines that are i hide platform-specific details from the core. """ -import i18n -_ = i18n._ -import error, osutil, encoding, parsers -import errno, shutil, sys, tempfile, traceback +from __future__ import absolute_import + +import bz2 +import calendar +import collections +import datetime +import errno +import gc +import hashlib +import imp +import os import re as remod -import os, time, datetime, calendar, textwrap, signal, collections -import imp, socket, urllib -import gc -import bz2 +import shutil +import signal +import socket +import subprocess +import sys +import tempfile +import textwrap +import time +import traceback +import urllib import zlib -import hashlib + +from . import ( + encoding, + error, + i18n, + osutil, + parsers, +) if os.name == 'nt': - import windows as platform + from . import windows as platform else: - import posix as platform + from . import posix as platform md5 = hashlib.md5 sha1 = hashlib.sha1 sha512 = hashlib.sha512 +_ = i18n._ cachestat = platform.cachestat checkexec = platform.checkexec @@ -200,7 +221,6 @@ except NameError: def buffer(sliceable, offset=0): return memoryview(sliceable)[offset:] -import subprocess closefds = os.name == 'posix' _chunksize = 4096 @@ -326,7 +346,7 @@ def popen4(cmd, env=None, newlines=False def version(): """Return version information if available.""" try: - import __version__ + from . import __version__ return __version__.version except ImportError: return 'unknown' 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 @@ -128,7 +128,6 @@ mercurial/scmwindows.py not using absolute_import mercurial/similar.py not using absolute_import mercurial/store.py not using absolute_import - mercurial/util.py not using absolute_import mercurial/windows.py not using absolute_import setup.py not using absolute_import tests/filterpyflakes.py requires print_function