Backed out changeset b913d3aacddc (see issue971/msg5317)
authorThomas Arendsen Hein <thomas@intevation.de>
Mon, 18 Feb 2008 19:20:22 +0100
changeset 6141 90e5c82a3859
parent 5995 b913d3aacddc
child 6142 50a277e6ceae
Backed out changeset b913d3aacddc (see issue971/msg5317)
contrib/hgwebdir.fcgi
doc/hgrc.5.txt
hgweb.cgi
hgwebdir.cgi
mercurial/dispatch.py
mercurial/hgweb/hgweb_mod.py
--- a/contrib/hgwebdir.fcgi	Fri Feb 01 13:09:45 2008 -0800
+++ b/contrib/hgwebdir.fcgi	Mon Feb 18 19:20:22 2008 +0100
@@ -23,7 +23,6 @@
 
 from mercurial.hgweb.hgwebdir_mod import hgwebdir
 from mercurial.hgweb.request import wsgiapplication
-from mercurial import dispatch, ui
 from flup.server.fcgi import WSGIServer
 
 # The config file looks like this.  You can have paths to individual
@@ -45,8 +44,7 @@
 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
 # or use a dictionary with entries like 'virtual/path': '/real/path'
 
-def web_app(ui):
-    return lambda: hgwebdir("hgweb.config", ui)
+def make_web_app():
+    return hgwebdir("hgweb.config")
 
-u = ui.ui(report_untrusted=False, interactive=False)
-dispatch.profiled(u, lambda: WSGIServer(wsgiapplication(web_app(u))).run())
+WSGIServer(wsgiapplication(make_web_app)).run()
--- a/doc/hgrc.5.txt	Fri Feb 01 13:09:45 2008 -0800
+++ b/doc/hgrc.5.txt	Mon Feb 18 19:20:22 2008 +0100
@@ -403,17 +403,6 @@
     Optional.  Directory or URL to use when pushing if no destination
     is specified.
 
-profile::
-  Configuration of profiling options, for in-depth performance
-  analysis.  Mostly useful to developers.
-  enable;;
-    Enable a particular profiling mode.  Useful for profiling
-    server-side processes.  "lsprof" enables modern profiling.
-    "hotshot" is deprecated, and produces less reliable results.
-    Default is no profiling.
-  output;;
-    The name of a file to write profiling data to.  Default is stderr.
-  
 server::
   Controls generic server settings.
   uncompressed;;
--- a/hgweb.cgi	Fri Feb 01 13:09:45 2008 -0800
+++ b/hgweb.cgi	Mon Feb 18 19:20:22 2008 +0100
@@ -22,9 +22,7 @@
 #os.environ["HGENCODING"] = "UTF-8"
 
 from mercurial.hgweb.hgweb_mod import hgweb
-from mercurial import dispatch, ui
 import mercurial.hgweb.wsgicgi as wsgicgi
 
-u = ui.ui(report_untrusted=False, interactive=False)
-dispatch.profiled(u, lambda: wsgicgi.launch(hgweb("/path/to/repo",
-                                                  "repository name", u)))
+application = hgweb("/path/to/repo", "repository name")
+wsgicgi.launch(application)
--- a/hgwebdir.cgi	Fri Feb 01 13:09:45 2008 -0800
+++ b/hgwebdir.cgi	Mon Feb 18 19:20:22 2008 +0100
@@ -22,7 +22,6 @@
 #os.environ["HGENCODING"] = "UTF-8"
 
 from mercurial.hgweb.hgwebdir_mod import hgwebdir
-from mercurial import dispatch, ui
 import mercurial.hgweb.wsgicgi as wsgicgi
 
 # The config file looks like this.  You can have paths to individual
@@ -44,5 +43,5 @@
 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
 # or use a dictionary with entries like 'virtual/path': '/real/path'
 
-u = ui.ui(report_untrusted=False, interactive=False)
-dispatch.profiled(u, lambda: wsgicgi.launch(hgwebdir('hgweb.config', u)))
+application = hgwebdir('hgweb.config')
+wsgicgi.launch(application)
--- a/mercurial/dispatch.py	Fri Feb 01 13:09:45 2008 -0800
+++ b/mercurial/dispatch.py	Mon Feb 18 19:20:22 2008 +0100
@@ -373,17 +373,8 @@
             if len(tb) != 2: # no
                 raise
             raise ParseError(cmd, _("invalid arguments"))
-    return profiled(ui, checkargs, options)
 
-def profiled(ui, func, options={}):
-    def profile_fp():
-        outfile = ui.config('profile', 'output', untrusted=True)
-        if outfile:
-            return open(outfile, 'w')
-        else:
-            return sys.stderr
-    
-    if options.get('profile') or ui.config('profile', 'enable') == 'hotshot':
+    if options['profile']:
         import hotshot, hotshot.stats
         prof = hotshot.Profile("hg.prof")
         try:
@@ -399,11 +390,10 @@
         finally:
             prof.close()
             stats = hotshot.stats.load("hg.prof")
-            stats.stream = profile_fp()
             stats.strip_dirs()
             stats.sort_stats('time', 'calls')
             stats.print_stats(40)
-    elif options.get('lsprof') or ui.config('profile', 'enable') == 'lsprof':
+    elif options['lsprof']:
         try:
             from mercurial import lsprof
         except ImportError:
@@ -413,11 +403,11 @@
         p = lsprof.Profiler()
         p.enable(subcalls=True)
         try:
-            return func()
+            return checkargs()
         finally:
             p.disable()
             stats = lsprof.Stats(p.getstats())
             stats.sort()
-            stats.pprint(top=10, file=profile_fp(), climit=5)
+            stats.pprint(top=10, file=sys.stderr, climit=5)
     else:
-        return func()
+        return checkargs()
--- a/mercurial/hgweb/hgweb_mod.py	Fri Feb 01 13:09:45 2008 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Feb 18 19:20:22 2008 +0100
@@ -79,10 +79,9 @@
     return nav
 
 class hgweb(object):
-    def __init__(self, repo, name=None, parentui=None):
+    def __init__(self, repo, name=None):
         if isinstance(repo, str):
-            parentui = (parentui or
-                        ui.ui(report_untrusted=False, interactive=False))
+            parentui = ui.ui(report_untrusted=False, interactive=False)
             self.repo = hg.repository(parentui, repo)
         else:
             self.repo = repo