Show More
@@ -1,47 +1,50 b'' | |||||
1 | Mercurial's internal web server, hgweb, can serve either a single |
|
1 | Mercurial's internal web server, hgweb, can serve either a single | |
2 |
repository, or a |
|
2 | repository, or a tree of repositories. In the second case, repository | |
3 | configuration file can be used to specify the repository paths to use |
|
3 | paths and global options can be defined using a dedicated | |
4 | and global web configuration options. |
|
4 | configuration file common to :hg:`serve`, ``hgweb.wsgi``, | |
|
5 | ``hgweb.cgi`` and ``hgweb.fcgi``. | |||
5 |
|
6 | |||
6 |
This file uses the same syntax as other Mercurial configuration files |
|
7 | This file uses the same syntax as other Mercurial configuration files | |
7 |
but only the following sections |
|
8 | but recognizes only the following sections: | |
8 |
|
9 | |||
9 | - web |
|
10 | - web | |
10 | - paths |
|
11 | - paths | |
11 | - collections |
|
12 | - collections | |
12 |
|
13 | |||
13 | The ``web`` section can specify all the settings described in the web |
|
14 | The ``web`` options are thorougly described in :hg:`help config`. | |
14 | section of the hgrc(5) documentation. See :hg:`help config` for |
|
15 | ||
15 | information on where to find the manual page. |
|
16 | The ``paths`` section maps URL paths to paths of repositories in the | |
|
17 | filesystem. hgweb will not expose the filesystem directly - only | |||
|
18 | Mercurial repositories can be published and only according to the | |||
|
19 | configuration. | |||
16 |
|
20 | |||
17 | The ``paths`` section provides mappings of physical repository |
|
21 | The left hand side is the path in the URL. Note that hgweb reserves | |
18 | paths to virtual ones. For instance:: |
|
22 | subpaths like ``rev`` or ``file``, try using different names for | |
|
23 | nested repositories to avoid confusing effects. | |||
|
24 | ||||
|
25 | The right hand side is the path in the filesystem. If the specified | |||
|
26 | path ends with ``*`` or ``**`` the filesystem will be searched | |||
|
27 | recursively for repositories below that point. | |||
|
28 | With ``*`` it will not recurse into the repositories it finds (except for | |||
|
29 | ``.hg/patches``). | |||
|
30 | With ``**`` it will also search inside repository working directories | |||
|
31 | and possibly find subrepositories. | |||
|
32 | ||||
|
33 | In this example:: | |||
19 |
|
34 | |||
20 | [paths] |
|
35 | [paths] | |
21 |
projects/a = / |
|
36 | /projects/a = /srv/tmprepos/a | |
22 |
projects/b = /b |
|
37 | /projects/b = c:/repos/b | |
23 | web/root = /real/root/* |
|
38 | / = /srv/repos/* | |
24 | / = /real/root2/* |
|
39 | /user/bob = /home/bob/repos/** | |
25 | virtual/root2 = /real/root2/** |
|
|||
26 |
|
40 | |||
27 | - The first two entries make two repositories in different directories |
|
41 | - The first two entries make two repositories in different directories | |
28 | appear under the same directory in the web interface |
|
42 | appear under the same directory in the web interface | |
29 |
- The third entry |
|
43 | - The third entry will publish every Mercurial repository found in | |
30 | into 'web/root'. This format is preferred over the [collections] one, |
|
44 | ``/srv/repos/``, for instance the repository ``/srv/repos/quux/`` | |
31 | since using absolute paths as configuration keys is not supported on every |
|
45 | will appear as ``http://server/quux/`` | |
32 | platform (especially on Windows). |
|
46 | - The fourth entry will publish both ``http://server/user/bob/quux/`` | |
33 | - The fourth entry is a special case mapping all repositories in |
|
47 | and ``http://server/user/bob/quux/testsubrepo/`` | |
34 | '/real/root2' in the root of the virtual directory. |
|
|||
35 | - The fifth entry recursively finds all repositories under the real |
|
|||
36 | root, and maps their relative paths under the virtual root. |
|
|||
37 |
|
48 | |||
38 | The ``collections`` section provides mappings of trees of physical |
|
49 | The ``collections`` section is deprecated and has been superseeded by | |
39 | repositories paths to virtual ones, though the paths syntax is generally |
|
50 | ``paths``. | |
40 | preferred. For instance:: |
|
|||
41 |
|
||||
42 | [collections] |
|
|||
43 | /foo = /foo |
|
|||
44 |
|
||||
45 | Here, the left side will be stripped off all repositories found in the |
|
|||
46 | right side. Thus ``/foo/bar`` and ``foo/quux/baz`` will be listed as |
|
|||
47 | ``bar`` and ``quux/baz`` respectively. |
|
@@ -23,10 +23,10 b' def findrepos(paths):' | |||||
23 | repos = [] |
|
23 | repos = [] | |
24 | for prefix, root in cleannames(paths): |
|
24 | for prefix, root in cleannames(paths): | |
25 | roothead, roottail = os.path.split(root) |
|
25 | roothead, roottail = os.path.split(root) | |
26 |
# "foo = /bar/*" |
|
26 | # "foo = /bar/*" or "foo = /bar/**" lets every repo /bar/N in or below | |
27 | # mounted as foo/subrepo |
|
27 | # /bar/ be served as as foo/N . | |
28 | # and "foo = /bar/**" also recurses into the subdirectories, |
|
28 | # '*' will not search inside dirs with .hg (except .hg/patches), | |
29 | # remember to use it without working dir. |
|
29 | # '**' will search inside dirs with .hg (and thus also find subrepos). | |
30 | try: |
|
30 | try: | |
31 | recurse = {'*': False, '**': True}[roottail] |
|
31 | recurse = {'*': False, '**': True}[roottail] | |
32 | except KeyError: |
|
32 | except KeyError: |
@@ -350,7 +350,8 b' def canonpath(root, cwd, myname, auditor' | |||||
350 | raise util.Abort('%s not under root' % myname) |
|
350 | raise util.Abort('%s not under root' % myname) | |
351 |
|
351 | |||
352 | def walkrepos(path, followsym=False, seen_dirs=None, recurse=False): |
|
352 | def walkrepos(path, followsym=False, seen_dirs=None, recurse=False): | |
353 |
'''yield every hg repository under path, recursively. |
|
353 | '''yield every hg repository under path, always recursively. | |
|
354 | The recurse flag will only control recursion into repo working dirs''' | |||
354 | def errhandler(err): |
|
355 | def errhandler(err): | |
355 | if err.filename == path: |
|
356 | if err.filename == path: | |
356 | raise err |
|
357 | raise err |
General Comments 0
You need to be logged in to leave comments.
Login now