[PATCH 1 of 5] ancestor: use absolute_import

Gregory Szorc gregory.szorc at gmail.com
Fri Aug 7 23:00:42 CDT 2015


Looks like I accidentally attached these to stable since I was working off
@. Heads up to whomever queues them!

On Fri, Aug 7, 2015 at 8:17 PM, Gregory Szorc <gregory.szorc at gmail.com>
wrote:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1439001948 25200
> #      Fri Aug 07 19:45:48 2015 -0700
> # Branch stable
> # Node ID b743eb4d51b0e9ec0b0ffbc269a8d1b2163727a5
> # Parent  79f0cb97d7537a7c2948f8f9b0a89148825a3a1d
> ancestor: use absolute_import
>
> A few months ago, import-checker.py was taught to enforce a more
> well-defined import style for files with absolute_import. However,
> we stopped short of actually converting source files to use
> absolute_import because of problems with certain files.
>
> Investigation revealed the following problems with switching to
> absolute_import universally:
>
> 1) import cycles result in import failure on Python 2.6
> 2) undetermined way to import C/pure modules
>
> While these problems need to be solved, they can be put off.
> This patch starts a series of converting files to absolute_import
> that won't exhibit any of the aforementioned problems.
>
> diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
> --- a/mercurial/ancestor.py
> +++ b/mercurial/ancestor.py
> @@ -4,11 +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 collections
>  import heapq
> -from node import nullrev
> +
> +from .node import nullrev
>
>  def commonancestorsheads(pfunc, *nodes):
>      """Returns a set with the heads of all common ancestors of all nodes,
>      heads(::nodes[0] and ::nodes[1] and ...) .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150807/559ce00d/attachment-0001.html>


More information about the Mercurial-devel mailing list