# HG changeset patch # User Thomas Arendsen Hein # Date 1183041157 -7200 # Node ID a64085f52bab1fea87d2757962a66712b403967f # Parent 8d4fac0a9df7670726d747f7e327c8f812b0895c Enable demandimport only in scripts, not in importable modules (issue605) This way other applications can choose if and when they want this feature, which will be problematic if those applications rely on ImportError. diff -r 8d4fac0a9df7 -r a64085f52bab contrib/hg-ssh --- a/contrib/hg-ssh Thu Jun 28 16:18:09 2007 +0200 +++ b/contrib/hg-ssh Thu Jun 28 16:32:37 2007 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005, 2006 by Intevation GmbH +# Copyright 2005, 2006, 2007 by Intevation GmbH # Author(s): # Thomas Arendsen Hein # @@ -25,6 +25,7 @@ command="cd repos && hg-ssh user/thomas/ command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}" """ +from mercurial import demandimport; demandimport.enable() from mercurial import commands import sys, os diff -r 8d4fac0a9df7 -r a64085f52bab contrib/hgwebdir.fcgi --- a/contrib/hgwebdir.fcgi Thu Jun 28 16:18:09 2007 +0200 +++ b/contrib/hgwebdir.fcgi Thu Jun 28 16:32:37 2007 +0200 @@ -1,6 +1,9 @@ #!/usr/bin/env python # # An example CGI script to export multiple hgweb repos, edit as necessary + +# enable demandloading to reduce startup time +from mercurial import demandimport; demandimport.enable() # send python tracebacks to the browser if an error occurs: import cgitb diff -r 8d4fac0a9df7 -r a64085f52bab hg --- a/hg Thu Jun 28 16:18:09 2007 +0200 +++ b/hg Thu Jun 28 16:32:37 2007 +0200 @@ -7,5 +7,8 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. +# enable demandloading to reduce startup time +from mercurial import demandimport; demandimport.enable() + import mercurial.commands mercurial.commands.run() diff -r 8d4fac0a9df7 -r a64085f52bab hgweb.cgi --- a/hgweb.cgi Thu Jun 28 16:18:09 2007 +0200 +++ b/hgweb.cgi Thu Jun 28 16:32:37 2007 +0200 @@ -1,6 +1,9 @@ #!/usr/bin/env python # # An example CGI script to use hgweb, edit as necessary + +# enable demandloading to reduce startup time +from mercurial import demandimport; demandimport.enable() # send python tracebacks to the browser if an error occurs: import cgitb diff -r 8d4fac0a9df7 -r a64085f52bab hgwebdir.cgi --- a/hgwebdir.cgi Thu Jun 28 16:18:09 2007 +0200 +++ b/hgwebdir.cgi Thu Jun 28 16:32:37 2007 +0200 @@ -1,6 +1,9 @@ #!/usr/bin/env python # # An example CGI script to export multiple hgweb repos, edit as necessary + +# enable demandloading to reduce startup time +from mercurial import demandimport; demandimport.enable() # send python tracebacks to the browser if an error occurs: import cgitb diff -r 8d4fac0a9df7 -r a64085f52bab mercurial/commands.py --- a/mercurial/commands.py Thu Jun 28 16:18:09 2007 +0200 +++ b/mercurial/commands.py Thu Jun 28 16:32:37 2007 +0200 @@ -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 demandimport; demandimport.enable() from node import * from i18n import _ import bisect, os, re, sys, urllib, shlex, stat diff -r 8d4fac0a9df7 -r a64085f52bab mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Thu Jun 28 16:18:09 2007 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Jun 28 16:32:37 2007 +0200 @@ -6,7 +6,6 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from mercurial import demandimport; demandimport.enable() import os, mimetools, cStringIO from mercurial.i18n import gettext as _ from mercurial import ui, hg, util, templater diff -r 8d4fac0a9df7 -r a64085f52bab setup.py --- a/setup.py Thu Jun 28 16:18:09 2007 +0200 +++ b/setup.py Thu Jun 28 16:32:37 2007 +0200 @@ -14,8 +14,6 @@ from distutils.command.install_data impo from distutils.command.install_data import install_data import mercurial.version -import mercurial.demandimport -mercurial.demandimport.enable = lambda: None extra = {}