[PATCH 1 of 4] revlog: use absolute_import

Gregory Szorc gregory.szorc at gmail.com
Tue Jul 14 15:51:10 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1436894831 25200
#      Tue Jul 14 10:27:11 2015 -0700
# Node ID 5154b8421ebd670d6155659c5811f193f5fe1555
# Parent  35fa7c77c754aa4d156c42abfdb61ca178468872
revlog: use absolute_import

This is needed for Python 3 compatibility. We have static analysis
checks in place to ensure files using absolute_import conform to the
style adopted by this patch.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -10,14 +10,31 @@
 This provides efficient delta storage with O(1) retrieve and append
 and O(changes) merge between branches.
 """
 
-# import stuff from node for others to import from revlog
+from __future__ import absolute_import
+
 import collections
-from node import bin, hex, nullid, nullrev
-from i18n import _
-import ancestor, mdiff, parsers, error, util, templatefilters
-import struct, zlib, errno
+import errno
+import struct
+import zlib
+
+from .i18n import _
+from .node import (
+    bin,
+    hex,
+    nullid,
+    nullrev,
+)
+
+from . import (
+    ancestor,
+    error,
+    mdiff,
+    parsers,
+    templatefilters,
+    util,
+)
 
 _pack = struct.pack
 _unpack = struct.unpack
 _compress = zlib.compress


More information about the Mercurial-devel mailing list