Show More
@@ -1,202 +1,211 b'' | |||||
1 | # httprepo.py - HTTP repository proxy classes for mercurial |
|
1 | # httprepo.py - HTTP repository proxy classes for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> | |
4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | from node import nullid |
|
9 | from node import nullid | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 | import changegroup, statichttprepo, error, url, util, wireproto |
|
11 | import changegroup, statichttprepo, error, url, util, wireproto | |
12 | import os, urllib, urllib2, urlparse, zlib, httplib |
|
12 | import os, urllib, urllib2, urlparse, zlib, httplib | |
13 | import errno, socket |
|
13 | import errno, socket | |
14 |
|
14 | |||
15 | def zgenerator(f): |
|
15 | def zgenerator(f): | |
16 | zd = zlib.decompressobj() |
|
16 | zd = zlib.decompressobj() | |
17 | try: |
|
17 | try: | |
18 | for chunk in util.filechunkiter(f): |
|
18 | for chunk in util.filechunkiter(f): | |
19 | while chunk: |
|
19 | while chunk: | |
20 | yield zd.decompress(chunk, 2**18) |
|
20 | yield zd.decompress(chunk, 2**18) | |
21 | chunk = zd.unconsumed_tail |
|
21 | chunk = zd.unconsumed_tail | |
22 | except httplib.HTTPException: |
|
22 | except httplib.HTTPException: | |
23 | raise IOError(None, _('connection ended unexpectedly')) |
|
23 | raise IOError(None, _('connection ended unexpectedly')) | |
24 | yield zd.flush() |
|
24 | yield zd.flush() | |
25 |
|
25 | |||
26 | class httprepository(wireproto.wirerepository): |
|
26 | class httprepository(wireproto.wirerepository): | |
27 | def __init__(self, ui, path): |
|
27 | def __init__(self, ui, path): | |
28 | self.path = path |
|
28 | self.path = path | |
29 | self.caps = None |
|
29 | self.caps = None | |
30 | self.handler = None |
|
30 | self.handler = None | |
31 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) |
|
31 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) | |
32 | if query or frag: |
|
32 | if query or frag: | |
33 | raise util.Abort(_('unsupported URL component: "%s"') % |
|
33 | raise util.Abort(_('unsupported URL component: "%s"') % | |
34 | (query or frag)) |
|
34 | (query or frag)) | |
35 |
|
35 | |||
36 | # urllib cannot handle URLs with embedded user or passwd |
|
36 | # urllib cannot handle URLs with embedded user or passwd | |
37 | self._url, authinfo = url.getauthinfo(path) |
|
37 | self._url, authinfo = url.getauthinfo(path) | |
38 |
|
38 | |||
39 | self.ui = ui |
|
39 | self.ui = ui | |
40 | self.ui.debug('using %s\n' % self._url) |
|
40 | self.ui.debug('using %s\n' % self._url) | |
41 |
|
41 | |||
42 | self.urlopener = url.opener(ui, authinfo) |
|
42 | self.urlopener = url.opener(ui, authinfo) | |
43 |
|
43 | |||
44 | def __del__(self): |
|
44 | def __del__(self): | |
45 | for h in self.urlopener.handlers: |
|
45 | for h in self.urlopener.handlers: | |
46 | h.close() |
|
46 | h.close() | |
47 | if hasattr(h, "close_all"): |
|
47 | if hasattr(h, "close_all"): | |
48 | h.close_all() |
|
48 | h.close_all() | |
49 |
|
49 | |||
50 | def url(self): |
|
50 | def url(self): | |
51 | return self.path |
|
51 | return self.path | |
52 |
|
52 | |||
53 | # look up capabilities only when needed |
|
53 | # look up capabilities only when needed | |
54 |
|
54 | |||
|
55 | def _fetchcaps(self): | |||
|
56 | self.caps = set(self._call('capabilities').split()) | |||
|
57 | ||||
55 | def get_caps(self): |
|
58 | def get_caps(self): | |
56 | if self.caps is None: |
|
59 | if self.caps is None: | |
57 | try: |
|
60 | try: | |
58 | self.caps = set(self._call('capabilities').split()) |
|
61 | self._fetchcaps() | |
59 | except error.RepoError: |
|
62 | except error.RepoError: | |
60 | self.caps = set() |
|
63 | self.caps = set() | |
61 | self.ui.debug('capabilities: %s\n' % |
|
64 | self.ui.debug('capabilities: %s\n' % | |
62 | (' '.join(self.caps or ['none']))) |
|
65 | (' '.join(self.caps or ['none']))) | |
63 | return self.caps |
|
66 | return self.caps | |
64 |
|
67 | |||
65 | capabilities = property(get_caps) |
|
68 | capabilities = property(get_caps) | |
66 |
|
69 | |||
67 | def lock(self): |
|
70 | def lock(self): | |
68 | raise util.Abort(_('operation not supported over http')) |
|
71 | raise util.Abort(_('operation not supported over http')) | |
69 |
|
72 | |||
70 | def _callstream(self, cmd, **args): |
|
73 | def _callstream(self, cmd, **args): | |
71 | if cmd == 'pushkey': |
|
74 | if cmd == 'pushkey': | |
72 | args['data'] = '' |
|
75 | args['data'] = '' | |
73 | data = args.pop('data', None) |
|
76 | data = args.pop('data', None) | |
74 | headers = args.pop('headers', {}) |
|
77 | headers = args.pop('headers', {}) | |
75 | self.ui.debug("sending %s command\n" % cmd) |
|
78 | self.ui.debug("sending %s command\n" % cmd) | |
76 | q = [('cmd', cmd)] + sorted(args.items()) |
|
79 | q = [('cmd', cmd)] + sorted(args.items()) | |
77 | qs = '?%s' % urllib.urlencode(q) |
|
80 | qs = '?%s' % urllib.urlencode(q) | |
78 | cu = "%s%s" % (self._url, qs) |
|
81 | cu = "%s%s" % (self._url, qs) | |
79 | req = urllib2.Request(cu, data, headers) |
|
82 | req = urllib2.Request(cu, data, headers) | |
80 | if data is not None: |
|
83 | if data is not None: | |
81 | # len(data) is broken if data doesn't fit into Py_ssize_t |
|
84 | # len(data) is broken if data doesn't fit into Py_ssize_t | |
82 | # add the header ourself to avoid OverflowError |
|
85 | # add the header ourself to avoid OverflowError | |
83 | size = data.__len__() |
|
86 | size = data.__len__() | |
84 | self.ui.debug("sending %s bytes\n" % size) |
|
87 | self.ui.debug("sending %s bytes\n" % size) | |
85 | req.add_unredirected_header('Content-Length', '%d' % size) |
|
88 | req.add_unredirected_header('Content-Length', '%d' % size) | |
86 | try: |
|
89 | try: | |
87 | resp = self.urlopener.open(req) |
|
90 | resp = self.urlopener.open(req) | |
88 | except urllib2.HTTPError, inst: |
|
91 | except urllib2.HTTPError, inst: | |
89 | if inst.code == 401: |
|
92 | if inst.code == 401: | |
90 | raise util.Abort(_('authorization failed')) |
|
93 | raise util.Abort(_('authorization failed')) | |
91 | raise |
|
94 | raise | |
92 | except httplib.HTTPException, inst: |
|
95 | except httplib.HTTPException, inst: | |
93 | self.ui.debug('http error while sending %s command\n' % cmd) |
|
96 | self.ui.debug('http error while sending %s command\n' % cmd) | |
94 | self.ui.traceback() |
|
97 | self.ui.traceback() | |
95 | raise IOError(None, inst) |
|
98 | raise IOError(None, inst) | |
96 | except IndexError: |
|
99 | except IndexError: | |
97 | # this only happens with Python 2.3, later versions raise URLError |
|
100 | # this only happens with Python 2.3, later versions raise URLError | |
98 | raise util.Abort(_('http error, possibly caused by proxy setting')) |
|
101 | raise util.Abort(_('http error, possibly caused by proxy setting')) | |
99 | # record the url we got redirected to |
|
102 | # record the url we got redirected to | |
100 | resp_url = resp.geturl() |
|
103 | resp_url = resp.geturl() | |
101 | if resp_url.endswith(qs): |
|
104 | if resp_url.endswith(qs): | |
102 | resp_url = resp_url[:-len(qs)] |
|
105 | resp_url = resp_url[:-len(qs)] | |
103 | if self._url.rstrip('/') != resp_url.rstrip('/'): |
|
106 | if self._url.rstrip('/') != resp_url.rstrip('/'): | |
104 | self.ui.status(_('real URL is %s\n') % resp_url) |
|
107 | self.ui.status(_('real URL is %s\n') % resp_url) | |
105 | self._url = resp_url |
|
108 | self._url = resp_url | |
106 | try: |
|
109 | try: | |
107 | proto = resp.getheader('content-type') |
|
110 | proto = resp.getheader('content-type') | |
108 | except AttributeError: |
|
111 | except AttributeError: | |
109 | proto = resp.headers['content-type'] |
|
112 | proto = resp.headers['content-type'] | |
110 |
|
113 | |||
111 | safeurl = url.hidepassword(self._url) |
|
114 | safeurl = url.hidepassword(self._url) | |
112 | # accept old "text/plain" and "application/hg-changegroup" for now |
|
115 | # accept old "text/plain" and "application/hg-changegroup" for now | |
113 | if not (proto.startswith('application/mercurial-') or |
|
116 | if not (proto.startswith('application/mercurial-') or | |
114 | proto.startswith('text/plain') or |
|
117 | proto.startswith('text/plain') or | |
115 | proto.startswith('application/hg-changegroup')): |
|
118 | proto.startswith('application/hg-changegroup')): | |
116 | self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu)) |
|
119 | self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu)) | |
117 | raise error.RepoError( |
|
120 | raise error.RepoError( | |
118 | _("'%s' does not appear to be an hg repository:\n" |
|
121 | _("'%s' does not appear to be an hg repository:\n" | |
119 | "---%%<--- (%s)\n%s\n---%%<---\n") |
|
122 | "---%%<--- (%s)\n%s\n---%%<---\n") | |
120 | % (safeurl, proto, resp.read())) |
|
123 | % (safeurl, proto, resp.read())) | |
121 |
|
124 | |||
122 | if proto.startswith('application/mercurial-'): |
|
125 | if proto.startswith('application/mercurial-'): | |
123 | try: |
|
126 | try: | |
124 | version = proto.split('-', 1)[1] |
|
127 | version = proto.split('-', 1)[1] | |
125 | version_info = tuple([int(n) for n in version.split('.')]) |
|
128 | version_info = tuple([int(n) for n in version.split('.')]) | |
126 | except ValueError: |
|
129 | except ValueError: | |
127 | raise error.RepoError(_("'%s' sent a broken Content-Type " |
|
130 | raise error.RepoError(_("'%s' sent a broken Content-Type " | |
128 | "header (%s)") % (safeurl, proto)) |
|
131 | "header (%s)") % (safeurl, proto)) | |
129 | if version_info > (0, 1): |
|
132 | if version_info > (0, 1): | |
130 | raise error.RepoError(_("'%s' uses newer protocol %s") % |
|
133 | raise error.RepoError(_("'%s' uses newer protocol %s") % | |
131 | (safeurl, version)) |
|
134 | (safeurl, version)) | |
132 |
|
135 | |||
133 | return resp |
|
136 | return resp | |
134 |
|
137 | |||
135 | def _call(self, cmd, **args): |
|
138 | def _call(self, cmd, **args): | |
136 | fp = self._callstream(cmd, **args) |
|
139 | fp = self._callstream(cmd, **args) | |
137 | try: |
|
140 | try: | |
138 | return fp.read() |
|
141 | return fp.read() | |
139 | finally: |
|
142 | finally: | |
140 | # if using keepalive, allow connection to be reused |
|
143 | # if using keepalive, allow connection to be reused | |
141 | fp.close() |
|
144 | fp.close() | |
142 |
|
145 | |||
143 | def _callpush(self, cmd, cg, **args): |
|
146 | def _callpush(self, cmd, cg, **args): | |
144 | # have to stream bundle to a temp file because we do not have |
|
147 | # have to stream bundle to a temp file because we do not have | |
145 | # http 1.1 chunked transfer. |
|
148 | # http 1.1 chunked transfer. | |
146 |
|
149 | |||
147 | type = "" |
|
150 | type = "" | |
148 | types = self.capable('unbundle') |
|
151 | types = self.capable('unbundle') | |
149 | # servers older than d1b16a746db6 will send 'unbundle' as a |
|
152 | # servers older than d1b16a746db6 will send 'unbundle' as a | |
150 | # boolean capability |
|
153 | # boolean capability | |
151 | try: |
|
154 | try: | |
152 | types = types.split(',') |
|
155 | types = types.split(',') | |
153 | except AttributeError: |
|
156 | except AttributeError: | |
154 | types = [""] |
|
157 | types = [""] | |
155 | if types: |
|
158 | if types: | |
156 | for x in types: |
|
159 | for x in types: | |
157 | if x in changegroup.bundletypes: |
|
160 | if x in changegroup.bundletypes: | |
158 | type = x |
|
161 | type = x | |
159 | break |
|
162 | break | |
160 |
|
163 | |||
161 | tempname = changegroup.writebundle(cg, None, type) |
|
164 | tempname = changegroup.writebundle(cg, None, type) | |
162 | fp = url.httpsendfile(self.ui, tempname, "rb") |
|
165 | fp = url.httpsendfile(self.ui, tempname, "rb") | |
163 | headers = {'Content-Type': 'application/mercurial-0.1'} |
|
166 | headers = {'Content-Type': 'application/mercurial-0.1'} | |
164 |
|
167 | |||
165 | try: |
|
168 | try: | |
166 | try: |
|
169 | try: | |
167 | r = self._call(cmd, data=fp, headers=headers, **args) |
|
170 | r = self._call(cmd, data=fp, headers=headers, **args) | |
168 | return r.split('\n', 1) |
|
171 | return r.split('\n', 1) | |
169 | except socket.error, err: |
|
172 | except socket.error, err: | |
170 | if err.args[0] in (errno.ECONNRESET, errno.EPIPE): |
|
173 | if err.args[0] in (errno.ECONNRESET, errno.EPIPE): | |
171 | raise util.Abort(_('push failed: %s') % err.args[1]) |
|
174 | raise util.Abort(_('push failed: %s') % err.args[1]) | |
172 | raise util.Abort(err.args[1]) |
|
175 | raise util.Abort(err.args[1]) | |
173 | finally: |
|
176 | finally: | |
174 | fp.close() |
|
177 | fp.close() | |
175 | os.unlink(tempname) |
|
178 | os.unlink(tempname) | |
176 |
|
179 | |||
177 | def _abort(self, exception): |
|
180 | def _abort(self, exception): | |
178 | raise exception |
|
181 | raise exception | |
179 |
|
182 | |||
180 | def _decompress(self, stream): |
|
183 | def _decompress(self, stream): | |
181 | return util.chunkbuffer(zgenerator(stream)) |
|
184 | return util.chunkbuffer(zgenerator(stream)) | |
182 |
|
185 | |||
183 | class httpsrepository(httprepository): |
|
186 | class httpsrepository(httprepository): | |
184 | def __init__(self, ui, path): |
|
187 | def __init__(self, ui, path): | |
185 | if not url.has_https: |
|
188 | if not url.has_https: | |
186 | raise util.Abort(_('Python support for SSL and HTTPS ' |
|
189 | raise util.Abort(_('Python support for SSL and HTTPS ' | |
187 | 'is not installed')) |
|
190 | 'is not installed')) | |
188 | httprepository.__init__(self, ui, path) |
|
191 | httprepository.__init__(self, ui, path) | |
189 |
|
192 | |||
190 | def instance(ui, path, create): |
|
193 | def instance(ui, path, create): | |
191 | if create: |
|
194 | if create: | |
192 | raise util.Abort(_('cannot create new http repository')) |
|
195 | raise util.Abort(_('cannot create new http repository')) | |
193 | try: |
|
196 | try: | |
194 | if path.startswith('https:'): |
|
197 | if path.startswith('https:'): | |
195 | inst = httpsrepository(ui, path) |
|
198 | inst = httpsrepository(ui, path) | |
196 | else: |
|
199 | else: | |
197 | inst = httprepository(ui, path) |
|
200 | inst = httprepository(ui, path) | |
198 | inst.between([(nullid, nullid)]) |
|
201 | try: | |
|
202 | # Try to do useful work when checking compatibility. | |||
|
203 | # Usually saves a roundtrip since we want the caps anyway. | |||
|
204 | inst._fetchcaps() | |||
|
205 | except error.RepoError: | |||
|
206 | # No luck, try older compatibility check. | |||
|
207 | inst.between([(nullid, nullid)]) | |||
199 | return inst |
|
208 | return inst | |
200 | except error.RepoError: |
|
209 | except error.RepoError: | |
201 | ui.note('(falling back to static-http)\n') |
|
210 | ui.note('(falling back to static-http)\n') | |
202 | return statichttprepo.instance(ui, "static-" + path, create) |
|
211 | return statichttprepo.instance(ui, "static-" + path, create) |
@@ -1,124 +1,119 b'' | |||||
1 |
|
1 | |||
2 | $ hg init a |
|
2 | $ hg init a | |
3 | $ cd a |
|
3 | $ cd a | |
4 | $ echo a > a |
|
4 | $ echo a > a | |
5 | $ hg ci -Ama -d '1123456789 0' |
|
5 | $ hg ci -Ama -d '1123456789 0' | |
6 | adding a |
|
6 | adding a | |
7 | $ hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid |
|
7 | $ hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid | |
8 | $ cat hg.pid >> $DAEMON_PIDS |
|
8 | $ cat hg.pid >> $DAEMON_PIDS | |
9 | $ cd .. |
|
9 | $ cd .. | |
10 | $ ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null & |
|
10 | $ ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null & | |
11 | $ echo $! > proxy.pid) |
|
11 | $ echo $! > proxy.pid) | |
12 | $ cat proxy.pid >> $DAEMON_PIDS |
|
12 | $ cat proxy.pid >> $DAEMON_PIDS | |
13 | $ sleep 2 |
|
13 | $ sleep 2 | |
14 |
|
14 | |||
15 | url for proxy, stream |
|
15 | url for proxy, stream | |
16 |
|
16 | |||
17 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b |
|
17 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b | |
18 | streaming all changes |
|
18 | streaming all changes | |
19 | 3 files to transfer, 303 bytes of data |
|
19 | 3 files to transfer, 303 bytes of data | |
20 | transferred * bytes in * seconds (*B/sec) (glob) |
|
20 | transferred * bytes in * seconds (*B/sec) (glob) | |
21 | updating to branch default |
|
21 | updating to branch default | |
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
23 | $ cd b |
|
23 | $ cd b | |
24 | $ hg verify |
|
24 | $ hg verify | |
25 | checking changesets |
|
25 | checking changesets | |
26 | checking manifests |
|
26 | checking manifests | |
27 | crosschecking files in changesets and manifests |
|
27 | crosschecking files in changesets and manifests | |
28 | checking files |
|
28 | checking files | |
29 | 1 files, 1 changesets, 1 total revisions |
|
29 | 1 files, 1 changesets, 1 total revisions | |
30 | $ cd .. |
|
30 | $ cd .. | |
31 |
|
31 | |||
32 | url for proxy, pull |
|
32 | url for proxy, pull | |
33 |
|
33 | |||
34 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull |
|
34 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull | |
35 | requesting all changes |
|
35 | requesting all changes | |
36 | adding changesets |
|
36 | adding changesets | |
37 | adding manifests |
|
37 | adding manifests | |
38 | adding file changes |
|
38 | adding file changes | |
39 | added 1 changesets with 1 changes to 1 files |
|
39 | added 1 changesets with 1 changes to 1 files | |
40 | updating to branch default |
|
40 | updating to branch default | |
41 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
41 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 | $ cd b-pull |
|
42 | $ cd b-pull | |
43 | $ hg verify |
|
43 | $ hg verify | |
44 | checking changesets |
|
44 | checking changesets | |
45 | checking manifests |
|
45 | checking manifests | |
46 | crosschecking files in changesets and manifests |
|
46 | crosschecking files in changesets and manifests | |
47 | checking files |
|
47 | checking files | |
48 | 1 files, 1 changesets, 1 total revisions |
|
48 | 1 files, 1 changesets, 1 total revisions | |
49 | $ cd .. |
|
49 | $ cd .. | |
50 |
|
50 | |||
51 | host:port for proxy |
|
51 | host:port for proxy | |
52 |
|
52 | |||
53 | $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c |
|
53 | $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c | |
54 | requesting all changes |
|
54 | requesting all changes | |
55 | adding changesets |
|
55 | adding changesets | |
56 | adding manifests |
|
56 | adding manifests | |
57 | adding file changes |
|
57 | adding file changes | |
58 | added 1 changesets with 1 changes to 1 files |
|
58 | added 1 changesets with 1 changes to 1 files | |
59 | updating to branch default |
|
59 | updating to branch default | |
60 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
60 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
61 |
|
61 | |||
62 | proxy url with user name and password |
|
62 | proxy url with user name and password | |
63 |
|
63 | |||
64 | $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d |
|
64 | $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d | |
65 | requesting all changes |
|
65 | requesting all changes | |
66 | adding changesets |
|
66 | adding changesets | |
67 | adding manifests |
|
67 | adding manifests | |
68 | adding file changes |
|
68 | adding file changes | |
69 | added 1 changesets with 1 changes to 1 files |
|
69 | added 1 changesets with 1 changes to 1 files | |
70 | updating to branch default |
|
70 | updating to branch default | |
71 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
72 |
|
72 | |||
73 | url with user name and password |
|
73 | url with user name and password | |
74 |
|
74 | |||
75 | $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e |
|
75 | $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e | |
76 | requesting all changes |
|
76 | requesting all changes | |
77 | adding changesets |
|
77 | adding changesets | |
78 | adding manifests |
|
78 | adding manifests | |
79 | adding file changes |
|
79 | adding file changes | |
80 | added 1 changesets with 1 changes to 1 files |
|
80 | added 1 changesets with 1 changes to 1 files | |
81 | updating to branch default |
|
81 | updating to branch default | |
82 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
82 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
83 |
|
83 | |||
84 | bad host:port for proxy |
|
84 | bad host:port for proxy | |
85 |
|
85 | |||
86 | $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f |
|
86 | $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f | |
87 | abort: error: Connection refused |
|
87 | abort: error: Connection refused | |
88 | [255] |
|
88 | [255] | |
89 |
|
89 | |||
90 | do not use the proxy if it is in the no list |
|
90 | do not use the proxy if it is in the no list | |
91 |
|
91 | |||
92 | $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g |
|
92 | $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g | |
93 | requesting all changes |
|
93 | requesting all changes | |
94 | adding changesets |
|
94 | adding changesets | |
95 | adding manifests |
|
95 | adding manifests | |
96 | adding file changes |
|
96 | adding file changes | |
97 | added 1 changesets with 1 changes to 1 files |
|
97 | added 1 changesets with 1 changes to 1 files | |
98 | updating to branch default |
|
98 | updating to branch default | |
99 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
99 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
100 | $ cat proxy.log |
|
100 | $ cat proxy.log | |
101 | * - - [*] "GET http://localhost:$HGPORT/?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
|||
102 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
101 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |
103 | * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob) |
|
102 | * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob) | |
104 | * - - [*] "GET http://localhost:$HGPORT/?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
103 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |
105 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
104 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
106 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
105 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
106 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
107 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
107 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |
108 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) |
|
|||
109 | * - - [*] "GET http://localhost:$HGPORT/?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
|||
110 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
108 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
111 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
109 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
110 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
112 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
111 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |
113 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) |
|
|||
114 | * - - [*] "GET http://localhost:$HGPORT/?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
|||
115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
112 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
116 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
113 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
114 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
117 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |
118 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) |
|
|||
119 | * - - [*] "GET http://localhost:$HGPORT/?cmd=between&pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
|||
120 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
116 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
121 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
117 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
122 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
|||
123 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) |
|
118 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |
124 |
|
119 |
@@ -1,45 +1,45 b'' | |||||
1 |
|
1 | |||
2 | $ cat <<EOF >> $HGRCPATH |
|
2 | $ cat <<EOF >> $HGRCPATH | |
3 | > [extensions] |
|
3 | > [extensions] | |
4 | > schemes= |
|
4 | > schemes= | |
5 | > |
|
5 | > | |
6 | > [schemes] |
|
6 | > [schemes] | |
7 | > l = http://localhost:$HGPORT/ |
|
7 | > l = http://localhost:$HGPORT/ | |
8 | > parts = http://{1}:$HGPORT/ |
|
8 | > parts = http://{1}:$HGPORT/ | |
9 | > z = file:\$PWD/ |
|
9 | > z = file:\$PWD/ | |
10 | > EOF |
|
10 | > EOF | |
11 | $ hg init test |
|
11 | $ hg init test | |
12 | $ cd test |
|
12 | $ cd test | |
13 | $ echo a > a |
|
13 | $ echo a > a | |
14 | $ hg ci -Am initial |
|
14 | $ hg ci -Am initial | |
15 | adding a |
|
15 | adding a | |
16 | $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
16 | $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
17 | $ cat hg.pid >> $DAEMON_PIDS |
|
17 | $ cat hg.pid >> $DAEMON_PIDS | |
18 | $ hg incoming l:// |
|
18 | $ hg incoming l:// | |
19 | comparing with l:// |
|
19 | comparing with l:// | |
20 | searching for changes |
|
20 | searching for changes | |
21 | no changes found |
|
21 | no changes found | |
22 | [1] |
|
22 | [1] | |
23 |
|
23 | |||
24 | check that {1} syntax works |
|
24 | check that {1} syntax works | |
25 |
|
25 | |||
26 | $ hg incoming --debug parts://localhost |
|
26 | $ hg incoming --debug parts://localhost | |
27 | using http://localhost:$HGPORT/ |
|
27 | using http://localhost:$HGPORT/ | |
28 |
sending |
|
28 | sending capabilities command | |
29 | comparing with parts://localhost |
|
29 | comparing with parts://localhost | |
30 | sending heads command |
|
30 | sending heads command | |
31 | searching for changes |
|
31 | searching for changes | |
32 | no changes found |
|
32 | no changes found | |
33 | [1] |
|
33 | [1] | |
34 |
|
34 | |||
35 | check that paths are expanded |
|
35 | check that paths are expanded | |
36 |
|
36 | |||
37 | $ PWD=`pwd` hg incoming z:// |
|
37 | $ PWD=`pwd` hg incoming z:// | |
38 | comparing with z:// |
|
38 | comparing with z:// | |
39 | searching for changes |
|
39 | searching for changes | |
40 | no changes found |
|
40 | no changes found | |
41 | [1] |
|
41 | [1] | |
42 |
|
42 | |||
43 | errors |
|
43 | errors | |
44 |
|
44 | |||
45 | $ cat errors.log |
|
45 | $ cat errors.log |
General Comments 0
You need to be logged in to leave comments.
Login now