[PATCH 1 of 2] httprepo: remove fallback to static-http

Mads Kiilerich mads at kiilerich.com
Mon Mar 7 18:33:40 CST 2011


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1299534655 -3600
# Node ID d4168b2f9181b8413c52effa03c76a6d8dad19c9
# Parent  0ab0ceefddf217b23d1ea80d27f2dc0cd417e664
httprepo: remove fallback to static-http

static-http is generally not recommended, but when ordinary http repo access
fails it would fall back to static-http instead of giving any help.

With this change we no longer fall back but shows the nice error message instead.

static-http is still available when requested explicitly.

diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -8,7 +8,7 @@
 
 from node import nullid
 from i18n import _
-import changegroup, statichttprepo, error, url, util, wireproto
+import changegroup, error, url, util, wireproto
 import os, urllib, urllib2, urlparse, zlib, httplib
 import errno, socket
 
@@ -116,7 +116,8 @@
             self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu))
             raise error.RepoError(
                 _("'%s' does not appear to be an hg repository:\n"
-                  "---%%<--- (%s)\n%s\n---%%<---\n")
+                  "---%%<--- (%s)\n%s\n---%%<---\n"
+                  "(for static http use static-http://...)\n")
                 % (safeurl, proto, resp.read()))
 
         if proto.startswith('application/mercurial-'):
@@ -190,13 +191,9 @@
 def instance(ui, path, create):
     if create:
         raise util.Abort(_('cannot create new http repository'))
-    try:
-        if path.startswith('https:'):
-            inst = httpsrepository(ui, path)
-        else:
-            inst = httprepository(ui, path)
-        inst.between([(nullid, nullid)])
-        return inst
-    except error.RepoError:
-        ui.note('(falling back to static-http)\n')
-        return statichttprepo.instance(ui, "static-" + path, create)
+    if path.startswith('https:'):
+        inst = httpsrepository(ui, path)
+    else:
+        inst = httprepository(ui, path)
+    inst.between([(nullid, nullid)])
+    return inst


More information about the Mercurial-devel mailing list