hgweb.cgi
author Durham Goode <durham@fb.com>
Wed, 24 Feb 2016 10:41:15 -0800
changeset 28217 d2ac8b57a75d
parent 26421 4b0fc75f9403
child 43731 47ef023d0165
permissions -rwxr-xr-x
revset: use smartset minus operator Previously, revsets like 'X - Y' were translated to be 'X and not Y'. This can be expensive, since if Y is a single commit then 'not Y' becomes a huge set and sometimes the query optimizer doesn't account for it well. This patch changes revsets to use the built in smartset minus operator, which is often smarter than 'X and not Y'. On a large repo this saves 2.2 seconds on rebase and histedit because "X:: - X" becomes almost instant. Relevant performance numbers from revsetbenchmark.py revset #13: roots((tip~100::) - (tip~100::tip)) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.001080 0.001107 0.001102 0.001118 0.001121 0.001114 0.001141 0.001123 0.001099 0.001123 0.001137 1) 0.000708 65% 0.000738 66% 0.000735 66% 0.000739 66% 0.000784 69% 0.000780 70% 0.000807 70% 0.000756 67% 0.000727 66% 0.000759 67% 0.000808 71% revset #14: roots((0::) - (0::tip)) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.131304 0.079168 0.133129 0.076560 0.048179 0.133349 0.049153 0.077097 0.129689 0.076212 0.048543 1) 0.065066 49% 0.036941 46% 0.066063 49% 0.034755 45% 0.048558 0.071091 53% 0.047679 0.034984 45% 0.064572 49% 0.035680 46% 0.048508 revset #22: (not public() - obsolete()) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.000139 0.000133 0.000133 0.000138 0.000134 0.000155 0.000157 0.000152 0.000157 0.000156 0.000153 1) 0.000108 77% 0.000129 0.000129 0.000134 0.000132 0.000127 81% 0.000151 0.000147 0.000127 80% 0.000152 0.000149 revset #25: (20000::) - (20000) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.050560 0.045513 0.022593 0.043588 0.021909 0.045517 0.021822 0.044660 0.049740 0.044227 0.021819 1) 0.018614 36% 0.000171 0% 0.019659 87% 0.000168 0% 0.015543 70% 0.021069 46% 0.015623 71% 0.000180 0% 0.018658 37% 0.000186 0% 0.015750 72%
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
202
e875a0cf7f3a Call python via env in hgweb.cgi
mpm@selenic.com
parents: 159
diff changeset
     1
#!/usr/bin/env python
159
f9d8620ef469 Add example CGI script
mpm@selenic.com
parents:
diff changeset
     2
#
11000
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
     3
# An example hgweb CGI script, edit as necessary
26421
4b0fc75f9403 urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents: 15475
diff changeset
     4
# See also https://mercurial-scm.org/wiki/PublishingRepositories
159
f9d8620ef469 Add example CGI script
mpm@selenic.com
parents:
diff changeset
     5
11000
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
     6
# Path to repo or hgweb config to serve (see 'hg help hgweb')
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
     7
config = "/path/to/repo/or/config"
5244
79279b5583c6 cgi: sys.path.insert should be before importing mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5197
diff changeset
     8
15475
85cba926cb59 hgweb: add hint about finding library path with debuginstall
Matt Mackall <mpm@selenic.com>
parents: 11503
diff changeset
     9
# Uncomment and adjust if Mercurial is not installed system-wide
85cba926cb59 hgweb: add hint about finding library path with debuginstall
Matt Mackall <mpm@selenic.com>
parents: 11503
diff changeset
    10
# (consult "installed modules" path from 'hg debuginstall'):
11000
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
    11
#import sys; sys.path.insert(0, "/path/to/python/lib")
5197
55860a45bbf2 Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3868
diff changeset
    12
6080
4baad19c4801 hgweb: disable cgitb by default
Maxim Dounin <mdounin@mdounin.ru>
parents: 5995
diff changeset
    13
# Uncomment to send python tracebacks to the browser if an error occurs:
11000
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
    14
#import cgitb; cgitb.enable()
391
5f65a108a559 hgweb: pull cgitb into CGI script example, where it can easily be disabled
mpm@selenic.com
parents: 202
diff changeset
    15
11000
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
    16
from mercurial import demandimport; demandimport.enable()
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
    17
from mercurial.hgweb import hgweb, wsgicgi
338167735124 hgweb: simplify hgweb.cgi, add help pointer
Matt Mackall <mpm@selenic.com>
parents: 6142
diff changeset
    18
application = hgweb(config)
6141
90e5c82a3859 Backed out changeset b913d3aacddc (see issue971/msg5317)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5995
diff changeset
    19
wsgicgi.launch(application)