Patchwork [5,of,8] revset: use absolute import

mail settings
Submitter Gregory Szorc
Date May 25, 2015, 7:23 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/9261/
State Rejected
Headers show


Gregory Szorc - May 25, 2015, 7:23 p.m.
# HG changeset patch
# User Gregory Szorc <>
# Date 1432580721 25200
#      Mon May 25 12:05:21 2015 -0700
# Node ID 8e33ad439702d716273068b9e0d1935b5d288f85
# Parent  c1da50042d77b6514bef2a51e7b142b80682f0ae
revset: use absolute import


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -4,18 +4,25 @@ 
 # 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 heapq
 import re
-import parser, util, error, hbisect, phases
-import node
-import heapq
-import match as matchmod
-from i18n import _
-import encoding
-import obsolete as obsmod
-import pathutil
-import repoview
+import mercurial.encoding as encoding
+import mercurial.error as error
+import mercurial.hbisect as hbisect
+from mercurial.i18n import _
+import mercurial.match as matchmod
+import mercurial.node as node
+import mercurial.obsolete as obsmod
+import mercurial.parser as parser
+import mercurial.pathutil as pathutil
+import mercurial.phases as phases
+import mercurial.repoview as repoview
+import mercurial.util as util
 def _revancestors(repo, revs, followfirst):
     """Like revlog.ancestors(), but supports followfirst."""
     if followfirst:
@@ -1367,10 +1374,10 @@  def outgoing(repo, subset, x):
     Changesets not found in the specified destination repository, or the
     default push location.
     # Avoid cycles.
-    import discovery
-    import hg
+    import mercurial.discovery as discovery
+    import mercurial.hg as hg
     # i18n: "outgoing" is a keyword
     l = getargs(x, 0, 1, _("outgoing takes one or no arguments"))
     # i18n: "outgoing" is a keyword
     dest = l and getstring(l[0], _("outgoing requires a repository path")) or ''
@@ -1508,9 +1515,9 @@  def remote(repo, subset, x):
     remote repository, if present. Here, the '.' identifier is a
     synonym for the current local branch.
-    import hg # avoid start-up nasties
+    import mercurial.hg as hg # avoid start-up nasties
     # i18n: "remote" is a keyword
     l = getargs(x, 0, 2, _("remote takes one, two or no arguments"))
     q = '.'
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/ mixed imports
-     stdlib:    parser
-     relative:  error, hbisect, phases, util
   mercurial/ mixed imports
      stdlib:    parser
      relative:  config, error, templatefilters, templatekw, util
   mercurial/ mixed imports