eggs/mercurial-1.7.3-py2.6-linux-x86_64.egg/mercurial/hgweb/__init__.py
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 # hgweb/__init__.py - web interface to a mercurial repository
       
     2 #
       
     3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
       
     4 # Copyright 2005 Matt Mackall <mpm@selenic.com>
       
     5 #
       
     6 # This software may be used and distributed according to the terms of the
       
     7 # GNU General Public License version 2 or any later version.
       
     8 
       
     9 import os
       
    10 import hgweb_mod, hgwebdir_mod
       
    11 
       
    12 def hgweb(config, name=None, baseui=None):
       
    13     '''create an hgweb wsgi object
       
    14 
       
    15     config can be one of:
       
    16     - repo object (single repo view)
       
    17     - path to repo (single repo view)
       
    18     - path to config file (multi-repo view)
       
    19     - dict of virtual:real pairs (multi-repo view)
       
    20     - list of virtual:real tuples (multi-repo view)
       
    21     '''
       
    22 
       
    23     if ((isinstance(config, str) and not os.path.isdir(config)) or
       
    24         isinstance(config, dict) or isinstance(config, list)):
       
    25         # create a multi-dir interface
       
    26         return hgwebdir_mod.hgwebdir(config, baseui=baseui)
       
    27     return hgweb_mod.hgweb(config, name=name, baseui=baseui)
       
    28 
       
    29 def hgwebdir(config, baseui=None):
       
    30     return hgwebdir_mod.hgwebdir(config, baseui=baseui)
       
    31