changeset 28323:ffc693f87148

commands: use absolute_import All mercurial.* modules are now using absolute_import \o/
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Dec 2015 22:26:31 -0800
parents ebd0e86bdf89
children 549ff28a345f
files mercurial/commands.py tests/test-check-py3-compat.t
diffstat 2 files changed, 76 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Feb 27 23:57:07 2016 -0800
+++ b/mercurial/commands.py	Mon Dec 21 22:26:31 2015 -0800
@@ -5,25 +5,75 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from node import hex, bin, nullhex, nullid, nullrev, short
-from lock import release
-from i18n import _
-import os, re, difflib, time, tempfile, errno, shlex
-import sys, socket
-import hg, scmutil, util, revlog, copies, error, bookmarks
-import patch, help, encoding, templatekw, discovery
-import archival, changegroup, cmdutil, hbisect
-import sshserver, hgweb
-import extensions
-import merge as mergemod
-import minirst, revset, fileset
-import dagparser, context, simplemerge, graphmod, copies
-import random, operator
-import setdiscovery, treediscovery, dagutil, pvec, localrepo, destutil
-import phases, obsolete, exchange, bundle2, repair, lock as lockmod
-import ui as uimod
-import streamclone
-import commandserver
+from __future__ import absolute_import
+
+import difflib
+import errno
+import operator
+import os
+import random
+import re
+import shlex
+import socket
+import sys
+import tempfile
+import time
+
+from .i18n import _
+from .node import (
+    bin,
+    hex,
+    nullhex,
+    nullid,
+    nullrev,
+    short,
+)
+from . import (
+    archival,
+    bookmarks,
+    bundle2,
+    changegroup,
+    cmdutil,
+    commandserver,
+    context,
+    copies,
+    dagparser,
+    dagutil,
+    destutil,
+    discovery,
+    encoding,
+    error,
+    exchange,
+    extensions,
+    fileset,
+    graphmod,
+    hbisect,
+    help,
+    hg,
+    hgweb,
+    localrepo,
+    lock as lockmod,
+    merge as mergemod,
+    minirst,
+    obsolete,
+    patch,
+    phases,
+    pvec,
+    repair,
+    revlog,
+    revset,
+    scmutil,
+    setdiscovery,
+    simplemerge,
+    sshserver,
+    streamclone,
+    templatekw,
+    treediscovery,
+    ui as uimod,
+    util,
+)
+
+release = lockmod.release
 
 table = {}
 
@@ -2677,7 +2727,12 @@
     ui.status(_("checking installed modules (%s)...\n")
               % os.path.dirname(__file__))
     try:
-        import bdiff, mpatch, base85, osutil
+        from . import (
+            base85,
+            bdiff,
+            mpatch,
+            osutil,
+        )
         dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
     except Exception as inst:
         ui.write(" %s\n" % inst)
@@ -2686,7 +2741,7 @@
         problems += 1
 
     # templates
-    import templater
+    from . import templater
     p = templater.templatepaths()
     ui.status(_("checking templates (%s)...\n") % ' '.join(p))
     if p:
--- a/tests/test-check-py3-compat.t	Sat Feb 27 23:57:07 2016 -0800
+++ b/tests/test-check-py3-compat.t	Mon Dec 21 22:26:31 2015 -0800
@@ -86,7 +86,6 @@
   hgext/win32text.py not using absolute_import
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import
-  mercurial/commands.py not using absolute_import
   setup.py not using absolute_import
   tests/filterpyflakes.py requires print_function
   tests/generate-working-copy-states.py requires print_function