diff mercurial/httprepo.py @ 2740:386f04d6ecb3

clean up hg.py: move repo constructor code into each repo module
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 31 Jul 2006 07:11:12 -0700
parents 109a22f5434a
children 345bac2bc4ec
line wrap: on
line diff
--- a/mercurial/httprepo.py	Sun Jul 30 22:52:34 2006 -0700
+++ b/mercurial/httprepo.py	Mon Jul 31 07:11:12 2006 -0700
@@ -339,3 +339,13 @@
             raise util.Abort(_('Python support for SSL and HTTPS '
                                'is not installed'))
         httprepository.__init__(self, ui, path)
+
+def instance(ui, path, create):
+    if create:
+        raise util.Abort(_('cannot create new http repository'))
+    if path.startswith('hg:'):
+        ui.warn(_("hg:// syntax is deprecated, please use http:// instead\n"))
+        path = 'http:' + path[3:]
+    if path.startswith('https:'):
+        return httpsrepository(ui, path)
+    return httprepository(ui, path)