mercurial/hgweb/hgwebdir_mod.py
changeset 13975 938fbeacac84
parent 13964 616ad3f6fd33
child 14076 924c82157d46
equal deleted inserted replaced
13974:23f2736abce3 13975:938fbeacac84
     6 # This software may be used and distributed according to the terms of the
     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.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 import os, re, time
     9 import os, re, time
    10 from mercurial.i18n import _
    10 from mercurial.i18n import _
    11 from mercurial import ui, hg, util, templater
    11 from mercurial import ui, hg, scmutil, util, templater
    12 from mercurial import error, encoding, url
    12 from mercurial import error, encoding, url
    13 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
    13 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
    14                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    14                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
    15 from hgweb_mod import hgweb
    15 from hgweb_mod import hgweb
    16 from request import wsgirequest
    16 from request import wsgirequest
    31             recurse = {'*': False, '**': True}[roottail]
    31             recurse = {'*': False, '**': True}[roottail]
    32         except KeyError:
    32         except KeyError:
    33             repos.append((prefix, root))
    33             repos.append((prefix, root))
    34             continue
    34             continue
    35         roothead = os.path.normpath(os.path.abspath(roothead))
    35         roothead = os.path.normpath(os.path.abspath(roothead))
    36         paths = util.walkrepos(roothead, followsym=True, recurse=recurse)
    36         paths = scmutil.walkrepos(roothead, followsym=True, recurse=recurse)
    37         repos.extend(urlrepos(prefix, roothead, paths))
    37         repos.extend(urlrepos(prefix, roothead, paths))
    38     return repos
    38     return repos
    39 
    39 
    40 def urlrepos(prefix, roothead, paths):
    40 def urlrepos(prefix, roothead, paths):
    41     """yield url paths and filesystem paths from a list of repo paths
    41     """yield url paths and filesystem paths from a list of repo paths
    87             paths = self.conf.items()
    87             paths = self.conf.items()
    88 
    88 
    89         repos = findrepos(paths)
    89         repos = findrepos(paths)
    90         for prefix, root in u.configitems('collections'):
    90         for prefix, root in u.configitems('collections'):
    91             prefix = util.pconvert(prefix)
    91             prefix = util.pconvert(prefix)
    92             for path in util.walkrepos(root, followsym=True):
    92             for path in scmutil.walkrepos(root, followsym=True):
    93                 repo = os.path.normpath(path)
    93                 repo = os.path.normpath(path)
    94                 name = util.pconvert(repo)
    94                 name = util.pconvert(repo)
    95                 if name.startswith(prefix):
    95                 if name.startswith(prefix):
    96                     name = name[len(prefix):]
    96                     name = name[len(prefix):]
    97                 repos.append((name.lstrip('/'), repo))
    97                 repos.append((name.lstrip('/'), repo))