separate import lines from mercurial and general python modules
authorSimon Heimberg <simohe@besonet.ch>
Tue, 28 Apr 2009 17:40:46 +0200
changeset 8312 b87a50b7125c
parent 8311 e0eb03bfa5af
child 8313 b695392491e7
separate import lines from mercurial and general python modules
mercurial/archival.py
mercurial/bundlerepo.py
mercurial/changegroup.py
mercurial/cmdutil.py
mercurial/commands.py
mercurial/config.py
mercurial/context.py
mercurial/copies.py
mercurial/dirstate.py
mercurial/encoding.py
mercurial/filemerge.py
mercurial/hg.py
mercurial/hook.py
mercurial/httprepo.py
mercurial/i18n.py
mercurial/ignore.py
mercurial/localrepo.py
mercurial/lock.py
mercurial/mail.py
mercurial/manifest.py
mercurial/mdiff.py
mercurial/merge.py
mercurial/posix.py
mercurial/repair.py
mercurial/revlog.py
mercurial/simplemerge.py
mercurial/sshrepo.py
mercurial/sshserver.py
mercurial/store.py
mercurial/templater.py
mercurial/ui.py
mercurial/util.py
mercurial/windows.py
--- a/mercurial/archival.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/archival.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,8 @@
 
 from i18n import _
 from node import hex
-import cStringIO, os, stat, tarfile, time, util, zipfile
+import util
+import cStringIO, os, stat, tarfile, time, zipfile
 import zlib, gzip
 
 def tidyprefix(dest, prefix, suffixes):
--- a/mercurial/bundlerepo.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/bundlerepo.py	Tue Apr 28 17:40:46 2009 +0200
@@ -13,7 +13,8 @@
 
 from node import nullid
 from i18n import _
-import changegroup, util, os, struct, bz2, zlib, tempfile, shutil, mdiff
+import os, struct, bz2, zlib, tempfile, shutil
+import changegroup, util, mdiff
 import localrepo, changelog, manifest, filelog, revlog, error
 
 class bundlerevlog(revlog.revlog):
--- a/mercurial/changegroup.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/changegroup.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import struct, os, bz2, zlib, util, tempfile
+import util
+import struct, os, bz2, zlib, tempfile
 
 def getchunk(source):
     """get a chunk from a changegroup"""
--- a/mercurial/cmdutil.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/cmdutil.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,8 +7,8 @@
 
 from node import hex, nullid, nullrev, short
 from i18n import _
-import os, sys, bisect, stat, encoding
-import mdiff, bdiff, util, templater, templatefilters, patch, errno, error
+import os, sys, bisect, stat, errno
+import mdiff, bdiff, util, templater, templatefilters, patch, error, encoding
 import match as _match
 
 revrangesep = ':'
--- a/mercurial/commands.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/commands.py	Tue Apr 28 17:40:46 2009 +0200
@@ -8,10 +8,11 @@
 from node import hex, nullid, nullrev, short
 from lock import release
 from i18n import _, gettext
-import os, re, sys, textwrap, subprocess
+import os, re, sys, textwrap, subprocess, difflib, time
 import hg, util, revlog, bundlerepo, extensions, copies, context, error
-import difflib, patch, time, help, mdiff, tempfile, url, encoding
-import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
+import patch, help, mdiff, tempfile, url, encoding
+import archival, changegroup, cmdutil, sshserver, hbisect
+from hgweb import server
 import merge as merge_
 
 # Commands start here, listed alphabetically
@@ -2698,7 +2699,7 @@
     class service:
         def init(self):
             util.set_signal_handler()
-            self.httpd = hgweb.server.create_server(baseui, repo)
+            self.httpd = server.create_server(baseui, repo)
 
             if not ui.verbose: return
 
--- a/mercurial/config.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/config.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import re, error, os
+import error
+import re, os
 
 class sortdict(dict):
     'a simple sorted dictionary'
--- a/mercurial/context.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/context.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,8 @@
 
 from node import nullid, nullrev, short, hex
 from i18n import _
-import ancestor, bdiff, error, util, os, errno
+import ancestor, bdiff, error, util
+import os, errno
 
 propertycache = util.propertycache
 
--- a/mercurial/copies.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/copies.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import util, heapq
+import util
+import heapq
 
 def _nonoverlap(d1, d2, d3):
     "Return list of elements in d1 not in d2 or d3"
--- a/mercurial/dirstate.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/dirstate.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,8 +7,9 @@
 
 from node import nullid
 from i18n import _
-import struct, os, stat, util, errno, ignore
-import cStringIO, osutil, sys, parsers
+import util, ignore, osutil, parsers
+import struct, os, stat, errno
+import cStringIO, sys
 
 _unknown = ('?', 0, 0, 0)
 _format = ">cllll"
--- a/mercurial/encoding.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/encoding.py	Tue Apr 28 17:40:46 2009 +0200
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
-import sys, unicodedata, locale, os, error
+import error
+import sys, unicodedata, locale, os
 
 _encodingfixup = {'646': 'ascii', 'ANSI_X3.4-1968': 'ascii'}
 
--- a/mercurial/filemerge.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/filemerge.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,8 @@
 
 from node import short
 from i18n import _
-import util, os, tempfile, simplemerge, re, filecmp
+import util, simplemerge
+import os, tempfile, re, filecmp
 
 def _toolstr(ui, tool, part, default=""):
     return ui.config("merge-tools", tool + "." + part, default)
--- a/mercurial/hg.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/hg.py	Tue Apr 28 17:40:46 2009 +0200
@@ -9,9 +9,10 @@
 from i18n import _
 from lock import release
 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
-import errno, lock, os, shutil, util, extensions, error
+import lock, util, extensions, error
 import merge as _merge
 import verify as _verify
+import errno, os, shutil
 
 def _local(path):
     return (os.path.isfile(util.drop_scheme('file', path)) and
--- a/mercurial/hook.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/hook.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,8 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import util, os, sys
-from mercurial import extensions
+import os, sys
+import extensions, util
 
 def _pythonhook(ui, repo, name, hname, funcname, args, throw):
     '''call python hook. hook is callable object, looked up as
--- a/mercurial/httprepo.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/httprepo.py	Tue Apr 28 17:40:46 2009 +0200
@@ -8,8 +8,9 @@
 
 from node import bin, hex, nullid
 from i18n import _
-import repo, os, urllib, urllib2, urlparse, zlib, util, httplib
-import errno, socket, changegroup, statichttprepo, error, url
+import repo, changegroup, statichttprepo, error, url, util
+import os, urllib, urllib2, urlparse, zlib, httplib
+import errno, socket
 
 def zgenerator(f):
     zd = zlib.decompressobj()
--- a/mercurial/i18n.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/i18n.py	Tue Apr 28 17:40:46 2009 +0200
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
-import gettext, sys, os, encoding
+import encoding
+import gettext, sys, os
 
 # modelled after templater.templatepath:
 if hasattr(sys, 'frozen'):
--- a/mercurial/ignore.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/ignore.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import util, re
+import util
+import re
 
 _commentre = None
 
--- a/mercurial/localrepo.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/localrepo.py	Tue Apr 28 17:40:46 2009 +0200
@@ -8,13 +8,13 @@
 from node import bin, hex, nullid, nullrev, short
 from i18n import _
 import repo, changegroup
-import changelog, dirstate, filelog, manifest, context, weakref
-import lock, transaction, stat, errno, ui, store, encoding
-import os, time, util, extensions, hook, inspect, error
+import changelog, dirstate, filelog, manifest, context
+import lock, transaction, ui, store, encoding
+import util, extensions, hook, error
 import match as match_
 import merge as merge_
-
 from lock import release
+import weakref, stat, errno, os, time, inspect
 propertycache = util.propertycache
 
 class localrepository(repo.repository):
--- a/mercurial/lock.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/lock.py	Tue Apr 28 17:40:46 2009 +0200
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
-import errno, os, socket, time, util, error
+import util, error
+import errno, os, socket, time
 import warnings
 
 class lock(object):
--- a/mercurial/mail.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/mail.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,9 +6,9 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
+import util, encoding
 import os, smtplib, socket
 import email.Header, email.MIMEText, email.Utils
-import util, encoding
 
 def _smtp(ui):
     '''build an smtp connection and return a function to send mail'''
--- a/mercurial/manifest.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/manifest.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import array, struct, mdiff, parsers, util, error, revlog
+import mdiff, parsers, util, error, revlog
+import array, struct
 
 class manifestdict(dict):
     def __init__(self, mapping=None, flags=None):
--- a/mercurial/mdiff.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/mdiff.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import bdiff, mpatch, re, struct, util
+import bdiff, mpatch, util
+import re, struct
 
 def splitnewlines(text):
     '''like str.splitlines, but only split on newlines.'''
--- a/mercurial/merge.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/merge.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,8 @@
 
 from node import nullid, nullrev, hex, bin
 from i18n import _
-import errno, util, os, filemerge, copies, shutil
+import util, filemerge, copies
+import errno, os, shutil
 
 class mergestate(object):
     '''track 3-way merge state of individual files'''
--- a/mercurial/posix.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/posix.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import os, sys, osutil, errno, stat, getpass, pwd, grp
+import osutil
+import os, sys, errno, stat, getpass, pwd, grp
 
 posixfile = file
 nulldev = '/dev/null'
--- a/mercurial/repair.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/repair.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,9 +6,10 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
-import changegroup, os
+import changegroup
 from node import nullrev, short
 from i18n import _
+import os
 
 def _bundle(repo, bases, heads, node, suffix, extranodes=None):
     """create a bundle with the specified revisions as a backup"""
--- a/mercurial/revlog.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/revlog.py	Tue Apr 28 17:40:46 2009 +0200
@@ -14,8 +14,8 @@
 # import stuff from node for others to import from revlog
 from node import bin, hex, nullid, nullrev, short #@UnusedImport
 from i18n import _
-import changegroup, errno, ancestor, mdiff, parsers
-import struct, util, zlib, error
+import changegroup, ancestor, mdiff, parsers, error, util
+import struct, zlib, errno
 
 _pack = struct.pack
 _unpack = struct.unpack
--- a/mercurial/simplemerge.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/simplemerge.py	Tue Apr 28 17:40:46 2009 +0200
@@ -19,7 +19,8 @@
 # s: "i hate that."
 
 from i18n import _
-import util, mdiff, sys, os
+import util, mdiff
+import sys, os
 
 class CantReprocessAndShowBase(Exception):
     pass
--- a/mercurial/sshrepo.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/sshrepo.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,8 @@
 
 from node import bin, hex
 from i18n import _
-import repo, re, util, error
+import repo, util, error
+import re
 
 class remotelock(object):
     def __init__(self, repo):
--- a/mercurial/sshserver.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/sshserver.py	Tue Apr 28 17:40:46 2009 +0200
@@ -8,7 +8,8 @@
 
 from i18n import _
 from node import bin, hex
-import os, streamclone, sys, tempfile, util, hook
+import streamclone, util, hook
+import os, sys, tempfile
 
 class sshserver(object):
     def __init__(self, ui, repo):
--- a/mercurial/store.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/store.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import os, stat, osutil, util
+import osutil, util
+import os, stat
 
 _sha = util.sha1
 
--- a/mercurial/templater.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/templater.py	Tue Apr 28 17:40:46 2009 +0200
@@ -7,7 +7,7 @@
 
 from i18n import _
 import re, sys, os
-from mercurial import util, config
+import util, config
 
 path = ['templates', '../templates']
 
--- a/mercurial/ui.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/ui.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,8 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import errno, getpass, os, re, socket, sys, tempfile
-import config, traceback, util, error
+import errno, getpass, os, re, socket, sys, tempfile, traceback
+import config, util, error
 
 _booleans = {'1': True, 'yes': True, 'true': True, 'on': True,
              '0': False, 'no': False, 'false': False, 'off': False}
--- a/mercurial/util.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/util.py	Tue Apr 28 17:40:46 2009 +0200
@@ -14,8 +14,9 @@
 """
 
 from i18n import _
-import cStringIO, errno, re, shutil, sys, tempfile, traceback, error
-import os, stat, threading, time, calendar, glob, osutil, random
+import error, osutil
+import cStringIO, errno, re, shutil, sys, tempfile, traceback
+import os, stat, threading, time, calendar, glob, random
 import imp
 
 # Python compatibility
--- a/mercurial/windows.py	Thu May 07 15:08:25 2009 +0300
+++ b/mercurial/windows.py	Tue Apr 28 17:40:46 2009 +0200
@@ -6,7 +6,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 from i18n import _
-import errno, msvcrt, os, osutil, re, sys, error
+import osutil, error
+import errno, msvcrt, os, re, sys
 nulldev = 'NUL:'
 
 umask = 002