annotate hgwebdir.cgi @ 2439:e8c4f3d3df8c

extend network protocol to stop clients from locking servers now all repositories have capabilities slot, tuple with list of names. if 'unbundle' capability present, repo supports push where client does not need to lock server. repository classes that have unbundle capability also have unbundle method. implemented for ssh now, will be base for push over http. unbundle protocol acts this way. server tells client what heads it has during normal negotiate step. client starts unbundle by repeat server's heads back to it. if server has new heads, abort immediately. otherwise, transfer changes to server. once data transferred, server locks and checks heads again. if heads same, changes can be added. else someone else added heads, and server aborts. if client wants to force server to add heads, sends special heads list of 'force'.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 15 Jun 2006 16:37:23 -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()