mercurial/hg.py
author Vincent Wagelaar <vincent@ricardis.tudelft.nl>
Tue, 30 Aug 2005 21:58:44 +0200
changeset 1181 4f5001f5b4c3
parent 1102 c81d264cd17d
child 1945 dec6d3c13dbf
permissions -rw-r--r--
Make sure the repository names don't have slashes at the at or else in some cases env[path_info] will not find an defined repository. REQUEST_URI can contain a query_string appending the repository name would lead to corrupt urls.

# hg.py - repository classes for mercurial
#
# Copyright 2005 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.

from node import *
from repo import *
from demandload import *
demandload(globals(), "localrepo httprepo sshrepo statichttprepo")

def repository(ui, path=None, create=0):
    if path:
        if path.startswith("http://"):
            return httprepo.httprepository(ui, path)
        if path.startswith("https://"):
            return httprepo.httpsrepository(ui, path)
        if path.startswith("hg://"):
            return httprepo.httprepository(
                ui, path.replace("hg://", "http://"))
        if path.startswith("old-http://"):
            return statichttprepo.statichttprepository(
                ui, path.replace("old-http://", "http://"))
        if path.startswith("ssh://"):
            return sshrepo.sshrepository(ui, path)

    return localrepo.localrepository(ui, path, create)