# HG changeset patch # User Thomas Arendsen Hein # Date 1187429828 -7200 # Node ID 55860a45bbf281dfe9f8d081f9f1498064652151 # Parent 86e95b93559afa8e16d5c13f306012d571775954 Enable demandimport only in scripts, not in importable modules (issue605) This way other applications can choose if and when they want this feature, because it might be problematic if those applications rely on ImportError. diff -r 86e95b93559a -r 55860a45bbf2 contrib/hg-ssh --- a/contrib/hg-ssh Fri Aug 17 23:20:13 2007 -0300 +++ b/contrib/hg-ssh Sat Aug 18 11:37:08 2007 +0200 @@ -25,6 +25,9 @@ command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}" """ +# enable importing on demand to reduce startup time +from mercurial import demandimport; demandimport.enable() + from mercurial import dispatch import sys, os diff -r 86e95b93559a -r 55860a45bbf2 contrib/hgwebdir.fcgi --- a/contrib/hgwebdir.fcgi Fri Aug 17 23:20:13 2007 -0300 +++ b/contrib/hgwebdir.fcgi Sat Aug 18 11:37:08 2007 +0200 @@ -2,6 +2,9 @@ # # 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 cgitb.enable() diff -r 86e95b93559a -r 55860a45bbf2 hg --- a/hg Fri Aug 17 23:20:13 2007 -0300 +++ b/hg Sat Aug 18 11:37:08 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 importing on demand to reduce startup time +from mercurial import demandimport; demandimport.enable() + import mercurial.dispatch mercurial.dispatch.run() diff -r 86e95b93559a -r 55860a45bbf2 hgweb.cgi --- a/hgweb.cgi Fri Aug 17 23:20:13 2007 -0300 +++ b/hgweb.cgi Sat Aug 18 11:37:08 2007 +0200 @@ -2,6 +2,9 @@ # # An example CGI script to use hgweb, edit as necessary +# enable importing on demand to reduce startup time +from mercurial import demandimport; demandimport.enable() + # send python tracebacks to the browser if an error occurs: import cgitb cgitb.enable() diff -r 86e95b93559a -r 55860a45bbf2 hgwebdir.cgi --- a/hgwebdir.cgi Fri Aug 17 23:20:13 2007 -0300 +++ b/hgwebdir.cgi Sat Aug 18 11:37:08 2007 +0200 @@ -2,6 +2,9 @@ # # An example CGI script to export multiple hgweb repos, edit as necessary +# enable importing on demand to reduce startup time +from mercurial import demandimport; demandimport.enable() + # send python tracebacks to the browser if an error occurs: import cgitb cgitb.enable() diff -r 86e95b93559a -r 55860a45bbf2 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Fri Aug 17 23:20:13 2007 -0300 +++ b/mercurial/hgweb/hgwebdir_mod.py Sat Aug 18 11:37:08 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 86e95b93559a -r 55860a45bbf2 setup.py --- a/setup.py Fri Aug 17 23:20:13 2007 -0300 +++ b/setup.py Sat Aug 18 11:37:08 2007 +0200 @@ -14,8 +14,6 @@ from distutils.command.install_data import install_data import mercurial.version -import mercurial.demandimport -mercurial.demandimport.enable = lambda: None extra = {}