##// END OF EJS Templates
http: minor tweaks to long arg handling...
Matt Mackall -
r14094:d10c6835 default
parent child Browse files
Show More
@@ -1,86 +1,88 b''
1 1 #
2 2 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
3 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 import cgi, cStringIO, itertools, zlib, sys, urllib
8 import cgi, cStringIO, zlib, sys, urllib
9 9 from mercurial import util, wireproto
10 10 from common import HTTP_OK
11 11
12 12 HGTYPE = 'application/mercurial-0.1'
13 13
14 14 class webproto(object):
15 15 def __init__(self, req):
16 16 self.req = req
17 17 self.response = ''
18 18 def getargs(self, args):
19 19 knownargs = self._args()
20 20 data = {}
21 21 keys = args.split()
22 22 for k in keys:
23 23 if k == '*':
24 24 star = {}
25 25 for key in knownargs.keys():
26 26 if key != 'cmd' and key not in keys:
27 27 star[key] = knownargs[key][0]
28 28 data['*'] = star
29 29 else:
30 30 data[k] = knownargs[k][0]
31 31 return [data[k] for k in keys]
32 32 def _args(self):
33 33 args = self.req.form.copy()
34 34 chunks = []
35 for i in itertools.count(1):
36 h = self.req.env.get('HTTP_X_ARG_' + str(i))
35 i = 1
36 while 1:
37 h = self.req.env.get('HTTP_X_HGARG_' + str(i))
37 38 if h is None:
38 39 break
39 40 chunks += [h]
41 i += 1
40 42 args.update(cgi.parse_qs(''.join(chunks), keep_blank_values=True))
41 43 return args
42 44 def getfile(self, fp):
43 45 length = int(self.req.env['CONTENT_LENGTH'])
44 46 for s in util.filechunkiter(self.req, limit=length):
45 47 fp.write(s)
46 48 def redirect(self):
47 49 self.oldio = sys.stdout, sys.stderr
48 50 sys.stderr = sys.stdout = cStringIO.StringIO()
49 51 def groupchunks(self, cg):
50 52 z = zlib.compressobj()
51 53 while 1:
52 54 chunk = cg.read(4096)
53 55 if not chunk:
54 56 break
55 57 yield z.compress(chunk)
56 58 yield z.flush()
57 59 def _client(self):
58 60 return 'remote:%s:%s:%s' % (
59 61 self.req.env.get('wsgi.url_scheme') or 'http',
60 62 urllib.quote(self.req.env.get('REMOTE_HOST', '')),
61 63 urllib.quote(self.req.env.get('REMOTE_USER', '')))
62 64
63 65 def iscmd(cmd):
64 66 return cmd in wireproto.commands
65 67
66 68 def call(repo, req, cmd):
67 69 p = webproto(req)
68 70 rsp = wireproto.dispatch(repo, p, cmd)
69 71 if isinstance(rsp, str):
70 72 req.respond(HTTP_OK, HGTYPE, length=len(rsp))
71 73 return [rsp]
72 74 elif isinstance(rsp, wireproto.streamres):
73 75 req.respond(HTTP_OK, HGTYPE)
74 76 return rsp.gen
75 77 elif isinstance(rsp, wireproto.pushres):
76 78 val = sys.stdout.getvalue()
77 79 sys.stdout, sys.stderr = p.oldio
78 80 req.respond(HTTP_OK, HGTYPE)
79 81 return ['%d\n%s' % (rsp.res, val)]
80 82 elif isinstance(rsp, wireproto.pusherr):
81 83 # drain the incoming bundle
82 84 req.drain()
83 85 sys.stdout, sys.stderr = p.oldio
84 86 rsp = '0\n%s\n' % rsp.res
85 87 req.respond(HTTP_OK, HGTYPE, length=len(rsp))
86 88 return [rsp]
@@ -1,229 +1,229 b''
1 1 # httprepo.py - HTTP repository proxy classes for mercurial
2 2 #
3 3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 from node import nullid
10 10 from i18n import _
11 11 import changegroup, statichttprepo, error, url, util, wireproto
12 12 import os, urllib, urllib2, zlib, httplib
13 13 import errno, socket
14 14
15 15 def zgenerator(f):
16 16 zd = zlib.decompressobj()
17 17 try:
18 18 for chunk in util.filechunkiter(f):
19 19 while chunk:
20 20 yield zd.decompress(chunk, 2**18)
21 21 chunk = zd.unconsumed_tail
22 22 except httplib.HTTPException:
23 23 raise IOError(None, _('connection ended unexpectedly'))
24 24 yield zd.flush()
25 25
26 26 class httprepository(wireproto.wirerepository):
27 27 def __init__(self, ui, path):
28 28 self.path = path
29 29 self.caps = None
30 30 self.handler = None
31 31 u = util.url(path)
32 32 if u.query or u.fragment:
33 33 raise util.Abort(_('unsupported URL component: "%s"') %
34 34 (u.query or u.fragment))
35 35
36 36 # urllib cannot handle URLs with embedded user or passwd
37 37 self._url, authinfo = u.authinfo()
38 38
39 39 self.ui = ui
40 40 self.ui.debug('using %s\n' % self._url)
41 41
42 42 self.urlopener = url.opener(ui, authinfo)
43 43
44 44 def __del__(self):
45 45 for h in self.urlopener.handlers:
46 46 h.close()
47 47 if hasattr(h, "close_all"):
48 48 h.close_all()
49 49
50 50 def url(self):
51 51 return self.path
52 52
53 53 # look up capabilities only when needed
54 54
55 55 def _fetchcaps(self):
56 56 self.caps = set(self._call('capabilities').split())
57 57
58 58 def get_caps(self):
59 59 if self.caps is None:
60 60 try:
61 61 self._fetchcaps()
62 62 except error.RepoError:
63 63 self.caps = set()
64 64 self.ui.debug('capabilities: %s\n' %
65 65 (' '.join(self.caps or ['none'])))
66 66 return self.caps
67 67
68 68 capabilities = property(get_caps)
69 69
70 70 def lock(self):
71 71 raise util.Abort(_('operation not supported over http'))
72 72
73 73 def _callstream(self, cmd, **args):
74 74 if cmd == 'pushkey':
75 75 args['data'] = ''
76 76 data = args.pop('data', None)
77 77 headers = args.pop('headers', {})
78 78 self.ui.debug("sending %s command\n" % cmd)
79 79 q = [('cmd', cmd)]
80 80 headersize = 0
81 81 if len(args) > 0:
82 82 httpheader = self.capable('httpheader')
83 83 if httpheader:
84 84 headersize = int(httpheader.split(',')[0])
85 85 if headersize > 0:
86 86 # The headers can typically carry more data than the URL.
87 87 encargs = urllib.urlencode(sorted(args.items()))
88 headerfmt = 'X-Arg-%s'
88 headerfmt = 'X-HgArg-%s'
89 89 contentlen = headersize - len(headerfmt % '000' + ': \r\n')
90 90 headernum = 0
91 91 for i in xrange(0, len(encargs), contentlen):
92 92 headernum += 1
93 93 header = headerfmt % str(headernum)
94 94 headers[header] = encargs[i:i + contentlen]
95 95 varyheaders = [headerfmt % str(h) for h in range(1, headernum + 1)]
96 96 headers['Vary'] = ','.join(varyheaders)
97 97 else:
98 98 q += sorted(args.items())
99 99 qs = '?%s' % urllib.urlencode(q)
100 100 cu = "%s%s" % (self._url, qs)
101 101 req = urllib2.Request(cu, data, headers)
102 102 if data is not None:
103 103 # len(data) is broken if data doesn't fit into Py_ssize_t
104 104 # add the header ourself to avoid OverflowError
105 105 size = data.__len__()
106 106 self.ui.debug("sending %s bytes\n" % size)
107 107 req.add_unredirected_header('Content-Length', '%d' % size)
108 108 try:
109 109 resp = self.urlopener.open(req)
110 110 except urllib2.HTTPError, inst:
111 111 if inst.code == 401:
112 112 raise util.Abort(_('authorization failed'))
113 113 raise
114 114 except httplib.HTTPException, inst:
115 115 self.ui.debug('http error while sending %s command\n' % cmd)
116 116 self.ui.traceback()
117 117 raise IOError(None, inst)
118 118 except IndexError:
119 119 # this only happens with Python 2.3, later versions raise URLError
120 120 raise util.Abort(_('http error, possibly caused by proxy setting'))
121 121 # record the url we got redirected to
122 122 resp_url = resp.geturl()
123 123 if resp_url.endswith(qs):
124 124 resp_url = resp_url[:-len(qs)]
125 125 if self._url.rstrip('/') != resp_url.rstrip('/'):
126 126 self.ui.status(_('real URL is %s\n') % resp_url)
127 127 self._url = resp_url
128 128 try:
129 129 proto = resp.getheader('content-type')
130 130 except AttributeError:
131 131 proto = resp.headers['content-type']
132 132
133 133 safeurl = util.hidepassword(self._url)
134 134 # accept old "text/plain" and "application/hg-changegroup" for now
135 135 if not (proto.startswith('application/mercurial-') or
136 136 proto.startswith('text/plain') or
137 137 proto.startswith('application/hg-changegroup')):
138 138 self.ui.debug("requested URL: '%s'\n" % util.hidepassword(cu))
139 139 raise error.RepoError(
140 140 _("'%s' does not appear to be an hg repository:\n"
141 141 "---%%<--- (%s)\n%s\n---%%<---\n")
142 142 % (safeurl, proto, resp.read()))
143 143
144 144 if proto.startswith('application/mercurial-'):
145 145 try:
146 146 version = proto.split('-', 1)[1]
147 147 version_info = tuple([int(n) for n in version.split('.')])
148 148 except ValueError:
149 149 raise error.RepoError(_("'%s' sent a broken Content-Type "
150 150 "header (%s)") % (safeurl, proto))
151 151 if version_info > (0, 1):
152 152 raise error.RepoError(_("'%s' uses newer protocol %s") %
153 153 (safeurl, version))
154 154
155 155 return resp
156 156
157 157 def _call(self, cmd, **args):
158 158 fp = self._callstream(cmd, **args)
159 159 try:
160 160 return fp.read()
161 161 finally:
162 162 # if using keepalive, allow connection to be reused
163 163 fp.close()
164 164
165 165 def _callpush(self, cmd, cg, **args):
166 166 # have to stream bundle to a temp file because we do not have
167 167 # http 1.1 chunked transfer.
168 168
169 169 types = self.capable('unbundle')
170 170 try:
171 171 types = types.split(',')
172 172 except AttributeError:
173 173 # servers older than d1b16a746db6 will send 'unbundle' as a
174 174 # boolean capability. They only support headerless/uncompressed
175 175 # bundles.
176 176 types = [""]
177 177 for x in types:
178 178 if x in changegroup.bundletypes:
179 179 type = x
180 180 break
181 181
182 182 tempname = changegroup.writebundle(cg, None, type)
183 183 fp = url.httpsendfile(self.ui, tempname, "rb")
184 184 headers = {'Content-Type': 'application/mercurial-0.1'}
185 185
186 186 try:
187 187 try:
188 188 r = self._call(cmd, data=fp, headers=headers, **args)
189 189 return r.split('\n', 1)
190 190 except socket.error, err:
191 191 if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
192 192 raise util.Abort(_('push failed: %s') % err.args[1])
193 193 raise util.Abort(err.args[1])
194 194 finally:
195 195 fp.close()
196 196 os.unlink(tempname)
197 197
198 198 def _abort(self, exception):
199 199 raise exception
200 200
201 201 def _decompress(self, stream):
202 202 return util.chunkbuffer(zgenerator(stream))
203 203
204 204 class httpsrepository(httprepository):
205 205 def __init__(self, ui, path):
206 206 if not url.has_https:
207 207 raise util.Abort(_('Python support for SSL and HTTPS '
208 208 'is not installed'))
209 209 httprepository.__init__(self, ui, path)
210 210
211 211 def instance(ui, path, create):
212 212 if create:
213 213 raise util.Abort(_('cannot create new http repository'))
214 214 try:
215 215 if path.startswith('https:'):
216 216 inst = httpsrepository(ui, path)
217 217 else:
218 218 inst = httprepository(ui, path)
219 219 try:
220 220 # Try to do useful work when checking compatibility.
221 221 # Usually saves a roundtrip since we want the caps anyway.
222 222 inst._fetchcaps()
223 223 except error.RepoError:
224 224 # No luck, try older compatibility check.
225 225 inst.between([(nullid, nullid)])
226 226 return inst
227 227 except error.RepoError:
228 228 ui.note('(falling back to static-http)\n')
229 229 return statichttprepo.instance(ui, "static-" + path, create)
@@ -1,253 +1,253 b''
1 1
2 2 = Test the getbundle() protocol function =
3 3
4 4 Enable graphlog extension:
5 5
6 6 $ echo "[extensions]" >> $HGRCPATH
7 7 $ echo "graphlog=" >> $HGRCPATH
8 8
9 9 Create a test repository:
10 10
11 11 $ hg init repo
12 12 $ cd repo
13 13 $ hg debugbuilddag -n -m '+2 :fork +5 :p1 *fork +6 :p2 /p1 :m1 +3' > /dev/null
14 14 $ hg glog --template '{node}\n'
15 15 @ 2bba2f40f321484159b395a43f20101d4bb7ead0
16 16 |
17 17 o d9e5488323c782fe684573f3043369d199038b6f
18 18 |
19 19 o 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
20 20 |
21 21 o 733bf0910832b26b768a09172f325f995b5476e1
22 22 |\
23 23 | o b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
24 24 | |
25 25 | o 6b57ee934bb2996050540f84cdfc8dcad1e7267d
26 26 | |
27 27 | o 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
28 28 | |
29 29 | o c1818a9f5977dd4139a48f93f5425c67d44a9368
30 30 | |
31 31 | o 6c725a58ad10aea441540bfd06c507f63e8b9cdd
32 32 | |
33 33 | o 18063366a155bd56b5618229ae2ac3e91849aa5e
34 34 | |
35 35 | o a21d913c992197a2eb60b298521ec0f045a04799
36 36 | |
37 37 o | b6b2b682253df2ffedc10e9415e4114202b303c5
38 38 | |
39 39 o | 2114148793524fd045998f71a45b0aaf139f752b
40 40 | |
41 41 o | 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
42 42 | |
43 43 o | ea919464b16e003894c48b6cb68df3cd9411b544
44 44 | |
45 45 o | 0f82d97ec2778746743fbc996740d409558fda22
46 46 |/
47 47 o 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
48 48 |
49 49 o 10e64d654571f11577745b4d8372e859d9e4df63
50 50
51 51 $ cd ..
52 52
53 53
54 54 = Test locally =
55 55
56 56 Get everything:
57 57
58 58 $ hg debuggetbundle repo bundle
59 59 $ hg debugbundle bundle
60 60 10e64d654571f11577745b4d8372e859d9e4df63
61 61 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
62 62 0f82d97ec2778746743fbc996740d409558fda22
63 63 ea919464b16e003894c48b6cb68df3cd9411b544
64 64 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
65 65 2114148793524fd045998f71a45b0aaf139f752b
66 66 b6b2b682253df2ffedc10e9415e4114202b303c5
67 67 a21d913c992197a2eb60b298521ec0f045a04799
68 68 18063366a155bd56b5618229ae2ac3e91849aa5e
69 69 6c725a58ad10aea441540bfd06c507f63e8b9cdd
70 70 c1818a9f5977dd4139a48f93f5425c67d44a9368
71 71 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
72 72 6b57ee934bb2996050540f84cdfc8dcad1e7267d
73 73 b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
74 74 733bf0910832b26b768a09172f325f995b5476e1
75 75 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
76 76 d9e5488323c782fe684573f3043369d199038b6f
77 77 2bba2f40f321484159b395a43f20101d4bb7ead0
78 78
79 79 Get part of linear run:
80 80
81 81 $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 733bf0910832b26b768a09172f325f995b5476e1
82 82 $ hg debugbundle bundle
83 83 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
84 84 d9e5488323c782fe684573f3043369d199038b6f
85 85
86 86 Get missing branch and merge:
87 87
88 88 $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 6b57ee934bb2996050540f84cdfc8dcad1e7267d
89 89 $ hg debugbundle bundle
90 90 0f82d97ec2778746743fbc996740d409558fda22
91 91 ea919464b16e003894c48b6cb68df3cd9411b544
92 92 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
93 93 2114148793524fd045998f71a45b0aaf139f752b
94 94 b6b2b682253df2ffedc10e9415e4114202b303c5
95 95 b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
96 96 733bf0910832b26b768a09172f325f995b5476e1
97 97 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
98 98 d9e5488323c782fe684573f3043369d199038b6f
99 99
100 100 Get from only one head:
101 101
102 102 $ hg debuggetbundle repo bundle -H 6c725a58ad10aea441540bfd06c507f63e8b9cdd -C 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
103 103 $ hg debugbundle bundle
104 104 a21d913c992197a2eb60b298521ec0f045a04799
105 105 18063366a155bd56b5618229ae2ac3e91849aa5e
106 106 6c725a58ad10aea441540bfd06c507f63e8b9cdd
107 107
108 108 Get parts of two branches:
109 109
110 110 $ hg debuggetbundle repo bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
111 111 $ hg debugbundle bundle
112 112 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
113 113 2114148793524fd045998f71a45b0aaf139f752b
114 114 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
115 115 6b57ee934bb2996050540f84cdfc8dcad1e7267d
116 116
117 117 Check that we get all needed file changes:
118 118
119 119 $ hg debugbundle bundle --all
120 120 format: id, p1, p2, cset, len(delta)
121 121
122 122 changelog
123 123 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
124 124 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
125 125 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
126 126 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
127 127
128 128 manifest
129 129 dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
130 130 0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
131 131 eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
132 132 b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
133 133
134 134 mf
135 135 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
136 136 c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
137 137 266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
138 138 698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
139 139
140 140 nf11
141 141 33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
142 142
143 143 nf12
144 144 ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
145 145
146 146 nf4
147 147 3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
148 148
149 149 nf5
150 150 0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15
151 151
152 152 Get branch and merge:
153 153
154 154 $ hg debuggetbundle repo bundle -C 10e64d654571f11577745b4d8372e859d9e4df63 -H 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
155 155 $ hg debugbundle bundle
156 156 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
157 157 0f82d97ec2778746743fbc996740d409558fda22
158 158 ea919464b16e003894c48b6cb68df3cd9411b544
159 159 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
160 160 2114148793524fd045998f71a45b0aaf139f752b
161 161 b6b2b682253df2ffedc10e9415e4114202b303c5
162 162 a21d913c992197a2eb60b298521ec0f045a04799
163 163 18063366a155bd56b5618229ae2ac3e91849aa5e
164 164 6c725a58ad10aea441540bfd06c507f63e8b9cdd
165 165 c1818a9f5977dd4139a48f93f5425c67d44a9368
166 166 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
167 167 6b57ee934bb2996050540f84cdfc8dcad1e7267d
168 168 b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
169 169 733bf0910832b26b768a09172f325f995b5476e1
170 170 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
171 171
172 172
173 173 = Test via HTTP =
174 174
175 175 Get everything:
176 176
177 177 $ hg serve -R repo -p $HGPORT -d --pid-file=hg.pid -E error.log -A access.log
178 178 $ cat hg.pid >> $DAEMON_PIDS
179 179 $ hg debuggetbundle http://localhost:$HGPORT/ bundle
180 180 $ hg debugbundle bundle
181 181 10e64d654571f11577745b4d8372e859d9e4df63
182 182 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
183 183 0f82d97ec2778746743fbc996740d409558fda22
184 184 ea919464b16e003894c48b6cb68df3cd9411b544
185 185 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
186 186 2114148793524fd045998f71a45b0aaf139f752b
187 187 b6b2b682253df2ffedc10e9415e4114202b303c5
188 188 a21d913c992197a2eb60b298521ec0f045a04799
189 189 18063366a155bd56b5618229ae2ac3e91849aa5e
190 190 6c725a58ad10aea441540bfd06c507f63e8b9cdd
191 191 c1818a9f5977dd4139a48f93f5425c67d44a9368
192 192 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
193 193 6b57ee934bb2996050540f84cdfc8dcad1e7267d
194 194 b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
195 195 733bf0910832b26b768a09172f325f995b5476e1
196 196 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
197 197 d9e5488323c782fe684573f3043369d199038b6f
198 198 2bba2f40f321484159b395a43f20101d4bb7ead0
199 199
200 200 Get parts of two branches:
201 201
202 202 $ hg debuggetbundle http://localhost:$HGPORT/ bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
203 203 $ hg debugbundle bundle
204 204 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
205 205 2114148793524fd045998f71a45b0aaf139f752b
206 206 2c0ec49482e8abe888b7bd090b5827acfc22b3d7
207 207 6b57ee934bb2996050540f84cdfc8dcad1e7267d
208 208
209 209 Check that we get all needed file changes:
210 210
211 211 $ hg debugbundle bundle --all
212 212 format: id, p1, p2, cset, len(delta)
213 213
214 214 changelog
215 215 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
216 216 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
217 217 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
218 218 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
219 219
220 220 manifest
221 221 dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
222 222 0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
223 223 eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
224 224 b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
225 225
226 226 mf
227 227 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
228 228 c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
229 229 266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
230 230 698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
231 231
232 232 nf11
233 233 33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
234 234
235 235 nf12
236 236 ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
237 237
238 238 nf4
239 239 3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
240 240
241 241 nf5
242 242 0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15
243 243
244 244 Verify we hit the HTTP server:
245 245
246 246 $ cat access.log
247 247 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
248 248 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob)
249 249 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
250 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-arg-1:common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b (glob)
250 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b (glob)
251 251
252 252 $ cat error.log
253 253
@@ -1,120 +1,120 b''
1 1
2 2 $ hg init a
3 3 $ cd a
4 4 $ echo a > a
5 5 $ hg ci -Ama -d '1123456789 0'
6 6 adding a
7 7 $ hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid
8 8 $ cat hg.pid >> $DAEMON_PIDS
9 9 $ cd ..
10 10 $ ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null &
11 11 $ echo $! > proxy.pid)
12 12 $ cat proxy.pid >> $DAEMON_PIDS
13 13 $ sleep 2
14 14
15 15 url for proxy, stream
16 16
17 17 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b
18 18 streaming all changes
19 19 3 files to transfer, 303 bytes of data
20 20 transferred * bytes in * seconds (*/sec) (glob)
21 21 updating to branch default
22 22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 23 $ cd b
24 24 $ hg verify
25 25 checking changesets
26 26 checking manifests
27 27 crosschecking files in changesets and manifests
28 28 checking files
29 29 1 files, 1 changesets, 1 total revisions
30 30 $ cd ..
31 31
32 32 url for proxy, pull
33 33
34 34 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull
35 35 requesting all changes
36 36 adding changesets
37 37 adding manifests
38 38 adding file changes
39 39 added 1 changesets with 1 changes to 1 files
40 40 updating to branch default
41 41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 42 $ cd b-pull
43 43 $ hg verify
44 44 checking changesets
45 45 checking manifests
46 46 crosschecking files in changesets and manifests
47 47 checking files
48 48 1 files, 1 changesets, 1 total revisions
49 49 $ cd ..
50 50
51 51 host:port for proxy
52 52
53 53 $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c
54 54 requesting all changes
55 55 adding changesets
56 56 adding manifests
57 57 adding file changes
58 58 added 1 changesets with 1 changes to 1 files
59 59 updating to branch default
60 60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 61
62 62 proxy url with user name and password
63 63
64 64 $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d
65 65 requesting all changes
66 66 adding changesets
67 67 adding manifests
68 68 adding file changes
69 69 added 1 changesets with 1 changes to 1 files
70 70 updating to branch default
71 71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 72
73 73 url with user name and password
74 74
75 75 $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
76 76 requesting all changes
77 77 adding changesets
78 78 adding manifests
79 79 adding file changes
80 80 added 1 changesets with 1 changes to 1 files
81 81 updating to branch default
82 82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 83
84 84 bad host:port for proxy
85 85
86 86 $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
87 87 abort: error: Connection refused
88 88 [255]
89 89
90 90 do not use the proxy if it is in the no list
91 91
92 92 $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g
93 93 requesting all changes
94 94 adding changesets
95 95 adding manifests
96 96 adding file changes
97 97 added 1 changesets with 1 changes to 1 files
98 98 updating to branch default
99 99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 100 $ cat proxy.log
101 101 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
102 102 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
104 104 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
105 105 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
106 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
108 108 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
109 109 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
111 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
112 112 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
113 113 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
114 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
115 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
116 116 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
117 117 * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-arg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-arg-1:namespace=bookmarks (glob)
118 * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob)
119 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
120 120
@@ -1,31 +1,31 b''
1 1
2 2 Test wire protocol unbundle with hashed heads (capability: unbundlehash)
3 3
4 4 Create a remote repository.
5 5
6 6 $ hg init remote
7 7 $ hg serve -R remote --config web.push_ssl=False --config web.allow_push=* -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log
8 8 $ cat hg1.pid >> $DAEMON_PIDS
9 9
10 10 Clone the repository and push a change.
11 11
12 12 $ hg clone http://localhost:$HGPORT/ local
13 13 no changes found
14 14 updating to branch default
15 15 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 16 $ touch local/README
17 17 $ hg ci -R local -A -m hoge
18 18 adding README
19 19 $ hg push -R local
20 20 pushing to http://localhost:$HGPORT/
21 21 searching for changes
22 22 remote: adding changesets
23 23 remote: adding manifests
24 24 remote: adding file changes
25 25 remote: added 1 changesets with 1 changes to 1 files
26 26
27 27 Ensure hashed heads format is used.
28 28 The hash here is always the same since the remote repository only has the null head.
29 29
30 30 $ cat access.log | grep unbundle
31 * - - [*] "POST /?cmd=unbundle HTTP/1.1" 200 - x-arg-1:heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f (glob)
31 * - - [*] "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f (glob)
@@ -1,112 +1,112 b''
1 1
2 2 Test wire protocol argument passing
3 3
4 4 Setup repo:
5 5
6 6 $ hg init repo
7 7
8 8 Local:
9 9
10 10 $ hg debugwireargs repo eins zwei --three drei --four vier
11 11 eins zwei drei vier None
12 12 $ hg debugwireargs repo eins zwei --four vier
13 13 eins zwei None vier None
14 14 $ hg debugwireargs repo eins zwei
15 15 eins zwei None None None
16 16 $ hg debugwireargs repo eins zwei --five fuenf
17 17 eins zwei None None fuenf
18 18
19 19 HTTP:
20 20
21 21 $ hg serve -R repo -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log
22 22 $ cat hg1.pid >> $DAEMON_PIDS
23 23
24 24 $ hg debugwireargs http://localhost:$HGPORT/ un deux trois quatre
25 25 un deux trois quatre None
26 26 $ hg debugwireargs http://localhost:$HGPORT/ \ un deux trois\ qu\ \ atre
27 27 un deux trois qu atre None
28 28 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --four vier
29 29 eins zwei None vier None
30 30 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei
31 31 eins zwei None None None
32 32 $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --five fuenf
33 33 eins zwei None None None
34 34 $ hg debugwireargs http://localhost:$HGPORT/ un deux trois onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx None
36 36 $ cat error.log
37 37 $ cat access.log
38 38 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
39 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=quatre&one=un&three=trois&two=deux (glob)
40 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=quatre&one=un&three=trois&two=deux (glob)
39 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux (glob)
40 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=quatre&one=un&three=trois&two=deux (glob)
41 41 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
42 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
43 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
42 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
43 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=qu++atre&one=+un&three=trois+&two=deux (glob)
44 44 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
45 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=vier&one=eins&two=zwei (glob)
46 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=vier&one=eins&two=zwei (glob)
45 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei (glob)
46 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:four=vier&one=eins&two=zwei (glob)
47 47 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
48 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
49 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
48 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei (glob)
49 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei (glob)
50 50 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
51 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
52 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:one=eins&two=zwei (glob)
51 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei (glob)
52 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-hgarg-1:one=eins&two=zwei (glob)
53 53 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
54 * - - [*] "GET /?cmd=debugwireargs HTTP/1.1" 200 - x-arg-1:four=onethousandcharactersxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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id-file=hg2.pid -E error2.log -A access2.log
64 64 $ cat hg2.pid >> $DAEMON_PIDS
65 65
66 66 $ hg debugwireargs http://localhost:$HGPORT2/ un deux trois quatre
67 67 un deux trois quatre None
68 68 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei --four vier
69 69 eins zwei None vier None
70 70 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei
71 71 eins zwei None None None
72 72 $ hg debugwireargs http://localhost:$HGPORT2/ eins zwei --five fuenf
73 73 eins zwei None None None
74 74 $ cat error2.log
75 75 $ cat access2.log
76 76 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
77 77 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
78 78 * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob)
79 79 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
80 80 * - - [*] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - (glob)
81 81 * - - [*] "GET /?cmd=debugwireargs&four=vier&one=eins&two=zwei HTTP/1.1" 200 - (glob)
82 82 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
83 83 * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob)
84 84 * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob)
85 85 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
86 86 * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob)
87 87 * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob)
88 88
89 89 SSH (try to exercise the ssh functionality with a dummy script):
90 90
91 91 $ cat <<EOF > dummyssh
92 92 > import sys
93 93 > import os
94 94 > os.chdir(os.path.dirname(sys.argv[0]))
95 95 > if sys.argv[1] != "user@dummy":
96 96 > sys.exit(-1)
97 97 > if not os.path.exists("dummyssh"):
98 98 > sys.exit(-1)
99 99 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
100 100 > r = os.system(sys.argv[2])
101 101 > sys.exit(bool(r))
102 102 > EOF
103 103
104 104 $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo uno due tre quattro
105 105 uno due tre quattro None
106 106 $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei --four vier
107 107 eins zwei None vier None
108 108 $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei
109 109 eins zwei None None None
110 110 $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei --five fuenf
111 111 eins zwei None None None
112 112
General Comments 0
You need to be logged in to leave comments. Login now