author | Augie Fackler <raf@durin42.com> |
Thu, 15 Aug 2013 21:36:53 -0400 | |
changeset 19618 | 6ac206fb6f27 |
parent 10996 | f6d41bfc189e |
child 27046 | 37fcfe52c68c |
permissions | -rw-r--r-- |
2391
d351a3be3371
Fixing up comment headers for split up code.
Eric Hopper <hopper@omnifarious.org>
parents:
2356
diff
changeset
|
1 |
# hgweb/__init__.py - web interface to a mercurial repository |
131 | 2 |
# |
238
3b92f8fe47ae
hgweb.py: kill #! line, clean up copyright notice
mpm@selenic.com
parents:
222
diff
changeset
|
3 |
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net> |
575 | 4 |
# Copyright 2005 Matt Mackall <mpm@selenic.com> |
131 | 5 |
# |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
3877
diff
changeset
|
6 |
# This software may be used and distributed according to the terms of the |
10263 | 7 |
# GNU General Public License version 2 or any later version. |
131 | 8 |
|
10996
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
9 |
import os |
3877
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
2391
diff
changeset
|
10 |
import hgweb_mod, hgwebdir_mod |
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
2391
diff
changeset
|
11 |
|
10996
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
12 |
def hgweb(config, name=None, baseui=None): |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
13 |
'''create an hgweb wsgi object |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
14 |
|
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
15 |
config can be one of: |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
16 |
- repo object (single repo view) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
17 |
- path to repo (single repo view) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
18 |
- path to config file (multi-repo view) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
19 |
- dict of virtual:real pairs (multi-repo view) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
20 |
- list of virtual:real tuples (multi-repo view) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
21 |
''' |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
22 |
|
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
23 |
if ((isinstance(config, str) and not os.path.isdir(config)) or |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
24 |
isinstance(config, dict) or isinstance(config, list)): |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
25 |
# create a multi-dir interface |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
26 |
return hgwebdir_mod.hgwebdir(config, baseui=baseui) |
f6d41bfc189e
hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir
Matt Mackall <mpm@selenic.com>
parents:
10994
diff
changeset
|
27 |
return hgweb_mod.hgweb(config, name=name, baseui=baseui) |
3877
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
2391
diff
changeset
|
28 |
|
10992
a9b8c8c8ce80
hgweb: make top-level prototypes mirror their callees
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
29 |
def hgwebdir(config, baseui=None): |
a9b8c8c8ce80
hgweb: make top-level prototypes mirror their callees
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
30 |
return hgwebdir_mod.hgwebdir(config, baseui=baseui) |
3877
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
2391
diff
changeset
|
31 |