# HG changeset patch # User Vadim Gelfer # Date 1150907551 25200 # Node ID 7a77934ece466cc4680b7dc83cb2a605ede44a8e # Parent 1e32e2fe8a677c391049d40b8794478976a0a914# Parent 6904e1ef8ad16202c03e488eb8faa59eaabe2a93 merge with crew. diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -6,10 +6,9 @@ changegroup.py - Mercurial changegroup m 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""" diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -7,11 +7,10 @@ This software may be used and distribute 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" diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -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): diff --git a/mercurial/hg.py b/mercurial/hg.py diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -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 = () diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -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): diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -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.''' diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -7,7 +7,8 @@ This software may be used and distribute of the GNU General Public License, incorporated herein by reference. """ -import binascii +from demandload import demandload +demandload(globals(), "binascii") nullid = "\0" * 20 diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.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. -import re from demandload import demandload from i18n import gettext as _ from node import * @@ -194,11 +193,16 @@ def stringify(thing): 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: diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -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): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -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, diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -10,11 +10,10 @@ This contains helper routines that are i 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."""