##// END OF EJS Templates
HTTPS: fix python2.3, persistent connections, don't explode if SSL is not available...
HTTPS: fix python2.3, persistent connections, don't explode if SSL is not available The urllib2 differences between python 2.3 and 2.4 are hidden by using keepalive.py, which also gives us support for persistent connections. Support for HTTPS is enabled only if there's a HTTPSHandler class in urllib2. It's not possible to have separate classes as handlers for HTTP and HTTPS: to support persistent HTTPS connections, we need a class that inherits from both keepalive.HTTPHandler and urllib2.HTTPSHandler. If we try to pass (an instance of) this class and (an instance of) the httphandler class to urllib2.build_opener, this function ends up getting confused, since both classes are subclasses of the HTTPHandler default handler, and raises an exception.

File last commit:

r2555:d6605381 default
r2569:52ce0d6b default
Show More
hg.py
73 lines | 2.2 KiB | text/x-python | PythonLexer
mpm@selenic.com
Add back links from file revisions to changeset revisions...
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.
mpm@selenic.com
Break apart hg.py...
r1089 from node import *
from repo import *
mpm@selenic.com
implement demand loading hack...
r262 from demandload import *
Benoit Boissinot
replace old-http:// syntax by static-http:// and deprecate the redundant hg://
r2431 from i18n import gettext as _
Benoit Boissinot
new type of repo: bundle://path/to/repo+/path/to/bundlename...
r1945 demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo")
Vadim Gelfer
make repo scheme table driven.
r2472 demandload(globals(), "os util")
mpm@selenic.com
Add back links from file revisions to changeset revisions...
r0
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 def bundle(ui, path):
if path.startswith('bundle://'):
path = path[9:]
else:
path = path[7:]
s = path.split("+", 1)
if len(s) == 1:
repopath, bundlename = "", s[0]
else:
repopath, bundlename = s
return bundlerepo.bundlerepository(ui, repopath, bundlename)
def hg(ui, path):
ui.warn(_("hg:// syntax is deprecated, please use http:// instead\n"))
return httprepo.httprepository(ui, path.replace("hg://", "http://"))
def local_(ui, path, create=0):
Vadim Gelfer
make repo scheme table driven.
r2472 if path.startswith('file:'):
path = path[5:]
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 return localrepo.localrepository(ui, path, create)
Sean Meiners
Added ability to clone from a local repository to a (new) remote one....
r2549 def ssh_(ui, path, create=0):
return sshrepo.sshrepository(ui, path, create)
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 def old_http(ui, path):
ui.warn(_("old-http:// syntax is deprecated, "
"please use static-http:// instead\n"))
return statichttprepo.statichttprepository(
ui, path.replace("old-http://", "http://"))
def static_http(ui, path):
return statichttprepo.statichttprepository(
ui, path.replace("static-http://", "http://"))
Vadim Gelfer
make repo scheme table driven.
r2472 schemes = {
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 'bundle': bundle,
'file': local_,
'hg': hg,
'http': lambda ui, path: httprepo.httprepository(ui, path),
'https': lambda ui, path: httprepo.httpsrepository(ui, path),
'old-http': old_http,
Sean Meiners
Added ability to clone from a local repository to a (new) remote one....
r2549 'ssh': ssh_,
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 'static-http': static_http,
}
mpm@selenic.com
Add hg:// protocol...
r60 def repository(ui, path=None, create=0):
Vadim Gelfer
hg.repository: many routines expect path to be a string even if empty.
r2479 if not path: path = ''
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 scheme = path
if scheme:
c = scheme.find(':')
scheme = c >= 0 and scheme[:c]
Alexis S. L. Carvalho
hg.py: move exception handling code to try to avoid hiding errors
r2555 ctor = schemes.get(scheme) or schemes['file']
if create:
try:
Vadim Gelfer
hg.repository: make protocol table driven....
r2469 return ctor(ui, path, create)
Alexis S. L. Carvalho
hg.py: move exception handling code to try to avoid hiding errors
r2555 except TypeError:
raise util.Abort(_('cannot create new repository over "%s" protocol') %
scheme)
return ctor(ui, path)