##// END OF EJS Templates
Autodetect static-http
Matt Mackall -
r7211:25c0dee1 default
parent child Browse files
Show More
@@ -30,10 +30,7 b' revision::'
30 30
31 31 repository path::
32 32 either the pathname of a local repository or the URI of a remote
33 repository. There are two available URI protocols, http:// which is
34 fast and the static-http:// protocol which is much slower but does not
35 require a special server on the web host.
36
33 repository.
37 34
38 35 include::hg.1.gendoc.txt[]
39 36
@@ -2071,13 +2071,10 b' def pull(ui, repo, source="default", **o'
2071 2071 http://[user[:pass]@]host[:port]/[path]
2072 2072 https://[user[:pass]@]host[:port]/[path]
2073 2073 ssh://[user[:pass]@]host[:port]/[path]
2074 static-http://host[:port]/[path]
2075 2074
2076 2075 Paths in the local filesystem can either point to Mercurial
2077 2076 repositories or to bundle files (as created by 'hg bundle' or
2078 'hg incoming --bundle'). The static-http:// protocol, albeit slow,
2079 allows access to a Mercurial repository where you simply use a web
2080 server to publish the .hg directory as static content.
2077 'hg incoming --bundle').
2081 2078
2082 2079 An optional identifier after # indicates a particular branch, tag,
2083 2080 or changeset to pull.
@@ -6,10 +6,10 b''
6 6 # This software may be used and distributed according to the terms
7 7 # of the GNU General Public License, incorporated herein by reference.
8 8
9 from node import bin, hex
9 from node import bin, hex, nullid
10 10 from i18n import _
11 11 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib
12 import errno, keepalive, socket, changegroup
12 import errno, keepalive, socket, changegroup, statichttprepo
13 13
14 14 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm):
15 15 def __init__(self, ui):
@@ -455,6 +455,13 b' class httpsrepository(httprepository):'
455 455 def instance(ui, path, create):
456 456 if create:
457 457 raise util.Abort(_('cannot create new http repository'))
458 if path.startswith('https:'):
459 return httpsrepository(ui, path)
460 return httprepository(ui, path)
458 try:
459 if path.startswith('https:'):
460 inst = httpsrepository(ui, path)
461 else:
462 inst = httprepository(ui, path)
463 inst.between([(nullid, nullid)])
464 return inst
465 except repo.RepoError:
466 ui.note('(falling back to static-http)\n')
467 return statichttprepo.instance(ui, "static-" + path, create)
@@ -76,7 +76,7 b' class statichttprepository(localrepo.loc'
76 76 self.decodepats = None
77 77
78 78 def url(self):
79 return 'static-' + self._url
79 return self._url
80 80
81 81 def local(self):
82 82 return False
@@ -2,7 +2,7 b''
2 2
3 3 cp "$TESTDIR"/printenv.py .
4 4
5 http_proxy= hg clone static-http://localhost:$HGPORT/ copy
5 http_proxy= hg clone http://localhost:$HGPORT/ copy
6 6 echo $?
7 7 test -d copy || echo copy: No such file or directory
8 8
@@ -1,4 +1,4 b''
1 abort: Connection refused
1 abort: error: Connection refused
2 2 255
3 3 copy: No such file or directory
4 4 changeset: 0:53e17d176ae6
@@ -21,7 +21,7 b' checking files'
21 21 1 files, 1 changesets, 1 total revisions
22 22 foo
23 23 adding quux
24 changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=static-http://localhost/remote
24 changegroup hook: HG_NODE=34401e0e9971e9720b613d9089ffa9a6eefb3d2d HG_SOURCE=pull HG_URL=http://localhost/remote
25 25 pulling from static-http://localhost/remote
26 26 searching for changes
27 27 adding changesets
General Comments 0
You need to be logged in to leave comments. Login now