Patchwork [6,of,8] templater: use absolute import

login
register
mail settings
Submitter Gregory Szorc
Date May 25, 2015, 7:23 p.m.
Message ID <e53b7f554302416e5de6.1432581830@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/9262/
State Rejected
Headers show

Comments

Gregory Szorc - May 25, 2015, 7:23 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1432580743 25200
#      Mon May 25 12:05:43 2015 -0700
# Node ID e53b7f554302416e5de6eb45098d5c2f418eeb4d
# Parent  8e33ad439702d716273068b9e0d1935b5d288f85
templater: use absolute import

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -4,14 +4,23 @@ 
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from i18n import _
-import os, re
-import util, config, templatefilters, templatekw, parser, error
-import revset as revsetmod
+from __future__ import absolute_import
+
+import os
+import re
 import types
-import minirst
+
+import mercurial.config as config
+import mercurial.error as error
+from mercurial.i18n import _
+import mercurial.minirst as minirst
+import mercurial.parser as parser
+import mercurial.revset as revsetmod
+import mercurial.templatefilters as templatefilters
+import mercurial.templatekw as templatekw
+import mercurial.util as util
 
 # template parsing
 
 elements = {
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/templater.py mixed imports
-     stdlib:    parser
-     relative:  config, error, templatefilters, templatekw, util
   mercurial/ui.py mixed imports
      stdlib:    formatter
      relative:  config, error, scmutil, util
   Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil