[PATCH 4 of 8] fileset: use absolute import

Gregory Szorc gregory.szorc at gmail.com
Mon May 25 14:23:48 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1432580431 25200
#      Mon May 25 12:00:31 2015 -0700
# Node ID c1da50042d77b6514bef2a51e7b142b80682f0ae
# Parent  dbb5949c7c1f7a4e23d1563159f518f1c2f79795
fileset: use absolute import

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -4,11 +4,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 _
+
+import mercurial.error as error
+from mercurial.i18n import _
+import mercurial.merge as merge
+import mercurial.parser as parser
+import mercurial.util as util
 
 elements = {
     "(": (20, ("group", 1, ")"), ("func", 1, ")")),
     "-": (5, ("negate", 19), ("minus", 5)),
@@ -404,9 +410,9 @@ def subrepo(mctx, x):
     if x:
         # i18n: "subrepo" is a keyword
         pat = getstring(x, _("subrepo requires a pattern or no arguments"))
 
-        import match as matchmod # avoid circular import issues
+        import mercurial.match as matchmod # avoid circular import issues
         fast = not matchmod.patkind(pat)
         if fast:
             def m(s):
                 return (s == pat)
diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
--- a/tests/test-module-imports.t
+++ b/tests/test-module-imports.t
@@ -16,11 +16,8 @@ here that we should still endeavor to fi
 hidden by deduplication algorithm in the cycle detector, so fixing
 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
   mercurial/templater.py mixed imports


More information about the Mercurial-devel mailing list