[PATCH 1 of 3] separate import lines from mercurial and general python modules

Simon Heimberg simohe at besonet.ch
Fri May 1 15:28:29 CDT 2009


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1240933246 -7200
# Node ID 1c64876cb225e06807c7ec9d00d26e08564fccbc
# Parent  bff69feb7d2c70a17e6331740abe3fec13553d66
separate import lines from mercurial and general python modules

diff -r bff69feb7d2c -r 1c64876cb225 mercurial/archival.py
--- a/mercurial/archival.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/archival.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/bundlerepo.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/changegroup.py
--- a/mercurial/changegroup.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/changegroup.py	Die 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"""
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/cmdutil.py	Die 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 = ':'
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/commands.py
--- a/mercurial/commands.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/commands.py	Die 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
+import os, re, sys, textwrap, 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
@@ -2693,7 +2694,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
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/config.py
--- a/mercurial/config.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/config.py	Die 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'
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/context.py
--- a/mercurial/context.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/context.py	Die 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
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/copies.py
--- a/mercurial/copies.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/copies.py	Die 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"
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/dirstate.py
--- a/mercurial/dirstate.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/dirstate.py	Die 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"
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/encoding.py
--- a/mercurial/encoding.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/encoding.py	Die 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'}
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/filemerge.py	Die 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)
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/hg.py
--- a/mercurial/hg.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/hg.py	Die 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
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/hook.py
--- a/mercurial/hook.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/hook.py	Die 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
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/httprepo.py
--- a/mercurial/httprepo.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/httprepo.py	Die 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()
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/i18n.py
--- a/mercurial/i18n.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/i18n.py	Die 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'):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/ignore.py
--- a/mercurial/ignore.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/ignore.py	Die 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
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/localrepo.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/lock.py
--- a/mercurial/lock.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/lock.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/mail.py
--- a/mercurial/mail.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/mail.py	Die 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'''
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/manifest.py
--- a/mercurial/manifest.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/manifest.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/mdiff.py
--- a/mercurial/mdiff.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/mdiff.py	Die 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.'''
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/merge.py
--- a/mercurial/merge.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/merge.py	Die 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'''
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/posix.py
--- a/mercurial/posix.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/posix.py	Die 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'
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/repair.py
--- a/mercurial/repair.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/repair.py	Die 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"""
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/revlog.py
--- a/mercurial/revlog.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/revlog.py	Die 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
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/simplemerge.py
--- a/mercurial/simplemerge.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/simplemerge.py	Die 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
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/sshrepo.py
--- a/mercurial/sshrepo.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/sshrepo.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/sshserver.py
--- a/mercurial/sshserver.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/sshserver.py	Die 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):
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/store.py
--- a/mercurial/store.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/store.py	Die 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
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/templater.py
--- a/mercurial/templater.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/templater.py	Die 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']
 
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/ui.py
--- a/mercurial/ui.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/ui.py	Die 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}
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/util.py
--- a/mercurial/util.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/util.py	Die 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
diff -r bff69feb7d2c -r 1c64876cb225 mercurial/windows.py
--- a/mercurial/windows.py	Die Apr 28 17:38:17 2009 +0200
+++ b/mercurial/windows.py	Die 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


More information about the Mercurial-devel mailing list