py3: move up symbol imports to enforce import-checker rules
authorYuya Nishihara <yuya@tcha.org>
Sat, 14 May 2016 14:03:12 +0900
changeset 29205 a0939666b836
parent 29204 ce2d81aafbae
child 29206 0ec8501af800
py3: move up symbol imports to enforce import-checker rules Since (b) is banned, we should do the same for (a) for consistency. a) from mercurial import hg from mercurial.i18n import _ b) from . import hg from .i18n import _
contrib/synthrepo.py
hgext/automv.py
hgext/color.py
hgext/convert/__init__.py
hgext/convert/bzr.py
hgext/convert/common.py
hgext/convert/convcmd.py
hgext/convert/cvs.py
hgext/convert/cvsps.py
hgext/convert/filemap.py
hgext/convert/git.py
hgext/convert/gnuarch.py
hgext/convert/hg.py
hgext/convert/monotone.py
hgext/convert/p4.py
hgext/convert/subversion.py
hgext/fsmonitor/__init__.py
hgext/fsmonitor/state.py
hgext/gpg.py
hgext/hgk.py
hgext/histedit.py
hgext/keyword.py
hgext/notify.py
hgext/pager.py
hgext/patchbomb.py
hgext/purge.py
hgext/rebase.py
hgext/record.py
hgext/relink.py
hgext/schemes.py
hgext/shelve.py
hgext/strip.py
hgext/win32mbcs.py
tests/test-filelog.py
tests/test-parseindex2.py
--- a/contrib/synthrepo.py	Thu May 19 00:20:38 2016 +0900
+++ b/contrib/synthrepo.py	Sat May 14 14:03:12 2016 +0900
@@ -45,6 +45,13 @@
 import random
 import sys
 import time
+
+from mercurial.i18n import _
+from mercurial.node import (
+    nullid,
+    nullrev,
+    short,
+)
 from mercurial import (
     cmdutil,
     context,
@@ -54,12 +61,6 @@
     scmutil,
     util,
 )
-from mercurial.i18n import _
-from mercurial.node import (
-    nullid,
-    nullrev,
-    short,
-)
 
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
--- a/hgext/automv.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/automv.py	Sat May 14 14:03:12 2016 +0900
@@ -26,6 +26,7 @@
 
 from __future__ import absolute_import
 
+from mercurial.i18n import _
 from mercurial import (
     commands,
     copies,
@@ -34,7 +35,6 @@
     scmutil,
     similar
 )
-from mercurial.i18n import _
 
 def extsetup(ui):
     entry = extensions.wrapcommand(
--- a/hgext/color.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/color.py	Sat May 14 14:03:12 2016 +0900
@@ -156,6 +156,8 @@
 from __future__ import absolute_import
 
 import os
+
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
@@ -165,7 +167,6 @@
     ui as uimod,
     util,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/convert/__init__.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/__init__.py	Sat May 14 14:03:12 2016 +0900
@@ -9,11 +9,11 @@
 
 from __future__ import absolute_import
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     registrar,
 )
-from mercurial.i18n import _
 
 from . import (
     convcmd,
--- a/hgext/convert/bzr.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/bzr.py	Sat May 14 14:03:12 2016 +0900
@@ -10,11 +10,12 @@
 from __future__ import absolute_import
 
 import os
+
+from mercurial.i18n import _
 from mercurial import (
     demandimport,
     error
 )
-from mercurial.i18n import _
 from . import common
 
 # these do not work with demandimport, blacklist
--- a/hgext/convert/common.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/common.py	Sat May 14 14:03:12 2016 +0900
@@ -14,12 +14,12 @@
 import re
 import subprocess
 
+from mercurial.i18n import _
 from mercurial import (
     error,
     phases,
     util,
 )
-from mercurial.i18n import _
 
 propertycache = util.propertycache
 
--- a/hgext/convert/convcmd.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/convcmd.py	Sat May 14 14:03:12 2016 +0900
@@ -10,13 +10,13 @@
 import shlex
 import shutil
 
+from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
     hg,
     util,
 )
-from mercurial.i18n import _
 
 from . import (
     bzr,
--- a/hgext/convert/cvs.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/cvs.py	Sat May 14 14:03:12 2016 +0900
@@ -11,12 +11,12 @@
 import re
 import socket
 
+from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
     util,
 )
-from mercurial.i18n import _
 
 from . import (
     common,
--- a/hgext/convert/cvsps.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/cvsps.py	Sat May 14 14:03:12 2016 +0900
@@ -10,11 +10,11 @@
 import os
 import re
 
+from mercurial.i18n import _
 from mercurial import (
     hook,
     util,
 )
-from mercurial.i18n import _
 
 class logentry(object):
     '''Class logentry has the following attributes:
--- a/hgext/convert/filemap.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/filemap.py	Sat May 14 14:03:12 2016 +0900
@@ -7,10 +7,11 @@
 
 import posixpath
 import shlex
+
+from mercurial.i18n import _
 from mercurial import (
     error,
 )
-from mercurial.i18n import _
 from . import common
 SKIPREV = common.SKIPREV
 
--- a/hgext/convert/git.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/git.py	Sat May 14 14:03:12 2016 +0900
@@ -7,12 +7,13 @@
 from __future__ import absolute_import
 
 import os
+
+from mercurial.i18n import _
 from mercurial import (
     config,
     error,
     node as nodemod,
 )
-from mercurial.i18n import _
 
 from . import (
     common,
--- a/hgext/convert/gnuarch.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/gnuarch.py	Sat May 14 14:03:12 2016 +0900
@@ -12,12 +12,13 @@
 import shutil
 import stat
 import tempfile
+
+from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
     util,
 )
-from mercurial.i18n import _
 from . import common
 
 class gnuarch_source(common.converter_source, common.commandline):
--- a/hgext/convert/hg.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/hg.py	Sat May 14 14:03:12 2016 +0900
@@ -22,6 +22,7 @@
 import re
 import time
 
+from mercurial.i18n import _
 from mercurial import (
     bookmarks,
     context,
@@ -37,7 +38,6 @@
 )
 stringio = util.stringio
 
-from mercurial.i18n import _
 from . import common
 mapfile = common.mapfile
 NoRepo = common.NoRepo
--- a/hgext/convert/monotone.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/monotone.py	Sat May 14 14:03:12 2016 +0900
@@ -10,11 +10,11 @@
 import os
 import re
 
+from mercurial.i18n import _
 from mercurial import (
     error,
     util,
 )
-from mercurial.i18n import _
 
 from . import common
 
--- a/hgext/convert/p4.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/p4.py	Sat May 14 14:03:12 2016 +0900
@@ -9,11 +9,11 @@
 import marshal
 import re
 
+from mercurial.i18n import _
 from mercurial import (
     error,
     util,
 )
-from mercurial.i18n import _
 
 from . import common
 
--- a/hgext/convert/subversion.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/convert/subversion.py	Sat May 14 14:03:12 2016 +0900
@@ -10,6 +10,7 @@
 import tempfile
 import xml.dom.minidom
 
+from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
@@ -17,7 +18,6 @@
     strutil,
     util,
 )
-from mercurial.i18n import _
 
 from . import common
 
--- a/hgext/fsmonitor/__init__.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/fsmonitor/__init__.py	Sat May 14 14:03:12 2016 +0900
@@ -95,6 +95,7 @@
 import stat
 import sys
 
+from mercurial.i18n import _
 from mercurial import (
     context,
     extensions,
@@ -105,7 +106,6 @@
     util,
 )
 from mercurial import match as matchmod
-from mercurial.i18n import _
 
 from . import (
     state,
--- a/hgext/fsmonitor/state.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/fsmonitor/state.py	Sat May 14 14:03:12 2016 +0900
@@ -12,8 +12,8 @@
 import socket
 import struct
 
+from mercurial.i18n import _
 from mercurial import pathutil
-from mercurial.i18n import _
 
 _version = 4
 _versionformat = ">I"
--- a/hgext/gpg.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/gpg.py	Sat May 14 14:03:12 2016 +0900
@@ -10,6 +10,8 @@
 import binascii
 import os
 import tempfile
+
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
@@ -18,7 +20,6 @@
     node as hgnode,
     util,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/hgk.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/hgk.py	Sat May 14 14:03:12 2016 +0900
@@ -37,6 +37,13 @@
 from __future__ import absolute_import
 
 import os
+
+from mercurial.i18n import _
+from mercurial.node import (
+    nullid,
+    nullrev,
+    short,
+)
 from mercurial import (
     cmdutil,
     commands,
@@ -44,12 +51,6 @@
     patch,
     scmutil,
 )
-from mercurial.node import (
-    nullid,
-    nullrev,
-    short,
-)
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/histedit.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/histedit.py	Sat May 14 14:03:12 2016 +0900
@@ -175,6 +175,8 @@
 import os
 import pickle
 import sys
+
+from mercurial.i18n import _
 from mercurial import (
     bundle2,
     cmdutil,
@@ -194,7 +196,6 @@
     scmutil,
     util,
 )
-from mercurial.i18n import _
 
 release = lock.release
 cmdtable = {}
--- a/hgext/keyword.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/keyword.py	Sat May 14 14:03:12 2016 +0900
@@ -89,8 +89,8 @@
 import re
 import tempfile
 
+from mercurial.i18n import _
 from mercurial.hgweb import webcommands
-from mercurial.i18n import _
 
 from mercurial import (
     cmdutil,
--- a/hgext/notify.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/notify.py	Sat May 14 14:03:12 2016 +0900
@@ -139,6 +139,7 @@
 import socket
 import time
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     error,
@@ -146,7 +147,6 @@
     patch,
     util,
 )
-from mercurial.i18n import _
 
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
--- a/hgext/pager.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/pager.py	Sat May 14 14:03:12 2016 +0900
@@ -66,6 +66,7 @@
 import subprocess
 import sys
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
@@ -73,7 +74,6 @@
     extensions,
     util,
     )
-from mercurial.i18n import _
 
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
--- a/hgext/patchbomb.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/patchbomb.py	Sat May 14 14:03:12 2016 +0900
@@ -71,6 +71,7 @@
 import socket
 import tempfile
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
@@ -83,7 +84,6 @@
     util,
 )
 stringio = util.stringio
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/purge.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/purge.py	Sat May 14 14:03:12 2016 +0900
@@ -27,6 +27,7 @@
 
 import os
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
@@ -34,7 +35,6 @@
     scmutil,
     util,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/rebase.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/rebase.py	Sat May 14 14:03:12 2016 +0900
@@ -18,6 +18,14 @@
 
 import errno
 import os
+
+from mercurial.i18n import _
+from mercurial.node import (
+    hex,
+    nullid,
+    nullrev,
+    short,
+)
 from mercurial import (
     bookmarks,
     cmdutil,
@@ -39,13 +47,6 @@
     scmutil,
     util,
 )
-from mercurial.node import (
-    hex,
-    nullid,
-    nullrev,
-    short,
-)
-from mercurial.i18n import _
 
 release = lock.release
 templateopts = commands.templateopts
--- a/hgext/record.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/record.py	Sat May 14 14:03:12 2016 +0900
@@ -12,13 +12,13 @@
 
 from __future__ import absolute_import
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     commands,
     error,
     extensions,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/relink.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/relink.py	Sat May 14 14:03:12 2016 +0900
@@ -11,13 +11,13 @@
 import os
 import stat
 
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     error,
     hg,
     util,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/schemes.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/schemes.py	Sat May 14 14:03:12 2016 +0900
@@ -43,6 +43,8 @@
 
 import os
 import re
+
+from mercurial.i18n import _
 from mercurial import (
     cmdutil,
     error,
@@ -51,7 +53,6 @@
     templater,
     util,
 )
-from mercurial.i18n import _
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
--- a/hgext/shelve.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/shelve.py	Sat May 14 14:03:12 2016 +0900
@@ -25,6 +25,8 @@
 import collections
 import errno
 import itertools
+
+from mercurial.i18n import _
 from mercurial import (
     bundle2,
     bundlerepo,
@@ -45,7 +47,6 @@
     templatefilters,
     util,
 )
-from mercurial.i18n import _
 
 from . import (
     rebase,
--- a/hgext/strip.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/strip.py	Sat May 14 14:03:12 2016 +0900
@@ -5,6 +5,7 @@
 """
 from __future__ import absolute_import
 
+from mercurial.i18n import _
 from mercurial import (
     bookmarks as bookmarksmod,
     cmdutil,
@@ -17,7 +18,6 @@
     scmutil,
     util,
 )
-from mercurial.i18n import _
 nullid = nodemod.nullid
 release = lockmod.release
 
--- a/hgext/win32mbcs.py	Thu May 19 00:20:38 2016 +0900
+++ b/hgext/win32mbcs.py	Sat May 14 14:03:12 2016 +0900
@@ -49,11 +49,11 @@
 import os
 import sys
 
+from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
 )
-from mercurial.i18n import _
 
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
--- a/tests/test-filelog.py	Thu May 19 00:20:38 2016 +0900
+++ b/tests/test-filelog.py	Sat May 14 14:03:12 2016 +0900
@@ -3,14 +3,15 @@
 Tests the behavior of filelog w.r.t. data starting with '\1\n'
 """
 from __future__ import absolute_import, print_function
+
+from mercurial.node import (
+    hex,
+    nullid,
+)
 from mercurial import (
     hg,
     ui as uimod,
 )
-from mercurial.node import (
-    hex,
-    nullid,
-)
 
 myui = uimod.ui()
 repo = hg.repository(myui, path='.', create=True)
--- a/tests/test-parseindex2.py	Thu May 19 00:20:38 2016 +0900
+++ b/tests/test-parseindex2.py	Sat May 14 14:03:12 2016 +0900
@@ -9,13 +9,13 @@
 import subprocess
 import sys
 
-from mercurial import (
-    parsers,
-)
 from mercurial.node import (
     nullid,
     nullrev,
 )
+from mercurial import (
+    parsers,
+)
 
 # original python implementation
 def gettype(q):