hg.py
30 lines
| 1.0 KiB
| text/x-python
|
PythonLexer
/ mercurial / hg.py
|
r0 | # 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. | ||||
|
r1089 | import os | ||
|
r419 | import util | ||
|
r1089 | from node import * | ||
from repo import * | ||||
|
r262 | from demandload import * | ||
|
r1089 | demandload(globals(), "localrepo httprepo sshrepo") | ||
|
r0 | |||
|
r60 | def repository(ui, path=None, create=0): | ||
|
r623 | if path: | ||
if path.startswith("http://"): | ||||
|
r1089 | return httprepo.httprepository(ui, path) | ||
|
r923 | if path.startswith("https://"): | ||
|
r1089 | return httprepo.httpsrepository(ui, path) | ||
|
r623 | if path.startswith("hg://"): | ||
|
r1089 | return httprepo.httprepository( | ||
ui, path.replace("hg://", "http://")) | ||||
|
r623 | if path.startswith("old-http://"): | ||
|
r1089 | return localrepo.localrepository( | ||
|
r1090 | ui, util.opener, path.replace("old-http://", "http://")) | ||
|
r624 | if path.startswith("ssh://"): | ||
|
r1089 | return sshrepo.sshrepository(ui, path) | ||
|
r60 | |||
|
r1090 | return localrepo.localrepository(ui, util.opener, path, create) | ||