diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -30,10 +30,7 @@ revision:: repository path:: either the pathname of a local repository or the URI of a remote - repository. There are two available URI protocols, http:// which is - fast and the static-http:// protocol which is much slower but does not - require a special server on the web host. - + repository. include::hg.1.gendoc.txt[] diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2071,13 +2071,10 @@ def pull(ui, repo, source="default", **o http://[user[:pass]@]host[:port]/[path] https://[user[:pass]@]host[:port]/[path] ssh://[user[:pass]@]host[:port]/[path] - static-http://host[:port]/[path] Paths in the local filesystem can either point to Mercurial repositories or to bundle files (as created by 'hg bundle' or - 'hg incoming --bundle'). The static-http:// protocol, albeit slow, - allows access to a Mercurial repository where you simply use a web - server to publish the .hg directory as static content. + 'hg incoming --bundle'). An optional identifier after # indicates a particular branch, tag, or changeset to pull. diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -6,10 +6,10 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from node import bin, hex +from node import bin, hex, nullid from i18n import _ import repo, os, urllib, urllib2, urlparse, zlib, util, httplib -import errno, keepalive, socket, changegroup +import errno, keepalive, socket, changegroup, statichttprepo class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): def __init__(self, ui): @@ -455,6 +455,13 @@ class httpsrepository(httprepository): def instance(ui, path, create): if create: raise util.Abort(_('cannot create new http repository')) - if path.startswith('https:'): - return httpsrepository(ui, path) - return httprepository(ui, path) + try: + if path.startswith('https:'): + inst = httpsrepository(ui, path) + else: + inst = httprepository(ui, path) + inst.between([(nullid, nullid)]) + return inst + except repo.RepoError: + ui.note('(falling back to static-http)\n') + return statichttprepo.instance(ui, "static-" + path, create) diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -76,7 +76,7 @@ class statichttprepository(localrepo.loc self.decodepats = None def url(self): - return 'static-' + self._url + return self._url def local(self): return False diff --git a/tests/test-static-http b/tests/test-static-http --- a/tests/test-static-http +++ b/tests/test-static-http @@ -2,7 +2,7 @@ cp "$TESTDIR"/printenv.py . -http_proxy= hg clone static-http://localhost:$HGPORT/ copy +http_proxy= hg clone http://localhost:$HGPORT/ copy echo $? test -d copy || echo copy: No such file or directory diff --git a/tests/test-static-http.out b/tests/test-static-http.out --- a/tests/test-static-http.out +++ b/tests/test-static-http.out @@ -1,4 +1,4 @@ -abort: Connection refused +abort: error: Connection refused 255 copy: No such file or directory changeset: 0:53e17d176ae6 @@ -21,7 +21,7 @@ checking files 1 files, 1 changesets, 1 total revisions foo adding quux -changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=static-http://localhost/remote +changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=http://localhost/remote pulling from static-http://localhost/remote searching for changes adding changesets