[PATCH 3 of 8] dispatch: use absolute import

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

# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1432580109 25200
#      Mon May 25 11:55:09 2015 -0700
# Node ID dbb5949c7c1f7a4e23d1563159f518f1c2f79795
# Parent  c2b845cda536ef0abc665befb19319f53bb6216e
dispatch: use absolute import

This conveniently gets rid of an import warning due to module
names now being non-ambiguous.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -4,14 +4,34 @@
 # 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, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
+from __future__ import absolute_import
+import atexit
 import difflib
-import util, commands, hg, fancyopts, extensions, hook, error
-import cmdutil, encoding
-import ui as uimod
+import errno
+import os
+import pdb
+import re
+import shlex
+import signal
+import socket
+import sys
+import time
+import traceback
+import mercurial.cmdutil as cmdutil
+import mercurial.commands as commands
+import mercurial.encoding as encoding
+import mercurial.error as error
+import mercurial.extensions as extensions
+import mercurial.fancyopts as fancyopts
+import mercurial.hg as hg
+import mercurial.hook as hook
+from mercurial.i18n import _
+import mercurial.ui as uimod
+import mercurial.util as util
 class request(object):
     def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
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/dispatch.py mixed imports
-     stdlib:    commands
-     relative:  error, extensions, fancyopts, hg, hook, util
   mercurial/fileset.py mixed imports
      stdlib:    parser
      relative:  error, merge, util
   mercurial/revset.py mixed imports

More information about the Mercurial-devel mailing list