hgweb.cgi
author Matt Mackall <mpm@selenic.com>
Fri, 01 Jun 2007 18:40:14 -0500
changeset 4478 b2b55acbacdd
parent 3868 6033d9f28052
child 5197 55860a45bbf2
permissions -rw-r--r--
Add support for url#id syntax This allows you to do: hg clone http://server/repo#stable which is equivalent to: hg clone -r stable http://server/repo Future incoming, outgoing, and push commands will default to using this id because it's recorded in the default path. Other commands that accept URLs (push, pull, bundle, incoming, and outgoing) also accept this syntax.
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
#
f9d8620ef469 Add example CGI script
mpm@selenic.com
parents:
diff changeset
     3
# An example CGI script to use hgweb, edit as necessary
f9d8620ef469 Add example CGI script
mpm@selenic.com
parents:
diff changeset
     4
3868
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
     5
# send python tracebacks to the browser if an error occurs:
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
     6
import cgitb
391
5f65a108a559 hgweb: pull cgitb into CGI script example, where it can easily be disabled
mpm@selenic.com
parents: 202
diff changeset
     7
cgitb.enable()
5f65a108a559 hgweb: pull cgitb into CGI script example, where it can easily be disabled
mpm@selenic.com
parents: 202
diff changeset
     8
3868
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
     9
# adjust python path if not a system-wide install:
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    10
#import sys
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    11
#sys.path.insert(0, "/path/to/python/lib")
159
f9d8620ef469 Add example CGI script
mpm@selenic.com
parents:
diff changeset
    12
3782
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    13
# If you'd like to serve pages with UTF-8 instead of your default
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    14
# locale charset, you can do so by uncommenting the following lines.
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    15
# Note that this will cause your .hgrc files to be interpreted in
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    16
# UTF-8 and all your repo files to be displayed using UTF-8.
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    17
#
3868
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    18
#import os
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    19
#os.environ["HGENCODING"] = "UTF-8"
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    20
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    21
from mercurial.hgweb.hgweb_mod import hgweb
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    22
from mercurial.hgweb.request import wsgiapplication
6033d9f28052 hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3782
diff changeset
    23
import mercurial.hgweb.wsgicgi as wsgicgi
3782
713e35dcc321 hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents: 2506
diff changeset
    24
2506
d0db3462d568 This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents: 391
diff changeset
    25
def make_web_app():
d0db3462d568 This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents: 391
diff changeset
    26
    return hgweb("/path/to/repo", "repository name")
d0db3462d568 This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents: 391
diff changeset
    27
d0db3462d568 This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents: 391
diff changeset
    28
wsgicgi.launch(wsgiapplication(make_web_app))