use demandload more.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Tue, 20 Jun 2006 23:58:21 -0700
changeset 2470 fe1689273f84
parent 2459 5c5277f03887
child 2471 6904e1ef8ad1
use demandload more.
mercurial/changegroup.py
mercurial/dirstate.py
mercurial/filelog.py
mercurial/localrepo.py
mercurial/manifest.py
mercurial/mdiff.py
mercurial/node.py
mercurial/templater.py
mercurial/transaction.py
mercurial/ui.py
mercurial/util.py
--- a/mercurial/changegroup.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/changegroup.py	Tue Jun 20 23:58:21 2006 -0700
@@ -6,10 +6,9 @@
 This software may be used and distributed according to the terms
 of the GNU General Public License, incorporated herein by reference.
 """
-import struct
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "util")
+demandload(globals(), "struct util")
 
 def getchunk(source):
     """get a chunk from a changegroup"""
--- a/mercurial/dirstate.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/dirstate.py	Tue Jun 20 23:58:21 2006 -0700
@@ -7,11 +7,10 @@
 of the GNU General Public License, incorporated herein by reference.
 """
 
-import struct, os
 from node import *
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "time bisect stat util re errno")
+demandload(globals(), "struct os time bisect stat util re errno")
 
 class dirstate(object):
     format = ">cllll"
--- a/mercurial/filelog.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/filelog.py	Tue Jun 20 23:58:21 2006 -0700
@@ -5,10 +5,9 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os
 from revlog import *
 from demandload import *
-demandload(globals(), "bdiff")
+demandload(globals(), "bdiff os")
 
 class filelog(revlog):
     def __init__(self, opener, path, defversion=REVLOG_DEFAULT_VERSION):
--- a/mercurial/localrepo.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/localrepo.py	Tue Jun 20 23:58:21 2006 -0700
@@ -5,14 +5,13 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os, util
-import filelog, manifest, changelog, dirstate, repo
 from node import *
 from i18n import gettext as _
 from demandload import *
 demandload(globals(), "appendfile changegroup")
+demandload(globals(), "changelog dirstate filelog manifest repo")
 demandload(globals(), "re lock transaction tempfile stat mdiff errno ui")
-demandload(globals(), "revlog")
+demandload(globals(), "os revlog util")
 
 class localrepository(object):
     capabilities = ()
--- a/mercurial/manifest.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/manifest.py	Tue Jun 20 23:58:21 2006 -0700
@@ -5,11 +5,10 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import struct
 from revlog import *
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "bisect array")
+demandload(globals(), "array bisect struct")
 
 class manifest(revlog):
     def __init__(self, opener, defversion=REVLOGV0):
--- a/mercurial/mdiff.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/mdiff.py	Tue Jun 20 23:58:21 2006 -0700
@@ -6,8 +6,8 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 from demandload import demandload
-import struct, bdiff, util, mpatch
-demandload(globals(), "re")
+import bdiff, mpatch
+demandload(globals(), "re struct util")
 
 def splitnewlines(text):
     '''like str.splitlines, but only split on newlines.'''
--- a/mercurial/node.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/node.py	Tue Jun 20 23:58:21 2006 -0700
@@ -7,7 +7,8 @@
 of the GNU General Public License, incorporated herein by reference.
 """
 
-import binascii
+from demandload import demandload
+demandload(globals(), "binascii")
 
 nullid = "\0" * 20
 
--- a/mercurial/templater.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/templater.py	Tue Jun 20 23:58:21 2006 -0700
@@ -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.
 
-import re
 from demandload import demandload
 from i18n import gettext as _
 from node import *
@@ -194,11 +193,16 @@
     walk(thing)
     return cs.getvalue()
 
-para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M)
-space_re = re.compile(r'  +')
+para_re = None
+space_re = None
 
 def fill(text, width):
     '''fill many paragraphs.'''
+    global para_re, space_re
+    if para_re is None:
+        para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M)
+        space_re = re.compile(r'  +')
+        
     def findparas():
         start = 0
         while True:
--- a/mercurial/transaction.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/transaction.py	Tue Jun 20 23:58:21 2006 -0700
@@ -11,8 +11,9 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os
+from demandload import demandload
 from i18n import gettext as _
+demandload(globals(), 'os')
 
 class transaction(object):
     def __init__(self, report, opener, journal, after=None):
--- a/mercurial/ui.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/ui.py	Tue Jun 20 23:58:21 2006 -0700
@@ -5,11 +5,10 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import ConfigParser
 from i18n import gettext as _
 from demandload import *
 demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
-demandload(globals(), "templater traceback util")
+demandload(globals(), "ConfigParser templater traceback util")
 
 class ui(object):
     def __init__(self, verbose=False, debug=False, quiet=False,
--- a/mercurial/util.py	Mon Jun 19 20:37:36 2006 +0200
+++ b/mercurial/util.py	Tue Jun 20 23:58:21 2006 -0700
@@ -10,11 +10,10 @@
 platform-specific details from the core.
 """
 
-import os, errno
 from i18n import gettext as _
 from demandload import *
 demandload(globals(), "cStringIO errno popen2 re shutil sys tempfile")
-demandload(globals(), "threading time")
+demandload(globals(), "os threading time")
 
 class SignalInterrupt(Exception):
     """Exception raised on SIGTERM and SIGHUP."""