[PATCH 1 of 4] revlog: use absolute_import

Augie Fackler raf at durin42.com
Wed Jul 15 10:52:08 CDT 2015


On Tue, Jul 14, 2015 at 01:51:10PM -0700, Gregory Szorc wrote:
> # 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 patch looks like straightforward code cleanup to me, and I think
we should just apply it now.

The rest of the series seems reasonable, but I think those make sense
for early in the next cycle rather than at the end of this one.

>
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list