annotate hgwebdir.cgi @ 2434:a2df85adface

http server: support persistent connections. only "hg serve" affected yet. http server running cgi script will not use persistent connections. support for fastcgi will help that. clients that support keepalive can use one tcp connection for all commands during clone and pull. this makes latency of binary search during pull much lower over wan. if server does not know content-length, it will force connection to close at end. right fix is to use chunked transfer-encoding but this is easier and does not hurt performance. only command that is affected is "changegroup" which is always last command during a pull.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 15 Jun 2006 12:55:58 -0700
parents b0f6af327fd4
children d0db3462d568
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
1 #!/usr/bin/env python
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
2 #
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
3 # An example CGI script to export multiple hgweb repos, edit as necessary
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
4
1064
8d791bea49d4 Removed obsolete imports from hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents: 941
diff changeset
5 import cgitb, sys
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
6 cgitb.enable()
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
7
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
8 # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
9 from mercurial import hgweb
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
10
1829
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
11 # The config file looks like this. You can have paths to individual
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
12 # repos, collections of repos in a directory tree, or both.
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
13 #
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
14 # [paths]
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
15 # virtual/path = /real/path
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
16 # virtual/path = /real/path
1829
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
17 #
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
18 # [collections]
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
19 # /prefix/to/strip/off = /root/of/tree/full/of/repos
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
20 #
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
21 # collections example: say directory tree /foo contains repos /foo/bar,
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
22 # /foo/quux/baz. Give this config section:
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
23 # [collections]
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
24 # /foo = /foo
b0f6af327fd4 hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1144
diff changeset
25 # Then repos will list as bar and quux/baz.
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
26
1144
8a39df05d2c1 Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1064
diff changeset
27 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
8a39df05d2c1 Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1064
diff changeset
28 # or use a dictionary with entries like 'virtual/path': '/real/path'
8a39df05d2c1 Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1064
diff changeset
29
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
30 h = hgweb.hgwebdir("hgweb.config")
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
31 h.run()