changeset 25938:e194ada8d45f

fileset: use absolute_import
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 08 Aug 2015 18:34:37 -0700
parents 4f1144c3c72b
children 130c0b83e963
files mercurial/fileset.py tests/test-module-imports.t
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Aug 08 16:13:27 2015 -0700
+++ b/mercurial/fileset.py	Sat Aug 08 18:34:37 2015 -0700
@@ -5,9 +5,17 @@
 # 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 re
-import parser, error, util, merge
-from i18n import _
+
+from .i18n import _
+from . import (
+    error,
+    merge,
+    parser,
+    util,
+)
 
 elements = {
     # token-type: binding-strength, primary, prefix, infix, suffix
@@ -410,7 +418,7 @@
         # i18n: "subrepo" is a keyword
         pat = getstring(x, _("subrepo requires a pattern or no arguments"))
 
-        import match as matchmod # avoid circular import issues
+        from . import match as matchmod # avoid circular import issues
         fast = not matchmod.patkind(pat)
         if fast:
             def m(s):
--- a/tests/test-module-imports.t	Sat Aug 08 16:13:27 2015 -0700
+++ b/tests/test-module-imports.t	Sat Aug 08 18:34:37 2015 -0700
@@ -112,9 +112,6 @@
 these may expose other cycles.
 
   $ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
-  mercurial/fileset.py mixed imports
-     stdlib:    parser
-     relative:  error, merge, util
   mercurial/revset.py mixed imports
      stdlib:    parser
      relative:  error, hbisect, phases, util