[PATCH 2 of 7] Remove unused imports

Joel Rosdahl joel at rosdahl.net
Thu Mar 6 15:52:13 CST 2008


# HG changeset patch
# User Joel Rosdahl <joel at rosdahl.net>
# Date 1204838621 -3600
# Node ID 4d3b021ae9e46562d88f90e2e51f1abaf5fa75d0
# Parent  e3b7802f77150184eb392c498ea40beecf4c6431
Remove unused imports

diff --git a/contrib/churn.py b/contrib/churn.py
--- a/contrib/churn.py
+++ b/contrib/churn.py
@@ -12,7 +12,7 @@
 # <alias email> <actual email>
 
 from mercurial.i18n import gettext as _
-from mercurial import hg, mdiff, cmdutil, ui, util, templatefilters, node
+from mercurial import mdiff, cmdutil, util, node
 import os, sys
 
 def get_tty_width():
diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -51,7 +51,7 @@
 
 import re, sys
 
-from mercurial import commands, cmdutil, ui
+from mercurial import commands, cmdutil
 from mercurial.i18n import _
 
 # start and stop parameters for effects
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from common import NoRepo, SKIPREV, converter_source, converter_sink, mapfile
+from common import NoRepo, SKIPREV, mapfile
 from cvs import convert_cvs
 from darcs import darcs_source
 from git import convert_git
diff --git a/hgext/convert/gnuarch.py b/hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py
+++ b/hgext/convert/gnuarch.py
@@ -1,6 +1,6 @@
 # GNU Arch support for the convert extension
 
-from common import NoRepo, checktool, commandline, commit, converter_source
+from common import NoRepo, commandline, commit, converter_source
 from mercurial.i18n import _
 from mercurial import util
 import os, shutil, tempfile, stat
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -16,7 +16,7 @@
 import os, time
 from mercurial.i18n import _
 from mercurial.node import bin, hex, nullid
-from mercurial import hg, lock, revlog, util
+from mercurial import hg, revlog, util
 
 from common import NoRepo, commit, converter_source, converter_sink
 
diff --git a/hgext/convert/transport.py b/hgext/convert/transport.py
--- a/hgext/convert/transport.py
+++ b/hgext/convert/transport.py
@@ -17,10 +17,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-from cStringIO import StringIO
-import os
-from tempfile import mktemp
 
 from svn.core import SubversionException, Pool
 import svn.ra
diff --git a/hgext/fetch.py b/hgext/fetch.py
--- a/hgext/fetch.py
+++ b/hgext/fetch.py
@@ -7,7 +7,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import nullid, short
-from mercurial import commands, cmdutil, hg, node, util
+from mercurial import commands, cmdutil, hg, util
 
 def fetch(ui, repo, source='default', **opts):
     '''Pull changes from a remote repository, merge new changes if needed.
diff --git a/hgext/graphlog.py b/hgext/graphlog.py
--- a/hgext/graphlog.py
+++ b/hgext/graphlog.py
@@ -10,7 +10,7 @@
 from mercurial.cmdutil import revrange, show_changeset
 from mercurial.commands import templateopts
 from mercurial.i18n import _
-from mercurial.node import nullid, nullrev
+from mercurial.node import nullrev
 from mercurial.util import Abort, canonpath
 
 def revision_grapher(repo, start_rev, stop_rev):
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -46,7 +46,7 @@
 # vdiff on hovered and selected revisions.
 
 import os
-from mercurial import hg, fancyopts, commands, ui, util, patch, revlog
+from mercurial import hg, commands, util, patch, revlog
 
 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
     """diff trees from two commits"""
diff --git a/hgext/highlight.py b/hgext/highlight.py
--- a/hgext/highlight.py
+++ b/hgext/highlight.py
@@ -31,13 +31,8 @@
                             'pkg_resources',
                             '__main__',])
 
-import mimetypes
-
-from mercurial.hgweb import hgweb_mod
 from mercurial.hgweb.hgweb_mod import hgweb
 from mercurial import util
-from mercurial.hgweb.common import paritygen
-from mercurial.node import hex
 from mercurial.templatefilters import filters
 
 from pygments import highlight
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -67,7 +67,7 @@
 import os, errno, socket, tempfile
 import email.MIMEMultipart, email.MIMEText, email.MIMEBase
 import email.Utils, email.Encoders
-from mercurial import cmdutil, commands, hg, mail, ui, patch, util
+from mercurial import cmdutil, commands, hg, mail, patch, util
 from mercurial.i18n import _
 from mercurial.node import bin
 
diff --git a/hgext/purge.py b/hgext/purge.py
--- a/hgext/purge.py
+++ b/hgext/purge.py
@@ -27,7 +27,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-from mercurial import hg, util, commands
+from mercurial import util, commands
 from mercurial.i18n import _
 import os
 
diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -8,9 +8,9 @@
 '''interactive change selection during commit or qrefresh'''
 
 from mercurial.i18n import _
-from mercurial import cmdutil, commands, cmdutil, extensions, hg, mdiff, patch, revlog
+from mercurial import cmdutil, commands, extensions, hg, mdiff, patch
 from mercurial import util
-import copy, cStringIO, errno, operator, os, re, shutil, tempfile
+import copy, cStringIO, errno, operator, os, re, tempfile
 
 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
 
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -7,7 +7,7 @@
 
 from mercurial.i18n import _
 import os, tempfile
-from mercurial import bundlerepo, changegroup, cmdutil, commands, hg, merge
+from mercurial import bundlerepo, changegroup, cmdutil, hg, merge
 from mercurial import patch, revlog, util
 
 '''patch transplanting tool
diff --git a/hgext/win32text.py b/hgext/win32text.py
--- a/hgext/win32text.py
+++ b/hgext/win32text.py
@@ -22,7 +22,6 @@
 # [hooks]
 # pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
 
-from mercurial import util, ui
 from mercurial.i18n import gettext as _
 from mercurial.node import bin, short
 import re
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -7,8 +7,7 @@
 
 from node import bin, hex, nullid
 from revlog import revlog
-from i18n import _
-import os, time, util
+import util
 
 def _string_escape(text):
     """
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -10,7 +10,7 @@
 import os, re, sys, urllib
 import hg, util, revlog, bundlerepo, extensions
 import difflib, patch, time, help, mdiff, tempfile
-import errno, version, socket
+import version, socket
 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
 
 # Commands start here, listed alphabetically
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -7,7 +7,7 @@
 
 from node import nullid, nullrev, short
 from i18n import _
-import ancestor, bdiff, repo, revlog, util, os, errno
+import ancestor, bdiff, revlog, util, os, errno
 
 class changectx(object):
     """A changecontext object makes access to data related to a particular
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -9,7 +9,7 @@
 
 from node import nullid
 from i18n import _
-import struct, os, time, bisect, stat, strutil, util, re, errno, ignore
+import struct, os, bisect, stat, strutil, util, errno, ignore
 import cStringIO, osutil
 
 _unknown = ('?', 0, 0, 0)
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -6,7 +6,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import imp, os
-import util, sys
+import util
 from i18n import _
 
 _extensions = {}
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -7,7 +7,6 @@
 
 from node import bin, nullid
 from revlog import revlog
-import os
 
 class filelog(revlog):
     def __init__(self, opener, path):
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,7 @@
 
 from node import nullrev
 from i18n import _
-import util, os, tempfile, context, simplemerge, re, filecmp
+import util, os, tempfile, simplemerge, re, filecmp
 
 def _toolstr(ui, tool, part, default=""):
     return ui.config("merge-tools", tool + "." + part, default)
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -5,9 +5,8 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import cStringIO, zlib, bz2, tempfile, errno, os, sys
+import cStringIO, zlib, tempfile, errno, os, sys
 from mercurial import util, streamclone
-from mercurial.i18n import gettext as _
 from mercurial.node import bin, hex
 from mercurial import changegroup as changegroupmod
 from common import HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -7,7 +7,6 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import socket, cgi, errno
-from mercurial.i18n import gettext as _
 from common import ErrorResponse, statusmessage
 
 class wsgirequest(object):
diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -7,7 +7,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback
-from mercurial import ui, hg, util, templater
+from mercurial import hg, util
 from hgweb_mod import hgweb
 from hgwebdir_mod import hgwebdir
 from mercurial.i18n import gettext as _
diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -10,7 +10,7 @@
 from remoterepo import remoterepository
 from i18n import _
 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib
-import errno, keepalive, tempfile, socket, changegroup
+import errno, keepalive, socket, changegroup
 
 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm):
     def __init__(self, ui):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -9,7 +9,7 @@
 from i18n import _
 import repo, changegroup
 import changelog, dirstate, filelog, manifest, context, weakref
-import re, lock, transaction, tempfile, stat, errno, ui
+import lock, transaction, stat, errno, ui
 import os, revlog, time, util, extensions, hook, inspect
 
 class localrepository(repo.repository):
diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py
--- a/mercurial/lsprof.py
+++ b/mercurial/lsprof.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 
 import sys
-from _lsprof import Profiler, profiler_entry, profiler_subentry
+from _lsprof import Profiler, profiler_entry
 
 __all__ = ['profile', 'Stats']
 
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -8,7 +8,7 @@
 from node import bin, hex, nullid
 from revlog import revlog, RevlogError
 from i18n import _
-import array, bisect, struct, mdiff
+import array, struct, mdiff
 
 class manifestdict(dict):
     def __init__(self, mapping=None, flags=None):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -12,7 +12,7 @@
 
 from node import bin, hex, nullid, nullrev, short
 from i18n import _
-import binascii, changegroup, errno, ancestor, mdiff, os
+import changegroup, errno, ancestor, mdiff
 import sha, struct, util, zlib
 
 _pack = struct.pack
diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -19,7 +19,7 @@
 # s: "i hate that."
 
 from i18n import _
-import util, mdiff, fancyopts, sys, os
+import util, mdiff, sys, os
 
 class CantReprocessAndShowBase(Exception):
     pass
diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py
--- a/mercurial/sshrepo.py
+++ b/mercurial/sshrepo.py
@@ -8,7 +8,7 @@
 from node import bin, hex
 from remoterepo import remotelock, remoterepository
 from i18n import _
-import repo, os, re, stat, util
+import repo, os, re, util
 
 class sshrepository(remoterepository):
     def __init__(self, ui, path, create=0):
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -8,7 +8,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 from i18n import _
-import changelog, filelog, httprangereader
+import changelog, httprangereader
 import repo, localrepo, manifest, util
 import urllib, urllib2, errno
 
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -5,7 +5,6 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from i18n import _
 import os, osutil, stat, util, lock
 
 # if server supports streaming clone, it advertises "stream"
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -13,7 +13,7 @@
 """
 
 from i18n import _
-import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil
+import cStringIO, errno, getpass, re, shutil, sys, tempfile
 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
 import urlparse
 
diff --git a/mercurial/util_win32.py b/mercurial/util_win32.py
--- a/mercurial/util_win32.py
+++ b/mercurial/util_win32.py
@@ -13,7 +13,6 @@
 
 import win32api
 
-from i18n import _
 import errno, os, pywintypes, win32con, win32file, win32process
 import cStringIO, winerror
 import osutil
diff --git a/tests/md5sum.py b/tests/md5sum.py
--- a/tests/md5sum.py
+++ b/tests/md5sum.py
@@ -7,7 +7,6 @@
 # GPL-compatible.
 
 import sys
-import os
 import md5
 
 for filename in sys.argv[1:]:
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -12,7 +12,6 @@
 import optparse
 import os
 import popen2
-import re
 import shutil
 import signal
 import sys
diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -1,5 +1,5 @@
 import os
-from mercurial import hg, ui, commands
+from mercurial import hg, ui
 
 u = ui.ui()
 
diff --git a/tests/test-simplemerge.py b/tests/test-simplemerge.py
--- a/tests/test-simplemerge.py
+++ b/tests/test-simplemerge.py
@@ -14,11 +14,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-import os
 import unittest
 from unittest import TestCase
-import imp
-import shutil
 from mercurial import util, simplemerge
 
 # bzr compatible interface, for the tests


More information about the Mercurial-devel mailing list