changeset 6142:50a277e6ceae

merge backout
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 18 Feb 2008 19:21:33 +0100
parents 90e5c82a3859 (diff) 47e6d5d5913a (current diff)
children 5b159ebb19cf
files contrib/favicon.ico contrib/hgwebdir.fcgi doc/hgmerge.1.txt doc/hgrc.5.txt doc/ja/hgmerge.1.ja.txt hgmerge hgweb.cgi hgwebdir.cgi mercurial/dispatch.py mercurial/hgweb/hgweb_mod.py
diffstat 6 files changed, 14 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgwebdir.fcgi	Tue Aug 28 18:00:07 2007 +0200
+++ b/contrib/hgwebdir.fcgi	Mon Feb 18 19:21:33 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	Tue Aug 28 18:00:07 2007 +0200
+++ b/doc/hgrc.5.txt	Mon Feb 18 19:21:33 2008 +0100
@@ -479,20 +479,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.  Each occurrence of
-    "%%p" will be replaced with the current process ID (the repeated
-    "%" protects against the config parser's string interpolator).
-    Default output is to stderr.
-  
 server::
   Controls generic server settings.
   uncompressed;;
--- a/hgweb.cgi	Tue Aug 28 18:00:07 2007 +0200
+++ b/hgweb.cgi	Mon Feb 18 19:21:33 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	Tue Aug 28 18:00:07 2007 +0200
+++ b/hgwebdir.cgi	Mon Feb 18 19:21:33 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	Tue Aug 28 18:00:07 2007 +0200
+++ b/mercurial/dispatch.py	Mon Feb 18 19:21:33 2008 +0100
@@ -373,18 +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:
-            pid = str(os.getpid())
-            return open(outfile.replace('%p', pid), '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:
@@ -400,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:
@@ -414,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	Tue Aug 28 18:00:07 2007 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Feb 18 19:21:33 2008 +0100
@@ -80,10 +80,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