##// END OF EJS Templates
debugwireproto: close the write end before consuming all available data...
Yuya Nishihara -
r36861:31581528 default
parent child Browse files
Show More
@@ -1,2861 +1,2854 b''
1 # debugcommands.py - command processing for debug* commands
1 # debugcommands.py - command processing for debug* commands
2 #
2 #
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2016 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import codecs
10 import codecs
11 import collections
11 import collections
12 import difflib
12 import difflib
13 import errno
13 import errno
14 import operator
14 import operator
15 import os
15 import os
16 import random
16 import random
17 import socket
17 import socket
18 import ssl
18 import ssl
19 import stat
19 import stat
20 import string
20 import string
21 import subprocess
21 import subprocess
22 import sys
22 import sys
23 import tempfile
23 import tempfile
24 import time
24 import time
25
25
26 from .i18n import _
26 from .i18n import _
27 from .node import (
27 from .node import (
28 bin,
28 bin,
29 hex,
29 hex,
30 nullhex,
30 nullhex,
31 nullid,
31 nullid,
32 nullrev,
32 nullrev,
33 short,
33 short,
34 )
34 )
35 from . import (
35 from . import (
36 bundle2,
36 bundle2,
37 changegroup,
37 changegroup,
38 cmdutil,
38 cmdutil,
39 color,
39 color,
40 context,
40 context,
41 dagparser,
41 dagparser,
42 dagutil,
42 dagutil,
43 encoding,
43 encoding,
44 error,
44 error,
45 exchange,
45 exchange,
46 extensions,
46 extensions,
47 filemerge,
47 filemerge,
48 fileset,
48 fileset,
49 formatter,
49 formatter,
50 hg,
50 hg,
51 localrepo,
51 localrepo,
52 lock as lockmod,
52 lock as lockmod,
53 logcmdutil,
53 logcmdutil,
54 merge as mergemod,
54 merge as mergemod,
55 obsolete,
55 obsolete,
56 obsutil,
56 obsutil,
57 phases,
57 phases,
58 policy,
58 policy,
59 pvec,
59 pvec,
60 pycompat,
60 pycompat,
61 registrar,
61 registrar,
62 repair,
62 repair,
63 revlog,
63 revlog,
64 revset,
64 revset,
65 revsetlang,
65 revsetlang,
66 scmutil,
66 scmutil,
67 setdiscovery,
67 setdiscovery,
68 simplemerge,
68 simplemerge,
69 smartset,
69 smartset,
70 sshpeer,
70 sshpeer,
71 sslutil,
71 sslutil,
72 streamclone,
72 streamclone,
73 templater,
73 templater,
74 treediscovery,
74 treediscovery,
75 upgrade,
75 upgrade,
76 url as urlmod,
76 url as urlmod,
77 util,
77 util,
78 vfs as vfsmod,
78 vfs as vfsmod,
79 wireprotoserver,
79 wireprotoserver,
80 )
80 )
81 from .utils import dateutil
81 from .utils import dateutil
82
82
83 release = lockmod.release
83 release = lockmod.release
84
84
85 command = registrar.command()
85 command = registrar.command()
86
86
87 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
87 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
88 def debugancestor(ui, repo, *args):
88 def debugancestor(ui, repo, *args):
89 """find the ancestor revision of two revisions in a given index"""
89 """find the ancestor revision of two revisions in a given index"""
90 if len(args) == 3:
90 if len(args) == 3:
91 index, rev1, rev2 = args
91 index, rev1, rev2 = args
92 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
92 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
93 lookup = r.lookup
93 lookup = r.lookup
94 elif len(args) == 2:
94 elif len(args) == 2:
95 if not repo:
95 if not repo:
96 raise error.Abort(_('there is no Mercurial repository here '
96 raise error.Abort(_('there is no Mercurial repository here '
97 '(.hg not found)'))
97 '(.hg not found)'))
98 rev1, rev2 = args
98 rev1, rev2 = args
99 r = repo.changelog
99 r = repo.changelog
100 lookup = repo.lookup
100 lookup = repo.lookup
101 else:
101 else:
102 raise error.Abort(_('either two or three arguments required'))
102 raise error.Abort(_('either two or three arguments required'))
103 a = r.ancestor(lookup(rev1), lookup(rev2))
103 a = r.ancestor(lookup(rev1), lookup(rev2))
104 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
104 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
105
105
106 @command('debugapplystreamclonebundle', [], 'FILE')
106 @command('debugapplystreamclonebundle', [], 'FILE')
107 def debugapplystreamclonebundle(ui, repo, fname):
107 def debugapplystreamclonebundle(ui, repo, fname):
108 """apply a stream clone bundle file"""
108 """apply a stream clone bundle file"""
109 f = hg.openpath(ui, fname)
109 f = hg.openpath(ui, fname)
110 gen = exchange.readbundle(ui, f, fname)
110 gen = exchange.readbundle(ui, f, fname)
111 gen.apply(repo)
111 gen.apply(repo)
112
112
113 @command('debugbuilddag',
113 @command('debugbuilddag',
114 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
114 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
115 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
115 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
116 ('n', 'new-file', None, _('add new file at each rev'))],
116 ('n', 'new-file', None, _('add new file at each rev'))],
117 _('[OPTION]... [TEXT]'))
117 _('[OPTION]... [TEXT]'))
118 def debugbuilddag(ui, repo, text=None,
118 def debugbuilddag(ui, repo, text=None,
119 mergeable_file=False,
119 mergeable_file=False,
120 overwritten_file=False,
120 overwritten_file=False,
121 new_file=False):
121 new_file=False):
122 """builds a repo with a given DAG from scratch in the current empty repo
122 """builds a repo with a given DAG from scratch in the current empty repo
123
123
124 The description of the DAG is read from stdin if not given on the
124 The description of the DAG is read from stdin if not given on the
125 command line.
125 command line.
126
126
127 Elements:
127 Elements:
128
128
129 - "+n" is a linear run of n nodes based on the current default parent
129 - "+n" is a linear run of n nodes based on the current default parent
130 - "." is a single node based on the current default parent
130 - "." is a single node based on the current default parent
131 - "$" resets the default parent to null (implied at the start);
131 - "$" resets the default parent to null (implied at the start);
132 otherwise the default parent is always the last node created
132 otherwise the default parent is always the last node created
133 - "<p" sets the default parent to the backref p
133 - "<p" sets the default parent to the backref p
134 - "*p" is a fork at parent p, which is a backref
134 - "*p" is a fork at parent p, which is a backref
135 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
135 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
136 - "/p2" is a merge of the preceding node and p2
136 - "/p2" is a merge of the preceding node and p2
137 - ":tag" defines a local tag for the preceding node
137 - ":tag" defines a local tag for the preceding node
138 - "@branch" sets the named branch for subsequent nodes
138 - "@branch" sets the named branch for subsequent nodes
139 - "#...\\n" is a comment up to the end of the line
139 - "#...\\n" is a comment up to the end of the line
140
140
141 Whitespace between the above elements is ignored.
141 Whitespace between the above elements is ignored.
142
142
143 A backref is either
143 A backref is either
144
144
145 - a number n, which references the node curr-n, where curr is the current
145 - a number n, which references the node curr-n, where curr is the current
146 node, or
146 node, or
147 - the name of a local tag you placed earlier using ":tag", or
147 - the name of a local tag you placed earlier using ":tag", or
148 - empty to denote the default parent.
148 - empty to denote the default parent.
149
149
150 All string valued-elements are either strictly alphanumeric, or must
150 All string valued-elements are either strictly alphanumeric, or must
151 be enclosed in double quotes ("..."), with "\\" as escape character.
151 be enclosed in double quotes ("..."), with "\\" as escape character.
152 """
152 """
153
153
154 if text is None:
154 if text is None:
155 ui.status(_("reading DAG from stdin\n"))
155 ui.status(_("reading DAG from stdin\n"))
156 text = ui.fin.read()
156 text = ui.fin.read()
157
157
158 cl = repo.changelog
158 cl = repo.changelog
159 if len(cl) > 0:
159 if len(cl) > 0:
160 raise error.Abort(_('repository is not empty'))
160 raise error.Abort(_('repository is not empty'))
161
161
162 # determine number of revs in DAG
162 # determine number of revs in DAG
163 total = 0
163 total = 0
164 for type, data in dagparser.parsedag(text):
164 for type, data in dagparser.parsedag(text):
165 if type == 'n':
165 if type == 'n':
166 total += 1
166 total += 1
167
167
168 if mergeable_file:
168 if mergeable_file:
169 linesperrev = 2
169 linesperrev = 2
170 # make a file with k lines per rev
170 # make a file with k lines per rev
171 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)]
171 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)]
172 initialmergedlines.append("")
172 initialmergedlines.append("")
173
173
174 tags = []
174 tags = []
175
175
176 wlock = lock = tr = None
176 wlock = lock = tr = None
177 try:
177 try:
178 wlock = repo.wlock()
178 wlock = repo.wlock()
179 lock = repo.lock()
179 lock = repo.lock()
180 tr = repo.transaction("builddag")
180 tr = repo.transaction("builddag")
181
181
182 at = -1
182 at = -1
183 atbranch = 'default'
183 atbranch = 'default'
184 nodeids = []
184 nodeids = []
185 id = 0
185 id = 0
186 ui.progress(_('building'), id, unit=_('revisions'), total=total)
186 ui.progress(_('building'), id, unit=_('revisions'), total=total)
187 for type, data in dagparser.parsedag(text):
187 for type, data in dagparser.parsedag(text):
188 if type == 'n':
188 if type == 'n':
189 ui.note(('node %s\n' % pycompat.bytestr(data)))
189 ui.note(('node %s\n' % pycompat.bytestr(data)))
190 id, ps = data
190 id, ps = data
191
191
192 files = []
192 files = []
193 filecontent = {}
193 filecontent = {}
194
194
195 p2 = None
195 p2 = None
196 if mergeable_file:
196 if mergeable_file:
197 fn = "mf"
197 fn = "mf"
198 p1 = repo[ps[0]]
198 p1 = repo[ps[0]]
199 if len(ps) > 1:
199 if len(ps) > 1:
200 p2 = repo[ps[1]]
200 p2 = repo[ps[1]]
201 pa = p1.ancestor(p2)
201 pa = p1.ancestor(p2)
202 base, local, other = [x[fn].data() for x in (pa, p1,
202 base, local, other = [x[fn].data() for x in (pa, p1,
203 p2)]
203 p2)]
204 m3 = simplemerge.Merge3Text(base, local, other)
204 m3 = simplemerge.Merge3Text(base, local, other)
205 ml = [l.strip() for l in m3.merge_lines()]
205 ml = [l.strip() for l in m3.merge_lines()]
206 ml.append("")
206 ml.append("")
207 elif at > 0:
207 elif at > 0:
208 ml = p1[fn].data().split("\n")
208 ml = p1[fn].data().split("\n")
209 else:
209 else:
210 ml = initialmergedlines
210 ml = initialmergedlines
211 ml[id * linesperrev] += " r%i" % id
211 ml[id * linesperrev] += " r%i" % id
212 mergedtext = "\n".join(ml)
212 mergedtext = "\n".join(ml)
213 files.append(fn)
213 files.append(fn)
214 filecontent[fn] = mergedtext
214 filecontent[fn] = mergedtext
215
215
216 if overwritten_file:
216 if overwritten_file:
217 fn = "of"
217 fn = "of"
218 files.append(fn)
218 files.append(fn)
219 filecontent[fn] = "r%i\n" % id
219 filecontent[fn] = "r%i\n" % id
220
220
221 if new_file:
221 if new_file:
222 fn = "nf%i" % id
222 fn = "nf%i" % id
223 files.append(fn)
223 files.append(fn)
224 filecontent[fn] = "r%i\n" % id
224 filecontent[fn] = "r%i\n" % id
225 if len(ps) > 1:
225 if len(ps) > 1:
226 if not p2:
226 if not p2:
227 p2 = repo[ps[1]]
227 p2 = repo[ps[1]]
228 for fn in p2:
228 for fn in p2:
229 if fn.startswith("nf"):
229 if fn.startswith("nf"):
230 files.append(fn)
230 files.append(fn)
231 filecontent[fn] = p2[fn].data()
231 filecontent[fn] = p2[fn].data()
232
232
233 def fctxfn(repo, cx, path):
233 def fctxfn(repo, cx, path):
234 if path in filecontent:
234 if path in filecontent:
235 return context.memfilectx(repo, cx, path,
235 return context.memfilectx(repo, cx, path,
236 filecontent[path])
236 filecontent[path])
237 return None
237 return None
238
238
239 if len(ps) == 0 or ps[0] < 0:
239 if len(ps) == 0 or ps[0] < 0:
240 pars = [None, None]
240 pars = [None, None]
241 elif len(ps) == 1:
241 elif len(ps) == 1:
242 pars = [nodeids[ps[0]], None]
242 pars = [nodeids[ps[0]], None]
243 else:
243 else:
244 pars = [nodeids[p] for p in ps]
244 pars = [nodeids[p] for p in ps]
245 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
245 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
246 date=(id, 0),
246 date=(id, 0),
247 user="debugbuilddag",
247 user="debugbuilddag",
248 extra={'branch': atbranch})
248 extra={'branch': atbranch})
249 nodeid = repo.commitctx(cx)
249 nodeid = repo.commitctx(cx)
250 nodeids.append(nodeid)
250 nodeids.append(nodeid)
251 at = id
251 at = id
252 elif type == 'l':
252 elif type == 'l':
253 id, name = data
253 id, name = data
254 ui.note(('tag %s\n' % name))
254 ui.note(('tag %s\n' % name))
255 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
255 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
256 elif type == 'a':
256 elif type == 'a':
257 ui.note(('branch %s\n' % data))
257 ui.note(('branch %s\n' % data))
258 atbranch = data
258 atbranch = data
259 ui.progress(_('building'), id, unit=_('revisions'), total=total)
259 ui.progress(_('building'), id, unit=_('revisions'), total=total)
260 tr.close()
260 tr.close()
261
261
262 if tags:
262 if tags:
263 repo.vfs.write("localtags", "".join(tags))
263 repo.vfs.write("localtags", "".join(tags))
264 finally:
264 finally:
265 ui.progress(_('building'), None)
265 ui.progress(_('building'), None)
266 release(tr, lock, wlock)
266 release(tr, lock, wlock)
267
267
268 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
268 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
269 indent_string = ' ' * indent
269 indent_string = ' ' * indent
270 if all:
270 if all:
271 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
271 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
272 % indent_string)
272 % indent_string)
273
273
274 def showchunks(named):
274 def showchunks(named):
275 ui.write("\n%s%s\n" % (indent_string, named))
275 ui.write("\n%s%s\n" % (indent_string, named))
276 for deltadata in gen.deltaiter():
276 for deltadata in gen.deltaiter():
277 node, p1, p2, cs, deltabase, delta, flags = deltadata
277 node, p1, p2, cs, deltabase, delta, flags = deltadata
278 ui.write("%s%s %s %s %s %s %d\n" %
278 ui.write("%s%s %s %s %s %s %d\n" %
279 (indent_string, hex(node), hex(p1), hex(p2),
279 (indent_string, hex(node), hex(p1), hex(p2),
280 hex(cs), hex(deltabase), len(delta)))
280 hex(cs), hex(deltabase), len(delta)))
281
281
282 chunkdata = gen.changelogheader()
282 chunkdata = gen.changelogheader()
283 showchunks("changelog")
283 showchunks("changelog")
284 chunkdata = gen.manifestheader()
284 chunkdata = gen.manifestheader()
285 showchunks("manifest")
285 showchunks("manifest")
286 for chunkdata in iter(gen.filelogheader, {}):
286 for chunkdata in iter(gen.filelogheader, {}):
287 fname = chunkdata['filename']
287 fname = chunkdata['filename']
288 showchunks(fname)
288 showchunks(fname)
289 else:
289 else:
290 if isinstance(gen, bundle2.unbundle20):
290 if isinstance(gen, bundle2.unbundle20):
291 raise error.Abort(_('use debugbundle2 for this file'))
291 raise error.Abort(_('use debugbundle2 for this file'))
292 chunkdata = gen.changelogheader()
292 chunkdata = gen.changelogheader()
293 for deltadata in gen.deltaiter():
293 for deltadata in gen.deltaiter():
294 node, p1, p2, cs, deltabase, delta, flags = deltadata
294 node, p1, p2, cs, deltabase, delta, flags = deltadata
295 ui.write("%s%s\n" % (indent_string, hex(node)))
295 ui.write("%s%s\n" % (indent_string, hex(node)))
296
296
297 def _debugobsmarkers(ui, part, indent=0, **opts):
297 def _debugobsmarkers(ui, part, indent=0, **opts):
298 """display version and markers contained in 'data'"""
298 """display version and markers contained in 'data'"""
299 opts = pycompat.byteskwargs(opts)
299 opts = pycompat.byteskwargs(opts)
300 data = part.read()
300 data = part.read()
301 indent_string = ' ' * indent
301 indent_string = ' ' * indent
302 try:
302 try:
303 version, markers = obsolete._readmarkers(data)
303 version, markers = obsolete._readmarkers(data)
304 except error.UnknownVersion as exc:
304 except error.UnknownVersion as exc:
305 msg = "%sunsupported version: %s (%d bytes)\n"
305 msg = "%sunsupported version: %s (%d bytes)\n"
306 msg %= indent_string, exc.version, len(data)
306 msg %= indent_string, exc.version, len(data)
307 ui.write(msg)
307 ui.write(msg)
308 else:
308 else:
309 msg = "%sversion: %d (%d bytes)\n"
309 msg = "%sversion: %d (%d bytes)\n"
310 msg %= indent_string, version, len(data)
310 msg %= indent_string, version, len(data)
311 ui.write(msg)
311 ui.write(msg)
312 fm = ui.formatter('debugobsolete', opts)
312 fm = ui.formatter('debugobsolete', opts)
313 for rawmarker in sorted(markers):
313 for rawmarker in sorted(markers):
314 m = obsutil.marker(None, rawmarker)
314 m = obsutil.marker(None, rawmarker)
315 fm.startitem()
315 fm.startitem()
316 fm.plain(indent_string)
316 fm.plain(indent_string)
317 cmdutil.showmarker(fm, m)
317 cmdutil.showmarker(fm, m)
318 fm.end()
318 fm.end()
319
319
320 def _debugphaseheads(ui, data, indent=0):
320 def _debugphaseheads(ui, data, indent=0):
321 """display version and markers contained in 'data'"""
321 """display version and markers contained in 'data'"""
322 indent_string = ' ' * indent
322 indent_string = ' ' * indent
323 headsbyphase = phases.binarydecode(data)
323 headsbyphase = phases.binarydecode(data)
324 for phase in phases.allphases:
324 for phase in phases.allphases:
325 for head in headsbyphase[phase]:
325 for head in headsbyphase[phase]:
326 ui.write(indent_string)
326 ui.write(indent_string)
327 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
327 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
328
328
329 def _quasirepr(thing):
329 def _quasirepr(thing):
330 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
330 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
331 return '{%s}' % (
331 return '{%s}' % (
332 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
332 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
333 return pycompat.bytestr(repr(thing))
333 return pycompat.bytestr(repr(thing))
334
334
335 def _debugbundle2(ui, gen, all=None, **opts):
335 def _debugbundle2(ui, gen, all=None, **opts):
336 """lists the contents of a bundle2"""
336 """lists the contents of a bundle2"""
337 if not isinstance(gen, bundle2.unbundle20):
337 if not isinstance(gen, bundle2.unbundle20):
338 raise error.Abort(_('not a bundle2 file'))
338 raise error.Abort(_('not a bundle2 file'))
339 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
339 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
340 parttypes = opts.get(r'part_type', [])
340 parttypes = opts.get(r'part_type', [])
341 for part in gen.iterparts():
341 for part in gen.iterparts():
342 if parttypes and part.type not in parttypes:
342 if parttypes and part.type not in parttypes:
343 continue
343 continue
344 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
344 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
345 if part.type == 'changegroup':
345 if part.type == 'changegroup':
346 version = part.params.get('version', '01')
346 version = part.params.get('version', '01')
347 cg = changegroup.getunbundler(version, part, 'UN')
347 cg = changegroup.getunbundler(version, part, 'UN')
348 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
348 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
349 if part.type == 'obsmarkers':
349 if part.type == 'obsmarkers':
350 _debugobsmarkers(ui, part, indent=4, **opts)
350 _debugobsmarkers(ui, part, indent=4, **opts)
351 if part.type == 'phase-heads':
351 if part.type == 'phase-heads':
352 _debugphaseheads(ui, part, indent=4)
352 _debugphaseheads(ui, part, indent=4)
353
353
354 @command('debugbundle',
354 @command('debugbundle',
355 [('a', 'all', None, _('show all details')),
355 [('a', 'all', None, _('show all details')),
356 ('', 'part-type', [], _('show only the named part type')),
356 ('', 'part-type', [], _('show only the named part type')),
357 ('', 'spec', None, _('print the bundlespec of the bundle'))],
357 ('', 'spec', None, _('print the bundlespec of the bundle'))],
358 _('FILE'),
358 _('FILE'),
359 norepo=True)
359 norepo=True)
360 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
360 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
361 """lists the contents of a bundle"""
361 """lists the contents of a bundle"""
362 with hg.openpath(ui, bundlepath) as f:
362 with hg.openpath(ui, bundlepath) as f:
363 if spec:
363 if spec:
364 spec = exchange.getbundlespec(ui, f)
364 spec = exchange.getbundlespec(ui, f)
365 ui.write('%s\n' % spec)
365 ui.write('%s\n' % spec)
366 return
366 return
367
367
368 gen = exchange.readbundle(ui, f, bundlepath)
368 gen = exchange.readbundle(ui, f, bundlepath)
369 if isinstance(gen, bundle2.unbundle20):
369 if isinstance(gen, bundle2.unbundle20):
370 return _debugbundle2(ui, gen, all=all, **opts)
370 return _debugbundle2(ui, gen, all=all, **opts)
371 _debugchangegroup(ui, gen, all=all, **opts)
371 _debugchangegroup(ui, gen, all=all, **opts)
372
372
373 @command('debugcapabilities',
373 @command('debugcapabilities',
374 [], _('PATH'),
374 [], _('PATH'),
375 norepo=True)
375 norepo=True)
376 def debugcapabilities(ui, path, **opts):
376 def debugcapabilities(ui, path, **opts):
377 """lists the capabilities of a remote peer"""
377 """lists the capabilities of a remote peer"""
378 opts = pycompat.byteskwargs(opts)
378 opts = pycompat.byteskwargs(opts)
379 peer = hg.peer(ui, opts, path)
379 peer = hg.peer(ui, opts, path)
380 caps = peer.capabilities()
380 caps = peer.capabilities()
381 ui.write(('Main capabilities:\n'))
381 ui.write(('Main capabilities:\n'))
382 for c in sorted(caps):
382 for c in sorted(caps):
383 ui.write((' %s\n') % c)
383 ui.write((' %s\n') % c)
384 b2caps = bundle2.bundle2caps(peer)
384 b2caps = bundle2.bundle2caps(peer)
385 if b2caps:
385 if b2caps:
386 ui.write(('Bundle2 capabilities:\n'))
386 ui.write(('Bundle2 capabilities:\n'))
387 for key, values in sorted(b2caps.iteritems()):
387 for key, values in sorted(b2caps.iteritems()):
388 ui.write((' %s\n') % key)
388 ui.write((' %s\n') % key)
389 for v in values:
389 for v in values:
390 ui.write((' %s\n') % v)
390 ui.write((' %s\n') % v)
391
391
392 @command('debugcheckstate', [], '')
392 @command('debugcheckstate', [], '')
393 def debugcheckstate(ui, repo):
393 def debugcheckstate(ui, repo):
394 """validate the correctness of the current dirstate"""
394 """validate the correctness of the current dirstate"""
395 parent1, parent2 = repo.dirstate.parents()
395 parent1, parent2 = repo.dirstate.parents()
396 m1 = repo[parent1].manifest()
396 m1 = repo[parent1].manifest()
397 m2 = repo[parent2].manifest()
397 m2 = repo[parent2].manifest()
398 errors = 0
398 errors = 0
399 for f in repo.dirstate:
399 for f in repo.dirstate:
400 state = repo.dirstate[f]
400 state = repo.dirstate[f]
401 if state in "nr" and f not in m1:
401 if state in "nr" and f not in m1:
402 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
402 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
403 errors += 1
403 errors += 1
404 if state in "a" and f in m1:
404 if state in "a" and f in m1:
405 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
405 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
406 errors += 1
406 errors += 1
407 if state in "m" and f not in m1 and f not in m2:
407 if state in "m" and f not in m1 and f not in m2:
408 ui.warn(_("%s in state %s, but not in either manifest\n") %
408 ui.warn(_("%s in state %s, but not in either manifest\n") %
409 (f, state))
409 (f, state))
410 errors += 1
410 errors += 1
411 for f in m1:
411 for f in m1:
412 state = repo.dirstate[f]
412 state = repo.dirstate[f]
413 if state not in "nrm":
413 if state not in "nrm":
414 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
414 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
415 errors += 1
415 errors += 1
416 if errors:
416 if errors:
417 error = _(".hg/dirstate inconsistent with current parent's manifest")
417 error = _(".hg/dirstate inconsistent with current parent's manifest")
418 raise error.Abort(error)
418 raise error.Abort(error)
419
419
420 @command('debugcolor',
420 @command('debugcolor',
421 [('', 'style', None, _('show all configured styles'))],
421 [('', 'style', None, _('show all configured styles'))],
422 'hg debugcolor')
422 'hg debugcolor')
423 def debugcolor(ui, repo, **opts):
423 def debugcolor(ui, repo, **opts):
424 """show available color, effects or style"""
424 """show available color, effects or style"""
425 ui.write(('color mode: %s\n') % ui._colormode)
425 ui.write(('color mode: %s\n') % ui._colormode)
426 if opts.get(r'style'):
426 if opts.get(r'style'):
427 return _debugdisplaystyle(ui)
427 return _debugdisplaystyle(ui)
428 else:
428 else:
429 return _debugdisplaycolor(ui)
429 return _debugdisplaycolor(ui)
430
430
431 def _debugdisplaycolor(ui):
431 def _debugdisplaycolor(ui):
432 ui = ui.copy()
432 ui = ui.copy()
433 ui._styles.clear()
433 ui._styles.clear()
434 for effect in color._activeeffects(ui).keys():
434 for effect in color._activeeffects(ui).keys():
435 ui._styles[effect] = effect
435 ui._styles[effect] = effect
436 if ui._terminfoparams:
436 if ui._terminfoparams:
437 for k, v in ui.configitems('color'):
437 for k, v in ui.configitems('color'):
438 if k.startswith('color.'):
438 if k.startswith('color.'):
439 ui._styles[k] = k[6:]
439 ui._styles[k] = k[6:]
440 elif k.startswith('terminfo.'):
440 elif k.startswith('terminfo.'):
441 ui._styles[k] = k[9:]
441 ui._styles[k] = k[9:]
442 ui.write(_('available colors:\n'))
442 ui.write(_('available colors:\n'))
443 # sort label with a '_' after the other to group '_background' entry.
443 # sort label with a '_' after the other to group '_background' entry.
444 items = sorted(ui._styles.items(),
444 items = sorted(ui._styles.items(),
445 key=lambda i: ('_' in i[0], i[0], i[1]))
445 key=lambda i: ('_' in i[0], i[0], i[1]))
446 for colorname, label in items:
446 for colorname, label in items:
447 ui.write(('%s\n') % colorname, label=label)
447 ui.write(('%s\n') % colorname, label=label)
448
448
449 def _debugdisplaystyle(ui):
449 def _debugdisplaystyle(ui):
450 ui.write(_('available style:\n'))
450 ui.write(_('available style:\n'))
451 width = max(len(s) for s in ui._styles)
451 width = max(len(s) for s in ui._styles)
452 for label, effects in sorted(ui._styles.items()):
452 for label, effects in sorted(ui._styles.items()):
453 ui.write('%s' % label, label=label)
453 ui.write('%s' % label, label=label)
454 if effects:
454 if effects:
455 # 50
455 # 50
456 ui.write(': ')
456 ui.write(': ')
457 ui.write(' ' * (max(0, width - len(label))))
457 ui.write(' ' * (max(0, width - len(label))))
458 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
458 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
459 ui.write('\n')
459 ui.write('\n')
460
460
461 @command('debugcreatestreamclonebundle', [], 'FILE')
461 @command('debugcreatestreamclonebundle', [], 'FILE')
462 def debugcreatestreamclonebundle(ui, repo, fname):
462 def debugcreatestreamclonebundle(ui, repo, fname):
463 """create a stream clone bundle file
463 """create a stream clone bundle file
464
464
465 Stream bundles are special bundles that are essentially archives of
465 Stream bundles are special bundles that are essentially archives of
466 revlog files. They are commonly used for cloning very quickly.
466 revlog files. They are commonly used for cloning very quickly.
467 """
467 """
468 # TODO we may want to turn this into an abort when this functionality
468 # TODO we may want to turn this into an abort when this functionality
469 # is moved into `hg bundle`.
469 # is moved into `hg bundle`.
470 if phases.hassecret(repo):
470 if phases.hassecret(repo):
471 ui.warn(_('(warning: stream clone bundle will contain secret '
471 ui.warn(_('(warning: stream clone bundle will contain secret '
472 'revisions)\n'))
472 'revisions)\n'))
473
473
474 requirements, gen = streamclone.generatebundlev1(repo)
474 requirements, gen = streamclone.generatebundlev1(repo)
475 changegroup.writechunks(ui, gen, fname)
475 changegroup.writechunks(ui, gen, fname)
476
476
477 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
477 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
478
478
479 @command('debugdag',
479 @command('debugdag',
480 [('t', 'tags', None, _('use tags as labels')),
480 [('t', 'tags', None, _('use tags as labels')),
481 ('b', 'branches', None, _('annotate with branch names')),
481 ('b', 'branches', None, _('annotate with branch names')),
482 ('', 'dots', None, _('use dots for runs')),
482 ('', 'dots', None, _('use dots for runs')),
483 ('s', 'spaces', None, _('separate elements by spaces'))],
483 ('s', 'spaces', None, _('separate elements by spaces'))],
484 _('[OPTION]... [FILE [REV]...]'),
484 _('[OPTION]... [FILE [REV]...]'),
485 optionalrepo=True)
485 optionalrepo=True)
486 def debugdag(ui, repo, file_=None, *revs, **opts):
486 def debugdag(ui, repo, file_=None, *revs, **opts):
487 """format the changelog or an index DAG as a concise textual description
487 """format the changelog or an index DAG as a concise textual description
488
488
489 If you pass a revlog index, the revlog's DAG is emitted. If you list
489 If you pass a revlog index, the revlog's DAG is emitted. If you list
490 revision numbers, they get labeled in the output as rN.
490 revision numbers, they get labeled in the output as rN.
491
491
492 Otherwise, the changelog DAG of the current repo is emitted.
492 Otherwise, the changelog DAG of the current repo is emitted.
493 """
493 """
494 spaces = opts.get(r'spaces')
494 spaces = opts.get(r'spaces')
495 dots = opts.get(r'dots')
495 dots = opts.get(r'dots')
496 if file_:
496 if file_:
497 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
497 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
498 file_)
498 file_)
499 revs = set((int(r) for r in revs))
499 revs = set((int(r) for r in revs))
500 def events():
500 def events():
501 for r in rlog:
501 for r in rlog:
502 yield 'n', (r, list(p for p in rlog.parentrevs(r)
502 yield 'n', (r, list(p for p in rlog.parentrevs(r)
503 if p != -1))
503 if p != -1))
504 if r in revs:
504 if r in revs:
505 yield 'l', (r, "r%i" % r)
505 yield 'l', (r, "r%i" % r)
506 elif repo:
506 elif repo:
507 cl = repo.changelog
507 cl = repo.changelog
508 tags = opts.get(r'tags')
508 tags = opts.get(r'tags')
509 branches = opts.get(r'branches')
509 branches = opts.get(r'branches')
510 if tags:
510 if tags:
511 labels = {}
511 labels = {}
512 for l, n in repo.tags().items():
512 for l, n in repo.tags().items():
513 labels.setdefault(cl.rev(n), []).append(l)
513 labels.setdefault(cl.rev(n), []).append(l)
514 def events():
514 def events():
515 b = "default"
515 b = "default"
516 for r in cl:
516 for r in cl:
517 if branches:
517 if branches:
518 newb = cl.read(cl.node(r))[5]['branch']
518 newb = cl.read(cl.node(r))[5]['branch']
519 if newb != b:
519 if newb != b:
520 yield 'a', newb
520 yield 'a', newb
521 b = newb
521 b = newb
522 yield 'n', (r, list(p for p in cl.parentrevs(r)
522 yield 'n', (r, list(p for p in cl.parentrevs(r)
523 if p != -1))
523 if p != -1))
524 if tags:
524 if tags:
525 ls = labels.get(r)
525 ls = labels.get(r)
526 if ls:
526 if ls:
527 for l in ls:
527 for l in ls:
528 yield 'l', (r, l)
528 yield 'l', (r, l)
529 else:
529 else:
530 raise error.Abort(_('need repo for changelog dag'))
530 raise error.Abort(_('need repo for changelog dag'))
531
531
532 for line in dagparser.dagtextlines(events(),
532 for line in dagparser.dagtextlines(events(),
533 addspaces=spaces,
533 addspaces=spaces,
534 wraplabels=True,
534 wraplabels=True,
535 wrapannotations=True,
535 wrapannotations=True,
536 wrapnonlinear=dots,
536 wrapnonlinear=dots,
537 usedots=dots,
537 usedots=dots,
538 maxlinewidth=70):
538 maxlinewidth=70):
539 ui.write(line)
539 ui.write(line)
540 ui.write("\n")
540 ui.write("\n")
541
541
542 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
542 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
543 def debugdata(ui, repo, file_, rev=None, **opts):
543 def debugdata(ui, repo, file_, rev=None, **opts):
544 """dump the contents of a data file revision"""
544 """dump the contents of a data file revision"""
545 opts = pycompat.byteskwargs(opts)
545 opts = pycompat.byteskwargs(opts)
546 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
546 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
547 if rev is not None:
547 if rev is not None:
548 raise error.CommandError('debugdata', _('invalid arguments'))
548 raise error.CommandError('debugdata', _('invalid arguments'))
549 file_, rev = None, file_
549 file_, rev = None, file_
550 elif rev is None:
550 elif rev is None:
551 raise error.CommandError('debugdata', _('invalid arguments'))
551 raise error.CommandError('debugdata', _('invalid arguments'))
552 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
552 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
553 try:
553 try:
554 ui.write(r.revision(r.lookup(rev), raw=True))
554 ui.write(r.revision(r.lookup(rev), raw=True))
555 except KeyError:
555 except KeyError:
556 raise error.Abort(_('invalid revision identifier %s') % rev)
556 raise error.Abort(_('invalid revision identifier %s') % rev)
557
557
558 @command('debugdate',
558 @command('debugdate',
559 [('e', 'extended', None, _('try extended date formats'))],
559 [('e', 'extended', None, _('try extended date formats'))],
560 _('[-e] DATE [RANGE]'),
560 _('[-e] DATE [RANGE]'),
561 norepo=True, optionalrepo=True)
561 norepo=True, optionalrepo=True)
562 def debugdate(ui, date, range=None, **opts):
562 def debugdate(ui, date, range=None, **opts):
563 """parse and display a date"""
563 """parse and display a date"""
564 if opts[r"extended"]:
564 if opts[r"extended"]:
565 d = dateutil.parsedate(date, util.extendeddateformats)
565 d = dateutil.parsedate(date, util.extendeddateformats)
566 else:
566 else:
567 d = dateutil.parsedate(date)
567 d = dateutil.parsedate(date)
568 ui.write(("internal: %d %d\n") % d)
568 ui.write(("internal: %d %d\n") % d)
569 ui.write(("standard: %s\n") % dateutil.datestr(d))
569 ui.write(("standard: %s\n") % dateutil.datestr(d))
570 if range:
570 if range:
571 m = dateutil.matchdate(range)
571 m = dateutil.matchdate(range)
572 ui.write(("match: %s\n") % m(d[0]))
572 ui.write(("match: %s\n") % m(d[0]))
573
573
574 @command('debugdeltachain',
574 @command('debugdeltachain',
575 cmdutil.debugrevlogopts + cmdutil.formatteropts,
575 cmdutil.debugrevlogopts + cmdutil.formatteropts,
576 _('-c|-m|FILE'),
576 _('-c|-m|FILE'),
577 optionalrepo=True)
577 optionalrepo=True)
578 def debugdeltachain(ui, repo, file_=None, **opts):
578 def debugdeltachain(ui, repo, file_=None, **opts):
579 """dump information about delta chains in a revlog
579 """dump information about delta chains in a revlog
580
580
581 Output can be templatized. Available template keywords are:
581 Output can be templatized. Available template keywords are:
582
582
583 :``rev``: revision number
583 :``rev``: revision number
584 :``chainid``: delta chain identifier (numbered by unique base)
584 :``chainid``: delta chain identifier (numbered by unique base)
585 :``chainlen``: delta chain length to this revision
585 :``chainlen``: delta chain length to this revision
586 :``prevrev``: previous revision in delta chain
586 :``prevrev``: previous revision in delta chain
587 :``deltatype``: role of delta / how it was computed
587 :``deltatype``: role of delta / how it was computed
588 :``compsize``: compressed size of revision
588 :``compsize``: compressed size of revision
589 :``uncompsize``: uncompressed size of revision
589 :``uncompsize``: uncompressed size of revision
590 :``chainsize``: total size of compressed revisions in chain
590 :``chainsize``: total size of compressed revisions in chain
591 :``chainratio``: total chain size divided by uncompressed revision size
591 :``chainratio``: total chain size divided by uncompressed revision size
592 (new delta chains typically start at ratio 2.00)
592 (new delta chains typically start at ratio 2.00)
593 :``lindist``: linear distance from base revision in delta chain to end
593 :``lindist``: linear distance from base revision in delta chain to end
594 of this revision
594 of this revision
595 :``extradist``: total size of revisions not part of this delta chain from
595 :``extradist``: total size of revisions not part of this delta chain from
596 base of delta chain to end of this revision; a measurement
596 base of delta chain to end of this revision; a measurement
597 of how much extra data we need to read/seek across to read
597 of how much extra data we need to read/seek across to read
598 the delta chain for this revision
598 the delta chain for this revision
599 :``extraratio``: extradist divided by chainsize; another representation of
599 :``extraratio``: extradist divided by chainsize; another representation of
600 how much unrelated data is needed to load this delta chain
600 how much unrelated data is needed to load this delta chain
601
601
602 If the repository is configured to use the sparse read, additional keywords
602 If the repository is configured to use the sparse read, additional keywords
603 are available:
603 are available:
604
604
605 :``readsize``: total size of data read from the disk for a revision
605 :``readsize``: total size of data read from the disk for a revision
606 (sum of the sizes of all the blocks)
606 (sum of the sizes of all the blocks)
607 :``largestblock``: size of the largest block of data read from the disk
607 :``largestblock``: size of the largest block of data read from the disk
608 :``readdensity``: density of useful bytes in the data read from the disk
608 :``readdensity``: density of useful bytes in the data read from the disk
609 :``srchunks``: in how many data hunks the whole revision would be read
609 :``srchunks``: in how many data hunks the whole revision would be read
610
610
611 The sparse read can be enabled with experimental.sparse-read = True
611 The sparse read can be enabled with experimental.sparse-read = True
612 """
612 """
613 opts = pycompat.byteskwargs(opts)
613 opts = pycompat.byteskwargs(opts)
614 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
614 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
615 index = r.index
615 index = r.index
616 generaldelta = r.version & revlog.FLAG_GENERALDELTA
616 generaldelta = r.version & revlog.FLAG_GENERALDELTA
617 withsparseread = getattr(r, '_withsparseread', False)
617 withsparseread = getattr(r, '_withsparseread', False)
618
618
619 def revinfo(rev):
619 def revinfo(rev):
620 e = index[rev]
620 e = index[rev]
621 compsize = e[1]
621 compsize = e[1]
622 uncompsize = e[2]
622 uncompsize = e[2]
623 chainsize = 0
623 chainsize = 0
624
624
625 if generaldelta:
625 if generaldelta:
626 if e[3] == e[5]:
626 if e[3] == e[5]:
627 deltatype = 'p1'
627 deltatype = 'p1'
628 elif e[3] == e[6]:
628 elif e[3] == e[6]:
629 deltatype = 'p2'
629 deltatype = 'p2'
630 elif e[3] == rev - 1:
630 elif e[3] == rev - 1:
631 deltatype = 'prev'
631 deltatype = 'prev'
632 elif e[3] == rev:
632 elif e[3] == rev:
633 deltatype = 'base'
633 deltatype = 'base'
634 else:
634 else:
635 deltatype = 'other'
635 deltatype = 'other'
636 else:
636 else:
637 if e[3] == rev:
637 if e[3] == rev:
638 deltatype = 'base'
638 deltatype = 'base'
639 else:
639 else:
640 deltatype = 'prev'
640 deltatype = 'prev'
641
641
642 chain = r._deltachain(rev)[0]
642 chain = r._deltachain(rev)[0]
643 for iterrev in chain:
643 for iterrev in chain:
644 e = index[iterrev]
644 e = index[iterrev]
645 chainsize += e[1]
645 chainsize += e[1]
646
646
647 return compsize, uncompsize, deltatype, chain, chainsize
647 return compsize, uncompsize, deltatype, chain, chainsize
648
648
649 fm = ui.formatter('debugdeltachain', opts)
649 fm = ui.formatter('debugdeltachain', opts)
650
650
651 fm.plain(' rev chain# chainlen prev delta '
651 fm.plain(' rev chain# chainlen prev delta '
652 'size rawsize chainsize ratio lindist extradist '
652 'size rawsize chainsize ratio lindist extradist '
653 'extraratio')
653 'extraratio')
654 if withsparseread:
654 if withsparseread:
655 fm.plain(' readsize largestblk rddensity srchunks')
655 fm.plain(' readsize largestblk rddensity srchunks')
656 fm.plain('\n')
656 fm.plain('\n')
657
657
658 chainbases = {}
658 chainbases = {}
659 for rev in r:
659 for rev in r:
660 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
660 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
661 chainbase = chain[0]
661 chainbase = chain[0]
662 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
662 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
663 start = r.start
663 start = r.start
664 length = r.length
664 length = r.length
665 basestart = start(chainbase)
665 basestart = start(chainbase)
666 revstart = start(rev)
666 revstart = start(rev)
667 lineardist = revstart + comp - basestart
667 lineardist = revstart + comp - basestart
668 extradist = lineardist - chainsize
668 extradist = lineardist - chainsize
669 try:
669 try:
670 prevrev = chain[-2]
670 prevrev = chain[-2]
671 except IndexError:
671 except IndexError:
672 prevrev = -1
672 prevrev = -1
673
673
674 chainratio = float(chainsize) / float(uncomp)
674 chainratio = float(chainsize) / float(uncomp)
675 extraratio = float(extradist) / float(chainsize)
675 extraratio = float(extradist) / float(chainsize)
676
676
677 fm.startitem()
677 fm.startitem()
678 fm.write('rev chainid chainlen prevrev deltatype compsize '
678 fm.write('rev chainid chainlen prevrev deltatype compsize '
679 'uncompsize chainsize chainratio lindist extradist '
679 'uncompsize chainsize chainratio lindist extradist '
680 'extraratio',
680 'extraratio',
681 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
681 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
682 rev, chainid, len(chain), prevrev, deltatype, comp,
682 rev, chainid, len(chain), prevrev, deltatype, comp,
683 uncomp, chainsize, chainratio, lineardist, extradist,
683 uncomp, chainsize, chainratio, lineardist, extradist,
684 extraratio,
684 extraratio,
685 rev=rev, chainid=chainid, chainlen=len(chain),
685 rev=rev, chainid=chainid, chainlen=len(chain),
686 prevrev=prevrev, deltatype=deltatype, compsize=comp,
686 prevrev=prevrev, deltatype=deltatype, compsize=comp,
687 uncompsize=uncomp, chainsize=chainsize,
687 uncompsize=uncomp, chainsize=chainsize,
688 chainratio=chainratio, lindist=lineardist,
688 chainratio=chainratio, lindist=lineardist,
689 extradist=extradist, extraratio=extraratio)
689 extradist=extradist, extraratio=extraratio)
690 if withsparseread:
690 if withsparseread:
691 readsize = 0
691 readsize = 0
692 largestblock = 0
692 largestblock = 0
693 srchunks = 0
693 srchunks = 0
694
694
695 for revschunk in revlog._slicechunk(r, chain):
695 for revschunk in revlog._slicechunk(r, chain):
696 srchunks += 1
696 srchunks += 1
697 blkend = start(revschunk[-1]) + length(revschunk[-1])
697 blkend = start(revschunk[-1]) + length(revschunk[-1])
698 blksize = blkend - start(revschunk[0])
698 blksize = blkend - start(revschunk[0])
699
699
700 readsize += blksize
700 readsize += blksize
701 if largestblock < blksize:
701 if largestblock < blksize:
702 largestblock = blksize
702 largestblock = blksize
703
703
704 readdensity = float(chainsize) / float(readsize)
704 readdensity = float(chainsize) / float(readsize)
705
705
706 fm.write('readsize largestblock readdensity srchunks',
706 fm.write('readsize largestblock readdensity srchunks',
707 ' %10d %10d %9.5f %8d',
707 ' %10d %10d %9.5f %8d',
708 readsize, largestblock, readdensity, srchunks,
708 readsize, largestblock, readdensity, srchunks,
709 readsize=readsize, largestblock=largestblock,
709 readsize=readsize, largestblock=largestblock,
710 readdensity=readdensity, srchunks=srchunks)
710 readdensity=readdensity, srchunks=srchunks)
711
711
712 fm.plain('\n')
712 fm.plain('\n')
713
713
714 fm.end()
714 fm.end()
715
715
716 @command('debugdirstate|debugstate',
716 @command('debugdirstate|debugstate',
717 [('', 'nodates', None, _('do not display the saved mtime')),
717 [('', 'nodates', None, _('do not display the saved mtime')),
718 ('', 'datesort', None, _('sort by saved mtime'))],
718 ('', 'datesort', None, _('sort by saved mtime'))],
719 _('[OPTION]...'))
719 _('[OPTION]...'))
720 def debugstate(ui, repo, **opts):
720 def debugstate(ui, repo, **opts):
721 """show the contents of the current dirstate"""
721 """show the contents of the current dirstate"""
722
722
723 nodates = opts.get(r'nodates')
723 nodates = opts.get(r'nodates')
724 datesort = opts.get(r'datesort')
724 datesort = opts.get(r'datesort')
725
725
726 timestr = ""
726 timestr = ""
727 if datesort:
727 if datesort:
728 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
728 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
729 else:
729 else:
730 keyfunc = None # sort by filename
730 keyfunc = None # sort by filename
731 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
731 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
732 if ent[3] == -1:
732 if ent[3] == -1:
733 timestr = 'unset '
733 timestr = 'unset '
734 elif nodates:
734 elif nodates:
735 timestr = 'set '
735 timestr = 'set '
736 else:
736 else:
737 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
737 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
738 time.localtime(ent[3]))
738 time.localtime(ent[3]))
739 timestr = encoding.strtolocal(timestr)
739 timestr = encoding.strtolocal(timestr)
740 if ent[1] & 0o20000:
740 if ent[1] & 0o20000:
741 mode = 'lnk'
741 mode = 'lnk'
742 else:
742 else:
743 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
743 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
744 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
744 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
745 for f in repo.dirstate.copies():
745 for f in repo.dirstate.copies():
746 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
746 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
747
747
748 @command('debugdiscovery',
748 @command('debugdiscovery',
749 [('', 'old', None, _('use old-style discovery')),
749 [('', 'old', None, _('use old-style discovery')),
750 ('', 'nonheads', None,
750 ('', 'nonheads', None,
751 _('use old-style discovery with non-heads included')),
751 _('use old-style discovery with non-heads included')),
752 ('', 'rev', [], 'restrict discovery to this set of revs'),
752 ('', 'rev', [], 'restrict discovery to this set of revs'),
753 ] + cmdutil.remoteopts,
753 ] + cmdutil.remoteopts,
754 _('[--rev REV] [OTHER]'))
754 _('[--rev REV] [OTHER]'))
755 def debugdiscovery(ui, repo, remoteurl="default", **opts):
755 def debugdiscovery(ui, repo, remoteurl="default", **opts):
756 """runs the changeset discovery protocol in isolation"""
756 """runs the changeset discovery protocol in isolation"""
757 opts = pycompat.byteskwargs(opts)
757 opts = pycompat.byteskwargs(opts)
758 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
758 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
759 remote = hg.peer(repo, opts, remoteurl)
759 remote = hg.peer(repo, opts, remoteurl)
760 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
760 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
761
761
762 # make sure tests are repeatable
762 # make sure tests are repeatable
763 random.seed(12323)
763 random.seed(12323)
764
764
765 def doit(pushedrevs, remoteheads, remote=remote):
765 def doit(pushedrevs, remoteheads, remote=remote):
766 if opts.get('old'):
766 if opts.get('old'):
767 if not util.safehasattr(remote, 'branches'):
767 if not util.safehasattr(remote, 'branches'):
768 # enable in-client legacy support
768 # enable in-client legacy support
769 remote = localrepo.locallegacypeer(remote.local())
769 remote = localrepo.locallegacypeer(remote.local())
770 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
770 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
771 force=True)
771 force=True)
772 common = set(common)
772 common = set(common)
773 if not opts.get('nonheads'):
773 if not opts.get('nonheads'):
774 ui.write(("unpruned common: %s\n") %
774 ui.write(("unpruned common: %s\n") %
775 " ".join(sorted(short(n) for n in common)))
775 " ".join(sorted(short(n) for n in common)))
776 dag = dagutil.revlogdag(repo.changelog)
776 dag = dagutil.revlogdag(repo.changelog)
777 all = dag.ancestorset(dag.internalizeall(common))
777 all = dag.ancestorset(dag.internalizeall(common))
778 common = dag.externalizeall(dag.headsetofconnecteds(all))
778 common = dag.externalizeall(dag.headsetofconnecteds(all))
779 else:
779 else:
780 nodes = None
780 nodes = None
781 if pushedrevs:
781 if pushedrevs:
782 revs = scmutil.revrange(repo, pushedrevs)
782 revs = scmutil.revrange(repo, pushedrevs)
783 nodes = [repo[r].node() for r in revs]
783 nodes = [repo[r].node() for r in revs]
784 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
784 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
785 ancestorsof=nodes)
785 ancestorsof=nodes)
786 common = set(common)
786 common = set(common)
787 rheads = set(hds)
787 rheads = set(hds)
788 lheads = set(repo.heads())
788 lheads = set(repo.heads())
789 ui.write(("common heads: %s\n") %
789 ui.write(("common heads: %s\n") %
790 " ".join(sorted(short(n) for n in common)))
790 " ".join(sorted(short(n) for n in common)))
791 if lheads <= common:
791 if lheads <= common:
792 ui.write(("local is subset\n"))
792 ui.write(("local is subset\n"))
793 elif rheads <= common:
793 elif rheads <= common:
794 ui.write(("remote is subset\n"))
794 ui.write(("remote is subset\n"))
795
795
796 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
796 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
797 localrevs = opts['rev']
797 localrevs = opts['rev']
798 doit(localrevs, remoterevs)
798 doit(localrevs, remoterevs)
799
799
800 _chunksize = 4 << 10
800 _chunksize = 4 << 10
801
801
802 @command('debugdownload',
802 @command('debugdownload',
803 [
803 [
804 ('o', 'output', '', _('path')),
804 ('o', 'output', '', _('path')),
805 ],
805 ],
806 optionalrepo=True)
806 optionalrepo=True)
807 def debugdownload(ui, repo, url, output=None, **opts):
807 def debugdownload(ui, repo, url, output=None, **opts):
808 """download a resource using Mercurial logic and config
808 """download a resource using Mercurial logic and config
809 """
809 """
810 fh = urlmod.open(ui, url, output)
810 fh = urlmod.open(ui, url, output)
811
811
812 dest = ui
812 dest = ui
813 if output:
813 if output:
814 dest = open(output, "wb", _chunksize)
814 dest = open(output, "wb", _chunksize)
815 try:
815 try:
816 data = fh.read(_chunksize)
816 data = fh.read(_chunksize)
817 while data:
817 while data:
818 dest.write(data)
818 dest.write(data)
819 data = fh.read(_chunksize)
819 data = fh.read(_chunksize)
820 finally:
820 finally:
821 if output:
821 if output:
822 dest.close()
822 dest.close()
823
823
824 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
824 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
825 def debugextensions(ui, **opts):
825 def debugextensions(ui, **opts):
826 '''show information about active extensions'''
826 '''show information about active extensions'''
827 opts = pycompat.byteskwargs(opts)
827 opts = pycompat.byteskwargs(opts)
828 exts = extensions.extensions(ui)
828 exts = extensions.extensions(ui)
829 hgver = util.version()
829 hgver = util.version()
830 fm = ui.formatter('debugextensions', opts)
830 fm = ui.formatter('debugextensions', opts)
831 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
831 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
832 isinternal = extensions.ismoduleinternal(extmod)
832 isinternal = extensions.ismoduleinternal(extmod)
833 extsource = pycompat.fsencode(extmod.__file__)
833 extsource = pycompat.fsencode(extmod.__file__)
834 if isinternal:
834 if isinternal:
835 exttestedwith = [] # never expose magic string to users
835 exttestedwith = [] # never expose magic string to users
836 else:
836 else:
837 exttestedwith = getattr(extmod, 'testedwith', '').split()
837 exttestedwith = getattr(extmod, 'testedwith', '').split()
838 extbuglink = getattr(extmod, 'buglink', None)
838 extbuglink = getattr(extmod, 'buglink', None)
839
839
840 fm.startitem()
840 fm.startitem()
841
841
842 if ui.quiet or ui.verbose:
842 if ui.quiet or ui.verbose:
843 fm.write('name', '%s\n', extname)
843 fm.write('name', '%s\n', extname)
844 else:
844 else:
845 fm.write('name', '%s', extname)
845 fm.write('name', '%s', extname)
846 if isinternal or hgver in exttestedwith:
846 if isinternal or hgver in exttestedwith:
847 fm.plain('\n')
847 fm.plain('\n')
848 elif not exttestedwith:
848 elif not exttestedwith:
849 fm.plain(_(' (untested!)\n'))
849 fm.plain(_(' (untested!)\n'))
850 else:
850 else:
851 lasttestedversion = exttestedwith[-1]
851 lasttestedversion = exttestedwith[-1]
852 fm.plain(' (%s!)\n' % lasttestedversion)
852 fm.plain(' (%s!)\n' % lasttestedversion)
853
853
854 fm.condwrite(ui.verbose and extsource, 'source',
854 fm.condwrite(ui.verbose and extsource, 'source',
855 _(' location: %s\n'), extsource or "")
855 _(' location: %s\n'), extsource or "")
856
856
857 if ui.verbose:
857 if ui.verbose:
858 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
858 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
859 fm.data(bundled=isinternal)
859 fm.data(bundled=isinternal)
860
860
861 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
861 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
862 _(' tested with: %s\n'),
862 _(' tested with: %s\n'),
863 fm.formatlist(exttestedwith, name='ver'))
863 fm.formatlist(exttestedwith, name='ver'))
864
864
865 fm.condwrite(ui.verbose and extbuglink, 'buglink',
865 fm.condwrite(ui.verbose and extbuglink, 'buglink',
866 _(' bug reporting: %s\n'), extbuglink or "")
866 _(' bug reporting: %s\n'), extbuglink or "")
867
867
868 fm.end()
868 fm.end()
869
869
870 @command('debugfileset',
870 @command('debugfileset',
871 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
871 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
872 _('[-r REV] FILESPEC'))
872 _('[-r REV] FILESPEC'))
873 def debugfileset(ui, repo, expr, **opts):
873 def debugfileset(ui, repo, expr, **opts):
874 '''parse and apply a fileset specification'''
874 '''parse and apply a fileset specification'''
875 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
875 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
876 if ui.verbose:
876 if ui.verbose:
877 tree = fileset.parse(expr)
877 tree = fileset.parse(expr)
878 ui.note(fileset.prettyformat(tree), "\n")
878 ui.note(fileset.prettyformat(tree), "\n")
879
879
880 for f in ctx.getfileset(expr):
880 for f in ctx.getfileset(expr):
881 ui.write("%s\n" % f)
881 ui.write("%s\n" % f)
882
882
883 @command('debugformat',
883 @command('debugformat',
884 [] + cmdutil.formatteropts,
884 [] + cmdutil.formatteropts,
885 _(''))
885 _(''))
886 def debugformat(ui, repo, **opts):
886 def debugformat(ui, repo, **opts):
887 """display format information about the current repository
887 """display format information about the current repository
888
888
889 Use --verbose to get extra information about current config value and
889 Use --verbose to get extra information about current config value and
890 Mercurial default."""
890 Mercurial default."""
891 opts = pycompat.byteskwargs(opts)
891 opts = pycompat.byteskwargs(opts)
892 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
892 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
893 maxvariantlength = max(len('format-variant'), maxvariantlength)
893 maxvariantlength = max(len('format-variant'), maxvariantlength)
894
894
895 def makeformatname(name):
895 def makeformatname(name):
896 return '%s:' + (' ' * (maxvariantlength - len(name)))
896 return '%s:' + (' ' * (maxvariantlength - len(name)))
897
897
898 fm = ui.formatter('debugformat', opts)
898 fm = ui.formatter('debugformat', opts)
899 if fm.isplain():
899 if fm.isplain():
900 def formatvalue(value):
900 def formatvalue(value):
901 if util.safehasattr(value, 'startswith'):
901 if util.safehasattr(value, 'startswith'):
902 return value
902 return value
903 if value:
903 if value:
904 return 'yes'
904 return 'yes'
905 else:
905 else:
906 return 'no'
906 return 'no'
907 else:
907 else:
908 formatvalue = pycompat.identity
908 formatvalue = pycompat.identity
909
909
910 fm.plain('format-variant')
910 fm.plain('format-variant')
911 fm.plain(' ' * (maxvariantlength - len('format-variant')))
911 fm.plain(' ' * (maxvariantlength - len('format-variant')))
912 fm.plain(' repo')
912 fm.plain(' repo')
913 if ui.verbose:
913 if ui.verbose:
914 fm.plain(' config default')
914 fm.plain(' config default')
915 fm.plain('\n')
915 fm.plain('\n')
916 for fv in upgrade.allformatvariant:
916 for fv in upgrade.allformatvariant:
917 fm.startitem()
917 fm.startitem()
918 repovalue = fv.fromrepo(repo)
918 repovalue = fv.fromrepo(repo)
919 configvalue = fv.fromconfig(repo)
919 configvalue = fv.fromconfig(repo)
920
920
921 if repovalue != configvalue:
921 if repovalue != configvalue:
922 namelabel = 'formatvariant.name.mismatchconfig'
922 namelabel = 'formatvariant.name.mismatchconfig'
923 repolabel = 'formatvariant.repo.mismatchconfig'
923 repolabel = 'formatvariant.repo.mismatchconfig'
924 elif repovalue != fv.default:
924 elif repovalue != fv.default:
925 namelabel = 'formatvariant.name.mismatchdefault'
925 namelabel = 'formatvariant.name.mismatchdefault'
926 repolabel = 'formatvariant.repo.mismatchdefault'
926 repolabel = 'formatvariant.repo.mismatchdefault'
927 else:
927 else:
928 namelabel = 'formatvariant.name.uptodate'
928 namelabel = 'formatvariant.name.uptodate'
929 repolabel = 'formatvariant.repo.uptodate'
929 repolabel = 'formatvariant.repo.uptodate'
930
930
931 fm.write('name', makeformatname(fv.name), fv.name,
931 fm.write('name', makeformatname(fv.name), fv.name,
932 label=namelabel)
932 label=namelabel)
933 fm.write('repo', ' %3s', formatvalue(repovalue),
933 fm.write('repo', ' %3s', formatvalue(repovalue),
934 label=repolabel)
934 label=repolabel)
935 if fv.default != configvalue:
935 if fv.default != configvalue:
936 configlabel = 'formatvariant.config.special'
936 configlabel = 'formatvariant.config.special'
937 else:
937 else:
938 configlabel = 'formatvariant.config.default'
938 configlabel = 'formatvariant.config.default'
939 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
939 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
940 label=configlabel)
940 label=configlabel)
941 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
941 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
942 label='formatvariant.default')
942 label='formatvariant.default')
943 fm.plain('\n')
943 fm.plain('\n')
944 fm.end()
944 fm.end()
945
945
946 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
946 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
947 def debugfsinfo(ui, path="."):
947 def debugfsinfo(ui, path="."):
948 """show information detected about current filesystem"""
948 """show information detected about current filesystem"""
949 ui.write(('path: %s\n') % path)
949 ui.write(('path: %s\n') % path)
950 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
950 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
951 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
951 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
952 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
952 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
953 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
953 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
954 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
954 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
955 casesensitive = '(unknown)'
955 casesensitive = '(unknown)'
956 try:
956 try:
957 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
957 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
958 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
958 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
959 except OSError:
959 except OSError:
960 pass
960 pass
961 ui.write(('case-sensitive: %s\n') % casesensitive)
961 ui.write(('case-sensitive: %s\n') % casesensitive)
962
962
963 @command('debuggetbundle',
963 @command('debuggetbundle',
964 [('H', 'head', [], _('id of head node'), _('ID')),
964 [('H', 'head', [], _('id of head node'), _('ID')),
965 ('C', 'common', [], _('id of common node'), _('ID')),
965 ('C', 'common', [], _('id of common node'), _('ID')),
966 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
966 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
967 _('REPO FILE [-H|-C ID]...'),
967 _('REPO FILE [-H|-C ID]...'),
968 norepo=True)
968 norepo=True)
969 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
969 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
970 """retrieves a bundle from a repo
970 """retrieves a bundle from a repo
971
971
972 Every ID must be a full-length hex node id string. Saves the bundle to the
972 Every ID must be a full-length hex node id string. Saves the bundle to the
973 given file.
973 given file.
974 """
974 """
975 opts = pycompat.byteskwargs(opts)
975 opts = pycompat.byteskwargs(opts)
976 repo = hg.peer(ui, opts, repopath)
976 repo = hg.peer(ui, opts, repopath)
977 if not repo.capable('getbundle'):
977 if not repo.capable('getbundle'):
978 raise error.Abort("getbundle() not supported by target repository")
978 raise error.Abort("getbundle() not supported by target repository")
979 args = {}
979 args = {}
980 if common:
980 if common:
981 args[r'common'] = [bin(s) for s in common]
981 args[r'common'] = [bin(s) for s in common]
982 if head:
982 if head:
983 args[r'heads'] = [bin(s) for s in head]
983 args[r'heads'] = [bin(s) for s in head]
984 # TODO: get desired bundlecaps from command line.
984 # TODO: get desired bundlecaps from command line.
985 args[r'bundlecaps'] = None
985 args[r'bundlecaps'] = None
986 bundle = repo.getbundle('debug', **args)
986 bundle = repo.getbundle('debug', **args)
987
987
988 bundletype = opts.get('type', 'bzip2').lower()
988 bundletype = opts.get('type', 'bzip2').lower()
989 btypes = {'none': 'HG10UN',
989 btypes = {'none': 'HG10UN',
990 'bzip2': 'HG10BZ',
990 'bzip2': 'HG10BZ',
991 'gzip': 'HG10GZ',
991 'gzip': 'HG10GZ',
992 'bundle2': 'HG20'}
992 'bundle2': 'HG20'}
993 bundletype = btypes.get(bundletype)
993 bundletype = btypes.get(bundletype)
994 if bundletype not in bundle2.bundletypes:
994 if bundletype not in bundle2.bundletypes:
995 raise error.Abort(_('unknown bundle type specified with --type'))
995 raise error.Abort(_('unknown bundle type specified with --type'))
996 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
996 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
997
997
998 @command('debugignore', [], '[FILE]')
998 @command('debugignore', [], '[FILE]')
999 def debugignore(ui, repo, *files, **opts):
999 def debugignore(ui, repo, *files, **opts):
1000 """display the combined ignore pattern and information about ignored files
1000 """display the combined ignore pattern and information about ignored files
1001
1001
1002 With no argument display the combined ignore pattern.
1002 With no argument display the combined ignore pattern.
1003
1003
1004 Given space separated file names, shows if the given file is ignored and
1004 Given space separated file names, shows if the given file is ignored and
1005 if so, show the ignore rule (file and line number) that matched it.
1005 if so, show the ignore rule (file and line number) that matched it.
1006 """
1006 """
1007 ignore = repo.dirstate._ignore
1007 ignore = repo.dirstate._ignore
1008 if not files:
1008 if not files:
1009 # Show all the patterns
1009 # Show all the patterns
1010 ui.write("%s\n" % pycompat.byterepr(ignore))
1010 ui.write("%s\n" % pycompat.byterepr(ignore))
1011 else:
1011 else:
1012 m = scmutil.match(repo[None], pats=files)
1012 m = scmutil.match(repo[None], pats=files)
1013 for f in m.files():
1013 for f in m.files():
1014 nf = util.normpath(f)
1014 nf = util.normpath(f)
1015 ignored = None
1015 ignored = None
1016 ignoredata = None
1016 ignoredata = None
1017 if nf != '.':
1017 if nf != '.':
1018 if ignore(nf):
1018 if ignore(nf):
1019 ignored = nf
1019 ignored = nf
1020 ignoredata = repo.dirstate._ignorefileandline(nf)
1020 ignoredata = repo.dirstate._ignorefileandline(nf)
1021 else:
1021 else:
1022 for p in util.finddirs(nf):
1022 for p in util.finddirs(nf):
1023 if ignore(p):
1023 if ignore(p):
1024 ignored = p
1024 ignored = p
1025 ignoredata = repo.dirstate._ignorefileandline(p)
1025 ignoredata = repo.dirstate._ignorefileandline(p)
1026 break
1026 break
1027 if ignored:
1027 if ignored:
1028 if ignored == nf:
1028 if ignored == nf:
1029 ui.write(_("%s is ignored\n") % m.uipath(f))
1029 ui.write(_("%s is ignored\n") % m.uipath(f))
1030 else:
1030 else:
1031 ui.write(_("%s is ignored because of "
1031 ui.write(_("%s is ignored because of "
1032 "containing folder %s\n")
1032 "containing folder %s\n")
1033 % (m.uipath(f), ignored))
1033 % (m.uipath(f), ignored))
1034 ignorefile, lineno, line = ignoredata
1034 ignorefile, lineno, line = ignoredata
1035 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1035 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1036 % (ignorefile, lineno, line))
1036 % (ignorefile, lineno, line))
1037 else:
1037 else:
1038 ui.write(_("%s is not ignored\n") % m.uipath(f))
1038 ui.write(_("%s is not ignored\n") % m.uipath(f))
1039
1039
1040 @command('debugindex', cmdutil.debugrevlogopts +
1040 @command('debugindex', cmdutil.debugrevlogopts +
1041 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1041 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1042 _('[-f FORMAT] -c|-m|FILE'),
1042 _('[-f FORMAT] -c|-m|FILE'),
1043 optionalrepo=True)
1043 optionalrepo=True)
1044 def debugindex(ui, repo, file_=None, **opts):
1044 def debugindex(ui, repo, file_=None, **opts):
1045 """dump the contents of an index file"""
1045 """dump the contents of an index file"""
1046 opts = pycompat.byteskwargs(opts)
1046 opts = pycompat.byteskwargs(opts)
1047 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1047 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1048 format = opts.get('format', 0)
1048 format = opts.get('format', 0)
1049 if format not in (0, 1):
1049 if format not in (0, 1):
1050 raise error.Abort(_("unknown format %d") % format)
1050 raise error.Abort(_("unknown format %d") % format)
1051
1051
1052 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1052 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1053 if generaldelta:
1053 if generaldelta:
1054 basehdr = ' delta'
1054 basehdr = ' delta'
1055 else:
1055 else:
1056 basehdr = ' base'
1056 basehdr = ' base'
1057
1057
1058 if ui.debugflag:
1058 if ui.debugflag:
1059 shortfn = hex
1059 shortfn = hex
1060 else:
1060 else:
1061 shortfn = short
1061 shortfn = short
1062
1062
1063 # There might not be anything in r, so have a sane default
1063 # There might not be anything in r, so have a sane default
1064 idlen = 12
1064 idlen = 12
1065 for i in r:
1065 for i in r:
1066 idlen = len(shortfn(r.node(i)))
1066 idlen = len(shortfn(r.node(i)))
1067 break
1067 break
1068
1068
1069 if format == 0:
1069 if format == 0:
1070 ui.write((" rev offset length " + basehdr + " linkrev"
1070 ui.write((" rev offset length " + basehdr + " linkrev"
1071 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1071 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1072 elif format == 1:
1072 elif format == 1:
1073 ui.write((" rev flag offset length"
1073 ui.write((" rev flag offset length"
1074 " size " + basehdr + " link p1 p2"
1074 " size " + basehdr + " link p1 p2"
1075 " %s\n") % "nodeid".rjust(idlen))
1075 " %s\n") % "nodeid".rjust(idlen))
1076
1076
1077 for i in r:
1077 for i in r:
1078 node = r.node(i)
1078 node = r.node(i)
1079 if generaldelta:
1079 if generaldelta:
1080 base = r.deltaparent(i)
1080 base = r.deltaparent(i)
1081 else:
1081 else:
1082 base = r.chainbase(i)
1082 base = r.chainbase(i)
1083 if format == 0:
1083 if format == 0:
1084 try:
1084 try:
1085 pp = r.parents(node)
1085 pp = r.parents(node)
1086 except Exception:
1086 except Exception:
1087 pp = [nullid, nullid]
1087 pp = [nullid, nullid]
1088 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1088 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1089 i, r.start(i), r.length(i), base, r.linkrev(i),
1089 i, r.start(i), r.length(i), base, r.linkrev(i),
1090 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1090 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1091 elif format == 1:
1091 elif format == 1:
1092 pr = r.parentrevs(i)
1092 pr = r.parentrevs(i)
1093 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1093 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1094 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1094 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1095 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1095 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1096
1096
1097 @command('debugindexdot', cmdutil.debugrevlogopts,
1097 @command('debugindexdot', cmdutil.debugrevlogopts,
1098 _('-c|-m|FILE'), optionalrepo=True)
1098 _('-c|-m|FILE'), optionalrepo=True)
1099 def debugindexdot(ui, repo, file_=None, **opts):
1099 def debugindexdot(ui, repo, file_=None, **opts):
1100 """dump an index DAG as a graphviz dot file"""
1100 """dump an index DAG as a graphviz dot file"""
1101 opts = pycompat.byteskwargs(opts)
1101 opts = pycompat.byteskwargs(opts)
1102 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1102 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1103 ui.write(("digraph G {\n"))
1103 ui.write(("digraph G {\n"))
1104 for i in r:
1104 for i in r:
1105 node = r.node(i)
1105 node = r.node(i)
1106 pp = r.parents(node)
1106 pp = r.parents(node)
1107 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1107 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1108 if pp[1] != nullid:
1108 if pp[1] != nullid:
1109 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1109 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1110 ui.write("}\n")
1110 ui.write("}\n")
1111
1111
1112 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1112 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1113 def debuginstall(ui, **opts):
1113 def debuginstall(ui, **opts):
1114 '''test Mercurial installation
1114 '''test Mercurial installation
1115
1115
1116 Returns 0 on success.
1116 Returns 0 on success.
1117 '''
1117 '''
1118 opts = pycompat.byteskwargs(opts)
1118 opts = pycompat.byteskwargs(opts)
1119
1119
1120 def writetemp(contents):
1120 def writetemp(contents):
1121 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1121 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1122 f = os.fdopen(fd, r"wb")
1122 f = os.fdopen(fd, r"wb")
1123 f.write(contents)
1123 f.write(contents)
1124 f.close()
1124 f.close()
1125 return name
1125 return name
1126
1126
1127 problems = 0
1127 problems = 0
1128
1128
1129 fm = ui.formatter('debuginstall', opts)
1129 fm = ui.formatter('debuginstall', opts)
1130 fm.startitem()
1130 fm.startitem()
1131
1131
1132 # encoding
1132 # encoding
1133 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1133 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1134 err = None
1134 err = None
1135 try:
1135 try:
1136 codecs.lookup(pycompat.sysstr(encoding.encoding))
1136 codecs.lookup(pycompat.sysstr(encoding.encoding))
1137 except LookupError as inst:
1137 except LookupError as inst:
1138 err = util.forcebytestr(inst)
1138 err = util.forcebytestr(inst)
1139 problems += 1
1139 problems += 1
1140 fm.condwrite(err, 'encodingerror', _(" %s\n"
1140 fm.condwrite(err, 'encodingerror', _(" %s\n"
1141 " (check that your locale is properly set)\n"), err)
1141 " (check that your locale is properly set)\n"), err)
1142
1142
1143 # Python
1143 # Python
1144 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1144 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1145 pycompat.sysexecutable)
1145 pycompat.sysexecutable)
1146 fm.write('pythonver', _("checking Python version (%s)\n"),
1146 fm.write('pythonver', _("checking Python version (%s)\n"),
1147 ("%d.%d.%d" % sys.version_info[:3]))
1147 ("%d.%d.%d" % sys.version_info[:3]))
1148 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1148 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1149 os.path.dirname(pycompat.fsencode(os.__file__)))
1149 os.path.dirname(pycompat.fsencode(os.__file__)))
1150
1150
1151 security = set(sslutil.supportedprotocols)
1151 security = set(sslutil.supportedprotocols)
1152 if sslutil.hassni:
1152 if sslutil.hassni:
1153 security.add('sni')
1153 security.add('sni')
1154
1154
1155 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1155 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1156 fm.formatlist(sorted(security), name='protocol',
1156 fm.formatlist(sorted(security), name='protocol',
1157 fmt='%s', sep=','))
1157 fmt='%s', sep=','))
1158
1158
1159 # These are warnings, not errors. So don't increment problem count. This
1159 # These are warnings, not errors. So don't increment problem count. This
1160 # may change in the future.
1160 # may change in the future.
1161 if 'tls1.2' not in security:
1161 if 'tls1.2' not in security:
1162 fm.plain(_(' TLS 1.2 not supported by Python install; '
1162 fm.plain(_(' TLS 1.2 not supported by Python install; '
1163 'network connections lack modern security\n'))
1163 'network connections lack modern security\n'))
1164 if 'sni' not in security:
1164 if 'sni' not in security:
1165 fm.plain(_(' SNI not supported by Python install; may have '
1165 fm.plain(_(' SNI not supported by Python install; may have '
1166 'connectivity issues with some servers\n'))
1166 'connectivity issues with some servers\n'))
1167
1167
1168 # TODO print CA cert info
1168 # TODO print CA cert info
1169
1169
1170 # hg version
1170 # hg version
1171 hgver = util.version()
1171 hgver = util.version()
1172 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1172 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1173 hgver.split('+')[0])
1173 hgver.split('+')[0])
1174 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1174 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1175 '+'.join(hgver.split('+')[1:]))
1175 '+'.join(hgver.split('+')[1:]))
1176
1176
1177 # compiled modules
1177 # compiled modules
1178 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1178 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1179 policy.policy)
1179 policy.policy)
1180 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1180 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1181 os.path.dirname(pycompat.fsencode(__file__)))
1181 os.path.dirname(pycompat.fsencode(__file__)))
1182
1182
1183 if policy.policy in ('c', 'allow'):
1183 if policy.policy in ('c', 'allow'):
1184 err = None
1184 err = None
1185 try:
1185 try:
1186 from .cext import (
1186 from .cext import (
1187 base85,
1187 base85,
1188 bdiff,
1188 bdiff,
1189 mpatch,
1189 mpatch,
1190 osutil,
1190 osutil,
1191 )
1191 )
1192 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1192 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1193 except Exception as inst:
1193 except Exception as inst:
1194 err = util.forcebytestr(inst)
1194 err = util.forcebytestr(inst)
1195 problems += 1
1195 problems += 1
1196 fm.condwrite(err, 'extensionserror', " %s\n", err)
1196 fm.condwrite(err, 'extensionserror', " %s\n", err)
1197
1197
1198 compengines = util.compengines._engines.values()
1198 compengines = util.compengines._engines.values()
1199 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1199 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1200 fm.formatlist(sorted(e.name() for e in compengines),
1200 fm.formatlist(sorted(e.name() for e in compengines),
1201 name='compengine', fmt='%s', sep=', '))
1201 name='compengine', fmt='%s', sep=', '))
1202 fm.write('compenginesavail', _('checking available compression engines '
1202 fm.write('compenginesavail', _('checking available compression engines '
1203 '(%s)\n'),
1203 '(%s)\n'),
1204 fm.formatlist(sorted(e.name() for e in compengines
1204 fm.formatlist(sorted(e.name() for e in compengines
1205 if e.available()),
1205 if e.available()),
1206 name='compengine', fmt='%s', sep=', '))
1206 name='compengine', fmt='%s', sep=', '))
1207 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1207 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1208 fm.write('compenginesserver', _('checking available compression engines '
1208 fm.write('compenginesserver', _('checking available compression engines '
1209 'for wire protocol (%s)\n'),
1209 'for wire protocol (%s)\n'),
1210 fm.formatlist([e.name() for e in wirecompengines
1210 fm.formatlist([e.name() for e in wirecompengines
1211 if e.wireprotosupport()],
1211 if e.wireprotosupport()],
1212 name='compengine', fmt='%s', sep=', '))
1212 name='compengine', fmt='%s', sep=', '))
1213 re2 = 'missing'
1213 re2 = 'missing'
1214 if util._re2:
1214 if util._re2:
1215 re2 = 'available'
1215 re2 = 'available'
1216 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1216 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1217 fm.data(re2=bool(util._re2))
1217 fm.data(re2=bool(util._re2))
1218
1218
1219 # templates
1219 # templates
1220 p = templater.templatepaths()
1220 p = templater.templatepaths()
1221 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1221 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1222 fm.condwrite(not p, '', _(" no template directories found\n"))
1222 fm.condwrite(not p, '', _(" no template directories found\n"))
1223 if p:
1223 if p:
1224 m = templater.templatepath("map-cmdline.default")
1224 m = templater.templatepath("map-cmdline.default")
1225 if m:
1225 if m:
1226 # template found, check if it is working
1226 # template found, check if it is working
1227 err = None
1227 err = None
1228 try:
1228 try:
1229 templater.templater.frommapfile(m)
1229 templater.templater.frommapfile(m)
1230 except Exception as inst:
1230 except Exception as inst:
1231 err = util.forcebytestr(inst)
1231 err = util.forcebytestr(inst)
1232 p = None
1232 p = None
1233 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1233 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1234 else:
1234 else:
1235 p = None
1235 p = None
1236 fm.condwrite(p, 'defaulttemplate',
1236 fm.condwrite(p, 'defaulttemplate',
1237 _("checking default template (%s)\n"), m)
1237 _("checking default template (%s)\n"), m)
1238 fm.condwrite(not m, 'defaulttemplatenotfound',
1238 fm.condwrite(not m, 'defaulttemplatenotfound',
1239 _(" template '%s' not found\n"), "default")
1239 _(" template '%s' not found\n"), "default")
1240 if not p:
1240 if not p:
1241 problems += 1
1241 problems += 1
1242 fm.condwrite(not p, '',
1242 fm.condwrite(not p, '',
1243 _(" (templates seem to have been installed incorrectly)\n"))
1243 _(" (templates seem to have been installed incorrectly)\n"))
1244
1244
1245 # editor
1245 # editor
1246 editor = ui.geteditor()
1246 editor = ui.geteditor()
1247 editor = util.expandpath(editor)
1247 editor = util.expandpath(editor)
1248 editorbin = util.shellsplit(editor)[0]
1248 editorbin = util.shellsplit(editor)[0]
1249 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1249 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1250 cmdpath = util.findexe(editorbin)
1250 cmdpath = util.findexe(editorbin)
1251 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1251 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1252 _(" No commit editor set and can't find %s in PATH\n"
1252 _(" No commit editor set and can't find %s in PATH\n"
1253 " (specify a commit editor in your configuration"
1253 " (specify a commit editor in your configuration"
1254 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1254 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1255 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1255 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1256 _(" Can't find editor '%s' in PATH\n"
1256 _(" Can't find editor '%s' in PATH\n"
1257 " (specify a commit editor in your configuration"
1257 " (specify a commit editor in your configuration"
1258 " file)\n"), not cmdpath and editorbin)
1258 " file)\n"), not cmdpath and editorbin)
1259 if not cmdpath and editor != 'vi':
1259 if not cmdpath and editor != 'vi':
1260 problems += 1
1260 problems += 1
1261
1261
1262 # check username
1262 # check username
1263 username = None
1263 username = None
1264 err = None
1264 err = None
1265 try:
1265 try:
1266 username = ui.username()
1266 username = ui.username()
1267 except error.Abort as e:
1267 except error.Abort as e:
1268 err = util.forcebytestr(e)
1268 err = util.forcebytestr(e)
1269 problems += 1
1269 problems += 1
1270
1270
1271 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1271 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1272 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1272 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1273 " (specify a username in your configuration file)\n"), err)
1273 " (specify a username in your configuration file)\n"), err)
1274
1274
1275 fm.condwrite(not problems, '',
1275 fm.condwrite(not problems, '',
1276 _("no problems detected\n"))
1276 _("no problems detected\n"))
1277 if not problems:
1277 if not problems:
1278 fm.data(problems=problems)
1278 fm.data(problems=problems)
1279 fm.condwrite(problems, 'problems',
1279 fm.condwrite(problems, 'problems',
1280 _("%d problems detected,"
1280 _("%d problems detected,"
1281 " please check your install!\n"), problems)
1281 " please check your install!\n"), problems)
1282 fm.end()
1282 fm.end()
1283
1283
1284 return problems
1284 return problems
1285
1285
1286 @command('debugknown', [], _('REPO ID...'), norepo=True)
1286 @command('debugknown', [], _('REPO ID...'), norepo=True)
1287 def debugknown(ui, repopath, *ids, **opts):
1287 def debugknown(ui, repopath, *ids, **opts):
1288 """test whether node ids are known to a repo
1288 """test whether node ids are known to a repo
1289
1289
1290 Every ID must be a full-length hex node id string. Returns a list of 0s
1290 Every ID must be a full-length hex node id string. Returns a list of 0s
1291 and 1s indicating unknown/known.
1291 and 1s indicating unknown/known.
1292 """
1292 """
1293 opts = pycompat.byteskwargs(opts)
1293 opts = pycompat.byteskwargs(opts)
1294 repo = hg.peer(ui, opts, repopath)
1294 repo = hg.peer(ui, opts, repopath)
1295 if not repo.capable('known'):
1295 if not repo.capable('known'):
1296 raise error.Abort("known() not supported by target repository")
1296 raise error.Abort("known() not supported by target repository")
1297 flags = repo.known([bin(s) for s in ids])
1297 flags = repo.known([bin(s) for s in ids])
1298 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1298 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1299
1299
1300 @command('debuglabelcomplete', [], _('LABEL...'))
1300 @command('debuglabelcomplete', [], _('LABEL...'))
1301 def debuglabelcomplete(ui, repo, *args):
1301 def debuglabelcomplete(ui, repo, *args):
1302 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1302 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1303 debugnamecomplete(ui, repo, *args)
1303 debugnamecomplete(ui, repo, *args)
1304
1304
1305 @command('debuglocks',
1305 @command('debuglocks',
1306 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1306 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1307 ('W', 'force-wlock', None,
1307 ('W', 'force-wlock', None,
1308 _('free the working state lock (DANGEROUS)')),
1308 _('free the working state lock (DANGEROUS)')),
1309 ('s', 'set-lock', None, _('set the store lock until stopped')),
1309 ('s', 'set-lock', None, _('set the store lock until stopped')),
1310 ('S', 'set-wlock', None,
1310 ('S', 'set-wlock', None,
1311 _('set the working state lock until stopped'))],
1311 _('set the working state lock until stopped'))],
1312 _('[OPTION]...'))
1312 _('[OPTION]...'))
1313 def debuglocks(ui, repo, **opts):
1313 def debuglocks(ui, repo, **opts):
1314 """show or modify state of locks
1314 """show or modify state of locks
1315
1315
1316 By default, this command will show which locks are held. This
1316 By default, this command will show which locks are held. This
1317 includes the user and process holding the lock, the amount of time
1317 includes the user and process holding the lock, the amount of time
1318 the lock has been held, and the machine name where the process is
1318 the lock has been held, and the machine name where the process is
1319 running if it's not local.
1319 running if it's not local.
1320
1320
1321 Locks protect the integrity of Mercurial's data, so should be
1321 Locks protect the integrity of Mercurial's data, so should be
1322 treated with care. System crashes or other interruptions may cause
1322 treated with care. System crashes or other interruptions may cause
1323 locks to not be properly released, though Mercurial will usually
1323 locks to not be properly released, though Mercurial will usually
1324 detect and remove such stale locks automatically.
1324 detect and remove such stale locks automatically.
1325
1325
1326 However, detecting stale locks may not always be possible (for
1326 However, detecting stale locks may not always be possible (for
1327 instance, on a shared filesystem). Removing locks may also be
1327 instance, on a shared filesystem). Removing locks may also be
1328 blocked by filesystem permissions.
1328 blocked by filesystem permissions.
1329
1329
1330 Setting a lock will prevent other commands from changing the data.
1330 Setting a lock will prevent other commands from changing the data.
1331 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1331 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1332 The set locks are removed when the command exits.
1332 The set locks are removed when the command exits.
1333
1333
1334 Returns 0 if no locks are held.
1334 Returns 0 if no locks are held.
1335
1335
1336 """
1336 """
1337
1337
1338 if opts.get(r'force_lock'):
1338 if opts.get(r'force_lock'):
1339 repo.svfs.unlink('lock')
1339 repo.svfs.unlink('lock')
1340 if opts.get(r'force_wlock'):
1340 if opts.get(r'force_wlock'):
1341 repo.vfs.unlink('wlock')
1341 repo.vfs.unlink('wlock')
1342 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1342 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1343 return 0
1343 return 0
1344
1344
1345 locks = []
1345 locks = []
1346 try:
1346 try:
1347 if opts.get(r'set_wlock'):
1347 if opts.get(r'set_wlock'):
1348 try:
1348 try:
1349 locks.append(repo.wlock(False))
1349 locks.append(repo.wlock(False))
1350 except error.LockHeld:
1350 except error.LockHeld:
1351 raise error.Abort(_('wlock is already held'))
1351 raise error.Abort(_('wlock is already held'))
1352 if opts.get(r'set_lock'):
1352 if opts.get(r'set_lock'):
1353 try:
1353 try:
1354 locks.append(repo.lock(False))
1354 locks.append(repo.lock(False))
1355 except error.LockHeld:
1355 except error.LockHeld:
1356 raise error.Abort(_('lock is already held'))
1356 raise error.Abort(_('lock is already held'))
1357 if len(locks):
1357 if len(locks):
1358 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1358 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1359 return 0
1359 return 0
1360 finally:
1360 finally:
1361 release(*locks)
1361 release(*locks)
1362
1362
1363 now = time.time()
1363 now = time.time()
1364 held = 0
1364 held = 0
1365
1365
1366 def report(vfs, name, method):
1366 def report(vfs, name, method):
1367 # this causes stale locks to get reaped for more accurate reporting
1367 # this causes stale locks to get reaped for more accurate reporting
1368 try:
1368 try:
1369 l = method(False)
1369 l = method(False)
1370 except error.LockHeld:
1370 except error.LockHeld:
1371 l = None
1371 l = None
1372
1372
1373 if l:
1373 if l:
1374 l.release()
1374 l.release()
1375 else:
1375 else:
1376 try:
1376 try:
1377 st = vfs.lstat(name)
1377 st = vfs.lstat(name)
1378 age = now - st[stat.ST_MTIME]
1378 age = now - st[stat.ST_MTIME]
1379 user = util.username(st.st_uid)
1379 user = util.username(st.st_uid)
1380 locker = vfs.readlock(name)
1380 locker = vfs.readlock(name)
1381 if ":" in locker:
1381 if ":" in locker:
1382 host, pid = locker.split(':')
1382 host, pid = locker.split(':')
1383 if host == socket.gethostname():
1383 if host == socket.gethostname():
1384 locker = 'user %s, process %s' % (user, pid)
1384 locker = 'user %s, process %s' % (user, pid)
1385 else:
1385 else:
1386 locker = 'user %s, process %s, host %s' \
1386 locker = 'user %s, process %s, host %s' \
1387 % (user, pid, host)
1387 % (user, pid, host)
1388 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1388 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1389 return 1
1389 return 1
1390 except OSError as e:
1390 except OSError as e:
1391 if e.errno != errno.ENOENT:
1391 if e.errno != errno.ENOENT:
1392 raise
1392 raise
1393
1393
1394 ui.write(("%-6s free\n") % (name + ":"))
1394 ui.write(("%-6s free\n") % (name + ":"))
1395 return 0
1395 return 0
1396
1396
1397 held += report(repo.svfs, "lock", repo.lock)
1397 held += report(repo.svfs, "lock", repo.lock)
1398 held += report(repo.vfs, "wlock", repo.wlock)
1398 held += report(repo.vfs, "wlock", repo.wlock)
1399
1399
1400 return held
1400 return held
1401
1401
1402 @command('debugmergestate', [], '')
1402 @command('debugmergestate', [], '')
1403 def debugmergestate(ui, repo, *args):
1403 def debugmergestate(ui, repo, *args):
1404 """print merge state
1404 """print merge state
1405
1405
1406 Use --verbose to print out information about whether v1 or v2 merge state
1406 Use --verbose to print out information about whether v1 or v2 merge state
1407 was chosen."""
1407 was chosen."""
1408 def _hashornull(h):
1408 def _hashornull(h):
1409 if h == nullhex:
1409 if h == nullhex:
1410 return 'null'
1410 return 'null'
1411 else:
1411 else:
1412 return h
1412 return h
1413
1413
1414 def printrecords(version):
1414 def printrecords(version):
1415 ui.write(('* version %d records\n') % version)
1415 ui.write(('* version %d records\n') % version)
1416 if version == 1:
1416 if version == 1:
1417 records = v1records
1417 records = v1records
1418 else:
1418 else:
1419 records = v2records
1419 records = v2records
1420
1420
1421 for rtype, record in records:
1421 for rtype, record in records:
1422 # pretty print some record types
1422 # pretty print some record types
1423 if rtype == 'L':
1423 if rtype == 'L':
1424 ui.write(('local: %s\n') % record)
1424 ui.write(('local: %s\n') % record)
1425 elif rtype == 'O':
1425 elif rtype == 'O':
1426 ui.write(('other: %s\n') % record)
1426 ui.write(('other: %s\n') % record)
1427 elif rtype == 'm':
1427 elif rtype == 'm':
1428 driver, mdstate = record.split('\0', 1)
1428 driver, mdstate = record.split('\0', 1)
1429 ui.write(('merge driver: %s (state "%s")\n')
1429 ui.write(('merge driver: %s (state "%s")\n')
1430 % (driver, mdstate))
1430 % (driver, mdstate))
1431 elif rtype in 'FDC':
1431 elif rtype in 'FDC':
1432 r = record.split('\0')
1432 r = record.split('\0')
1433 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1433 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1434 if version == 1:
1434 if version == 1:
1435 onode = 'not stored in v1 format'
1435 onode = 'not stored in v1 format'
1436 flags = r[7]
1436 flags = r[7]
1437 else:
1437 else:
1438 onode, flags = r[7:9]
1438 onode, flags = r[7:9]
1439 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1439 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1440 % (f, rtype, state, _hashornull(hash)))
1440 % (f, rtype, state, _hashornull(hash)))
1441 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1441 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1442 ui.write((' ancestor path: %s (node %s)\n')
1442 ui.write((' ancestor path: %s (node %s)\n')
1443 % (afile, _hashornull(anode)))
1443 % (afile, _hashornull(anode)))
1444 ui.write((' other path: %s (node %s)\n')
1444 ui.write((' other path: %s (node %s)\n')
1445 % (ofile, _hashornull(onode)))
1445 % (ofile, _hashornull(onode)))
1446 elif rtype == 'f':
1446 elif rtype == 'f':
1447 filename, rawextras = record.split('\0', 1)
1447 filename, rawextras = record.split('\0', 1)
1448 extras = rawextras.split('\0')
1448 extras = rawextras.split('\0')
1449 i = 0
1449 i = 0
1450 extrastrings = []
1450 extrastrings = []
1451 while i < len(extras):
1451 while i < len(extras):
1452 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1452 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1453 i += 2
1453 i += 2
1454
1454
1455 ui.write(('file extras: %s (%s)\n')
1455 ui.write(('file extras: %s (%s)\n')
1456 % (filename, ', '.join(extrastrings)))
1456 % (filename, ', '.join(extrastrings)))
1457 elif rtype == 'l':
1457 elif rtype == 'l':
1458 labels = record.split('\0', 2)
1458 labels = record.split('\0', 2)
1459 labels = [l for l in labels if len(l) > 0]
1459 labels = [l for l in labels if len(l) > 0]
1460 ui.write(('labels:\n'))
1460 ui.write(('labels:\n'))
1461 ui.write((' local: %s\n' % labels[0]))
1461 ui.write((' local: %s\n' % labels[0]))
1462 ui.write((' other: %s\n' % labels[1]))
1462 ui.write((' other: %s\n' % labels[1]))
1463 if len(labels) > 2:
1463 if len(labels) > 2:
1464 ui.write((' base: %s\n' % labels[2]))
1464 ui.write((' base: %s\n' % labels[2]))
1465 else:
1465 else:
1466 ui.write(('unrecognized entry: %s\t%s\n')
1466 ui.write(('unrecognized entry: %s\t%s\n')
1467 % (rtype, record.replace('\0', '\t')))
1467 % (rtype, record.replace('\0', '\t')))
1468
1468
1469 # Avoid mergestate.read() since it may raise an exception for unsupported
1469 # Avoid mergestate.read() since it may raise an exception for unsupported
1470 # merge state records. We shouldn't be doing this, but this is OK since this
1470 # merge state records. We shouldn't be doing this, but this is OK since this
1471 # command is pretty low-level.
1471 # command is pretty low-level.
1472 ms = mergemod.mergestate(repo)
1472 ms = mergemod.mergestate(repo)
1473
1473
1474 # sort so that reasonable information is on top
1474 # sort so that reasonable information is on top
1475 v1records = ms._readrecordsv1()
1475 v1records = ms._readrecordsv1()
1476 v2records = ms._readrecordsv2()
1476 v2records = ms._readrecordsv2()
1477 order = 'LOml'
1477 order = 'LOml'
1478 def key(r):
1478 def key(r):
1479 idx = order.find(r[0])
1479 idx = order.find(r[0])
1480 if idx == -1:
1480 if idx == -1:
1481 return (1, r[1])
1481 return (1, r[1])
1482 else:
1482 else:
1483 return (0, idx)
1483 return (0, idx)
1484 v1records.sort(key=key)
1484 v1records.sort(key=key)
1485 v2records.sort(key=key)
1485 v2records.sort(key=key)
1486
1486
1487 if not v1records and not v2records:
1487 if not v1records and not v2records:
1488 ui.write(('no merge state found\n'))
1488 ui.write(('no merge state found\n'))
1489 elif not v2records:
1489 elif not v2records:
1490 ui.note(('no version 2 merge state\n'))
1490 ui.note(('no version 2 merge state\n'))
1491 printrecords(1)
1491 printrecords(1)
1492 elif ms._v1v2match(v1records, v2records):
1492 elif ms._v1v2match(v1records, v2records):
1493 ui.note(('v1 and v2 states match: using v2\n'))
1493 ui.note(('v1 and v2 states match: using v2\n'))
1494 printrecords(2)
1494 printrecords(2)
1495 else:
1495 else:
1496 ui.note(('v1 and v2 states mismatch: using v1\n'))
1496 ui.note(('v1 and v2 states mismatch: using v1\n'))
1497 printrecords(1)
1497 printrecords(1)
1498 if ui.verbose:
1498 if ui.verbose:
1499 printrecords(2)
1499 printrecords(2)
1500
1500
1501 @command('debugnamecomplete', [], _('NAME...'))
1501 @command('debugnamecomplete', [], _('NAME...'))
1502 def debugnamecomplete(ui, repo, *args):
1502 def debugnamecomplete(ui, repo, *args):
1503 '''complete "names" - tags, open branch names, bookmark names'''
1503 '''complete "names" - tags, open branch names, bookmark names'''
1504
1504
1505 names = set()
1505 names = set()
1506 # since we previously only listed open branches, we will handle that
1506 # since we previously only listed open branches, we will handle that
1507 # specially (after this for loop)
1507 # specially (after this for loop)
1508 for name, ns in repo.names.iteritems():
1508 for name, ns in repo.names.iteritems():
1509 if name != 'branches':
1509 if name != 'branches':
1510 names.update(ns.listnames(repo))
1510 names.update(ns.listnames(repo))
1511 names.update(tag for (tag, heads, tip, closed)
1511 names.update(tag for (tag, heads, tip, closed)
1512 in repo.branchmap().iterbranches() if not closed)
1512 in repo.branchmap().iterbranches() if not closed)
1513 completions = set()
1513 completions = set()
1514 if not args:
1514 if not args:
1515 args = ['']
1515 args = ['']
1516 for a in args:
1516 for a in args:
1517 completions.update(n for n in names if n.startswith(a))
1517 completions.update(n for n in names if n.startswith(a))
1518 ui.write('\n'.join(sorted(completions)))
1518 ui.write('\n'.join(sorted(completions)))
1519 ui.write('\n')
1519 ui.write('\n')
1520
1520
1521 @command('debugobsolete',
1521 @command('debugobsolete',
1522 [('', 'flags', 0, _('markers flag')),
1522 [('', 'flags', 0, _('markers flag')),
1523 ('', 'record-parents', False,
1523 ('', 'record-parents', False,
1524 _('record parent information for the precursor')),
1524 _('record parent information for the precursor')),
1525 ('r', 'rev', [], _('display markers relevant to REV')),
1525 ('r', 'rev', [], _('display markers relevant to REV')),
1526 ('', 'exclusive', False, _('restrict display to markers only '
1526 ('', 'exclusive', False, _('restrict display to markers only '
1527 'relevant to REV')),
1527 'relevant to REV')),
1528 ('', 'index', False, _('display index of the marker')),
1528 ('', 'index', False, _('display index of the marker')),
1529 ('', 'delete', [], _('delete markers specified by indices')),
1529 ('', 'delete', [], _('delete markers specified by indices')),
1530 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1530 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1531 _('[OBSOLETED [REPLACEMENT ...]]'))
1531 _('[OBSOLETED [REPLACEMENT ...]]'))
1532 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1532 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1533 """create arbitrary obsolete marker
1533 """create arbitrary obsolete marker
1534
1534
1535 With no arguments, displays the list of obsolescence markers."""
1535 With no arguments, displays the list of obsolescence markers."""
1536
1536
1537 opts = pycompat.byteskwargs(opts)
1537 opts = pycompat.byteskwargs(opts)
1538
1538
1539 def parsenodeid(s):
1539 def parsenodeid(s):
1540 try:
1540 try:
1541 # We do not use revsingle/revrange functions here to accept
1541 # We do not use revsingle/revrange functions here to accept
1542 # arbitrary node identifiers, possibly not present in the
1542 # arbitrary node identifiers, possibly not present in the
1543 # local repository.
1543 # local repository.
1544 n = bin(s)
1544 n = bin(s)
1545 if len(n) != len(nullid):
1545 if len(n) != len(nullid):
1546 raise TypeError()
1546 raise TypeError()
1547 return n
1547 return n
1548 except TypeError:
1548 except TypeError:
1549 raise error.Abort('changeset references must be full hexadecimal '
1549 raise error.Abort('changeset references must be full hexadecimal '
1550 'node identifiers')
1550 'node identifiers')
1551
1551
1552 if opts.get('delete'):
1552 if opts.get('delete'):
1553 indices = []
1553 indices = []
1554 for v in opts.get('delete'):
1554 for v in opts.get('delete'):
1555 try:
1555 try:
1556 indices.append(int(v))
1556 indices.append(int(v))
1557 except ValueError:
1557 except ValueError:
1558 raise error.Abort(_('invalid index value: %r') % v,
1558 raise error.Abort(_('invalid index value: %r') % v,
1559 hint=_('use integers for indices'))
1559 hint=_('use integers for indices'))
1560
1560
1561 if repo.currenttransaction():
1561 if repo.currenttransaction():
1562 raise error.Abort(_('cannot delete obsmarkers in the middle '
1562 raise error.Abort(_('cannot delete obsmarkers in the middle '
1563 'of transaction.'))
1563 'of transaction.'))
1564
1564
1565 with repo.lock():
1565 with repo.lock():
1566 n = repair.deleteobsmarkers(repo.obsstore, indices)
1566 n = repair.deleteobsmarkers(repo.obsstore, indices)
1567 ui.write(_('deleted %i obsolescence markers\n') % n)
1567 ui.write(_('deleted %i obsolescence markers\n') % n)
1568
1568
1569 return
1569 return
1570
1570
1571 if precursor is not None:
1571 if precursor is not None:
1572 if opts['rev']:
1572 if opts['rev']:
1573 raise error.Abort('cannot select revision when creating marker')
1573 raise error.Abort('cannot select revision when creating marker')
1574 metadata = {}
1574 metadata = {}
1575 metadata['user'] = opts['user'] or ui.username()
1575 metadata['user'] = opts['user'] or ui.username()
1576 succs = tuple(parsenodeid(succ) for succ in successors)
1576 succs = tuple(parsenodeid(succ) for succ in successors)
1577 l = repo.lock()
1577 l = repo.lock()
1578 try:
1578 try:
1579 tr = repo.transaction('debugobsolete')
1579 tr = repo.transaction('debugobsolete')
1580 try:
1580 try:
1581 date = opts.get('date')
1581 date = opts.get('date')
1582 if date:
1582 if date:
1583 date = dateutil.parsedate(date)
1583 date = dateutil.parsedate(date)
1584 else:
1584 else:
1585 date = None
1585 date = None
1586 prec = parsenodeid(precursor)
1586 prec = parsenodeid(precursor)
1587 parents = None
1587 parents = None
1588 if opts['record_parents']:
1588 if opts['record_parents']:
1589 if prec not in repo.unfiltered():
1589 if prec not in repo.unfiltered():
1590 raise error.Abort('cannot used --record-parents on '
1590 raise error.Abort('cannot used --record-parents on '
1591 'unknown changesets')
1591 'unknown changesets')
1592 parents = repo.unfiltered()[prec].parents()
1592 parents = repo.unfiltered()[prec].parents()
1593 parents = tuple(p.node() for p in parents)
1593 parents = tuple(p.node() for p in parents)
1594 repo.obsstore.create(tr, prec, succs, opts['flags'],
1594 repo.obsstore.create(tr, prec, succs, opts['flags'],
1595 parents=parents, date=date,
1595 parents=parents, date=date,
1596 metadata=metadata, ui=ui)
1596 metadata=metadata, ui=ui)
1597 tr.close()
1597 tr.close()
1598 except ValueError as exc:
1598 except ValueError as exc:
1599 raise error.Abort(_('bad obsmarker input: %s') %
1599 raise error.Abort(_('bad obsmarker input: %s') %
1600 pycompat.bytestr(exc))
1600 pycompat.bytestr(exc))
1601 finally:
1601 finally:
1602 tr.release()
1602 tr.release()
1603 finally:
1603 finally:
1604 l.release()
1604 l.release()
1605 else:
1605 else:
1606 if opts['rev']:
1606 if opts['rev']:
1607 revs = scmutil.revrange(repo, opts['rev'])
1607 revs = scmutil.revrange(repo, opts['rev'])
1608 nodes = [repo[r].node() for r in revs]
1608 nodes = [repo[r].node() for r in revs]
1609 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1609 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1610 exclusive=opts['exclusive']))
1610 exclusive=opts['exclusive']))
1611 markers.sort(key=lambda x: x._data)
1611 markers.sort(key=lambda x: x._data)
1612 else:
1612 else:
1613 markers = obsutil.getmarkers(repo)
1613 markers = obsutil.getmarkers(repo)
1614
1614
1615 markerstoiter = markers
1615 markerstoiter = markers
1616 isrelevant = lambda m: True
1616 isrelevant = lambda m: True
1617 if opts.get('rev') and opts.get('index'):
1617 if opts.get('rev') and opts.get('index'):
1618 markerstoiter = obsutil.getmarkers(repo)
1618 markerstoiter = obsutil.getmarkers(repo)
1619 markerset = set(markers)
1619 markerset = set(markers)
1620 isrelevant = lambda m: m in markerset
1620 isrelevant = lambda m: m in markerset
1621
1621
1622 fm = ui.formatter('debugobsolete', opts)
1622 fm = ui.formatter('debugobsolete', opts)
1623 for i, m in enumerate(markerstoiter):
1623 for i, m in enumerate(markerstoiter):
1624 if not isrelevant(m):
1624 if not isrelevant(m):
1625 # marker can be irrelevant when we're iterating over a set
1625 # marker can be irrelevant when we're iterating over a set
1626 # of markers (markerstoiter) which is bigger than the set
1626 # of markers (markerstoiter) which is bigger than the set
1627 # of markers we want to display (markers)
1627 # of markers we want to display (markers)
1628 # this can happen if both --index and --rev options are
1628 # this can happen if both --index and --rev options are
1629 # provided and thus we need to iterate over all of the markers
1629 # provided and thus we need to iterate over all of the markers
1630 # to get the correct indices, but only display the ones that
1630 # to get the correct indices, but only display the ones that
1631 # are relevant to --rev value
1631 # are relevant to --rev value
1632 continue
1632 continue
1633 fm.startitem()
1633 fm.startitem()
1634 ind = i if opts.get('index') else None
1634 ind = i if opts.get('index') else None
1635 cmdutil.showmarker(fm, m, index=ind)
1635 cmdutil.showmarker(fm, m, index=ind)
1636 fm.end()
1636 fm.end()
1637
1637
1638 @command('debugpathcomplete',
1638 @command('debugpathcomplete',
1639 [('f', 'full', None, _('complete an entire path')),
1639 [('f', 'full', None, _('complete an entire path')),
1640 ('n', 'normal', None, _('show only normal files')),
1640 ('n', 'normal', None, _('show only normal files')),
1641 ('a', 'added', None, _('show only added files')),
1641 ('a', 'added', None, _('show only added files')),
1642 ('r', 'removed', None, _('show only removed files'))],
1642 ('r', 'removed', None, _('show only removed files'))],
1643 _('FILESPEC...'))
1643 _('FILESPEC...'))
1644 def debugpathcomplete(ui, repo, *specs, **opts):
1644 def debugpathcomplete(ui, repo, *specs, **opts):
1645 '''complete part or all of a tracked path
1645 '''complete part or all of a tracked path
1646
1646
1647 This command supports shells that offer path name completion. It
1647 This command supports shells that offer path name completion. It
1648 currently completes only files already known to the dirstate.
1648 currently completes only files already known to the dirstate.
1649
1649
1650 Completion extends only to the next path segment unless
1650 Completion extends only to the next path segment unless
1651 --full is specified, in which case entire paths are used.'''
1651 --full is specified, in which case entire paths are used.'''
1652
1652
1653 def complete(path, acceptable):
1653 def complete(path, acceptable):
1654 dirstate = repo.dirstate
1654 dirstate = repo.dirstate
1655 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1655 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1656 rootdir = repo.root + pycompat.ossep
1656 rootdir = repo.root + pycompat.ossep
1657 if spec != repo.root and not spec.startswith(rootdir):
1657 if spec != repo.root and not spec.startswith(rootdir):
1658 return [], []
1658 return [], []
1659 if os.path.isdir(spec):
1659 if os.path.isdir(spec):
1660 spec += '/'
1660 spec += '/'
1661 spec = spec[len(rootdir):]
1661 spec = spec[len(rootdir):]
1662 fixpaths = pycompat.ossep != '/'
1662 fixpaths = pycompat.ossep != '/'
1663 if fixpaths:
1663 if fixpaths:
1664 spec = spec.replace(pycompat.ossep, '/')
1664 spec = spec.replace(pycompat.ossep, '/')
1665 speclen = len(spec)
1665 speclen = len(spec)
1666 fullpaths = opts[r'full']
1666 fullpaths = opts[r'full']
1667 files, dirs = set(), set()
1667 files, dirs = set(), set()
1668 adddir, addfile = dirs.add, files.add
1668 adddir, addfile = dirs.add, files.add
1669 for f, st in dirstate.iteritems():
1669 for f, st in dirstate.iteritems():
1670 if f.startswith(spec) and st[0] in acceptable:
1670 if f.startswith(spec) and st[0] in acceptable:
1671 if fixpaths:
1671 if fixpaths:
1672 f = f.replace('/', pycompat.ossep)
1672 f = f.replace('/', pycompat.ossep)
1673 if fullpaths:
1673 if fullpaths:
1674 addfile(f)
1674 addfile(f)
1675 continue
1675 continue
1676 s = f.find(pycompat.ossep, speclen)
1676 s = f.find(pycompat.ossep, speclen)
1677 if s >= 0:
1677 if s >= 0:
1678 adddir(f[:s])
1678 adddir(f[:s])
1679 else:
1679 else:
1680 addfile(f)
1680 addfile(f)
1681 return files, dirs
1681 return files, dirs
1682
1682
1683 acceptable = ''
1683 acceptable = ''
1684 if opts[r'normal']:
1684 if opts[r'normal']:
1685 acceptable += 'nm'
1685 acceptable += 'nm'
1686 if opts[r'added']:
1686 if opts[r'added']:
1687 acceptable += 'a'
1687 acceptable += 'a'
1688 if opts[r'removed']:
1688 if opts[r'removed']:
1689 acceptable += 'r'
1689 acceptable += 'r'
1690 cwd = repo.getcwd()
1690 cwd = repo.getcwd()
1691 if not specs:
1691 if not specs:
1692 specs = ['.']
1692 specs = ['.']
1693
1693
1694 files, dirs = set(), set()
1694 files, dirs = set(), set()
1695 for spec in specs:
1695 for spec in specs:
1696 f, d = complete(spec, acceptable or 'nmar')
1696 f, d = complete(spec, acceptable or 'nmar')
1697 files.update(f)
1697 files.update(f)
1698 dirs.update(d)
1698 dirs.update(d)
1699 files.update(dirs)
1699 files.update(dirs)
1700 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1700 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1701 ui.write('\n')
1701 ui.write('\n')
1702
1702
1703 @command('debugpeer', [], _('PATH'), norepo=True)
1703 @command('debugpeer', [], _('PATH'), norepo=True)
1704 def debugpeer(ui, path):
1704 def debugpeer(ui, path):
1705 """establish a connection to a peer repository"""
1705 """establish a connection to a peer repository"""
1706 # Always enable peer request logging. Requires --debug to display
1706 # Always enable peer request logging. Requires --debug to display
1707 # though.
1707 # though.
1708 overrides = {
1708 overrides = {
1709 ('devel', 'debug.peer-request'): True,
1709 ('devel', 'debug.peer-request'): True,
1710 }
1710 }
1711
1711
1712 with ui.configoverride(overrides):
1712 with ui.configoverride(overrides):
1713 peer = hg.peer(ui, {}, path)
1713 peer = hg.peer(ui, {}, path)
1714
1714
1715 local = peer.local() is not None
1715 local = peer.local() is not None
1716 canpush = peer.canpush()
1716 canpush = peer.canpush()
1717
1717
1718 ui.write(_('url: %s\n') % peer.url())
1718 ui.write(_('url: %s\n') % peer.url())
1719 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1719 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1720 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1720 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1721
1721
1722 @command('debugpickmergetool',
1722 @command('debugpickmergetool',
1723 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1723 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1724 ('', 'changedelete', None, _('emulate merging change and delete')),
1724 ('', 'changedelete', None, _('emulate merging change and delete')),
1725 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1725 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1726 _('[PATTERN]...'),
1726 _('[PATTERN]...'),
1727 inferrepo=True)
1727 inferrepo=True)
1728 def debugpickmergetool(ui, repo, *pats, **opts):
1728 def debugpickmergetool(ui, repo, *pats, **opts):
1729 """examine which merge tool is chosen for specified file
1729 """examine which merge tool is chosen for specified file
1730
1730
1731 As described in :hg:`help merge-tools`, Mercurial examines
1731 As described in :hg:`help merge-tools`, Mercurial examines
1732 configurations below in this order to decide which merge tool is
1732 configurations below in this order to decide which merge tool is
1733 chosen for specified file.
1733 chosen for specified file.
1734
1734
1735 1. ``--tool`` option
1735 1. ``--tool`` option
1736 2. ``HGMERGE`` environment variable
1736 2. ``HGMERGE`` environment variable
1737 3. configurations in ``merge-patterns`` section
1737 3. configurations in ``merge-patterns`` section
1738 4. configuration of ``ui.merge``
1738 4. configuration of ``ui.merge``
1739 5. configurations in ``merge-tools`` section
1739 5. configurations in ``merge-tools`` section
1740 6. ``hgmerge`` tool (for historical reason only)
1740 6. ``hgmerge`` tool (for historical reason only)
1741 7. default tool for fallback (``:merge`` or ``:prompt``)
1741 7. default tool for fallback (``:merge`` or ``:prompt``)
1742
1742
1743 This command writes out examination result in the style below::
1743 This command writes out examination result in the style below::
1744
1744
1745 FILE = MERGETOOL
1745 FILE = MERGETOOL
1746
1746
1747 By default, all files known in the first parent context of the
1747 By default, all files known in the first parent context of the
1748 working directory are examined. Use file patterns and/or -I/-X
1748 working directory are examined. Use file patterns and/or -I/-X
1749 options to limit target files. -r/--rev is also useful to examine
1749 options to limit target files. -r/--rev is also useful to examine
1750 files in another context without actual updating to it.
1750 files in another context without actual updating to it.
1751
1751
1752 With --debug, this command shows warning messages while matching
1752 With --debug, this command shows warning messages while matching
1753 against ``merge-patterns`` and so on, too. It is recommended to
1753 against ``merge-patterns`` and so on, too. It is recommended to
1754 use this option with explicit file patterns and/or -I/-X options,
1754 use this option with explicit file patterns and/or -I/-X options,
1755 because this option increases amount of output per file according
1755 because this option increases amount of output per file according
1756 to configurations in hgrc.
1756 to configurations in hgrc.
1757
1757
1758 With -v/--verbose, this command shows configurations below at
1758 With -v/--verbose, this command shows configurations below at
1759 first (only if specified).
1759 first (only if specified).
1760
1760
1761 - ``--tool`` option
1761 - ``--tool`` option
1762 - ``HGMERGE`` environment variable
1762 - ``HGMERGE`` environment variable
1763 - configuration of ``ui.merge``
1763 - configuration of ``ui.merge``
1764
1764
1765 If merge tool is chosen before matching against
1765 If merge tool is chosen before matching against
1766 ``merge-patterns``, this command can't show any helpful
1766 ``merge-patterns``, this command can't show any helpful
1767 information, even with --debug. In such case, information above is
1767 information, even with --debug. In such case, information above is
1768 useful to know why a merge tool is chosen.
1768 useful to know why a merge tool is chosen.
1769 """
1769 """
1770 opts = pycompat.byteskwargs(opts)
1770 opts = pycompat.byteskwargs(opts)
1771 overrides = {}
1771 overrides = {}
1772 if opts['tool']:
1772 if opts['tool']:
1773 overrides[('ui', 'forcemerge')] = opts['tool']
1773 overrides[('ui', 'forcemerge')] = opts['tool']
1774 ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool'])))
1774 ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool'])))
1775
1775
1776 with ui.configoverride(overrides, 'debugmergepatterns'):
1776 with ui.configoverride(overrides, 'debugmergepatterns'):
1777 hgmerge = encoding.environ.get("HGMERGE")
1777 hgmerge = encoding.environ.get("HGMERGE")
1778 if hgmerge is not None:
1778 if hgmerge is not None:
1779 ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge)))
1779 ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge)))
1780 uimerge = ui.config("ui", "merge")
1780 uimerge = ui.config("ui", "merge")
1781 if uimerge:
1781 if uimerge:
1782 ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge)))
1782 ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge)))
1783
1783
1784 ctx = scmutil.revsingle(repo, opts.get('rev'))
1784 ctx = scmutil.revsingle(repo, opts.get('rev'))
1785 m = scmutil.match(ctx, pats, opts)
1785 m = scmutil.match(ctx, pats, opts)
1786 changedelete = opts['changedelete']
1786 changedelete = opts['changedelete']
1787 for path in ctx.walk(m):
1787 for path in ctx.walk(m):
1788 fctx = ctx[path]
1788 fctx = ctx[path]
1789 try:
1789 try:
1790 if not ui.debugflag:
1790 if not ui.debugflag:
1791 ui.pushbuffer(error=True)
1791 ui.pushbuffer(error=True)
1792 tool, toolpath = filemerge._picktool(repo, ui, path,
1792 tool, toolpath = filemerge._picktool(repo, ui, path,
1793 fctx.isbinary(),
1793 fctx.isbinary(),
1794 'l' in fctx.flags(),
1794 'l' in fctx.flags(),
1795 changedelete)
1795 changedelete)
1796 finally:
1796 finally:
1797 if not ui.debugflag:
1797 if not ui.debugflag:
1798 ui.popbuffer()
1798 ui.popbuffer()
1799 ui.write(('%s = %s\n') % (path, tool))
1799 ui.write(('%s = %s\n') % (path, tool))
1800
1800
1801 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1801 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1802 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1802 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1803 '''access the pushkey key/value protocol
1803 '''access the pushkey key/value protocol
1804
1804
1805 With two args, list the keys in the given namespace.
1805 With two args, list the keys in the given namespace.
1806
1806
1807 With five args, set a key to new if it currently is set to old.
1807 With five args, set a key to new if it currently is set to old.
1808 Reports success or failure.
1808 Reports success or failure.
1809 '''
1809 '''
1810
1810
1811 target = hg.peer(ui, {}, repopath)
1811 target = hg.peer(ui, {}, repopath)
1812 if keyinfo:
1812 if keyinfo:
1813 key, old, new = keyinfo
1813 key, old, new = keyinfo
1814 r = target.pushkey(namespace, key, old, new)
1814 r = target.pushkey(namespace, key, old, new)
1815 ui.status(pycompat.bytestr(r) + '\n')
1815 ui.status(pycompat.bytestr(r) + '\n')
1816 return not r
1816 return not r
1817 else:
1817 else:
1818 for k, v in sorted(target.listkeys(namespace).iteritems()):
1818 for k, v in sorted(target.listkeys(namespace).iteritems()):
1819 ui.write("%s\t%s\n" % (util.escapestr(k),
1819 ui.write("%s\t%s\n" % (util.escapestr(k),
1820 util.escapestr(v)))
1820 util.escapestr(v)))
1821
1821
1822 @command('debugpvec', [], _('A B'))
1822 @command('debugpvec', [], _('A B'))
1823 def debugpvec(ui, repo, a, b=None):
1823 def debugpvec(ui, repo, a, b=None):
1824 ca = scmutil.revsingle(repo, a)
1824 ca = scmutil.revsingle(repo, a)
1825 cb = scmutil.revsingle(repo, b)
1825 cb = scmutil.revsingle(repo, b)
1826 pa = pvec.ctxpvec(ca)
1826 pa = pvec.ctxpvec(ca)
1827 pb = pvec.ctxpvec(cb)
1827 pb = pvec.ctxpvec(cb)
1828 if pa == pb:
1828 if pa == pb:
1829 rel = "="
1829 rel = "="
1830 elif pa > pb:
1830 elif pa > pb:
1831 rel = ">"
1831 rel = ">"
1832 elif pa < pb:
1832 elif pa < pb:
1833 rel = "<"
1833 rel = "<"
1834 elif pa | pb:
1834 elif pa | pb:
1835 rel = "|"
1835 rel = "|"
1836 ui.write(_("a: %s\n") % pa)
1836 ui.write(_("a: %s\n") % pa)
1837 ui.write(_("b: %s\n") % pb)
1837 ui.write(_("b: %s\n") % pb)
1838 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1838 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1839 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1839 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1840 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1840 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1841 pa.distance(pb), rel))
1841 pa.distance(pb), rel))
1842
1842
1843 @command('debugrebuilddirstate|debugrebuildstate',
1843 @command('debugrebuilddirstate|debugrebuildstate',
1844 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1844 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1845 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1845 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1846 'the working copy parent')),
1846 'the working copy parent')),
1847 ],
1847 ],
1848 _('[-r REV]'))
1848 _('[-r REV]'))
1849 def debugrebuilddirstate(ui, repo, rev, **opts):
1849 def debugrebuilddirstate(ui, repo, rev, **opts):
1850 """rebuild the dirstate as it would look like for the given revision
1850 """rebuild the dirstate as it would look like for the given revision
1851
1851
1852 If no revision is specified the first current parent will be used.
1852 If no revision is specified the first current parent will be used.
1853
1853
1854 The dirstate will be set to the files of the given revision.
1854 The dirstate will be set to the files of the given revision.
1855 The actual working directory content or existing dirstate
1855 The actual working directory content or existing dirstate
1856 information such as adds or removes is not considered.
1856 information such as adds or removes is not considered.
1857
1857
1858 ``minimal`` will only rebuild the dirstate status for files that claim to be
1858 ``minimal`` will only rebuild the dirstate status for files that claim to be
1859 tracked but are not in the parent manifest, or that exist in the parent
1859 tracked but are not in the parent manifest, or that exist in the parent
1860 manifest but are not in the dirstate. It will not change adds, removes, or
1860 manifest but are not in the dirstate. It will not change adds, removes, or
1861 modified files that are in the working copy parent.
1861 modified files that are in the working copy parent.
1862
1862
1863 One use of this command is to make the next :hg:`status` invocation
1863 One use of this command is to make the next :hg:`status` invocation
1864 check the actual file content.
1864 check the actual file content.
1865 """
1865 """
1866 ctx = scmutil.revsingle(repo, rev)
1866 ctx = scmutil.revsingle(repo, rev)
1867 with repo.wlock():
1867 with repo.wlock():
1868 dirstate = repo.dirstate
1868 dirstate = repo.dirstate
1869 changedfiles = None
1869 changedfiles = None
1870 # See command doc for what minimal does.
1870 # See command doc for what minimal does.
1871 if opts.get(r'minimal'):
1871 if opts.get(r'minimal'):
1872 manifestfiles = set(ctx.manifest().keys())
1872 manifestfiles = set(ctx.manifest().keys())
1873 dirstatefiles = set(dirstate)
1873 dirstatefiles = set(dirstate)
1874 manifestonly = manifestfiles - dirstatefiles
1874 manifestonly = manifestfiles - dirstatefiles
1875 dsonly = dirstatefiles - manifestfiles
1875 dsonly = dirstatefiles - manifestfiles
1876 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1876 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1877 changedfiles = manifestonly | dsnotadded
1877 changedfiles = manifestonly | dsnotadded
1878
1878
1879 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1879 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1880
1880
1881 @command('debugrebuildfncache', [], '')
1881 @command('debugrebuildfncache', [], '')
1882 def debugrebuildfncache(ui, repo):
1882 def debugrebuildfncache(ui, repo):
1883 """rebuild the fncache file"""
1883 """rebuild the fncache file"""
1884 repair.rebuildfncache(ui, repo)
1884 repair.rebuildfncache(ui, repo)
1885
1885
1886 @command('debugrename',
1886 @command('debugrename',
1887 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1887 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1888 _('[-r REV] FILE'))
1888 _('[-r REV] FILE'))
1889 def debugrename(ui, repo, file1, *pats, **opts):
1889 def debugrename(ui, repo, file1, *pats, **opts):
1890 """dump rename information"""
1890 """dump rename information"""
1891
1891
1892 opts = pycompat.byteskwargs(opts)
1892 opts = pycompat.byteskwargs(opts)
1893 ctx = scmutil.revsingle(repo, opts.get('rev'))
1893 ctx = scmutil.revsingle(repo, opts.get('rev'))
1894 m = scmutil.match(ctx, (file1,) + pats, opts)
1894 m = scmutil.match(ctx, (file1,) + pats, opts)
1895 for abs in ctx.walk(m):
1895 for abs in ctx.walk(m):
1896 fctx = ctx[abs]
1896 fctx = ctx[abs]
1897 o = fctx.filelog().renamed(fctx.filenode())
1897 o = fctx.filelog().renamed(fctx.filenode())
1898 rel = m.rel(abs)
1898 rel = m.rel(abs)
1899 if o:
1899 if o:
1900 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1900 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1901 else:
1901 else:
1902 ui.write(_("%s not renamed\n") % rel)
1902 ui.write(_("%s not renamed\n") % rel)
1903
1903
1904 @command('debugrevlog', cmdutil.debugrevlogopts +
1904 @command('debugrevlog', cmdutil.debugrevlogopts +
1905 [('d', 'dump', False, _('dump index data'))],
1905 [('d', 'dump', False, _('dump index data'))],
1906 _('-c|-m|FILE'),
1906 _('-c|-m|FILE'),
1907 optionalrepo=True)
1907 optionalrepo=True)
1908 def debugrevlog(ui, repo, file_=None, **opts):
1908 def debugrevlog(ui, repo, file_=None, **opts):
1909 """show data and statistics about a revlog"""
1909 """show data and statistics about a revlog"""
1910 opts = pycompat.byteskwargs(opts)
1910 opts = pycompat.byteskwargs(opts)
1911 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1911 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1912
1912
1913 if opts.get("dump"):
1913 if opts.get("dump"):
1914 numrevs = len(r)
1914 numrevs = len(r)
1915 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1915 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1916 " rawsize totalsize compression heads chainlen\n"))
1916 " rawsize totalsize compression heads chainlen\n"))
1917 ts = 0
1917 ts = 0
1918 heads = set()
1918 heads = set()
1919
1919
1920 for rev in xrange(numrevs):
1920 for rev in xrange(numrevs):
1921 dbase = r.deltaparent(rev)
1921 dbase = r.deltaparent(rev)
1922 if dbase == -1:
1922 if dbase == -1:
1923 dbase = rev
1923 dbase = rev
1924 cbase = r.chainbase(rev)
1924 cbase = r.chainbase(rev)
1925 clen = r.chainlen(rev)
1925 clen = r.chainlen(rev)
1926 p1, p2 = r.parentrevs(rev)
1926 p1, p2 = r.parentrevs(rev)
1927 rs = r.rawsize(rev)
1927 rs = r.rawsize(rev)
1928 ts = ts + rs
1928 ts = ts + rs
1929 heads -= set(r.parentrevs(rev))
1929 heads -= set(r.parentrevs(rev))
1930 heads.add(rev)
1930 heads.add(rev)
1931 try:
1931 try:
1932 compression = ts / r.end(rev)
1932 compression = ts / r.end(rev)
1933 except ZeroDivisionError:
1933 except ZeroDivisionError:
1934 compression = 0
1934 compression = 0
1935 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1935 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1936 "%11d %5d %8d\n" %
1936 "%11d %5d %8d\n" %
1937 (rev, p1, p2, r.start(rev), r.end(rev),
1937 (rev, p1, p2, r.start(rev), r.end(rev),
1938 r.start(dbase), r.start(cbase),
1938 r.start(dbase), r.start(cbase),
1939 r.start(p1), r.start(p2),
1939 r.start(p1), r.start(p2),
1940 rs, ts, compression, len(heads), clen))
1940 rs, ts, compression, len(heads), clen))
1941 return 0
1941 return 0
1942
1942
1943 v = r.version
1943 v = r.version
1944 format = v & 0xFFFF
1944 format = v & 0xFFFF
1945 flags = []
1945 flags = []
1946 gdelta = False
1946 gdelta = False
1947 if v & revlog.FLAG_INLINE_DATA:
1947 if v & revlog.FLAG_INLINE_DATA:
1948 flags.append('inline')
1948 flags.append('inline')
1949 if v & revlog.FLAG_GENERALDELTA:
1949 if v & revlog.FLAG_GENERALDELTA:
1950 gdelta = True
1950 gdelta = True
1951 flags.append('generaldelta')
1951 flags.append('generaldelta')
1952 if not flags:
1952 if not flags:
1953 flags = ['(none)']
1953 flags = ['(none)']
1954
1954
1955 nummerges = 0
1955 nummerges = 0
1956 numfull = 0
1956 numfull = 0
1957 numprev = 0
1957 numprev = 0
1958 nump1 = 0
1958 nump1 = 0
1959 nump2 = 0
1959 nump2 = 0
1960 numother = 0
1960 numother = 0
1961 nump1prev = 0
1961 nump1prev = 0
1962 nump2prev = 0
1962 nump2prev = 0
1963 chainlengths = []
1963 chainlengths = []
1964 chainbases = []
1964 chainbases = []
1965 chainspans = []
1965 chainspans = []
1966
1966
1967 datasize = [None, 0, 0]
1967 datasize = [None, 0, 0]
1968 fullsize = [None, 0, 0]
1968 fullsize = [None, 0, 0]
1969 deltasize = [None, 0, 0]
1969 deltasize = [None, 0, 0]
1970 chunktypecounts = {}
1970 chunktypecounts = {}
1971 chunktypesizes = {}
1971 chunktypesizes = {}
1972
1972
1973 def addsize(size, l):
1973 def addsize(size, l):
1974 if l[0] is None or size < l[0]:
1974 if l[0] is None or size < l[0]:
1975 l[0] = size
1975 l[0] = size
1976 if size > l[1]:
1976 if size > l[1]:
1977 l[1] = size
1977 l[1] = size
1978 l[2] += size
1978 l[2] += size
1979
1979
1980 numrevs = len(r)
1980 numrevs = len(r)
1981 for rev in xrange(numrevs):
1981 for rev in xrange(numrevs):
1982 p1, p2 = r.parentrevs(rev)
1982 p1, p2 = r.parentrevs(rev)
1983 delta = r.deltaparent(rev)
1983 delta = r.deltaparent(rev)
1984 if format > 0:
1984 if format > 0:
1985 addsize(r.rawsize(rev), datasize)
1985 addsize(r.rawsize(rev), datasize)
1986 if p2 != nullrev:
1986 if p2 != nullrev:
1987 nummerges += 1
1987 nummerges += 1
1988 size = r.length(rev)
1988 size = r.length(rev)
1989 if delta == nullrev:
1989 if delta == nullrev:
1990 chainlengths.append(0)
1990 chainlengths.append(0)
1991 chainbases.append(r.start(rev))
1991 chainbases.append(r.start(rev))
1992 chainspans.append(size)
1992 chainspans.append(size)
1993 numfull += 1
1993 numfull += 1
1994 addsize(size, fullsize)
1994 addsize(size, fullsize)
1995 else:
1995 else:
1996 chainlengths.append(chainlengths[delta] + 1)
1996 chainlengths.append(chainlengths[delta] + 1)
1997 baseaddr = chainbases[delta]
1997 baseaddr = chainbases[delta]
1998 revaddr = r.start(rev)
1998 revaddr = r.start(rev)
1999 chainbases.append(baseaddr)
1999 chainbases.append(baseaddr)
2000 chainspans.append((revaddr - baseaddr) + size)
2000 chainspans.append((revaddr - baseaddr) + size)
2001 addsize(size, deltasize)
2001 addsize(size, deltasize)
2002 if delta == rev - 1:
2002 if delta == rev - 1:
2003 numprev += 1
2003 numprev += 1
2004 if delta == p1:
2004 if delta == p1:
2005 nump1prev += 1
2005 nump1prev += 1
2006 elif delta == p2:
2006 elif delta == p2:
2007 nump2prev += 1
2007 nump2prev += 1
2008 elif delta == p1:
2008 elif delta == p1:
2009 nump1 += 1
2009 nump1 += 1
2010 elif delta == p2:
2010 elif delta == p2:
2011 nump2 += 1
2011 nump2 += 1
2012 elif delta != nullrev:
2012 elif delta != nullrev:
2013 numother += 1
2013 numother += 1
2014
2014
2015 # Obtain data on the raw chunks in the revlog.
2015 # Obtain data on the raw chunks in the revlog.
2016 segment = r._getsegmentforrevs(rev, rev)[1]
2016 segment = r._getsegmentforrevs(rev, rev)[1]
2017 if segment:
2017 if segment:
2018 chunktype = bytes(segment[0:1])
2018 chunktype = bytes(segment[0:1])
2019 else:
2019 else:
2020 chunktype = 'empty'
2020 chunktype = 'empty'
2021
2021
2022 if chunktype not in chunktypecounts:
2022 if chunktype not in chunktypecounts:
2023 chunktypecounts[chunktype] = 0
2023 chunktypecounts[chunktype] = 0
2024 chunktypesizes[chunktype] = 0
2024 chunktypesizes[chunktype] = 0
2025
2025
2026 chunktypecounts[chunktype] += 1
2026 chunktypecounts[chunktype] += 1
2027 chunktypesizes[chunktype] += size
2027 chunktypesizes[chunktype] += size
2028
2028
2029 # Adjust size min value for empty cases
2029 # Adjust size min value for empty cases
2030 for size in (datasize, fullsize, deltasize):
2030 for size in (datasize, fullsize, deltasize):
2031 if size[0] is None:
2031 if size[0] is None:
2032 size[0] = 0
2032 size[0] = 0
2033
2033
2034 numdeltas = numrevs - numfull
2034 numdeltas = numrevs - numfull
2035 numoprev = numprev - nump1prev - nump2prev
2035 numoprev = numprev - nump1prev - nump2prev
2036 totalrawsize = datasize[2]
2036 totalrawsize = datasize[2]
2037 datasize[2] /= numrevs
2037 datasize[2] /= numrevs
2038 fulltotal = fullsize[2]
2038 fulltotal = fullsize[2]
2039 fullsize[2] /= numfull
2039 fullsize[2] /= numfull
2040 deltatotal = deltasize[2]
2040 deltatotal = deltasize[2]
2041 if numrevs - numfull > 0:
2041 if numrevs - numfull > 0:
2042 deltasize[2] /= numrevs - numfull
2042 deltasize[2] /= numrevs - numfull
2043 totalsize = fulltotal + deltatotal
2043 totalsize = fulltotal + deltatotal
2044 avgchainlen = sum(chainlengths) / numrevs
2044 avgchainlen = sum(chainlengths) / numrevs
2045 maxchainlen = max(chainlengths)
2045 maxchainlen = max(chainlengths)
2046 maxchainspan = max(chainspans)
2046 maxchainspan = max(chainspans)
2047 compratio = 1
2047 compratio = 1
2048 if totalsize:
2048 if totalsize:
2049 compratio = totalrawsize / totalsize
2049 compratio = totalrawsize / totalsize
2050
2050
2051 basedfmtstr = '%%%dd\n'
2051 basedfmtstr = '%%%dd\n'
2052 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2052 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2053
2053
2054 def dfmtstr(max):
2054 def dfmtstr(max):
2055 return basedfmtstr % len(str(max))
2055 return basedfmtstr % len(str(max))
2056 def pcfmtstr(max, padding=0):
2056 def pcfmtstr(max, padding=0):
2057 return basepcfmtstr % (len(str(max)), ' ' * padding)
2057 return basepcfmtstr % (len(str(max)), ' ' * padding)
2058
2058
2059 def pcfmt(value, total):
2059 def pcfmt(value, total):
2060 if total:
2060 if total:
2061 return (value, 100 * float(value) / total)
2061 return (value, 100 * float(value) / total)
2062 else:
2062 else:
2063 return value, 100.0
2063 return value, 100.0
2064
2064
2065 ui.write(('format : %d\n') % format)
2065 ui.write(('format : %d\n') % format)
2066 ui.write(('flags : %s\n') % ', '.join(flags))
2066 ui.write(('flags : %s\n') % ', '.join(flags))
2067
2067
2068 ui.write('\n')
2068 ui.write('\n')
2069 fmt = pcfmtstr(totalsize)
2069 fmt = pcfmtstr(totalsize)
2070 fmt2 = dfmtstr(totalsize)
2070 fmt2 = dfmtstr(totalsize)
2071 ui.write(('revisions : ') + fmt2 % numrevs)
2071 ui.write(('revisions : ') + fmt2 % numrevs)
2072 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2072 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2073 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2073 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2074 ui.write(('revisions : ') + fmt2 % numrevs)
2074 ui.write(('revisions : ') + fmt2 % numrevs)
2075 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2075 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2076 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2076 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2077 ui.write(('revision size : ') + fmt2 % totalsize)
2077 ui.write(('revision size : ') + fmt2 % totalsize)
2078 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2078 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2079 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2079 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2080
2080
2081 def fmtchunktype(chunktype):
2081 def fmtchunktype(chunktype):
2082 if chunktype == 'empty':
2082 if chunktype == 'empty':
2083 return ' %s : ' % chunktype
2083 return ' %s : ' % chunktype
2084 elif chunktype in pycompat.bytestr(string.ascii_letters):
2084 elif chunktype in pycompat.bytestr(string.ascii_letters):
2085 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2085 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2086 else:
2086 else:
2087 return ' 0x%s : ' % hex(chunktype)
2087 return ' 0x%s : ' % hex(chunktype)
2088
2088
2089 ui.write('\n')
2089 ui.write('\n')
2090 ui.write(('chunks : ') + fmt2 % numrevs)
2090 ui.write(('chunks : ') + fmt2 % numrevs)
2091 for chunktype in sorted(chunktypecounts):
2091 for chunktype in sorted(chunktypecounts):
2092 ui.write(fmtchunktype(chunktype))
2092 ui.write(fmtchunktype(chunktype))
2093 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2093 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2094 ui.write(('chunks size : ') + fmt2 % totalsize)
2094 ui.write(('chunks size : ') + fmt2 % totalsize)
2095 for chunktype in sorted(chunktypecounts):
2095 for chunktype in sorted(chunktypecounts):
2096 ui.write(fmtchunktype(chunktype))
2096 ui.write(fmtchunktype(chunktype))
2097 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2097 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2098
2098
2099 ui.write('\n')
2099 ui.write('\n')
2100 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2100 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2101 ui.write(('avg chain length : ') + fmt % avgchainlen)
2101 ui.write(('avg chain length : ') + fmt % avgchainlen)
2102 ui.write(('max chain length : ') + fmt % maxchainlen)
2102 ui.write(('max chain length : ') + fmt % maxchainlen)
2103 ui.write(('max chain reach : ') + fmt % maxchainspan)
2103 ui.write(('max chain reach : ') + fmt % maxchainspan)
2104 ui.write(('compression ratio : ') + fmt % compratio)
2104 ui.write(('compression ratio : ') + fmt % compratio)
2105
2105
2106 if format > 0:
2106 if format > 0:
2107 ui.write('\n')
2107 ui.write('\n')
2108 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2108 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2109 % tuple(datasize))
2109 % tuple(datasize))
2110 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2110 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2111 % tuple(fullsize))
2111 % tuple(fullsize))
2112 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2112 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2113 % tuple(deltasize))
2113 % tuple(deltasize))
2114
2114
2115 if numdeltas > 0:
2115 if numdeltas > 0:
2116 ui.write('\n')
2116 ui.write('\n')
2117 fmt = pcfmtstr(numdeltas)
2117 fmt = pcfmtstr(numdeltas)
2118 fmt2 = pcfmtstr(numdeltas, 4)
2118 fmt2 = pcfmtstr(numdeltas, 4)
2119 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2119 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2120 if numprev > 0:
2120 if numprev > 0:
2121 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2121 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2122 numprev))
2122 numprev))
2123 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2123 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2124 numprev))
2124 numprev))
2125 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2125 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2126 numprev))
2126 numprev))
2127 if gdelta:
2127 if gdelta:
2128 ui.write(('deltas against p1 : ')
2128 ui.write(('deltas against p1 : ')
2129 + fmt % pcfmt(nump1, numdeltas))
2129 + fmt % pcfmt(nump1, numdeltas))
2130 ui.write(('deltas against p2 : ')
2130 ui.write(('deltas against p2 : ')
2131 + fmt % pcfmt(nump2, numdeltas))
2131 + fmt % pcfmt(nump2, numdeltas))
2132 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2132 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2133 numdeltas))
2133 numdeltas))
2134
2134
2135 @command('debugrevspec',
2135 @command('debugrevspec',
2136 [('', 'optimize', None,
2136 [('', 'optimize', None,
2137 _('print parsed tree after optimizing (DEPRECATED)')),
2137 _('print parsed tree after optimizing (DEPRECATED)')),
2138 ('', 'show-revs', True, _('print list of result revisions (default)')),
2138 ('', 'show-revs', True, _('print list of result revisions (default)')),
2139 ('s', 'show-set', None, _('print internal representation of result set')),
2139 ('s', 'show-set', None, _('print internal representation of result set')),
2140 ('p', 'show-stage', [],
2140 ('p', 'show-stage', [],
2141 _('print parsed tree at the given stage'), _('NAME')),
2141 _('print parsed tree at the given stage'), _('NAME')),
2142 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2142 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2143 ('', 'verify-optimized', False, _('verify optimized result')),
2143 ('', 'verify-optimized', False, _('verify optimized result')),
2144 ],
2144 ],
2145 ('REVSPEC'))
2145 ('REVSPEC'))
2146 def debugrevspec(ui, repo, expr, **opts):
2146 def debugrevspec(ui, repo, expr, **opts):
2147 """parse and apply a revision specification
2147 """parse and apply a revision specification
2148
2148
2149 Use -p/--show-stage option to print the parsed tree at the given stages.
2149 Use -p/--show-stage option to print the parsed tree at the given stages.
2150 Use -p all to print tree at every stage.
2150 Use -p all to print tree at every stage.
2151
2151
2152 Use --no-show-revs option with -s or -p to print only the set
2152 Use --no-show-revs option with -s or -p to print only the set
2153 representation or the parsed tree respectively.
2153 representation or the parsed tree respectively.
2154
2154
2155 Use --verify-optimized to compare the optimized result with the unoptimized
2155 Use --verify-optimized to compare the optimized result with the unoptimized
2156 one. Returns 1 if the optimized result differs.
2156 one. Returns 1 if the optimized result differs.
2157 """
2157 """
2158 opts = pycompat.byteskwargs(opts)
2158 opts = pycompat.byteskwargs(opts)
2159 aliases = ui.configitems('revsetalias')
2159 aliases = ui.configitems('revsetalias')
2160 stages = [
2160 stages = [
2161 ('parsed', lambda tree: tree),
2161 ('parsed', lambda tree: tree),
2162 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2162 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2163 ui.warn)),
2163 ui.warn)),
2164 ('concatenated', revsetlang.foldconcat),
2164 ('concatenated', revsetlang.foldconcat),
2165 ('analyzed', revsetlang.analyze),
2165 ('analyzed', revsetlang.analyze),
2166 ('optimized', revsetlang.optimize),
2166 ('optimized', revsetlang.optimize),
2167 ]
2167 ]
2168 if opts['no_optimized']:
2168 if opts['no_optimized']:
2169 stages = stages[:-1]
2169 stages = stages[:-1]
2170 if opts['verify_optimized'] and opts['no_optimized']:
2170 if opts['verify_optimized'] and opts['no_optimized']:
2171 raise error.Abort(_('cannot use --verify-optimized with '
2171 raise error.Abort(_('cannot use --verify-optimized with '
2172 '--no-optimized'))
2172 '--no-optimized'))
2173 stagenames = set(n for n, f in stages)
2173 stagenames = set(n for n, f in stages)
2174
2174
2175 showalways = set()
2175 showalways = set()
2176 showchanged = set()
2176 showchanged = set()
2177 if ui.verbose and not opts['show_stage']:
2177 if ui.verbose and not opts['show_stage']:
2178 # show parsed tree by --verbose (deprecated)
2178 # show parsed tree by --verbose (deprecated)
2179 showalways.add('parsed')
2179 showalways.add('parsed')
2180 showchanged.update(['expanded', 'concatenated'])
2180 showchanged.update(['expanded', 'concatenated'])
2181 if opts['optimize']:
2181 if opts['optimize']:
2182 showalways.add('optimized')
2182 showalways.add('optimized')
2183 if opts['show_stage'] and opts['optimize']:
2183 if opts['show_stage'] and opts['optimize']:
2184 raise error.Abort(_('cannot use --optimize with --show-stage'))
2184 raise error.Abort(_('cannot use --optimize with --show-stage'))
2185 if opts['show_stage'] == ['all']:
2185 if opts['show_stage'] == ['all']:
2186 showalways.update(stagenames)
2186 showalways.update(stagenames)
2187 else:
2187 else:
2188 for n in opts['show_stage']:
2188 for n in opts['show_stage']:
2189 if n not in stagenames:
2189 if n not in stagenames:
2190 raise error.Abort(_('invalid stage name: %s') % n)
2190 raise error.Abort(_('invalid stage name: %s') % n)
2191 showalways.update(opts['show_stage'])
2191 showalways.update(opts['show_stage'])
2192
2192
2193 treebystage = {}
2193 treebystage = {}
2194 printedtree = None
2194 printedtree = None
2195 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2195 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2196 for n, f in stages:
2196 for n, f in stages:
2197 treebystage[n] = tree = f(tree)
2197 treebystage[n] = tree = f(tree)
2198 if n in showalways or (n in showchanged and tree != printedtree):
2198 if n in showalways or (n in showchanged and tree != printedtree):
2199 if opts['show_stage'] or n != 'parsed':
2199 if opts['show_stage'] or n != 'parsed':
2200 ui.write(("* %s:\n") % n)
2200 ui.write(("* %s:\n") % n)
2201 ui.write(revsetlang.prettyformat(tree), "\n")
2201 ui.write(revsetlang.prettyformat(tree), "\n")
2202 printedtree = tree
2202 printedtree = tree
2203
2203
2204 if opts['verify_optimized']:
2204 if opts['verify_optimized']:
2205 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2205 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2206 brevs = revset.makematcher(treebystage['optimized'])(repo)
2206 brevs = revset.makematcher(treebystage['optimized'])(repo)
2207 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2207 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2208 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2208 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2209 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2209 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2210 arevs = list(arevs)
2210 arevs = list(arevs)
2211 brevs = list(brevs)
2211 brevs = list(brevs)
2212 if arevs == brevs:
2212 if arevs == brevs:
2213 return 0
2213 return 0
2214 ui.write(('--- analyzed\n'), label='diff.file_a')
2214 ui.write(('--- analyzed\n'), label='diff.file_a')
2215 ui.write(('+++ optimized\n'), label='diff.file_b')
2215 ui.write(('+++ optimized\n'), label='diff.file_b')
2216 sm = difflib.SequenceMatcher(None, arevs, brevs)
2216 sm = difflib.SequenceMatcher(None, arevs, brevs)
2217 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2217 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2218 if tag in ('delete', 'replace'):
2218 if tag in ('delete', 'replace'):
2219 for c in arevs[alo:ahi]:
2219 for c in arevs[alo:ahi]:
2220 ui.write('-%s\n' % c, label='diff.deleted')
2220 ui.write('-%s\n' % c, label='diff.deleted')
2221 if tag in ('insert', 'replace'):
2221 if tag in ('insert', 'replace'):
2222 for c in brevs[blo:bhi]:
2222 for c in brevs[blo:bhi]:
2223 ui.write('+%s\n' % c, label='diff.inserted')
2223 ui.write('+%s\n' % c, label='diff.inserted')
2224 if tag == 'equal':
2224 if tag == 'equal':
2225 for c in arevs[alo:ahi]:
2225 for c in arevs[alo:ahi]:
2226 ui.write(' %s\n' % c)
2226 ui.write(' %s\n' % c)
2227 return 1
2227 return 1
2228
2228
2229 func = revset.makematcher(tree)
2229 func = revset.makematcher(tree)
2230 revs = func(repo)
2230 revs = func(repo)
2231 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2231 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2232 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2232 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2233 if not opts['show_revs']:
2233 if not opts['show_revs']:
2234 return
2234 return
2235 for c in revs:
2235 for c in revs:
2236 ui.write("%d\n" % c)
2236 ui.write("%d\n" % c)
2237
2237
2238 @command('debugserve', [
2238 @command('debugserve', [
2239 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2239 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2240 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2240 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2241 ('', 'logiofile', '', _('file to log server I/O to')),
2241 ('', 'logiofile', '', _('file to log server I/O to')),
2242 ], '')
2242 ], '')
2243 def debugserve(ui, repo, **opts):
2243 def debugserve(ui, repo, **opts):
2244 """run a server with advanced settings
2244 """run a server with advanced settings
2245
2245
2246 This command is similar to :hg:`serve`. It exists partially as a
2246 This command is similar to :hg:`serve`. It exists partially as a
2247 workaround to the fact that ``hg serve --stdio`` must have specific
2247 workaround to the fact that ``hg serve --stdio`` must have specific
2248 arguments for security reasons.
2248 arguments for security reasons.
2249 """
2249 """
2250 opts = pycompat.byteskwargs(opts)
2250 opts = pycompat.byteskwargs(opts)
2251
2251
2252 if not opts['sshstdio']:
2252 if not opts['sshstdio']:
2253 raise error.Abort(_('only --sshstdio is currently supported'))
2253 raise error.Abort(_('only --sshstdio is currently supported'))
2254
2254
2255 logfh = None
2255 logfh = None
2256
2256
2257 if opts['logiofd'] and opts['logiofile']:
2257 if opts['logiofd'] and opts['logiofile']:
2258 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2258 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2259
2259
2260 if opts['logiofd']:
2260 if opts['logiofd']:
2261 # Line buffered because output is line based.
2261 # Line buffered because output is line based.
2262 logfh = os.fdopen(int(opts['logiofd']), r'ab', 1)
2262 logfh = os.fdopen(int(opts['logiofd']), r'ab', 1)
2263 elif opts['logiofile']:
2263 elif opts['logiofile']:
2264 logfh = open(opts['logiofile'], 'ab', 1)
2264 logfh = open(opts['logiofile'], 'ab', 1)
2265
2265
2266 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2266 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2267 s.serve_forever()
2267 s.serve_forever()
2268
2268
2269 @command('debugsetparents', [], _('REV1 [REV2]'))
2269 @command('debugsetparents', [], _('REV1 [REV2]'))
2270 def debugsetparents(ui, repo, rev1, rev2=None):
2270 def debugsetparents(ui, repo, rev1, rev2=None):
2271 """manually set the parents of the current working directory
2271 """manually set the parents of the current working directory
2272
2272
2273 This is useful for writing repository conversion tools, but should
2273 This is useful for writing repository conversion tools, but should
2274 be used with care. For example, neither the working directory nor the
2274 be used with care. For example, neither the working directory nor the
2275 dirstate is updated, so file status may be incorrect after running this
2275 dirstate is updated, so file status may be incorrect after running this
2276 command.
2276 command.
2277
2277
2278 Returns 0 on success.
2278 Returns 0 on success.
2279 """
2279 """
2280
2280
2281 r1 = scmutil.revsingle(repo, rev1).node()
2281 r1 = scmutil.revsingle(repo, rev1).node()
2282 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2282 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2283
2283
2284 with repo.wlock():
2284 with repo.wlock():
2285 repo.setparents(r1, r2)
2285 repo.setparents(r1, r2)
2286
2286
2287 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2287 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2288 def debugssl(ui, repo, source=None, **opts):
2288 def debugssl(ui, repo, source=None, **opts):
2289 '''test a secure connection to a server
2289 '''test a secure connection to a server
2290
2290
2291 This builds the certificate chain for the server on Windows, installing the
2291 This builds the certificate chain for the server on Windows, installing the
2292 missing intermediates and trusted root via Windows Update if necessary. It
2292 missing intermediates and trusted root via Windows Update if necessary. It
2293 does nothing on other platforms.
2293 does nothing on other platforms.
2294
2294
2295 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2295 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2296 that server is used. See :hg:`help urls` for more information.
2296 that server is used. See :hg:`help urls` for more information.
2297
2297
2298 If the update succeeds, retry the original operation. Otherwise, the cause
2298 If the update succeeds, retry the original operation. Otherwise, the cause
2299 of the SSL error is likely another issue.
2299 of the SSL error is likely another issue.
2300 '''
2300 '''
2301 if not pycompat.iswindows:
2301 if not pycompat.iswindows:
2302 raise error.Abort(_('certificate chain building is only possible on '
2302 raise error.Abort(_('certificate chain building is only possible on '
2303 'Windows'))
2303 'Windows'))
2304
2304
2305 if not source:
2305 if not source:
2306 if not repo:
2306 if not repo:
2307 raise error.Abort(_("there is no Mercurial repository here, and no "
2307 raise error.Abort(_("there is no Mercurial repository here, and no "
2308 "server specified"))
2308 "server specified"))
2309 source = "default"
2309 source = "default"
2310
2310
2311 source, branches = hg.parseurl(ui.expandpath(source))
2311 source, branches = hg.parseurl(ui.expandpath(source))
2312 url = util.url(source)
2312 url = util.url(source)
2313 addr = None
2313 addr = None
2314
2314
2315 defaultport = {'https': 443, 'ssh': 22}
2315 defaultport = {'https': 443, 'ssh': 22}
2316 if url.scheme in defaultport:
2316 if url.scheme in defaultport:
2317 try:
2317 try:
2318 addr = (url.host, int(url.port or defaultport[url.scheme]))
2318 addr = (url.host, int(url.port or defaultport[url.scheme]))
2319 except ValueError:
2319 except ValueError:
2320 raise error.Abort(_("malformed port number in URL"))
2320 raise error.Abort(_("malformed port number in URL"))
2321 else:
2321 else:
2322 raise error.Abort(_("only https and ssh connections are supported"))
2322 raise error.Abort(_("only https and ssh connections are supported"))
2323
2323
2324 from . import win32
2324 from . import win32
2325
2325
2326 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2326 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2327 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2327 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2328
2328
2329 try:
2329 try:
2330 s.connect(addr)
2330 s.connect(addr)
2331 cert = s.getpeercert(True)
2331 cert = s.getpeercert(True)
2332
2332
2333 ui.status(_('checking the certificate chain for %s\n') % url.host)
2333 ui.status(_('checking the certificate chain for %s\n') % url.host)
2334
2334
2335 complete = win32.checkcertificatechain(cert, build=False)
2335 complete = win32.checkcertificatechain(cert, build=False)
2336
2336
2337 if not complete:
2337 if not complete:
2338 ui.status(_('certificate chain is incomplete, updating... '))
2338 ui.status(_('certificate chain is incomplete, updating... '))
2339
2339
2340 if not win32.checkcertificatechain(cert):
2340 if not win32.checkcertificatechain(cert):
2341 ui.status(_('failed.\n'))
2341 ui.status(_('failed.\n'))
2342 else:
2342 else:
2343 ui.status(_('done.\n'))
2343 ui.status(_('done.\n'))
2344 else:
2344 else:
2345 ui.status(_('full certificate chain is available\n'))
2345 ui.status(_('full certificate chain is available\n'))
2346 finally:
2346 finally:
2347 s.close()
2347 s.close()
2348
2348
2349 @command('debugsub',
2349 @command('debugsub',
2350 [('r', 'rev', '',
2350 [('r', 'rev', '',
2351 _('revision to check'), _('REV'))],
2351 _('revision to check'), _('REV'))],
2352 _('[-r REV] [REV]'))
2352 _('[-r REV] [REV]'))
2353 def debugsub(ui, repo, rev=None):
2353 def debugsub(ui, repo, rev=None):
2354 ctx = scmutil.revsingle(repo, rev, None)
2354 ctx = scmutil.revsingle(repo, rev, None)
2355 for k, v in sorted(ctx.substate.items()):
2355 for k, v in sorted(ctx.substate.items()):
2356 ui.write(('path %s\n') % k)
2356 ui.write(('path %s\n') % k)
2357 ui.write((' source %s\n') % v[0])
2357 ui.write((' source %s\n') % v[0])
2358 ui.write((' revision %s\n') % v[1])
2358 ui.write((' revision %s\n') % v[1])
2359
2359
2360 @command('debugsuccessorssets',
2360 @command('debugsuccessorssets',
2361 [('', 'closest', False, _('return closest successors sets only'))],
2361 [('', 'closest', False, _('return closest successors sets only'))],
2362 _('[REV]'))
2362 _('[REV]'))
2363 def debugsuccessorssets(ui, repo, *revs, **opts):
2363 def debugsuccessorssets(ui, repo, *revs, **opts):
2364 """show set of successors for revision
2364 """show set of successors for revision
2365
2365
2366 A successors set of changeset A is a consistent group of revisions that
2366 A successors set of changeset A is a consistent group of revisions that
2367 succeed A. It contains non-obsolete changesets only unless closests
2367 succeed A. It contains non-obsolete changesets only unless closests
2368 successors set is set.
2368 successors set is set.
2369
2369
2370 In most cases a changeset A has a single successors set containing a single
2370 In most cases a changeset A has a single successors set containing a single
2371 successor (changeset A replaced by A').
2371 successor (changeset A replaced by A').
2372
2372
2373 A changeset that is made obsolete with no successors are called "pruned".
2373 A changeset that is made obsolete with no successors are called "pruned".
2374 Such changesets have no successors sets at all.
2374 Such changesets have no successors sets at all.
2375
2375
2376 A changeset that has been "split" will have a successors set containing
2376 A changeset that has been "split" will have a successors set containing
2377 more than one successor.
2377 more than one successor.
2378
2378
2379 A changeset that has been rewritten in multiple different ways is called
2379 A changeset that has been rewritten in multiple different ways is called
2380 "divergent". Such changesets have multiple successor sets (each of which
2380 "divergent". Such changesets have multiple successor sets (each of which
2381 may also be split, i.e. have multiple successors).
2381 may also be split, i.e. have multiple successors).
2382
2382
2383 Results are displayed as follows::
2383 Results are displayed as follows::
2384
2384
2385 <rev1>
2385 <rev1>
2386 <successors-1A>
2386 <successors-1A>
2387 <rev2>
2387 <rev2>
2388 <successors-2A>
2388 <successors-2A>
2389 <successors-2B1> <successors-2B2> <successors-2B3>
2389 <successors-2B1> <successors-2B2> <successors-2B3>
2390
2390
2391 Here rev2 has two possible (i.e. divergent) successors sets. The first
2391 Here rev2 has two possible (i.e. divergent) successors sets. The first
2392 holds one element, whereas the second holds three (i.e. the changeset has
2392 holds one element, whereas the second holds three (i.e. the changeset has
2393 been split).
2393 been split).
2394 """
2394 """
2395 # passed to successorssets caching computation from one call to another
2395 # passed to successorssets caching computation from one call to another
2396 cache = {}
2396 cache = {}
2397 ctx2str = bytes
2397 ctx2str = bytes
2398 node2str = short
2398 node2str = short
2399 for rev in scmutil.revrange(repo, revs):
2399 for rev in scmutil.revrange(repo, revs):
2400 ctx = repo[rev]
2400 ctx = repo[rev]
2401 ui.write('%s\n'% ctx2str(ctx))
2401 ui.write('%s\n'% ctx2str(ctx))
2402 for succsset in obsutil.successorssets(repo, ctx.node(),
2402 for succsset in obsutil.successorssets(repo, ctx.node(),
2403 closest=opts[r'closest'],
2403 closest=opts[r'closest'],
2404 cache=cache):
2404 cache=cache):
2405 if succsset:
2405 if succsset:
2406 ui.write(' ')
2406 ui.write(' ')
2407 ui.write(node2str(succsset[0]))
2407 ui.write(node2str(succsset[0]))
2408 for node in succsset[1:]:
2408 for node in succsset[1:]:
2409 ui.write(' ')
2409 ui.write(' ')
2410 ui.write(node2str(node))
2410 ui.write(node2str(node))
2411 ui.write('\n')
2411 ui.write('\n')
2412
2412
2413 @command('debugtemplate',
2413 @command('debugtemplate',
2414 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2414 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2415 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2415 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2416 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2416 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2417 optionalrepo=True)
2417 optionalrepo=True)
2418 def debugtemplate(ui, repo, tmpl, **opts):
2418 def debugtemplate(ui, repo, tmpl, **opts):
2419 """parse and apply a template
2419 """parse and apply a template
2420
2420
2421 If -r/--rev is given, the template is processed as a log template and
2421 If -r/--rev is given, the template is processed as a log template and
2422 applied to the given changesets. Otherwise, it is processed as a generic
2422 applied to the given changesets. Otherwise, it is processed as a generic
2423 template.
2423 template.
2424
2424
2425 Use --verbose to print the parsed tree.
2425 Use --verbose to print the parsed tree.
2426 """
2426 """
2427 revs = None
2427 revs = None
2428 if opts[r'rev']:
2428 if opts[r'rev']:
2429 if repo is None:
2429 if repo is None:
2430 raise error.RepoError(_('there is no Mercurial repository here '
2430 raise error.RepoError(_('there is no Mercurial repository here '
2431 '(.hg not found)'))
2431 '(.hg not found)'))
2432 revs = scmutil.revrange(repo, opts[r'rev'])
2432 revs = scmutil.revrange(repo, opts[r'rev'])
2433
2433
2434 props = {}
2434 props = {}
2435 for d in opts[r'define']:
2435 for d in opts[r'define']:
2436 try:
2436 try:
2437 k, v = (e.strip() for e in d.split('=', 1))
2437 k, v = (e.strip() for e in d.split('=', 1))
2438 if not k or k == 'ui':
2438 if not k or k == 'ui':
2439 raise ValueError
2439 raise ValueError
2440 props[k] = v
2440 props[k] = v
2441 except ValueError:
2441 except ValueError:
2442 raise error.Abort(_('malformed keyword definition: %s') % d)
2442 raise error.Abort(_('malformed keyword definition: %s') % d)
2443
2443
2444 if ui.verbose:
2444 if ui.verbose:
2445 aliases = ui.configitems('templatealias')
2445 aliases = ui.configitems('templatealias')
2446 tree = templater.parse(tmpl)
2446 tree = templater.parse(tmpl)
2447 ui.note(templater.prettyformat(tree), '\n')
2447 ui.note(templater.prettyformat(tree), '\n')
2448 newtree = templater.expandaliases(tree, aliases)
2448 newtree = templater.expandaliases(tree, aliases)
2449 if newtree != tree:
2449 if newtree != tree:
2450 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2450 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2451
2451
2452 if revs is None:
2452 if revs is None:
2453 tres = formatter.templateresources(ui, repo)
2453 tres = formatter.templateresources(ui, repo)
2454 t = formatter.maketemplater(ui, tmpl, resources=tres)
2454 t = formatter.maketemplater(ui, tmpl, resources=tres)
2455 ui.write(t.render(props))
2455 ui.write(t.render(props))
2456 else:
2456 else:
2457 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2457 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2458 for r in revs:
2458 for r in revs:
2459 displayer.show(repo[r], **pycompat.strkwargs(props))
2459 displayer.show(repo[r], **pycompat.strkwargs(props))
2460 displayer.close()
2460 displayer.close()
2461
2461
2462 @command('debuguigetpass', [
2462 @command('debuguigetpass', [
2463 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2463 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2464 ], _('[-p TEXT]'), norepo=True)
2464 ], _('[-p TEXT]'), norepo=True)
2465 def debuguigetpass(ui, prompt=''):
2465 def debuguigetpass(ui, prompt=''):
2466 """show prompt to type password"""
2466 """show prompt to type password"""
2467 r = ui.getpass(prompt)
2467 r = ui.getpass(prompt)
2468 ui.write(('respose: %s\n') % r)
2468 ui.write(('respose: %s\n') % r)
2469
2469
2470 @command('debuguiprompt', [
2470 @command('debuguiprompt', [
2471 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2471 ('p', 'prompt', '', _('prompt text'), _('TEXT')),
2472 ], _('[-p TEXT]'), norepo=True)
2472 ], _('[-p TEXT]'), norepo=True)
2473 def debuguiprompt(ui, prompt=''):
2473 def debuguiprompt(ui, prompt=''):
2474 """show plain prompt"""
2474 """show plain prompt"""
2475 r = ui.prompt(prompt)
2475 r = ui.prompt(prompt)
2476 ui.write(('response: %s\n') % r)
2476 ui.write(('response: %s\n') % r)
2477
2477
2478 @command('debugupdatecaches', [])
2478 @command('debugupdatecaches', [])
2479 def debugupdatecaches(ui, repo, *pats, **opts):
2479 def debugupdatecaches(ui, repo, *pats, **opts):
2480 """warm all known caches in the repository"""
2480 """warm all known caches in the repository"""
2481 with repo.wlock(), repo.lock():
2481 with repo.wlock(), repo.lock():
2482 repo.updatecaches()
2482 repo.updatecaches()
2483
2483
2484 @command('debugupgraderepo', [
2484 @command('debugupgraderepo', [
2485 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2485 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2486 ('', 'run', False, _('performs an upgrade')),
2486 ('', 'run', False, _('performs an upgrade')),
2487 ])
2487 ])
2488 def debugupgraderepo(ui, repo, run=False, optimize=None):
2488 def debugupgraderepo(ui, repo, run=False, optimize=None):
2489 """upgrade a repository to use different features
2489 """upgrade a repository to use different features
2490
2490
2491 If no arguments are specified, the repository is evaluated for upgrade
2491 If no arguments are specified, the repository is evaluated for upgrade
2492 and a list of problems and potential optimizations is printed.
2492 and a list of problems and potential optimizations is printed.
2493
2493
2494 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2494 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2495 can be influenced via additional arguments. More details will be provided
2495 can be influenced via additional arguments. More details will be provided
2496 by the command output when run without ``--run``.
2496 by the command output when run without ``--run``.
2497
2497
2498 During the upgrade, the repository will be locked and no writes will be
2498 During the upgrade, the repository will be locked and no writes will be
2499 allowed.
2499 allowed.
2500
2500
2501 At the end of the upgrade, the repository may not be readable while new
2501 At the end of the upgrade, the repository may not be readable while new
2502 repository data is swapped in. This window will be as long as it takes to
2502 repository data is swapped in. This window will be as long as it takes to
2503 rename some directories inside the ``.hg`` directory. On most machines, this
2503 rename some directories inside the ``.hg`` directory. On most machines, this
2504 should complete almost instantaneously and the chances of a consumer being
2504 should complete almost instantaneously and the chances of a consumer being
2505 unable to access the repository should be low.
2505 unable to access the repository should be low.
2506 """
2506 """
2507 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2507 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2508
2508
2509 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2509 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2510 inferrepo=True)
2510 inferrepo=True)
2511 def debugwalk(ui, repo, *pats, **opts):
2511 def debugwalk(ui, repo, *pats, **opts):
2512 """show how files match on given patterns"""
2512 """show how files match on given patterns"""
2513 opts = pycompat.byteskwargs(opts)
2513 opts = pycompat.byteskwargs(opts)
2514 m = scmutil.match(repo[None], pats, opts)
2514 m = scmutil.match(repo[None], pats, opts)
2515 ui.write(('matcher: %r\n' % m))
2515 ui.write(('matcher: %r\n' % m))
2516 items = list(repo[None].walk(m))
2516 items = list(repo[None].walk(m))
2517 if not items:
2517 if not items:
2518 return
2518 return
2519 f = lambda fn: fn
2519 f = lambda fn: fn
2520 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2520 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2521 f = lambda fn: util.normpath(fn)
2521 f = lambda fn: util.normpath(fn)
2522 fmt = 'f %%-%ds %%-%ds %%s' % (
2522 fmt = 'f %%-%ds %%-%ds %%s' % (
2523 max([len(abs) for abs in items]),
2523 max([len(abs) for abs in items]),
2524 max([len(m.rel(abs)) for abs in items]))
2524 max([len(m.rel(abs)) for abs in items]))
2525 for abs in items:
2525 for abs in items:
2526 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2526 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2527 ui.write("%s\n" % line.rstrip())
2527 ui.write("%s\n" % line.rstrip())
2528
2528
2529 @command('debugwireargs',
2529 @command('debugwireargs',
2530 [('', 'three', '', 'three'),
2530 [('', 'three', '', 'three'),
2531 ('', 'four', '', 'four'),
2531 ('', 'four', '', 'four'),
2532 ('', 'five', '', 'five'),
2532 ('', 'five', '', 'five'),
2533 ] + cmdutil.remoteopts,
2533 ] + cmdutil.remoteopts,
2534 _('REPO [OPTIONS]... [ONE [TWO]]'),
2534 _('REPO [OPTIONS]... [ONE [TWO]]'),
2535 norepo=True)
2535 norepo=True)
2536 def debugwireargs(ui, repopath, *vals, **opts):
2536 def debugwireargs(ui, repopath, *vals, **opts):
2537 opts = pycompat.byteskwargs(opts)
2537 opts = pycompat.byteskwargs(opts)
2538 repo = hg.peer(ui, opts, repopath)
2538 repo = hg.peer(ui, opts, repopath)
2539 for opt in cmdutil.remoteopts:
2539 for opt in cmdutil.remoteopts:
2540 del opts[opt[1]]
2540 del opts[opt[1]]
2541 args = {}
2541 args = {}
2542 for k, v in opts.iteritems():
2542 for k, v in opts.iteritems():
2543 if v:
2543 if v:
2544 args[k] = v
2544 args[k] = v
2545 args = pycompat.strkwargs(args)
2545 args = pycompat.strkwargs(args)
2546 # run twice to check that we don't mess up the stream for the next command
2546 # run twice to check that we don't mess up the stream for the next command
2547 res1 = repo.debugwireargs(*vals, **args)
2547 res1 = repo.debugwireargs(*vals, **args)
2548 res2 = repo.debugwireargs(*vals, **args)
2548 res2 = repo.debugwireargs(*vals, **args)
2549 ui.write("%s\n" % res1)
2549 ui.write("%s\n" % res1)
2550 if res1 != res2:
2550 if res1 != res2:
2551 ui.warn("%s\n" % res2)
2551 ui.warn("%s\n" % res2)
2552
2552
2553 def _parsewirelangblocks(fh):
2553 def _parsewirelangblocks(fh):
2554 activeaction = None
2554 activeaction = None
2555 blocklines = []
2555 blocklines = []
2556
2556
2557 for line in fh:
2557 for line in fh:
2558 line = line.rstrip()
2558 line = line.rstrip()
2559 if not line:
2559 if not line:
2560 continue
2560 continue
2561
2561
2562 if line.startswith(b'#'):
2562 if line.startswith(b'#'):
2563 continue
2563 continue
2564
2564
2565 if not line.startswith(' '):
2565 if not line.startswith(' '):
2566 # New block. Flush previous one.
2566 # New block. Flush previous one.
2567 if activeaction:
2567 if activeaction:
2568 yield activeaction, blocklines
2568 yield activeaction, blocklines
2569
2569
2570 activeaction = line
2570 activeaction = line
2571 blocklines = []
2571 blocklines = []
2572 continue
2572 continue
2573
2573
2574 # Else we start with an indent.
2574 # Else we start with an indent.
2575
2575
2576 if not activeaction:
2576 if not activeaction:
2577 raise error.Abort(_('indented line outside of block'))
2577 raise error.Abort(_('indented line outside of block'))
2578
2578
2579 blocklines.append(line)
2579 blocklines.append(line)
2580
2580
2581 # Flush last block.
2581 # Flush last block.
2582 if activeaction:
2582 if activeaction:
2583 yield activeaction, blocklines
2583 yield activeaction, blocklines
2584
2584
2585 @command('debugwireproto',
2585 @command('debugwireproto',
2586 [
2586 [
2587 ('', 'localssh', False, _('start an SSH server for this repo')),
2587 ('', 'localssh', False, _('start an SSH server for this repo')),
2588 ('', 'peer', '', _('construct a specific version of the peer')),
2588 ('', 'peer', '', _('construct a specific version of the peer')),
2589 ('', 'noreadstderr', False, _('do not read from stderr of the remote')),
2589 ('', 'noreadstderr', False, _('do not read from stderr of the remote')),
2590 ] + cmdutil.remoteopts,
2590 ] + cmdutil.remoteopts,
2591 _('[REPO]'),
2591 _('[REPO]'),
2592 optionalrepo=True)
2592 optionalrepo=True)
2593 def debugwireproto(ui, repo, **opts):
2593 def debugwireproto(ui, repo, **opts):
2594 """send wire protocol commands to a server
2594 """send wire protocol commands to a server
2595
2595
2596 This command can be used to issue wire protocol commands to remote
2596 This command can be used to issue wire protocol commands to remote
2597 peers and to debug the raw data being exchanged.
2597 peers and to debug the raw data being exchanged.
2598
2598
2599 ``--localssh`` will start an SSH server against the current repository
2599 ``--localssh`` will start an SSH server against the current repository
2600 and connect to that. By default, the connection will perform a handshake
2600 and connect to that. By default, the connection will perform a handshake
2601 and establish an appropriate peer instance.
2601 and establish an appropriate peer instance.
2602
2602
2603 ``--peer`` can be used to bypass the handshake protocol and construct a
2603 ``--peer`` can be used to bypass the handshake protocol and construct a
2604 peer instance using the specified class type. Valid values are ``raw``,
2604 peer instance using the specified class type. Valid values are ``raw``,
2605 ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data
2605 ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data
2606 payloads and don't support higher-level command actions.
2606 payloads and don't support higher-level command actions.
2607
2607
2608 ``--noreadstderr`` can be used to disable automatic reading from stderr
2608 ``--noreadstderr`` can be used to disable automatic reading from stderr
2609 of the peer (for SSH connections only). Disabling automatic reading of
2609 of the peer (for SSH connections only). Disabling automatic reading of
2610 stderr is useful for making output more deterministic.
2610 stderr is useful for making output more deterministic.
2611
2611
2612 Commands are issued via a mini language which is specified via stdin.
2612 Commands are issued via a mini language which is specified via stdin.
2613 The language consists of individual actions to perform. An action is
2613 The language consists of individual actions to perform. An action is
2614 defined by a block. A block is defined as a line with no leading
2614 defined by a block. A block is defined as a line with no leading
2615 space followed by 0 or more lines with leading space. Blocks are
2615 space followed by 0 or more lines with leading space. Blocks are
2616 effectively a high-level command with additional metadata.
2616 effectively a high-level command with additional metadata.
2617
2617
2618 Lines beginning with ``#`` are ignored.
2618 Lines beginning with ``#`` are ignored.
2619
2619
2620 The following sections denote available actions.
2620 The following sections denote available actions.
2621
2621
2622 raw
2622 raw
2623 ---
2623 ---
2624
2624
2625 Send raw data to the server.
2625 Send raw data to the server.
2626
2626
2627 The block payload contains the raw data to send as one atomic send
2627 The block payload contains the raw data to send as one atomic send
2628 operation. The data may not actually be delivered in a single system
2628 operation. The data may not actually be delivered in a single system
2629 call: it depends on the abilities of the transport being used.
2629 call: it depends on the abilities of the transport being used.
2630
2630
2631 Each line in the block is de-indented and concatenated. Then, that
2631 Each line in the block is de-indented and concatenated. Then, that
2632 value is evaluated as a Python b'' literal. This allows the use of
2632 value is evaluated as a Python b'' literal. This allows the use of
2633 backslash escaping, etc.
2633 backslash escaping, etc.
2634
2634
2635 raw+
2635 raw+
2636 ----
2636 ----
2637
2637
2638 Behaves like ``raw`` except flushes output afterwards.
2638 Behaves like ``raw`` except flushes output afterwards.
2639
2639
2640 command <X>
2640 command <X>
2641 -----------
2641 -----------
2642
2642
2643 Send a request to run a named command, whose name follows the ``command``
2643 Send a request to run a named command, whose name follows the ``command``
2644 string.
2644 string.
2645
2645
2646 Arguments to the command are defined as lines in this block. The format of
2646 Arguments to the command are defined as lines in this block. The format of
2647 each line is ``<key> <value>``. e.g.::
2647 each line is ``<key> <value>``. e.g.::
2648
2648
2649 command listkeys
2649 command listkeys
2650 namespace bookmarks
2650 namespace bookmarks
2651
2651
2652 Values are interpreted as Python b'' literals. This allows encoding
2652 Values are interpreted as Python b'' literals. This allows encoding
2653 special byte sequences via backslash escaping.
2653 special byte sequences via backslash escaping.
2654
2654
2655 The following arguments have special meaning:
2655 The following arguments have special meaning:
2656
2656
2657 ``PUSHFILE``
2657 ``PUSHFILE``
2658 When defined, the *push* mechanism of the peer will be used instead
2658 When defined, the *push* mechanism of the peer will be used instead
2659 of the static request-response mechanism and the content of the
2659 of the static request-response mechanism and the content of the
2660 file specified in the value of this argument will be sent as the
2660 file specified in the value of this argument will be sent as the
2661 command payload.
2661 command payload.
2662
2662
2663 This can be used to submit a local bundle file to the remote.
2663 This can be used to submit a local bundle file to the remote.
2664
2664
2665 batchbegin
2665 batchbegin
2666 ----------
2666 ----------
2667
2667
2668 Instruct the peer to begin a batched send.
2668 Instruct the peer to begin a batched send.
2669
2669
2670 All ``command`` blocks are queued for execution until the next
2670 All ``command`` blocks are queued for execution until the next
2671 ``batchsubmit`` block.
2671 ``batchsubmit`` block.
2672
2672
2673 batchsubmit
2673 batchsubmit
2674 -----------
2674 -----------
2675
2675
2676 Submit previously queued ``command`` blocks as a batch request.
2676 Submit previously queued ``command`` blocks as a batch request.
2677
2677
2678 This action MUST be paired with a ``batchbegin`` action.
2678 This action MUST be paired with a ``batchbegin`` action.
2679
2679
2680 close
2680 close
2681 -----
2681 -----
2682
2682
2683 Close the connection to the server.
2683 Close the connection to the server.
2684
2684
2685 flush
2685 flush
2686 -----
2686 -----
2687
2687
2688 Flush data written to the server.
2688 Flush data written to the server.
2689
2689
2690 readavailable
2690 readavailable
2691 -------------
2691 -------------
2692
2692
2693 Read all available data from the server.
2693 Close the write end of the connection and read all available data from
2694 the server.
2694
2695
2695 If the connection to the server encompasses multiple pipes, we poll both
2696 If the connection to the server encompasses multiple pipes, we poll both
2696 pipes and read available data.
2697 pipes and read available data.
2697
2698
2698 readline
2699 readline
2699 --------
2700 --------
2700
2701
2701 Read a line of output from the server. If there are multiple output
2702 Read a line of output from the server. If there are multiple output
2702 pipes, reads only the main pipe.
2703 pipes, reads only the main pipe.
2703 """
2704 """
2704 opts = pycompat.byteskwargs(opts)
2705 opts = pycompat.byteskwargs(opts)
2705
2706
2706 if opts['localssh'] and not repo:
2707 if opts['localssh'] and not repo:
2707 raise error.Abort(_('--localssh requires a repository'))
2708 raise error.Abort(_('--localssh requires a repository'))
2708
2709
2709 if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'):
2710 if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'):
2710 raise error.Abort(_('invalid value for --peer'),
2711 raise error.Abort(_('invalid value for --peer'),
2711 hint=_('valid values are "raw", "ssh1", and "ssh2"'))
2712 hint=_('valid values are "raw", "ssh1", and "ssh2"'))
2712
2713
2713 if ui.interactive():
2714 if ui.interactive():
2714 ui.write(_('(waiting for commands on stdin)\n'))
2715 ui.write(_('(waiting for commands on stdin)\n'))
2715
2716
2716 blocks = list(_parsewirelangblocks(ui.fin))
2717 blocks = list(_parsewirelangblocks(ui.fin))
2717
2718
2718 proc = None
2719 proc = None
2719
2720
2720 if opts['localssh']:
2721 if opts['localssh']:
2721 # We start the SSH server in its own process so there is process
2722 # We start the SSH server in its own process so there is process
2722 # separation. This prevents a whole class of potential bugs around
2723 # separation. This prevents a whole class of potential bugs around
2723 # shared state from interfering with server operation.
2724 # shared state from interfering with server operation.
2724 args = util.hgcmd() + [
2725 args = util.hgcmd() + [
2725 '-R', repo.root,
2726 '-R', repo.root,
2726 'debugserve', '--sshstdio',
2727 'debugserve', '--sshstdio',
2727 ]
2728 ]
2728 proc = subprocess.Popen(args, stdin=subprocess.PIPE,
2729 proc = subprocess.Popen(args, stdin=subprocess.PIPE,
2729 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
2730 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
2730 bufsize=0)
2731 bufsize=0)
2731
2732
2732 stdin = proc.stdin
2733 stdin = proc.stdin
2733 stdout = proc.stdout
2734 stdout = proc.stdout
2734 stderr = proc.stderr
2735 stderr = proc.stderr
2735
2736
2736 # We turn the pipes into observers so we can log I/O.
2737 # We turn the pipes into observers so we can log I/O.
2737 if ui.verbose or opts['peer'] == 'raw':
2738 if ui.verbose or opts['peer'] == 'raw':
2738 stdin = util.makeloggingfileobject(ui, proc.stdin, b'i',
2739 stdin = util.makeloggingfileobject(ui, proc.stdin, b'i',
2739 logdata=True)
2740 logdata=True)
2740 stdout = util.makeloggingfileobject(ui, proc.stdout, b'o',
2741 stdout = util.makeloggingfileobject(ui, proc.stdout, b'o',
2741 logdata=True)
2742 logdata=True)
2742 stderr = util.makeloggingfileobject(ui, proc.stderr, b'e',
2743 stderr = util.makeloggingfileobject(ui, proc.stderr, b'e',
2743 logdata=True)
2744 logdata=True)
2744
2745
2745 # --localssh also implies the peer connection settings.
2746 # --localssh also implies the peer connection settings.
2746
2747
2747 url = 'ssh://localserver'
2748 url = 'ssh://localserver'
2748 autoreadstderr = not opts['noreadstderr']
2749 autoreadstderr = not opts['noreadstderr']
2749
2750
2750 if opts['peer'] == 'ssh1':
2751 if opts['peer'] == 'ssh1':
2751 ui.write(_('creating ssh peer for wire protocol version 1\n'))
2752 ui.write(_('creating ssh peer for wire protocol version 1\n'))
2752 peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr,
2753 peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr,
2753 None, autoreadstderr=autoreadstderr)
2754 None, autoreadstderr=autoreadstderr)
2754 elif opts['peer'] == 'ssh2':
2755 elif opts['peer'] == 'ssh2':
2755 ui.write(_('creating ssh peer for wire protocol version 2\n'))
2756 ui.write(_('creating ssh peer for wire protocol version 2\n'))
2756 peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr,
2757 peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr,
2757 None, autoreadstderr=autoreadstderr)
2758 None, autoreadstderr=autoreadstderr)
2758 elif opts['peer'] == 'raw':
2759 elif opts['peer'] == 'raw':
2759 ui.write(_('using raw connection to peer\n'))
2760 ui.write(_('using raw connection to peer\n'))
2760 peer = None
2761 peer = None
2761 else:
2762 else:
2762 ui.write(_('creating ssh peer from handshake results\n'))
2763 ui.write(_('creating ssh peer from handshake results\n'))
2763 peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr,
2764 peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr,
2764 autoreadstderr=autoreadstderr)
2765 autoreadstderr=autoreadstderr)
2765
2766
2766 else:
2767 else:
2767 raise error.Abort(_('only --localssh is currently supported'))
2768 raise error.Abort(_('only --localssh is currently supported'))
2768
2769
2769 batchedcommands = None
2770 batchedcommands = None
2770
2771
2771 # Now perform actions based on the parsed wire language instructions.
2772 # Now perform actions based on the parsed wire language instructions.
2772 for action, lines in blocks:
2773 for action, lines in blocks:
2773 if action in ('raw', 'raw+'):
2774 if action in ('raw', 'raw+'):
2774 # Concatenate the data together.
2775 # Concatenate the data together.
2775 data = ''.join(l.lstrip() for l in lines)
2776 data = ''.join(l.lstrip() for l in lines)
2776 data = util.unescapestr(data)
2777 data = util.unescapestr(data)
2777 stdin.write(data)
2778 stdin.write(data)
2778
2779
2779 if action == 'raw+':
2780 if action == 'raw+':
2780 stdin.flush()
2781 stdin.flush()
2781 elif action == 'flush':
2782 elif action == 'flush':
2782 stdin.flush()
2783 stdin.flush()
2783 elif action.startswith('command'):
2784 elif action.startswith('command'):
2784 if not peer:
2785 if not peer:
2785 raise error.Abort(_('cannot send commands unless peer instance '
2786 raise error.Abort(_('cannot send commands unless peer instance '
2786 'is available'))
2787 'is available'))
2787
2788
2788 command = action.split(' ', 1)[1]
2789 command = action.split(' ', 1)[1]
2789
2790
2790 args = {}
2791 args = {}
2791 for line in lines:
2792 for line in lines:
2792 # We need to allow empty values.
2793 # We need to allow empty values.
2793 fields = line.lstrip().split(' ', 1)
2794 fields = line.lstrip().split(' ', 1)
2794 if len(fields) == 1:
2795 if len(fields) == 1:
2795 key = fields[0]
2796 key = fields[0]
2796 value = ''
2797 value = ''
2797 else:
2798 else:
2798 key, value = fields
2799 key, value = fields
2799
2800
2800 args[key] = util.unescapestr(value)
2801 args[key] = util.unescapestr(value)
2801
2802
2802 if batchedcommands is not None:
2803 if batchedcommands is not None:
2803 batchedcommands.append((command, args))
2804 batchedcommands.append((command, args))
2804 continue
2805 continue
2805
2806
2806 ui.status(_('sending %s command\n') % command)
2807 ui.status(_('sending %s command\n') % command)
2807
2808
2808 if 'PUSHFILE' in args:
2809 if 'PUSHFILE' in args:
2809 with open(args['PUSHFILE'], r'rb') as fh:
2810 with open(args['PUSHFILE'], r'rb') as fh:
2810 del args['PUSHFILE']
2811 del args['PUSHFILE']
2811 res, output = peer._callpush(command, fh,
2812 res, output = peer._callpush(command, fh,
2812 **pycompat.strkwargs(args))
2813 **pycompat.strkwargs(args))
2813 ui.status(_('result: %s\n') % util.escapedata(res))
2814 ui.status(_('result: %s\n') % util.escapedata(res))
2814 ui.status(_('remote output: %s\n') %
2815 ui.status(_('remote output: %s\n') %
2815 util.escapedata(output))
2816 util.escapedata(output))
2816 else:
2817 else:
2817 res = peer._call(command, **pycompat.strkwargs(args))
2818 res = peer._call(command, **pycompat.strkwargs(args))
2818 ui.status(_('response: %s\n') % util.escapedata(res))
2819 ui.status(_('response: %s\n') % util.escapedata(res))
2819
2820
2820 elif action == 'batchbegin':
2821 elif action == 'batchbegin':
2821 if batchedcommands is not None:
2822 if batchedcommands is not None:
2822 raise error.Abort(_('nested batchbegin not allowed'))
2823 raise error.Abort(_('nested batchbegin not allowed'))
2823
2824
2824 batchedcommands = []
2825 batchedcommands = []
2825 elif action == 'batchsubmit':
2826 elif action == 'batchsubmit':
2826 # There is a batching API we could go through. But it would be
2827 # There is a batching API we could go through. But it would be
2827 # difficult to normalize requests into function calls. It is easier
2828 # difficult to normalize requests into function calls. It is easier
2828 # to bypass this layer and normalize to commands + args.
2829 # to bypass this layer and normalize to commands + args.
2829 ui.status(_('sending batch with %d sub-commands\n') %
2830 ui.status(_('sending batch with %d sub-commands\n') %
2830 len(batchedcommands))
2831 len(batchedcommands))
2831 for i, chunk in enumerate(peer._submitbatch(batchedcommands)):
2832 for i, chunk in enumerate(peer._submitbatch(batchedcommands)):
2832 ui.status(_('response #%d: %s\n') % (i, util.escapedata(chunk)))
2833 ui.status(_('response #%d: %s\n') % (i, util.escapedata(chunk)))
2833
2834
2834 batchedcommands = None
2835 batchedcommands = None
2835 elif action == 'close':
2836 elif action == 'close':
2836 peer.close()
2837 peer.close()
2837 elif action == 'readavailable':
2838 elif action == 'readavailable':
2838 fds = [stdout.fileno(), stderr.fileno()]
2839 stdin.close()
2839 try:
2840 stdout.read()
2840 act = util.poll(fds)
2841 stderr.read()
2841 except NotImplementedError:
2842 # non supported yet case, assume all have data.
2843 act = fds
2844
2845 if stdout.fileno() in act:
2846 util.readpipe(stdout)
2847 if stderr.fileno() in act:
2848 util.readpipe(stderr)
2849 elif action == 'readline':
2842 elif action == 'readline':
2850 stdout.readline()
2843 stdout.readline()
2851 else:
2844 else:
2852 raise error.Abort(_('unknown action: %s') % action)
2845 raise error.Abort(_('unknown action: %s') % action)
2853
2846
2854 if batchedcommands is not None:
2847 if batchedcommands is not None:
2855 raise error.Abort(_('unclosed "batchbegin" request'))
2848 raise error.Abort(_('unclosed "batchbegin" request'))
2856
2849
2857 if peer:
2850 if peer:
2858 peer.close()
2851 peer.close()
2859
2852
2860 if proc:
2853 if proc:
2861 proc.kill()
2854 proc.kill()
@@ -1,2034 +1,2064 b''
1 $ cat > hgrc-sshv2 << EOF
1 $ cat > hgrc-sshv2 << EOF
2 > %include $HGRCPATH
2 > %include $HGRCPATH
3 > [experimental]
3 > [experimental]
4 > sshpeer.advertise-v2 = true
4 > sshpeer.advertise-v2 = true
5 > sshserver.support-v2 = true
5 > sshserver.support-v2 = true
6 > EOF
6 > EOF
7
7
8 $ debugwireproto() {
8 $ debugwireproto() {
9 > commands=`cat -`
9 > commands=`cat -`
10 > echo 'testing ssh1'
10 > echo 'testing ssh1'
11 > tip=`hg log -r tip -T '{node}'`
11 > tip=`hg log -r tip -T '{node}'`
12 > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr
12 > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr
13 > if [ -n "$1" ]; then
13 > if [ -n "$1" ]; then
14 > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
14 > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
15 > fi
15 > fi
16 > echo ""
16 > echo ""
17 > echo 'testing ssh2'
17 > echo 'testing ssh2'
18 > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr
18 > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr
19 > if [ -n "$1" ]; then
19 > if [ -n "$1" ]; then
20 > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
20 > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
21 > fi
21 > fi
22 > }
22 > }
23
23
24 Generate some bundle files
24 Generate some bundle files
25
25
26 $ hg init repo
26 $ hg init repo
27 $ cd repo
27 $ cd repo
28 $ echo 0 > foo
28 $ echo 0 > foo
29 $ hg -q commit -A -m initial
29 $ hg -q commit -A -m initial
30 $ hg bundle --all -t none-v1 ../initial.v1.hg
30 $ hg bundle --all -t none-v1 ../initial.v1.hg
31 1 changesets found
31 1 changesets found
32 $ cd ..
32 $ cd ..
33
33
34 Test pushing bundle1 payload to a server with bundle1 disabled
34 Test pushing bundle1 payload to a server with bundle1 disabled
35
35
36 $ hg init no-bundle1
36 $ hg init no-bundle1
37 $ cd no-bundle1
37 $ cd no-bundle1
38 $ cat > .hg/hgrc << EOF
38 $ cat > .hg/hgrc << EOF
39 > [server]
39 > [server]
40 > bundle1 = false
40 > bundle1 = false
41 > EOF
41 > EOF
42
42
43 $ debugwireproto << EOF
43 $ debugwireproto << EOF
44 > command unbundle
44 > command unbundle
45 > # This is "force" in hex.
45 > # This is "force" in hex.
46 > heads 666f726365
46 > heads 666f726365
47 > PUSHFILE ../initial.v1.hg
47 > PUSHFILE ../initial.v1.hg
48 > readavailable
48 > readavailable
49 > EOF
49 > EOF
50 testing ssh1
50 testing ssh1
51 creating ssh peer from handshake results
51 creating ssh peer from handshake results
52 i> write(104) -> 104:
52 i> write(104) -> 104:
53 i> hello\n
53 i> hello\n
54 i> between\n
54 i> between\n
55 i> pairs 81\n
55 i> pairs 81\n
56 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
56 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
57 i> flush() -> None
57 i> flush() -> None
58 o> readline() -> 4:
58 o> readline() -> 4:
59 o> 384\n
59 o> 384\n
60 o> readline() -> 384:
60 o> readline() -> 384:
61 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
61 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
62 o> readline() -> 2:
62 o> readline() -> 2:
63 o> 1\n
63 o> 1\n
64 o> readline() -> 1:
64 o> readline() -> 1:
65 o> \n
65 o> \n
66 sending unbundle command
66 sending unbundle command
67 i> write(9) -> 9:
67 i> write(9) -> 9:
68 i> unbundle\n
68 i> unbundle\n
69 i> write(9) -> 9:
69 i> write(9) -> 9:
70 i> heads 10\n
70 i> heads 10\n
71 i> write(10) -> 10: 666f726365
71 i> write(10) -> 10: 666f726365
72 i> flush() -> None
72 i> flush() -> None
73 o> readline() -> 2:
73 o> readline() -> 2:
74 o> 0\n
74 o> 0\n
75 i> write(4) -> 4:
75 i> write(4) -> 4:
76 i> 426\n
76 i> 426\n
77 i> write(426) -> 426:
77 i> write(426) -> 426:
78 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
78 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
79 i> test\n
79 i> test\n
80 i> 0 0\n
80 i> 0 0\n
81 i> foo\n
81 i> foo\n
82 i> \n
82 i> \n
83 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
83 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
84 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
84 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
85 i> \x00\x00\x00\x00\x00\x00\x00\x00
85 i> \x00\x00\x00\x00\x00\x00\x00\x00
86 i> write(2) -> 2:
86 i> write(2) -> 2:
87 i> 0\n
87 i> 0\n
88 i> flush() -> None
88 i> flush() -> None
89 o> readline() -> 2:
89 o> readline() -> 2:
90 o> 0\n
90 o> 0\n
91 o> readline() -> 2:
91 o> readline() -> 2:
92 o> 1\n
92 o> 1\n
93 o> read(1) -> 1: 0
93 o> read(1) -> 1: 0
94 result: 0
94 result: 0
95 remote output:
95 remote output:
96 o> read(-1) -> 0:
96 e> read(-1) -> 115:
97 e> read(-1) -> 115:
97 e> abort: incompatible Mercurial client; bundle2 required\n
98 e> abort: incompatible Mercurial client; bundle2 required\n
98 e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n
99 e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n
99
100
100 testing ssh2
101 testing ssh2
101 creating ssh peer from handshake results
102 creating ssh peer from handshake results
102 i> write(171) -> 171:
103 i> write(171) -> 171:
103 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
104 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
104 i> hello\n
105 i> hello\n
105 i> between\n
106 i> between\n
106 i> pairs 81\n
107 i> pairs 81\n
107 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
108 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
108 i> flush() -> None
109 i> flush() -> None
109 o> readline() -> 62:
110 o> readline() -> 62:
110 o> upgraded * exp-ssh-v2-0001\n (glob)
111 o> upgraded * exp-ssh-v2-0001\n (glob)
111 o> readline() -> 4:
112 o> readline() -> 4:
112 o> 383\n
113 o> 383\n
113 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
114 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
114 o> read(1) -> 1:
115 o> read(1) -> 1:
115 o> \n
116 o> \n
116 sending unbundle command
117 sending unbundle command
117 i> write(9) -> 9:
118 i> write(9) -> 9:
118 i> unbundle\n
119 i> unbundle\n
119 i> write(9) -> 9:
120 i> write(9) -> 9:
120 i> heads 10\n
121 i> heads 10\n
121 i> write(10) -> 10: 666f726365
122 i> write(10) -> 10: 666f726365
122 i> flush() -> None
123 i> flush() -> None
123 o> readline() -> 2:
124 o> readline() -> 2:
124 o> 0\n
125 o> 0\n
125 i> write(4) -> 4:
126 i> write(4) -> 4:
126 i> 426\n
127 i> 426\n
127 i> write(426) -> 426:
128 i> write(426) -> 426:
128 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
129 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
129 i> test\n
130 i> test\n
130 i> 0 0\n
131 i> 0 0\n
131 i> foo\n
132 i> foo\n
132 i> \n
133 i> \n
133 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
134 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
134 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
135 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
135 i> \x00\x00\x00\x00\x00\x00\x00\x00
136 i> \x00\x00\x00\x00\x00\x00\x00\x00
136 i> write(2) -> 2:
137 i> write(2) -> 2:
137 i> 0\n
138 i> 0\n
138 i> flush() -> None
139 i> flush() -> None
139 o> readline() -> 2:
140 o> readline() -> 2:
140 o> 0\n
141 o> 0\n
141 o> readline() -> 2:
142 o> readline() -> 2:
142 o> 1\n
143 o> 1\n
143 o> read(1) -> 1: 0
144 o> read(1) -> 1: 0
144 result: 0
145 result: 0
145 remote output:
146 remote output:
147 o> read(-1) -> 0:
146 e> read(-1) -> 115:
148 e> read(-1) -> 115:
147 e> abort: incompatible Mercurial client; bundle2 required\n
149 e> abort: incompatible Mercurial client; bundle2 required\n
148 e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n
150 e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n
149
151
150 $ cd ..
152 $ cd ..
151
153
152 Create a pretxnchangegroup hook that fails. Give it multiple modes of printing
154 Create a pretxnchangegroup hook that fails. Give it multiple modes of printing
153 output so we can test I/O capture and behavior.
155 output so we can test I/O capture and behavior.
154
156
155 Test pushing to a server that has a pretxnchangegroup Python hook that fails
157 Test pushing to a server that has a pretxnchangegroup Python hook that fails
156
158
157 $ cat > $TESTTMP/failhook << EOF
159 $ cat > $TESTTMP/failhook << EOF
158 > from __future__ import print_function
160 > from __future__ import print_function
159 > import sys
161 > import sys
160 > def hook1line(ui, repo, **kwargs):
162 > def hook1line(ui, repo, **kwargs):
161 > ui.write(b'ui.write 1 line\n')
163 > ui.write(b'ui.write 1 line\n')
162 > return 1
164 > return 1
163 > def hook2lines(ui, repo, **kwargs):
165 > def hook2lines(ui, repo, **kwargs):
164 > ui.write(b'ui.write 2 lines 1\n')
166 > ui.write(b'ui.write 2 lines 1\n')
165 > ui.write(b'ui.write 2 lines 2\n')
167 > ui.write(b'ui.write 2 lines 2\n')
166 > return 1
168 > return 1
167 > def hook1lineflush(ui, repo, **kwargs):
169 > def hook1lineflush(ui, repo, **kwargs):
168 > ui.write(b'ui.write 1 line flush\n')
170 > ui.write(b'ui.write 1 line flush\n')
169 > ui.flush()
171 > ui.flush()
170 > return 1
172 > return 1
171 > def hookmultiflush(ui, repo, **kwargs):
173 > def hookmultiflush(ui, repo, **kwargs):
172 > ui.write(b'ui.write 1st\n')
174 > ui.write(b'ui.write 1st\n')
173 > ui.flush()
175 > ui.flush()
174 > ui.write(b'ui.write 2nd\n')
176 > ui.write(b'ui.write 2nd\n')
175 > ui.flush()
177 > ui.flush()
176 > return 1
178 > return 1
177 > def hookwriteandwriteerr(ui, repo, **kwargs):
179 > def hookwriteandwriteerr(ui, repo, **kwargs):
178 > ui.write(b'ui.write 1\n')
180 > ui.write(b'ui.write 1\n')
179 > ui.write_err(b'ui.write_err 1\n')
181 > ui.write_err(b'ui.write_err 1\n')
180 > ui.write(b'ui.write 2\n')
182 > ui.write(b'ui.write 2\n')
181 > ui.write_err(b'ui.write_err 2\n')
183 > ui.write_err(b'ui.write_err 2\n')
182 > return 1
184 > return 1
183 > def hookprintstdout(ui, repo, **kwargs):
185 > def hookprintstdout(ui, repo, **kwargs):
184 > print('printed line')
186 > print('printed line')
185 > return 1
187 > return 1
186 > def hookprintandwrite(ui, repo, **kwargs):
188 > def hookprintandwrite(ui, repo, **kwargs):
187 > print('print 1')
189 > print('print 1')
188 > ui.write(b'ui.write 1\n')
190 > ui.write(b'ui.write 1\n')
189 > print('print 2')
191 > print('print 2')
190 > ui.write(b'ui.write 2\n')
192 > ui.write(b'ui.write 2\n')
191 > return 1
193 > return 1
192 > def hookprintstderrandstdout(ui, repo, **kwargs):
194 > def hookprintstderrandstdout(ui, repo, **kwargs):
193 > print('stdout 1')
195 > print('stdout 1')
194 > print('stderr 1', file=sys.stderr)
196 > print('stderr 1', file=sys.stderr)
195 > print('stdout 2')
197 > print('stdout 2')
196 > print('stderr 2', file=sys.stderr)
198 > print('stderr 2', file=sys.stderr)
197 > return 1
199 > return 1
198 > EOF
200 > EOF
199
201
200 $ hg init failrepo
202 $ hg init failrepo
201 $ cd failrepo
203 $ cd failrepo
202
204
203 ui.write() in hook is redirected to stderr
205 ui.write() in hook is redirected to stderr
204
206
205 $ cat > .hg/hgrc << EOF
207 $ cat > .hg/hgrc << EOF
206 > [hooks]
208 > [hooks]
207 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line
209 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line
208 > EOF
210 > EOF
209
211
210 $ debugwireproto << EOF
212 $ debugwireproto << EOF
211 > command unbundle
213 > command unbundle
212 > # This is "force" in hex.
214 > # This is "force" in hex.
213 > heads 666f726365
215 > heads 666f726365
214 > PUSHFILE ../initial.v1.hg
216 > PUSHFILE ../initial.v1.hg
215 > readavailable
217 > readavailable
216 > EOF
218 > EOF
217 testing ssh1
219 testing ssh1
218 creating ssh peer from handshake results
220 creating ssh peer from handshake results
219 i> write(104) -> 104:
221 i> write(104) -> 104:
220 i> hello\n
222 i> hello\n
221 i> between\n
223 i> between\n
222 i> pairs 81\n
224 i> pairs 81\n
223 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
225 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
224 i> flush() -> None
226 i> flush() -> None
225 o> readline() -> 4:
227 o> readline() -> 4:
226 o> 384\n
228 o> 384\n
227 o> readline() -> 384:
229 o> readline() -> 384:
228 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
230 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
229 o> readline() -> 2:
231 o> readline() -> 2:
230 o> 1\n
232 o> 1\n
231 o> readline() -> 1:
233 o> readline() -> 1:
232 o> \n
234 o> \n
233 sending unbundle command
235 sending unbundle command
234 i> write(9) -> 9:
236 i> write(9) -> 9:
235 i> unbundle\n
237 i> unbundle\n
236 i> write(9) -> 9:
238 i> write(9) -> 9:
237 i> heads 10\n
239 i> heads 10\n
238 i> write(10) -> 10: 666f726365
240 i> write(10) -> 10: 666f726365
239 i> flush() -> None
241 i> flush() -> None
240 o> readline() -> 2:
242 o> readline() -> 2:
241 o> 0\n
243 o> 0\n
242 i> write(4) -> 4:
244 i> write(4) -> 4:
243 i> 426\n
245 i> 426\n
244 i> write(426) -> 426:
246 i> write(426) -> 426:
245 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
247 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
246 i> test\n
248 i> test\n
247 i> 0 0\n
249 i> 0 0\n
248 i> foo\n
250 i> foo\n
249 i> \n
251 i> \n
250 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
252 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
251 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
253 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
252 i> \x00\x00\x00\x00\x00\x00\x00\x00
254 i> \x00\x00\x00\x00\x00\x00\x00\x00
253 i> write(2) -> 2:
255 i> write(2) -> 2:
254 i> 0\n
256 i> 0\n
255 i> flush() -> None
257 i> flush() -> None
256 o> readline() -> 2:
258 o> readline() -> 2:
257 o> 0\n
259 o> 0\n
258 o> readline() -> 2:
260 o> readline() -> 2:
259 o> 1\n
261 o> 1\n
260 o> read(1) -> 1: 0
262 o> read(1) -> 1: 0
261 result: 0
263 result: 0
262 remote output:
264 remote output:
265 o> read(-1) -> 0:
263 e> read(-1) -> 196:
266 e> read(-1) -> 196:
264 e> adding changesets\n
267 e> adding changesets\n
265 e> adding manifests\n
268 e> adding manifests\n
266 e> adding file changes\n
269 e> adding file changes\n
267 e> added 1 changesets with 1 changes to 1 files\n
270 e> added 1 changesets with 1 changes to 1 files\n
268 e> ui.write 1 line\n
271 e> ui.write 1 line\n
269 e> transaction abort!\n
272 e> transaction abort!\n
270 e> rollback completed\n
273 e> rollback completed\n
271 e> abort: pretxnchangegroup.fail hook failed\n
274 e> abort: pretxnchangegroup.fail hook failed\n
272
275
273 testing ssh2
276 testing ssh2
274 creating ssh peer from handshake results
277 creating ssh peer from handshake results
275 i> write(171) -> 171:
278 i> write(171) -> 171:
276 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
279 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
277 i> hello\n
280 i> hello\n
278 i> between\n
281 i> between\n
279 i> pairs 81\n
282 i> pairs 81\n
280 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
283 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
281 i> flush() -> None
284 i> flush() -> None
282 o> readline() -> 62:
285 o> readline() -> 62:
283 o> upgraded * exp-ssh-v2-0001\n (glob)
286 o> upgraded * exp-ssh-v2-0001\n (glob)
284 o> readline() -> 4:
287 o> readline() -> 4:
285 o> 383\n
288 o> 383\n
286 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
289 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
287 o> read(1) -> 1:
290 o> read(1) -> 1:
288 o> \n
291 o> \n
289 sending unbundle command
292 sending unbundle command
290 i> write(9) -> 9:
293 i> write(9) -> 9:
291 i> unbundle\n
294 i> unbundle\n
292 i> write(9) -> 9:
295 i> write(9) -> 9:
293 i> heads 10\n
296 i> heads 10\n
294 i> write(10) -> 10: 666f726365
297 i> write(10) -> 10: 666f726365
295 i> flush() -> None
298 i> flush() -> None
296 o> readline() -> 2:
299 o> readline() -> 2:
297 o> 0\n
300 o> 0\n
298 i> write(4) -> 4:
301 i> write(4) -> 4:
299 i> 426\n
302 i> 426\n
300 i> write(426) -> 426:
303 i> write(426) -> 426:
301 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
304 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
302 i> test\n
305 i> test\n
303 i> 0 0\n
306 i> 0 0\n
304 i> foo\n
307 i> foo\n
305 i> \n
308 i> \n
306 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
309 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
307 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
310 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
308 i> \x00\x00\x00\x00\x00\x00\x00\x00
311 i> \x00\x00\x00\x00\x00\x00\x00\x00
309 i> write(2) -> 2:
312 i> write(2) -> 2:
310 i> 0\n
313 i> 0\n
311 i> flush() -> None
314 i> flush() -> None
312 o> readline() -> 2:
315 o> readline() -> 2:
313 o> 0\n
316 o> 0\n
314 o> readline() -> 2:
317 o> readline() -> 2:
315 o> 1\n
318 o> 1\n
316 o> read(1) -> 1: 0
319 o> read(1) -> 1: 0
317 result: 0
320 result: 0
318 remote output:
321 remote output:
322 o> read(-1) -> 0:
319 e> read(-1) -> 196:
323 e> read(-1) -> 196:
320 e> adding changesets\n
324 e> adding changesets\n
321 e> adding manifests\n
325 e> adding manifests\n
322 e> adding file changes\n
326 e> adding file changes\n
323 e> added 1 changesets with 1 changes to 1 files\n
327 e> added 1 changesets with 1 changes to 1 files\n
324 e> ui.write 1 line\n
328 e> ui.write 1 line\n
325 e> transaction abort!\n
329 e> transaction abort!\n
326 e> rollback completed\n
330 e> rollback completed\n
327 e> abort: pretxnchangegroup.fail hook failed\n
331 e> abort: pretxnchangegroup.fail hook failed\n
328
332
329 And a variation that writes multiple lines using ui.write
333 And a variation that writes multiple lines using ui.write
330
334
331 $ cat > .hg/hgrc << EOF
335 $ cat > .hg/hgrc << EOF
332 > [hooks]
336 > [hooks]
333 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines
337 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines
334 > EOF
338 > EOF
335
339
336 $ debugwireproto << EOF
340 $ debugwireproto << EOF
337 > command unbundle
341 > command unbundle
338 > # This is "force" in hex.
342 > # This is "force" in hex.
339 > heads 666f726365
343 > heads 666f726365
340 > PUSHFILE ../initial.v1.hg
344 > PUSHFILE ../initial.v1.hg
341 > readavailable
345 > readavailable
342 > EOF
346 > EOF
343 testing ssh1
347 testing ssh1
344 creating ssh peer from handshake results
348 creating ssh peer from handshake results
345 i> write(104) -> 104:
349 i> write(104) -> 104:
346 i> hello\n
350 i> hello\n
347 i> between\n
351 i> between\n
348 i> pairs 81\n
352 i> pairs 81\n
349 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
353 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
350 i> flush() -> None
354 i> flush() -> None
351 o> readline() -> 4:
355 o> readline() -> 4:
352 o> 384\n
356 o> 384\n
353 o> readline() -> 384:
357 o> readline() -> 384:
354 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
358 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
355 o> readline() -> 2:
359 o> readline() -> 2:
356 o> 1\n
360 o> 1\n
357 o> readline() -> 1:
361 o> readline() -> 1:
358 o> \n
362 o> \n
359 sending unbundle command
363 sending unbundle command
360 i> write(9) -> 9:
364 i> write(9) -> 9:
361 i> unbundle\n
365 i> unbundle\n
362 i> write(9) -> 9:
366 i> write(9) -> 9:
363 i> heads 10\n
367 i> heads 10\n
364 i> write(10) -> 10: 666f726365
368 i> write(10) -> 10: 666f726365
365 i> flush() -> None
369 i> flush() -> None
366 o> readline() -> 2:
370 o> readline() -> 2:
367 o> 0\n
371 o> 0\n
368 i> write(4) -> 4:
372 i> write(4) -> 4:
369 i> 426\n
373 i> 426\n
370 i> write(426) -> 426:
374 i> write(426) -> 426:
371 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
375 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
372 i> test\n
376 i> test\n
373 i> 0 0\n
377 i> 0 0\n
374 i> foo\n
378 i> foo\n
375 i> \n
379 i> \n
376 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
380 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
377 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
381 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
378 i> \x00\x00\x00\x00\x00\x00\x00\x00
382 i> \x00\x00\x00\x00\x00\x00\x00\x00
379 i> write(2) -> 2:
383 i> write(2) -> 2:
380 i> 0\n
384 i> 0\n
381 i> flush() -> None
385 i> flush() -> None
382 o> readline() -> 2:
386 o> readline() -> 2:
383 o> 0\n
387 o> 0\n
384 o> readline() -> 2:
388 o> readline() -> 2:
385 o> 1\n
389 o> 1\n
386 o> read(1) -> 1: 0
390 o> read(1) -> 1: 0
387 result: 0
391 result: 0
388 remote output:
392 remote output:
393 o> read(-1) -> 0:
389 e> read(-1) -> 218:
394 e> read(-1) -> 218:
390 e> adding changesets\n
395 e> adding changesets\n
391 e> adding manifests\n
396 e> adding manifests\n
392 e> adding file changes\n
397 e> adding file changes\n
393 e> added 1 changesets with 1 changes to 1 files\n
398 e> added 1 changesets with 1 changes to 1 files\n
394 e> ui.write 2 lines 1\n
399 e> ui.write 2 lines 1\n
395 e> ui.write 2 lines 2\n
400 e> ui.write 2 lines 2\n
396 e> transaction abort!\n
401 e> transaction abort!\n
397 e> rollback completed\n
402 e> rollback completed\n
398 e> abort: pretxnchangegroup.fail hook failed\n
403 e> abort: pretxnchangegroup.fail hook failed\n
399
404
400 testing ssh2
405 testing ssh2
401 creating ssh peer from handshake results
406 creating ssh peer from handshake results
402 i> write(171) -> 171:
407 i> write(171) -> 171:
403 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
408 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
404 i> hello\n
409 i> hello\n
405 i> between\n
410 i> between\n
406 i> pairs 81\n
411 i> pairs 81\n
407 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
412 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
408 i> flush() -> None
413 i> flush() -> None
409 o> readline() -> 62:
414 o> readline() -> 62:
410 o> upgraded * exp-ssh-v2-0001\n (glob)
415 o> upgraded * exp-ssh-v2-0001\n (glob)
411 o> readline() -> 4:
416 o> readline() -> 4:
412 o> 383\n
417 o> 383\n
413 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
418 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
414 o> read(1) -> 1:
419 o> read(1) -> 1:
415 o> \n
420 o> \n
416 sending unbundle command
421 sending unbundle command
417 i> write(9) -> 9:
422 i> write(9) -> 9:
418 i> unbundle\n
423 i> unbundle\n
419 i> write(9) -> 9:
424 i> write(9) -> 9:
420 i> heads 10\n
425 i> heads 10\n
421 i> write(10) -> 10: 666f726365
426 i> write(10) -> 10: 666f726365
422 i> flush() -> None
427 i> flush() -> None
423 o> readline() -> 2:
428 o> readline() -> 2:
424 o> 0\n
429 o> 0\n
425 i> write(4) -> 4:
430 i> write(4) -> 4:
426 i> 426\n
431 i> 426\n
427 i> write(426) -> 426:
432 i> write(426) -> 426:
428 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
433 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
429 i> test\n
434 i> test\n
430 i> 0 0\n
435 i> 0 0\n
431 i> foo\n
436 i> foo\n
432 i> \n
437 i> \n
433 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
438 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
434 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
439 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
435 i> \x00\x00\x00\x00\x00\x00\x00\x00
440 i> \x00\x00\x00\x00\x00\x00\x00\x00
436 i> write(2) -> 2:
441 i> write(2) -> 2:
437 i> 0\n
442 i> 0\n
438 i> flush() -> None
443 i> flush() -> None
439 o> readline() -> 2:
444 o> readline() -> 2:
440 o> 0\n
445 o> 0\n
441 o> readline() -> 2:
446 o> readline() -> 2:
442 o> 1\n
447 o> 1\n
443 o> read(1) -> 1: 0
448 o> read(1) -> 1: 0
444 result: 0
449 result: 0
445 remote output:
450 remote output:
451 o> read(-1) -> 0:
446 e> read(-1) -> 218:
452 e> read(-1) -> 218:
447 e> adding changesets\n
453 e> adding changesets\n
448 e> adding manifests\n
454 e> adding manifests\n
449 e> adding file changes\n
455 e> adding file changes\n
450 e> added 1 changesets with 1 changes to 1 files\n
456 e> added 1 changesets with 1 changes to 1 files\n
451 e> ui.write 2 lines 1\n
457 e> ui.write 2 lines 1\n
452 e> ui.write 2 lines 2\n
458 e> ui.write 2 lines 2\n
453 e> transaction abort!\n
459 e> transaction abort!\n
454 e> rollback completed\n
460 e> rollback completed\n
455 e> abort: pretxnchangegroup.fail hook failed\n
461 e> abort: pretxnchangegroup.fail hook failed\n
456
462
457 And a variation that does a ui.flush() after writing output
463 And a variation that does a ui.flush() after writing output
458
464
459 $ cat > .hg/hgrc << EOF
465 $ cat > .hg/hgrc << EOF
460 > [hooks]
466 > [hooks]
461 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush
467 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush
462 > EOF
468 > EOF
463
469
464 $ debugwireproto << EOF
470 $ debugwireproto << EOF
465 > command unbundle
471 > command unbundle
466 > # This is "force" in hex.
472 > # This is "force" in hex.
467 > heads 666f726365
473 > heads 666f726365
468 > PUSHFILE ../initial.v1.hg
474 > PUSHFILE ../initial.v1.hg
469 > readavailable
475 > readavailable
470 > EOF
476 > EOF
471 testing ssh1
477 testing ssh1
472 creating ssh peer from handshake results
478 creating ssh peer from handshake results
473 i> write(104) -> 104:
479 i> write(104) -> 104:
474 i> hello\n
480 i> hello\n
475 i> between\n
481 i> between\n
476 i> pairs 81\n
482 i> pairs 81\n
477 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
483 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
478 i> flush() -> None
484 i> flush() -> None
479 o> readline() -> 4:
485 o> readline() -> 4:
480 o> 384\n
486 o> 384\n
481 o> readline() -> 384:
487 o> readline() -> 384:
482 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
488 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
483 o> readline() -> 2:
489 o> readline() -> 2:
484 o> 1\n
490 o> 1\n
485 o> readline() -> 1:
491 o> readline() -> 1:
486 o> \n
492 o> \n
487 sending unbundle command
493 sending unbundle command
488 i> write(9) -> 9:
494 i> write(9) -> 9:
489 i> unbundle\n
495 i> unbundle\n
490 i> write(9) -> 9:
496 i> write(9) -> 9:
491 i> heads 10\n
497 i> heads 10\n
492 i> write(10) -> 10: 666f726365
498 i> write(10) -> 10: 666f726365
493 i> flush() -> None
499 i> flush() -> None
494 o> readline() -> 2:
500 o> readline() -> 2:
495 o> 0\n
501 o> 0\n
496 i> write(4) -> 4:
502 i> write(4) -> 4:
497 i> 426\n
503 i> 426\n
498 i> write(426) -> 426:
504 i> write(426) -> 426:
499 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
505 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
500 i> test\n
506 i> test\n
501 i> 0 0\n
507 i> 0 0\n
502 i> foo\n
508 i> foo\n
503 i> \n
509 i> \n
504 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
510 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
505 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
511 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
506 i> \x00\x00\x00\x00\x00\x00\x00\x00
512 i> \x00\x00\x00\x00\x00\x00\x00\x00
507 i> write(2) -> 2:
513 i> write(2) -> 2:
508 i> 0\n
514 i> 0\n
509 i> flush() -> None
515 i> flush() -> None
510 o> readline() -> 2:
516 o> readline() -> 2:
511 o> 0\n
517 o> 0\n
512 o> readline() -> 2:
518 o> readline() -> 2:
513 o> 1\n
519 o> 1\n
514 o> read(1) -> 1: 0
520 o> read(1) -> 1: 0
515 result: 0
521 result: 0
516 remote output:
522 remote output:
523 o> read(-1) -> 0:
517 e> read(-1) -> 202:
524 e> read(-1) -> 202:
518 e> adding changesets\n
525 e> adding changesets\n
519 e> adding manifests\n
526 e> adding manifests\n
520 e> adding file changes\n
527 e> adding file changes\n
521 e> added 1 changesets with 1 changes to 1 files\n
528 e> added 1 changesets with 1 changes to 1 files\n
522 e> ui.write 1 line flush\n
529 e> ui.write 1 line flush\n
523 e> transaction abort!\n
530 e> transaction abort!\n
524 e> rollback completed\n
531 e> rollback completed\n
525 e> abort: pretxnchangegroup.fail hook failed\n
532 e> abort: pretxnchangegroup.fail hook failed\n
526
533
527 testing ssh2
534 testing ssh2
528 creating ssh peer from handshake results
535 creating ssh peer from handshake results
529 i> write(171) -> 171:
536 i> write(171) -> 171:
530 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
537 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
531 i> hello\n
538 i> hello\n
532 i> between\n
539 i> between\n
533 i> pairs 81\n
540 i> pairs 81\n
534 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
541 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
535 i> flush() -> None
542 i> flush() -> None
536 o> readline() -> 62:
543 o> readline() -> 62:
537 o> upgraded * exp-ssh-v2-0001\n (glob)
544 o> upgraded * exp-ssh-v2-0001\n (glob)
538 o> readline() -> 4:
545 o> readline() -> 4:
539 o> 383\n
546 o> 383\n
540 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
547 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
541 o> read(1) -> 1:
548 o> read(1) -> 1:
542 o> \n
549 o> \n
543 sending unbundle command
550 sending unbundle command
544 i> write(9) -> 9:
551 i> write(9) -> 9:
545 i> unbundle\n
552 i> unbundle\n
546 i> write(9) -> 9:
553 i> write(9) -> 9:
547 i> heads 10\n
554 i> heads 10\n
548 i> write(10) -> 10: 666f726365
555 i> write(10) -> 10: 666f726365
549 i> flush() -> None
556 i> flush() -> None
550 o> readline() -> 2:
557 o> readline() -> 2:
551 o> 0\n
558 o> 0\n
552 i> write(4) -> 4:
559 i> write(4) -> 4:
553 i> 426\n
560 i> 426\n
554 i> write(426) -> 426:
561 i> write(426) -> 426:
555 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
562 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
556 i> test\n
563 i> test\n
557 i> 0 0\n
564 i> 0 0\n
558 i> foo\n
565 i> foo\n
559 i> \n
566 i> \n
560 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
567 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
561 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
568 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
562 i> \x00\x00\x00\x00\x00\x00\x00\x00
569 i> \x00\x00\x00\x00\x00\x00\x00\x00
563 i> write(2) -> 2:
570 i> write(2) -> 2:
564 i> 0\n
571 i> 0\n
565 i> flush() -> None
572 i> flush() -> None
566 o> readline() -> 2:
573 o> readline() -> 2:
567 o> 0\n
574 o> 0\n
568 o> readline() -> 2:
575 o> readline() -> 2:
569 o> 1\n
576 o> 1\n
570 o> read(1) -> 1: 0
577 o> read(1) -> 1: 0
571 result: 0
578 result: 0
572 remote output:
579 remote output:
580 o> read(-1) -> 0:
573 e> read(-1) -> 202:
581 e> read(-1) -> 202:
574 e> adding changesets\n
582 e> adding changesets\n
575 e> adding manifests\n
583 e> adding manifests\n
576 e> adding file changes\n
584 e> adding file changes\n
577 e> added 1 changesets with 1 changes to 1 files\n
585 e> added 1 changesets with 1 changes to 1 files\n
578 e> ui.write 1 line flush\n
586 e> ui.write 1 line flush\n
579 e> transaction abort!\n
587 e> transaction abort!\n
580 e> rollback completed\n
588 e> rollback completed\n
581 e> abort: pretxnchangegroup.fail hook failed\n
589 e> abort: pretxnchangegroup.fail hook failed\n
582
590
583 Multiple writes + flush
591 Multiple writes + flush
584
592
585 $ cat > .hg/hgrc << EOF
593 $ cat > .hg/hgrc << EOF
586 > [hooks]
594 > [hooks]
587 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush
595 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush
588 > EOF
596 > EOF
589
597
590 $ debugwireproto << EOF
598 $ debugwireproto << EOF
591 > command unbundle
599 > command unbundle
592 > # This is "force" in hex.
600 > # This is "force" in hex.
593 > heads 666f726365
601 > heads 666f726365
594 > PUSHFILE ../initial.v1.hg
602 > PUSHFILE ../initial.v1.hg
595 > readavailable
603 > readavailable
596 > EOF
604 > EOF
597 testing ssh1
605 testing ssh1
598 creating ssh peer from handshake results
606 creating ssh peer from handshake results
599 i> write(104) -> 104:
607 i> write(104) -> 104:
600 i> hello\n
608 i> hello\n
601 i> between\n
609 i> between\n
602 i> pairs 81\n
610 i> pairs 81\n
603 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
611 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
604 i> flush() -> None
612 i> flush() -> None
605 o> readline() -> 4:
613 o> readline() -> 4:
606 o> 384\n
614 o> 384\n
607 o> readline() -> 384:
615 o> readline() -> 384:
608 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
616 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
609 o> readline() -> 2:
617 o> readline() -> 2:
610 o> 1\n
618 o> 1\n
611 o> readline() -> 1:
619 o> readline() -> 1:
612 o> \n
620 o> \n
613 sending unbundle command
621 sending unbundle command
614 i> write(9) -> 9:
622 i> write(9) -> 9:
615 i> unbundle\n
623 i> unbundle\n
616 i> write(9) -> 9:
624 i> write(9) -> 9:
617 i> heads 10\n
625 i> heads 10\n
618 i> write(10) -> 10: 666f726365
626 i> write(10) -> 10: 666f726365
619 i> flush() -> None
627 i> flush() -> None
620 o> readline() -> 2:
628 o> readline() -> 2:
621 o> 0\n
629 o> 0\n
622 i> write(4) -> 4:
630 i> write(4) -> 4:
623 i> 426\n
631 i> 426\n
624 i> write(426) -> 426:
632 i> write(426) -> 426:
625 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
633 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
626 i> test\n
634 i> test\n
627 i> 0 0\n
635 i> 0 0\n
628 i> foo\n
636 i> foo\n
629 i> \n
637 i> \n
630 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
638 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
631 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
639 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
632 i> \x00\x00\x00\x00\x00\x00\x00\x00
640 i> \x00\x00\x00\x00\x00\x00\x00\x00
633 i> write(2) -> 2:
641 i> write(2) -> 2:
634 i> 0\n
642 i> 0\n
635 i> flush() -> None
643 i> flush() -> None
636 o> readline() -> 2:
644 o> readline() -> 2:
637 o> 0\n
645 o> 0\n
638 o> readline() -> 2:
646 o> readline() -> 2:
639 o> 1\n
647 o> 1\n
640 o> read(1) -> 1: 0
648 o> read(1) -> 1: 0
641 result: 0
649 result: 0
642 remote output:
650 remote output:
651 o> read(-1) -> 0:
643 e> read(-1) -> 206:
652 e> read(-1) -> 206:
644 e> adding changesets\n
653 e> adding changesets\n
645 e> adding manifests\n
654 e> adding manifests\n
646 e> adding file changes\n
655 e> adding file changes\n
647 e> added 1 changesets with 1 changes to 1 files\n
656 e> added 1 changesets with 1 changes to 1 files\n
648 e> ui.write 1st\n
657 e> ui.write 1st\n
649 e> ui.write 2nd\n
658 e> ui.write 2nd\n
650 e> transaction abort!\n
659 e> transaction abort!\n
651 e> rollback completed\n
660 e> rollback completed\n
652 e> abort: pretxnchangegroup.fail hook failed\n
661 e> abort: pretxnchangegroup.fail hook failed\n
653
662
654 testing ssh2
663 testing ssh2
655 creating ssh peer from handshake results
664 creating ssh peer from handshake results
656 i> write(171) -> 171:
665 i> write(171) -> 171:
657 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
666 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
658 i> hello\n
667 i> hello\n
659 i> between\n
668 i> between\n
660 i> pairs 81\n
669 i> pairs 81\n
661 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
670 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
662 i> flush() -> None
671 i> flush() -> None
663 o> readline() -> 62:
672 o> readline() -> 62:
664 o> upgraded * exp-ssh-v2-0001\n (glob)
673 o> upgraded * exp-ssh-v2-0001\n (glob)
665 o> readline() -> 4:
674 o> readline() -> 4:
666 o> 383\n
675 o> 383\n
667 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
676 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
668 o> read(1) -> 1:
677 o> read(1) -> 1:
669 o> \n
678 o> \n
670 sending unbundle command
679 sending unbundle command
671 i> write(9) -> 9:
680 i> write(9) -> 9:
672 i> unbundle\n
681 i> unbundle\n
673 i> write(9) -> 9:
682 i> write(9) -> 9:
674 i> heads 10\n
683 i> heads 10\n
675 i> write(10) -> 10: 666f726365
684 i> write(10) -> 10: 666f726365
676 i> flush() -> None
685 i> flush() -> None
677 o> readline() -> 2:
686 o> readline() -> 2:
678 o> 0\n
687 o> 0\n
679 i> write(4) -> 4:
688 i> write(4) -> 4:
680 i> 426\n
689 i> 426\n
681 i> write(426) -> 426:
690 i> write(426) -> 426:
682 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
691 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
683 i> test\n
692 i> test\n
684 i> 0 0\n
693 i> 0 0\n
685 i> foo\n
694 i> foo\n
686 i> \n
695 i> \n
687 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
696 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
688 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
697 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
689 i> \x00\x00\x00\x00\x00\x00\x00\x00
698 i> \x00\x00\x00\x00\x00\x00\x00\x00
690 i> write(2) -> 2:
699 i> write(2) -> 2:
691 i> 0\n
700 i> 0\n
692 i> flush() -> None
701 i> flush() -> None
693 o> readline() -> 2:
702 o> readline() -> 2:
694 o> 0\n
703 o> 0\n
695 o> readline() -> 2:
704 o> readline() -> 2:
696 o> 1\n
705 o> 1\n
697 o> read(1) -> 1: 0
706 o> read(1) -> 1: 0
698 result: 0
707 result: 0
699 remote output:
708 remote output:
709 o> read(-1) -> 0:
700 e> read(-1) -> 206:
710 e> read(-1) -> 206:
701 e> adding changesets\n
711 e> adding changesets\n
702 e> adding manifests\n
712 e> adding manifests\n
703 e> adding file changes\n
713 e> adding file changes\n
704 e> added 1 changesets with 1 changes to 1 files\n
714 e> added 1 changesets with 1 changes to 1 files\n
705 e> ui.write 1st\n
715 e> ui.write 1st\n
706 e> ui.write 2nd\n
716 e> ui.write 2nd\n
707 e> transaction abort!\n
717 e> transaction abort!\n
708 e> rollback completed\n
718 e> rollback completed\n
709 e> abort: pretxnchangegroup.fail hook failed\n
719 e> abort: pretxnchangegroup.fail hook failed\n
710
720
711 ui.write() + ui.write_err() output is captured
721 ui.write() + ui.write_err() output is captured
712
722
713 $ cat > .hg/hgrc << EOF
723 $ cat > .hg/hgrc << EOF
714 > [hooks]
724 > [hooks]
715 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr
725 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr
716 > EOF
726 > EOF
717
727
718 $ debugwireproto << EOF
728 $ debugwireproto << EOF
719 > command unbundle
729 > command unbundle
720 > # This is "force" in hex.
730 > # This is "force" in hex.
721 > heads 666f726365
731 > heads 666f726365
722 > PUSHFILE ../initial.v1.hg
732 > PUSHFILE ../initial.v1.hg
723 > readavailable
733 > readavailable
724 > EOF
734 > EOF
725 testing ssh1
735 testing ssh1
726 creating ssh peer from handshake results
736 creating ssh peer from handshake results
727 i> write(104) -> 104:
737 i> write(104) -> 104:
728 i> hello\n
738 i> hello\n
729 i> between\n
739 i> between\n
730 i> pairs 81\n
740 i> pairs 81\n
731 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
741 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
732 i> flush() -> None
742 i> flush() -> None
733 o> readline() -> 4:
743 o> readline() -> 4:
734 o> 384\n
744 o> 384\n
735 o> readline() -> 384:
745 o> readline() -> 384:
736 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
746 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
737 o> readline() -> 2:
747 o> readline() -> 2:
738 o> 1\n
748 o> 1\n
739 o> readline() -> 1:
749 o> readline() -> 1:
740 o> \n
750 o> \n
741 sending unbundle command
751 sending unbundle command
742 i> write(9) -> 9:
752 i> write(9) -> 9:
743 i> unbundle\n
753 i> unbundle\n
744 i> write(9) -> 9:
754 i> write(9) -> 9:
745 i> heads 10\n
755 i> heads 10\n
746 i> write(10) -> 10: 666f726365
756 i> write(10) -> 10: 666f726365
747 i> flush() -> None
757 i> flush() -> None
748 o> readline() -> 2:
758 o> readline() -> 2:
749 o> 0\n
759 o> 0\n
750 i> write(4) -> 4:
760 i> write(4) -> 4:
751 i> 426\n
761 i> 426\n
752 i> write(426) -> 426:
762 i> write(426) -> 426:
753 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
763 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
754 i> test\n
764 i> test\n
755 i> 0 0\n
765 i> 0 0\n
756 i> foo\n
766 i> foo\n
757 i> \n
767 i> \n
758 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
768 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
759 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
769 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
760 i> \x00\x00\x00\x00\x00\x00\x00\x00
770 i> \x00\x00\x00\x00\x00\x00\x00\x00
761 i> write(2) -> 2:
771 i> write(2) -> 2:
762 i> 0\n
772 i> 0\n
763 i> flush() -> None
773 i> flush() -> None
764 o> readline() -> 2:
774 o> readline() -> 2:
765 o> 0\n
775 o> 0\n
766 o> readline() -> 2:
776 o> readline() -> 2:
767 o> 1\n
777 o> 1\n
768 o> read(1) -> 1: 0
778 o> read(1) -> 1: 0
769 result: 0
779 result: 0
770 remote output:
780 remote output:
781 o> read(-1) -> 0:
771 e> read(-1) -> 232:
782 e> read(-1) -> 232:
772 e> adding changesets\n
783 e> adding changesets\n
773 e> adding manifests\n
784 e> adding manifests\n
774 e> adding file changes\n
785 e> adding file changes\n
775 e> added 1 changesets with 1 changes to 1 files\n
786 e> added 1 changesets with 1 changes to 1 files\n
776 e> ui.write 1\n
787 e> ui.write 1\n
777 e> ui.write_err 1\n
788 e> ui.write_err 1\n
778 e> ui.write 2\n
789 e> ui.write 2\n
779 e> ui.write_err 2\n
790 e> ui.write_err 2\n
780 e> transaction abort!\n
791 e> transaction abort!\n
781 e> rollback completed\n
792 e> rollback completed\n
782 e> abort: pretxnchangegroup.fail hook failed\n
793 e> abort: pretxnchangegroup.fail hook failed\n
783
794
784 testing ssh2
795 testing ssh2
785 creating ssh peer from handshake results
796 creating ssh peer from handshake results
786 i> write(171) -> 171:
797 i> write(171) -> 171:
787 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
798 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
788 i> hello\n
799 i> hello\n
789 i> between\n
800 i> between\n
790 i> pairs 81\n
801 i> pairs 81\n
791 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
802 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
792 i> flush() -> None
803 i> flush() -> None
793 o> readline() -> 62:
804 o> readline() -> 62:
794 o> upgraded * exp-ssh-v2-0001\n (glob)
805 o> upgraded * exp-ssh-v2-0001\n (glob)
795 o> readline() -> 4:
806 o> readline() -> 4:
796 o> 383\n
807 o> 383\n
797 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
808 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
798 o> read(1) -> 1:
809 o> read(1) -> 1:
799 o> \n
810 o> \n
800 sending unbundle command
811 sending unbundle command
801 i> write(9) -> 9:
812 i> write(9) -> 9:
802 i> unbundle\n
813 i> unbundle\n
803 i> write(9) -> 9:
814 i> write(9) -> 9:
804 i> heads 10\n
815 i> heads 10\n
805 i> write(10) -> 10: 666f726365
816 i> write(10) -> 10: 666f726365
806 i> flush() -> None
817 i> flush() -> None
807 o> readline() -> 2:
818 o> readline() -> 2:
808 o> 0\n
819 o> 0\n
809 i> write(4) -> 4:
820 i> write(4) -> 4:
810 i> 426\n
821 i> 426\n
811 i> write(426) -> 426:
822 i> write(426) -> 426:
812 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
823 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
813 i> test\n
824 i> test\n
814 i> 0 0\n
825 i> 0 0\n
815 i> foo\n
826 i> foo\n
816 i> \n
827 i> \n
817 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
828 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
818 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
829 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
819 i> \x00\x00\x00\x00\x00\x00\x00\x00
830 i> \x00\x00\x00\x00\x00\x00\x00\x00
820 i> write(2) -> 2:
831 i> write(2) -> 2:
821 i> 0\n
832 i> 0\n
822 i> flush() -> None
833 i> flush() -> None
823 o> readline() -> 2:
834 o> readline() -> 2:
824 o> 0\n
835 o> 0\n
825 o> readline() -> 2:
836 o> readline() -> 2:
826 o> 1\n
837 o> 1\n
827 o> read(1) -> 1: 0
838 o> read(1) -> 1: 0
828 result: 0
839 result: 0
829 remote output:
840 remote output:
841 o> read(-1) -> 0:
830 e> read(-1) -> 232:
842 e> read(-1) -> 232:
831 e> adding changesets\n
843 e> adding changesets\n
832 e> adding manifests\n
844 e> adding manifests\n
833 e> adding file changes\n
845 e> adding file changes\n
834 e> added 1 changesets with 1 changes to 1 files\n
846 e> added 1 changesets with 1 changes to 1 files\n
835 e> ui.write 1\n
847 e> ui.write 1\n
836 e> ui.write_err 1\n
848 e> ui.write_err 1\n
837 e> ui.write 2\n
849 e> ui.write 2\n
838 e> ui.write_err 2\n
850 e> ui.write_err 2\n
839 e> transaction abort!\n
851 e> transaction abort!\n
840 e> rollback completed\n
852 e> rollback completed\n
841 e> abort: pretxnchangegroup.fail hook failed\n
853 e> abort: pretxnchangegroup.fail hook failed\n
842
854
843 print() output is captured
855 print() output is captured
844
856
845 $ cat > .hg/hgrc << EOF
857 $ cat > .hg/hgrc << EOF
846 > [hooks]
858 > [hooks]
847 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout
859 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout
848 > EOF
860 > EOF
849
861
850 $ debugwireproto << EOF
862 $ debugwireproto << EOF
851 > command unbundle
863 > command unbundle
852 > # This is "force" in hex.
864 > # This is "force" in hex.
853 > heads 666f726365
865 > heads 666f726365
854 > PUSHFILE ../initial.v1.hg
866 > PUSHFILE ../initial.v1.hg
855 > readavailable
867 > readavailable
856 > EOF
868 > EOF
857 testing ssh1
869 testing ssh1
858 creating ssh peer from handshake results
870 creating ssh peer from handshake results
859 i> write(104) -> 104:
871 i> write(104) -> 104:
860 i> hello\n
872 i> hello\n
861 i> between\n
873 i> between\n
862 i> pairs 81\n
874 i> pairs 81\n
863 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
875 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
864 i> flush() -> None
876 i> flush() -> None
865 o> readline() -> 4:
877 o> readline() -> 4:
866 o> 384\n
878 o> 384\n
867 o> readline() -> 384:
879 o> readline() -> 384:
868 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
880 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
869 o> readline() -> 2:
881 o> readline() -> 2:
870 o> 1\n
882 o> 1\n
871 o> readline() -> 1:
883 o> readline() -> 1:
872 o> \n
884 o> \n
873 sending unbundle command
885 sending unbundle command
874 i> write(9) -> 9:
886 i> write(9) -> 9:
875 i> unbundle\n
887 i> unbundle\n
876 i> write(9) -> 9:
888 i> write(9) -> 9:
877 i> heads 10\n
889 i> heads 10\n
878 i> write(10) -> 10: 666f726365
890 i> write(10) -> 10: 666f726365
879 i> flush() -> None
891 i> flush() -> None
880 o> readline() -> 2:
892 o> readline() -> 2:
881 o> 0\n
893 o> 0\n
882 i> write(4) -> 4:
894 i> write(4) -> 4:
883 i> 426\n
895 i> 426\n
884 i> write(426) -> 426:
896 i> write(426) -> 426:
885 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
897 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
886 i> test\n
898 i> test\n
887 i> 0 0\n
899 i> 0 0\n
888 i> foo\n
900 i> foo\n
889 i> \n
901 i> \n
890 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
902 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
891 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
903 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
892 i> \x00\x00\x00\x00\x00\x00\x00\x00
904 i> \x00\x00\x00\x00\x00\x00\x00\x00
893 i> write(2) -> 2:
905 i> write(2) -> 2:
894 i> 0\n
906 i> 0\n
895 i> flush() -> None
907 i> flush() -> None
896 o> readline() -> 2:
908 o> readline() -> 2:
897 o> 0\n
909 o> 0\n
898 o> readline() -> 2:
910 o> readline() -> 2:
899 o> 1\n
911 o> 1\n
900 o> read(1) -> 1: 0
912 o> read(1) -> 1: 0
901 result: 0
913 result: 0
902 remote output:
914 remote output:
915 o> read(-1) -> 0:
903 e> read(-1) -> 193:
916 e> read(-1) -> 193:
904 e> adding changesets\n
917 e> adding changesets\n
905 e> adding manifests\n
918 e> adding manifests\n
906 e> adding file changes\n
919 e> adding file changes\n
907 e> added 1 changesets with 1 changes to 1 files\n
920 e> added 1 changesets with 1 changes to 1 files\n
908 e> printed line\n
921 e> printed line\n
909 e> transaction abort!\n
922 e> transaction abort!\n
910 e> rollback completed\n
923 e> rollback completed\n
911 e> abort: pretxnchangegroup.fail hook failed\n
924 e> abort: pretxnchangegroup.fail hook failed\n
912
925
913 testing ssh2
926 testing ssh2
914 creating ssh peer from handshake results
927 creating ssh peer from handshake results
915 i> write(171) -> 171:
928 i> write(171) -> 171:
916 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
929 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
917 i> hello\n
930 i> hello\n
918 i> between\n
931 i> between\n
919 i> pairs 81\n
932 i> pairs 81\n
920 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
933 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
921 i> flush() -> None
934 i> flush() -> None
922 o> readline() -> 62:
935 o> readline() -> 62:
923 o> upgraded * exp-ssh-v2-0001\n (glob)
936 o> upgraded * exp-ssh-v2-0001\n (glob)
924 o> readline() -> 4:
937 o> readline() -> 4:
925 o> 383\n
938 o> 383\n
926 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
939 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
927 o> read(1) -> 1:
940 o> read(1) -> 1:
928 o> \n
941 o> \n
929 sending unbundle command
942 sending unbundle command
930 i> write(9) -> 9:
943 i> write(9) -> 9:
931 i> unbundle\n
944 i> unbundle\n
932 i> write(9) -> 9:
945 i> write(9) -> 9:
933 i> heads 10\n
946 i> heads 10\n
934 i> write(10) -> 10: 666f726365
947 i> write(10) -> 10: 666f726365
935 i> flush() -> None
948 i> flush() -> None
936 o> readline() -> 2:
949 o> readline() -> 2:
937 o> 0\n
950 o> 0\n
938 i> write(4) -> 4:
951 i> write(4) -> 4:
939 i> 426\n
952 i> 426\n
940 i> write(426) -> 426:
953 i> write(426) -> 426:
941 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
954 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
942 i> test\n
955 i> test\n
943 i> 0 0\n
956 i> 0 0\n
944 i> foo\n
957 i> foo\n
945 i> \n
958 i> \n
946 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
959 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
947 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
960 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
948 i> \x00\x00\x00\x00\x00\x00\x00\x00
961 i> \x00\x00\x00\x00\x00\x00\x00\x00
949 i> write(2) -> 2:
962 i> write(2) -> 2:
950 i> 0\n
963 i> 0\n
951 i> flush() -> None
964 i> flush() -> None
952 o> readline() -> 2:
965 o> readline() -> 2:
953 o> 0\n
966 o> 0\n
954 o> readline() -> 2:
967 o> readline() -> 2:
955 o> 1\n
968 o> 1\n
956 o> read(1) -> 1: 0
969 o> read(1) -> 1: 0
957 result: 0
970 result: 0
958 remote output:
971 remote output:
972 o> read(-1) -> 0:
959 e> read(-1) -> 193:
973 e> read(-1) -> 193:
960 e> adding changesets\n
974 e> adding changesets\n
961 e> adding manifests\n
975 e> adding manifests\n
962 e> adding file changes\n
976 e> adding file changes\n
963 e> added 1 changesets with 1 changes to 1 files\n
977 e> added 1 changesets with 1 changes to 1 files\n
964 e> printed line\n
978 e> printed line\n
965 e> transaction abort!\n
979 e> transaction abort!\n
966 e> rollback completed\n
980 e> rollback completed\n
967 e> abort: pretxnchangegroup.fail hook failed\n
981 e> abort: pretxnchangegroup.fail hook failed\n
968
982
969 Mixed print() and ui.write() are both captured
983 Mixed print() and ui.write() are both captured
970
984
971 $ cat > .hg/hgrc << EOF
985 $ cat > .hg/hgrc << EOF
972 > [hooks]
986 > [hooks]
973 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite
987 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite
974 > EOF
988 > EOF
975
989
976 $ debugwireproto << EOF
990 $ debugwireproto << EOF
977 > command unbundle
991 > command unbundle
978 > # This is "force" in hex.
992 > # This is "force" in hex.
979 > heads 666f726365
993 > heads 666f726365
980 > PUSHFILE ../initial.v1.hg
994 > PUSHFILE ../initial.v1.hg
981 > readavailable
995 > readavailable
982 > EOF
996 > EOF
983 testing ssh1
997 testing ssh1
984 creating ssh peer from handshake results
998 creating ssh peer from handshake results
985 i> write(104) -> 104:
999 i> write(104) -> 104:
986 i> hello\n
1000 i> hello\n
987 i> between\n
1001 i> between\n
988 i> pairs 81\n
1002 i> pairs 81\n
989 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1003 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
990 i> flush() -> None
1004 i> flush() -> None
991 o> readline() -> 4:
1005 o> readline() -> 4:
992 o> 384\n
1006 o> 384\n
993 o> readline() -> 384:
1007 o> readline() -> 384:
994 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1008 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
995 o> readline() -> 2:
1009 o> readline() -> 2:
996 o> 1\n
1010 o> 1\n
997 o> readline() -> 1:
1011 o> readline() -> 1:
998 o> \n
1012 o> \n
999 sending unbundle command
1013 sending unbundle command
1000 i> write(9) -> 9:
1014 i> write(9) -> 9:
1001 i> unbundle\n
1015 i> unbundle\n
1002 i> write(9) -> 9:
1016 i> write(9) -> 9:
1003 i> heads 10\n
1017 i> heads 10\n
1004 i> write(10) -> 10: 666f726365
1018 i> write(10) -> 10: 666f726365
1005 i> flush() -> None
1019 i> flush() -> None
1006 o> readline() -> 2:
1020 o> readline() -> 2:
1007 o> 0\n
1021 o> 0\n
1008 i> write(4) -> 4:
1022 i> write(4) -> 4:
1009 i> 426\n
1023 i> 426\n
1010 i> write(426) -> 426:
1024 i> write(426) -> 426:
1011 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1025 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1012 i> test\n
1026 i> test\n
1013 i> 0 0\n
1027 i> 0 0\n
1014 i> foo\n
1028 i> foo\n
1015 i> \n
1029 i> \n
1016 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1030 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1017 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1031 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1018 i> \x00\x00\x00\x00\x00\x00\x00\x00
1032 i> \x00\x00\x00\x00\x00\x00\x00\x00
1019 i> write(2) -> 2:
1033 i> write(2) -> 2:
1020 i> 0\n
1034 i> 0\n
1021 i> flush() -> None
1035 i> flush() -> None
1022 o> readline() -> 2:
1036 o> readline() -> 2:
1023 o> 0\n
1037 o> 0\n
1024 o> readline() -> 2:
1038 o> readline() -> 2:
1025 o> 1\n
1039 o> 1\n
1026 o> read(1) -> 1: 0
1040 o> read(1) -> 1: 0
1027 result: 0
1041 result: 0
1028 remote output:
1042 remote output:
1043 o> read(-1) -> 0:
1029 e> read(-1) -> 218:
1044 e> read(-1) -> 218:
1030 e> adding changesets\n
1045 e> adding changesets\n
1031 e> adding manifests\n
1046 e> adding manifests\n
1032 e> adding file changes\n
1047 e> adding file changes\n
1033 e> added 1 changesets with 1 changes to 1 files\n
1048 e> added 1 changesets with 1 changes to 1 files\n
1034 e> ui.write 1\n
1049 e> ui.write 1\n
1035 e> ui.write 2\n
1050 e> ui.write 2\n
1036 e> print 1\n
1051 e> print 1\n
1037 e> print 2\n
1052 e> print 2\n
1038 e> transaction abort!\n
1053 e> transaction abort!\n
1039 e> rollback completed\n
1054 e> rollback completed\n
1040 e> abort: pretxnchangegroup.fail hook failed\n
1055 e> abort: pretxnchangegroup.fail hook failed\n
1041
1056
1042 testing ssh2
1057 testing ssh2
1043 creating ssh peer from handshake results
1058 creating ssh peer from handshake results
1044 i> write(171) -> 171:
1059 i> write(171) -> 171:
1045 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1060 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1046 i> hello\n
1061 i> hello\n
1047 i> between\n
1062 i> between\n
1048 i> pairs 81\n
1063 i> pairs 81\n
1049 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1064 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1050 i> flush() -> None
1065 i> flush() -> None
1051 o> readline() -> 62:
1066 o> readline() -> 62:
1052 o> upgraded * exp-ssh-v2-0001\n (glob)
1067 o> upgraded * exp-ssh-v2-0001\n (glob)
1053 o> readline() -> 4:
1068 o> readline() -> 4:
1054 o> 383\n
1069 o> 383\n
1055 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1070 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1056 o> read(1) -> 1:
1071 o> read(1) -> 1:
1057 o> \n
1072 o> \n
1058 sending unbundle command
1073 sending unbundle command
1059 i> write(9) -> 9:
1074 i> write(9) -> 9:
1060 i> unbundle\n
1075 i> unbundle\n
1061 i> write(9) -> 9:
1076 i> write(9) -> 9:
1062 i> heads 10\n
1077 i> heads 10\n
1063 i> write(10) -> 10: 666f726365
1078 i> write(10) -> 10: 666f726365
1064 i> flush() -> None
1079 i> flush() -> None
1065 o> readline() -> 2:
1080 o> readline() -> 2:
1066 o> 0\n
1081 o> 0\n
1067 i> write(4) -> 4:
1082 i> write(4) -> 4:
1068 i> 426\n
1083 i> 426\n
1069 i> write(426) -> 426:
1084 i> write(426) -> 426:
1070 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1085 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1071 i> test\n
1086 i> test\n
1072 i> 0 0\n
1087 i> 0 0\n
1073 i> foo\n
1088 i> foo\n
1074 i> \n
1089 i> \n
1075 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1090 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1076 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1091 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1077 i> \x00\x00\x00\x00\x00\x00\x00\x00
1092 i> \x00\x00\x00\x00\x00\x00\x00\x00
1078 i> write(2) -> 2:
1093 i> write(2) -> 2:
1079 i> 0\n
1094 i> 0\n
1080 i> flush() -> None
1095 i> flush() -> None
1081 o> readline() -> 2:
1096 o> readline() -> 2:
1082 o> 0\n
1097 o> 0\n
1083 o> readline() -> 2:
1098 o> readline() -> 2:
1084 o> 1\n
1099 o> 1\n
1085 o> read(1) -> 1: 0
1100 o> read(1) -> 1: 0
1086 result: 0
1101 result: 0
1087 remote output:
1102 remote output:
1103 o> read(-1) -> 0:
1088 e> read(-1) -> 218:
1104 e> read(-1) -> 218:
1089 e> adding changesets\n
1105 e> adding changesets\n
1090 e> adding manifests\n
1106 e> adding manifests\n
1091 e> adding file changes\n
1107 e> adding file changes\n
1092 e> added 1 changesets with 1 changes to 1 files\n
1108 e> added 1 changesets with 1 changes to 1 files\n
1093 e> ui.write 1\n
1109 e> ui.write 1\n
1094 e> ui.write 2\n
1110 e> ui.write 2\n
1095 e> print 1\n
1111 e> print 1\n
1096 e> print 2\n
1112 e> print 2\n
1097 e> transaction abort!\n
1113 e> transaction abort!\n
1098 e> rollback completed\n
1114 e> rollback completed\n
1099 e> abort: pretxnchangegroup.fail hook failed\n
1115 e> abort: pretxnchangegroup.fail hook failed\n
1100
1116
1101 print() to stdout and stderr both get captured
1117 print() to stdout and stderr both get captured
1102
1118
1103 $ cat > .hg/hgrc << EOF
1119 $ cat > .hg/hgrc << EOF
1104 > [hooks]
1120 > [hooks]
1105 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout
1121 > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout
1106 > EOF
1122 > EOF
1107
1123
1108 $ debugwireproto << EOF
1124 $ debugwireproto << EOF
1109 > command unbundle
1125 > command unbundle
1110 > # This is "force" in hex.
1126 > # This is "force" in hex.
1111 > heads 666f726365
1127 > heads 666f726365
1112 > PUSHFILE ../initial.v1.hg
1128 > PUSHFILE ../initial.v1.hg
1113 > readavailable
1129 > readavailable
1114 > EOF
1130 > EOF
1115 testing ssh1
1131 testing ssh1
1116 creating ssh peer from handshake results
1132 creating ssh peer from handshake results
1117 i> write(104) -> 104:
1133 i> write(104) -> 104:
1118 i> hello\n
1134 i> hello\n
1119 i> between\n
1135 i> between\n
1120 i> pairs 81\n
1136 i> pairs 81\n
1121 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1137 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1122 i> flush() -> None
1138 i> flush() -> None
1123 o> readline() -> 4:
1139 o> readline() -> 4:
1124 o> 384\n
1140 o> 384\n
1125 o> readline() -> 384:
1141 o> readline() -> 384:
1126 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1142 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1127 o> readline() -> 2:
1143 o> readline() -> 2:
1128 o> 1\n
1144 o> 1\n
1129 o> readline() -> 1:
1145 o> readline() -> 1:
1130 o> \n
1146 o> \n
1131 sending unbundle command
1147 sending unbundle command
1132 i> write(9) -> 9:
1148 i> write(9) -> 9:
1133 i> unbundle\n
1149 i> unbundle\n
1134 i> write(9) -> 9:
1150 i> write(9) -> 9:
1135 i> heads 10\n
1151 i> heads 10\n
1136 i> write(10) -> 10: 666f726365
1152 i> write(10) -> 10: 666f726365
1137 i> flush() -> None
1153 i> flush() -> None
1138 o> readline() -> 2:
1154 o> readline() -> 2:
1139 o> 0\n
1155 o> 0\n
1140 i> write(4) -> 4:
1156 i> write(4) -> 4:
1141 i> 426\n
1157 i> 426\n
1142 i> write(426) -> 426:
1158 i> write(426) -> 426:
1143 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1159 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1144 i> test\n
1160 i> test\n
1145 i> 0 0\n
1161 i> 0 0\n
1146 i> foo\n
1162 i> foo\n
1147 i> \n
1163 i> \n
1148 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1164 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1149 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1165 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1150 i> \x00\x00\x00\x00\x00\x00\x00\x00
1166 i> \x00\x00\x00\x00\x00\x00\x00\x00
1151 i> write(2) -> 2:
1167 i> write(2) -> 2:
1152 i> 0\n
1168 i> 0\n
1153 i> flush() -> None
1169 i> flush() -> None
1154 o> readline() -> 2:
1170 o> readline() -> 2:
1155 o> 0\n
1171 o> 0\n
1156 o> readline() -> 2:
1172 o> readline() -> 2:
1157 o> 1\n
1173 o> 1\n
1158 o> read(1) -> 1: 0
1174 o> read(1) -> 1: 0
1159 result: 0
1175 result: 0
1160 remote output:
1176 remote output:
1177 o> read(-1) -> 0:
1161 e> read(-1) -> 216:
1178 e> read(-1) -> 216:
1162 e> adding changesets\n
1179 e> adding changesets\n
1163 e> adding manifests\n
1180 e> adding manifests\n
1164 e> adding file changes\n
1181 e> adding file changes\n
1165 e> added 1 changesets with 1 changes to 1 files\n
1182 e> added 1 changesets with 1 changes to 1 files\n
1166 e> stderr 1\n
1183 e> stderr 1\n
1167 e> stderr 2\n
1184 e> stderr 2\n
1168 e> stdout 1\n
1185 e> stdout 1\n
1169 e> stdout 2\n
1186 e> stdout 2\n
1170 e> transaction abort!\n
1187 e> transaction abort!\n
1171 e> rollback completed\n
1188 e> rollback completed\n
1172 e> abort: pretxnchangegroup.fail hook failed\n
1189 e> abort: pretxnchangegroup.fail hook failed\n
1173
1190
1174 testing ssh2
1191 testing ssh2
1175 creating ssh peer from handshake results
1192 creating ssh peer from handshake results
1176 i> write(171) -> 171:
1193 i> write(171) -> 171:
1177 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1194 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1178 i> hello\n
1195 i> hello\n
1179 i> between\n
1196 i> between\n
1180 i> pairs 81\n
1197 i> pairs 81\n
1181 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1198 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1182 i> flush() -> None
1199 i> flush() -> None
1183 o> readline() -> 62:
1200 o> readline() -> 62:
1184 o> upgraded * exp-ssh-v2-0001\n (glob)
1201 o> upgraded * exp-ssh-v2-0001\n (glob)
1185 o> readline() -> 4:
1202 o> readline() -> 4:
1186 o> 383\n
1203 o> 383\n
1187 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1204 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1188 o> read(1) -> 1:
1205 o> read(1) -> 1:
1189 o> \n
1206 o> \n
1190 sending unbundle command
1207 sending unbundle command
1191 i> write(9) -> 9:
1208 i> write(9) -> 9:
1192 i> unbundle\n
1209 i> unbundle\n
1193 i> write(9) -> 9:
1210 i> write(9) -> 9:
1194 i> heads 10\n
1211 i> heads 10\n
1195 i> write(10) -> 10: 666f726365
1212 i> write(10) -> 10: 666f726365
1196 i> flush() -> None
1213 i> flush() -> None
1197 o> readline() -> 2:
1214 o> readline() -> 2:
1198 o> 0\n
1215 o> 0\n
1199 i> write(4) -> 4:
1216 i> write(4) -> 4:
1200 i> 426\n
1217 i> 426\n
1201 i> write(426) -> 426:
1218 i> write(426) -> 426:
1202 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1219 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1203 i> test\n
1220 i> test\n
1204 i> 0 0\n
1221 i> 0 0\n
1205 i> foo\n
1222 i> foo\n
1206 i> \n
1223 i> \n
1207 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1224 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1208 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1225 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1209 i> \x00\x00\x00\x00\x00\x00\x00\x00
1226 i> \x00\x00\x00\x00\x00\x00\x00\x00
1210 i> write(2) -> 2:
1227 i> write(2) -> 2:
1211 i> 0\n
1228 i> 0\n
1212 i> flush() -> None
1229 i> flush() -> None
1213 o> readline() -> 2:
1230 o> readline() -> 2:
1214 o> 0\n
1231 o> 0\n
1215 o> readline() -> 2:
1232 o> readline() -> 2:
1216 o> 1\n
1233 o> 1\n
1217 o> read(1) -> 1: 0
1234 o> read(1) -> 1: 0
1218 result: 0
1235 result: 0
1219 remote output:
1236 remote output:
1237 o> read(-1) -> 0:
1220 e> read(-1) -> 216:
1238 e> read(-1) -> 216:
1221 e> adding changesets\n
1239 e> adding changesets\n
1222 e> adding manifests\n
1240 e> adding manifests\n
1223 e> adding file changes\n
1241 e> adding file changes\n
1224 e> added 1 changesets with 1 changes to 1 files\n
1242 e> added 1 changesets with 1 changes to 1 files\n
1225 e> stderr 1\n
1243 e> stderr 1\n
1226 e> stderr 2\n
1244 e> stderr 2\n
1227 e> stdout 1\n
1245 e> stdout 1\n
1228 e> stdout 2\n
1246 e> stdout 2\n
1229 e> transaction abort!\n
1247 e> transaction abort!\n
1230 e> rollback completed\n
1248 e> rollback completed\n
1231 e> abort: pretxnchangegroup.fail hook failed\n
1249 e> abort: pretxnchangegroup.fail hook failed\n
1232
1250
1233 Shell hook writing to stdout has output captured
1251 Shell hook writing to stdout has output captured
1234
1252
1235 $ cat > $TESTTMP/hook.sh << EOF
1253 $ cat > $TESTTMP/hook.sh << EOF
1236 > echo 'stdout 1'
1254 > echo 'stdout 1'
1237 > echo 'stdout 2'
1255 > echo 'stdout 2'
1238 > exit 1
1256 > exit 1
1239 > EOF
1257 > EOF
1240
1258
1241 $ cat > .hg/hgrc << EOF
1259 $ cat > .hg/hgrc << EOF
1242 > [hooks]
1260 > [hooks]
1243 > pretxnchangegroup.fail = sh $TESTTMP/hook.sh
1261 > pretxnchangegroup.fail = sh $TESTTMP/hook.sh
1244 > EOF
1262 > EOF
1245
1263
1246 $ debugwireproto << EOF
1264 $ debugwireproto << EOF
1247 > command unbundle
1265 > command unbundle
1248 > # This is "force" in hex.
1266 > # This is "force" in hex.
1249 > heads 666f726365
1267 > heads 666f726365
1250 > PUSHFILE ../initial.v1.hg
1268 > PUSHFILE ../initial.v1.hg
1251 > readavailable
1269 > readavailable
1252 > EOF
1270 > EOF
1253 testing ssh1
1271 testing ssh1
1254 creating ssh peer from handshake results
1272 creating ssh peer from handshake results
1255 i> write(104) -> 104:
1273 i> write(104) -> 104:
1256 i> hello\n
1274 i> hello\n
1257 i> between\n
1275 i> between\n
1258 i> pairs 81\n
1276 i> pairs 81\n
1259 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1277 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1260 i> flush() -> None
1278 i> flush() -> None
1261 o> readline() -> 4:
1279 o> readline() -> 4:
1262 o> 384\n
1280 o> 384\n
1263 o> readline() -> 384:
1281 o> readline() -> 384:
1264 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1282 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1265 o> readline() -> 2:
1283 o> readline() -> 2:
1266 o> 1\n
1284 o> 1\n
1267 o> readline() -> 1:
1285 o> readline() -> 1:
1268 o> \n
1286 o> \n
1269 sending unbundle command
1287 sending unbundle command
1270 i> write(9) -> 9:
1288 i> write(9) -> 9:
1271 i> unbundle\n
1289 i> unbundle\n
1272 i> write(9) -> 9:
1290 i> write(9) -> 9:
1273 i> heads 10\n
1291 i> heads 10\n
1274 i> write(10) -> 10: 666f726365
1292 i> write(10) -> 10: 666f726365
1275 i> flush() -> None
1293 i> flush() -> None
1276 o> readline() -> 2:
1294 o> readline() -> 2:
1277 o> 0\n
1295 o> 0\n
1278 i> write(4) -> 4:
1296 i> write(4) -> 4:
1279 i> 426\n
1297 i> 426\n
1280 i> write(426) -> 426:
1298 i> write(426) -> 426:
1281 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1299 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1282 i> test\n
1300 i> test\n
1283 i> 0 0\n
1301 i> 0 0\n
1284 i> foo\n
1302 i> foo\n
1285 i> \n
1303 i> \n
1286 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1304 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1287 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1305 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1288 i> \x00\x00\x00\x00\x00\x00\x00\x00
1306 i> \x00\x00\x00\x00\x00\x00\x00\x00
1289 i> write(2) -> 2:
1307 i> write(2) -> 2:
1290 i> 0\n
1308 i> 0\n
1291 i> flush() -> None
1309 i> flush() -> None
1292 o> readline() -> 2:
1310 o> readline() -> 2:
1293 o> 0\n
1311 o> 0\n
1294 o> readline() -> 2:
1312 o> readline() -> 2:
1295 o> 1\n
1313 o> 1\n
1296 o> read(1) -> 1: 0
1314 o> read(1) -> 1: 0
1297 result: 0
1315 result: 0
1298 remote output:
1316 remote output:
1317 o> read(-1) -> 0:
1299 e> read(-1) -> 212:
1318 e> read(-1) -> 212:
1300 e> adding changesets\n
1319 e> adding changesets\n
1301 e> adding manifests\n
1320 e> adding manifests\n
1302 e> adding file changes\n
1321 e> adding file changes\n
1303 e> added 1 changesets with 1 changes to 1 files\n
1322 e> added 1 changesets with 1 changes to 1 files\n
1304 e> stdout 1\n
1323 e> stdout 1\n
1305 e> stdout 2\n
1324 e> stdout 2\n
1306 e> transaction abort!\n
1325 e> transaction abort!\n
1307 e> rollback completed\n
1326 e> rollback completed\n
1308 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1327 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1309
1328
1310 testing ssh2
1329 testing ssh2
1311 creating ssh peer from handshake results
1330 creating ssh peer from handshake results
1312 i> write(171) -> 171:
1331 i> write(171) -> 171:
1313 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1332 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1314 i> hello\n
1333 i> hello\n
1315 i> between\n
1334 i> between\n
1316 i> pairs 81\n
1335 i> pairs 81\n
1317 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1336 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1318 i> flush() -> None
1337 i> flush() -> None
1319 o> readline() -> 62:
1338 o> readline() -> 62:
1320 o> upgraded * exp-ssh-v2-0001\n (glob)
1339 o> upgraded * exp-ssh-v2-0001\n (glob)
1321 o> readline() -> 4:
1340 o> readline() -> 4:
1322 o> 383\n
1341 o> 383\n
1323 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1342 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1324 o> read(1) -> 1:
1343 o> read(1) -> 1:
1325 o> \n
1344 o> \n
1326 sending unbundle command
1345 sending unbundle command
1327 i> write(9) -> 9:
1346 i> write(9) -> 9:
1328 i> unbundle\n
1347 i> unbundle\n
1329 i> write(9) -> 9:
1348 i> write(9) -> 9:
1330 i> heads 10\n
1349 i> heads 10\n
1331 i> write(10) -> 10: 666f726365
1350 i> write(10) -> 10: 666f726365
1332 i> flush() -> None
1351 i> flush() -> None
1333 o> readline() -> 2:
1352 o> readline() -> 2:
1334 o> 0\n
1353 o> 0\n
1335 i> write(4) -> 4:
1354 i> write(4) -> 4:
1336 i> 426\n
1355 i> 426\n
1337 i> write(426) -> 426:
1356 i> write(426) -> 426:
1338 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1357 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1339 i> test\n
1358 i> test\n
1340 i> 0 0\n
1359 i> 0 0\n
1341 i> foo\n
1360 i> foo\n
1342 i> \n
1361 i> \n
1343 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1362 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1344 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1363 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1345 i> \x00\x00\x00\x00\x00\x00\x00\x00
1364 i> \x00\x00\x00\x00\x00\x00\x00\x00
1346 i> write(2) -> 2:
1365 i> write(2) -> 2:
1347 i> 0\n
1366 i> 0\n
1348 i> flush() -> None
1367 i> flush() -> None
1349 o> readline() -> 2:
1368 o> readline() -> 2:
1350 o> 0\n
1369 o> 0\n
1351 o> readline() -> 2:
1370 o> readline() -> 2:
1352 o> 1\n
1371 o> 1\n
1353 o> read(1) -> 1: 0
1372 o> read(1) -> 1: 0
1354 result: 0
1373 result: 0
1355 remote output:
1374 remote output:
1375 o> read(-1) -> 0:
1356 e> read(-1) -> 212:
1376 e> read(-1) -> 212:
1357 e> adding changesets\n
1377 e> adding changesets\n
1358 e> adding manifests\n
1378 e> adding manifests\n
1359 e> adding file changes\n
1379 e> adding file changes\n
1360 e> added 1 changesets with 1 changes to 1 files\n
1380 e> added 1 changesets with 1 changes to 1 files\n
1361 e> stdout 1\n
1381 e> stdout 1\n
1362 e> stdout 2\n
1382 e> stdout 2\n
1363 e> transaction abort!\n
1383 e> transaction abort!\n
1364 e> rollback completed\n
1384 e> rollback completed\n
1365 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1385 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1366
1386
1367 Shell hook writing to stderr has output captured
1387 Shell hook writing to stderr has output captured
1368
1388
1369 $ cat > $TESTTMP/hook.sh << EOF
1389 $ cat > $TESTTMP/hook.sh << EOF
1370 > echo 'stderr 1' 1>&2
1390 > echo 'stderr 1' 1>&2
1371 > echo 'stderr 2' 1>&2
1391 > echo 'stderr 2' 1>&2
1372 > exit 1
1392 > exit 1
1373 > EOF
1393 > EOF
1374
1394
1375 $ debugwireproto << EOF
1395 $ debugwireproto << EOF
1376 > command unbundle
1396 > command unbundle
1377 > # This is "force" in hex.
1397 > # This is "force" in hex.
1378 > heads 666f726365
1398 > heads 666f726365
1379 > PUSHFILE ../initial.v1.hg
1399 > PUSHFILE ../initial.v1.hg
1380 > readavailable
1400 > readavailable
1381 > EOF
1401 > EOF
1382 testing ssh1
1402 testing ssh1
1383 creating ssh peer from handshake results
1403 creating ssh peer from handshake results
1384 i> write(104) -> 104:
1404 i> write(104) -> 104:
1385 i> hello\n
1405 i> hello\n
1386 i> between\n
1406 i> between\n
1387 i> pairs 81\n
1407 i> pairs 81\n
1388 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1408 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1389 i> flush() -> None
1409 i> flush() -> None
1390 o> readline() -> 4:
1410 o> readline() -> 4:
1391 o> 384\n
1411 o> 384\n
1392 o> readline() -> 384:
1412 o> readline() -> 384:
1393 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1413 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1394 o> readline() -> 2:
1414 o> readline() -> 2:
1395 o> 1\n
1415 o> 1\n
1396 o> readline() -> 1:
1416 o> readline() -> 1:
1397 o> \n
1417 o> \n
1398 sending unbundle command
1418 sending unbundle command
1399 i> write(9) -> 9:
1419 i> write(9) -> 9:
1400 i> unbundle\n
1420 i> unbundle\n
1401 i> write(9) -> 9:
1421 i> write(9) -> 9:
1402 i> heads 10\n
1422 i> heads 10\n
1403 i> write(10) -> 10: 666f726365
1423 i> write(10) -> 10: 666f726365
1404 i> flush() -> None
1424 i> flush() -> None
1405 o> readline() -> 2:
1425 o> readline() -> 2:
1406 o> 0\n
1426 o> 0\n
1407 i> write(4) -> 4:
1427 i> write(4) -> 4:
1408 i> 426\n
1428 i> 426\n
1409 i> write(426) -> 426:
1429 i> write(426) -> 426:
1410 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1430 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1411 i> test\n
1431 i> test\n
1412 i> 0 0\n
1432 i> 0 0\n
1413 i> foo\n
1433 i> foo\n
1414 i> \n
1434 i> \n
1415 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1435 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1416 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1436 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1417 i> \x00\x00\x00\x00\x00\x00\x00\x00
1437 i> \x00\x00\x00\x00\x00\x00\x00\x00
1418 i> write(2) -> 2:
1438 i> write(2) -> 2:
1419 i> 0\n
1439 i> 0\n
1420 i> flush() -> None
1440 i> flush() -> None
1421 o> readline() -> 2:
1441 o> readline() -> 2:
1422 o> 0\n
1442 o> 0\n
1423 o> readline() -> 2:
1443 o> readline() -> 2:
1424 o> 1\n
1444 o> 1\n
1425 o> read(1) -> 1: 0
1445 o> read(1) -> 1: 0
1426 result: 0
1446 result: 0
1427 remote output:
1447 remote output:
1448 o> read(-1) -> 0:
1428 e> read(-1) -> 212:
1449 e> read(-1) -> 212:
1429 e> adding changesets\n
1450 e> adding changesets\n
1430 e> adding manifests\n
1451 e> adding manifests\n
1431 e> adding file changes\n
1452 e> adding file changes\n
1432 e> added 1 changesets with 1 changes to 1 files\n
1453 e> added 1 changesets with 1 changes to 1 files\n
1433 e> stderr 1\n
1454 e> stderr 1\n
1434 e> stderr 2\n
1455 e> stderr 2\n
1435 e> transaction abort!\n
1456 e> transaction abort!\n
1436 e> rollback completed\n
1457 e> rollback completed\n
1437 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1458 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1438
1459
1439 testing ssh2
1460 testing ssh2
1440 creating ssh peer from handshake results
1461 creating ssh peer from handshake results
1441 i> write(171) -> 171:
1462 i> write(171) -> 171:
1442 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1463 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1443 i> hello\n
1464 i> hello\n
1444 i> between\n
1465 i> between\n
1445 i> pairs 81\n
1466 i> pairs 81\n
1446 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1467 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1447 i> flush() -> None
1468 i> flush() -> None
1448 o> readline() -> 62:
1469 o> readline() -> 62:
1449 o> upgraded * exp-ssh-v2-0001\n (glob)
1470 o> upgraded * exp-ssh-v2-0001\n (glob)
1450 o> readline() -> 4:
1471 o> readline() -> 4:
1451 o> 383\n
1472 o> 383\n
1452 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1473 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1453 o> read(1) -> 1:
1474 o> read(1) -> 1:
1454 o> \n
1475 o> \n
1455 sending unbundle command
1476 sending unbundle command
1456 i> write(9) -> 9:
1477 i> write(9) -> 9:
1457 i> unbundle\n
1478 i> unbundle\n
1458 i> write(9) -> 9:
1479 i> write(9) -> 9:
1459 i> heads 10\n
1480 i> heads 10\n
1460 i> write(10) -> 10: 666f726365
1481 i> write(10) -> 10: 666f726365
1461 i> flush() -> None
1482 i> flush() -> None
1462 o> readline() -> 2:
1483 o> readline() -> 2:
1463 o> 0\n
1484 o> 0\n
1464 i> write(4) -> 4:
1485 i> write(4) -> 4:
1465 i> 426\n
1486 i> 426\n
1466 i> write(426) -> 426:
1487 i> write(426) -> 426:
1467 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1488 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1468 i> test\n
1489 i> test\n
1469 i> 0 0\n
1490 i> 0 0\n
1470 i> foo\n
1491 i> foo\n
1471 i> \n
1492 i> \n
1472 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1493 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1473 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1494 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1474 i> \x00\x00\x00\x00\x00\x00\x00\x00
1495 i> \x00\x00\x00\x00\x00\x00\x00\x00
1475 i> write(2) -> 2:
1496 i> write(2) -> 2:
1476 i> 0\n
1497 i> 0\n
1477 i> flush() -> None
1498 i> flush() -> None
1478 o> readline() -> 2:
1499 o> readline() -> 2:
1479 o> 0\n
1500 o> 0\n
1480 o> readline() -> 2:
1501 o> readline() -> 2:
1481 o> 1\n
1502 o> 1\n
1482 o> read(1) -> 1: 0
1503 o> read(1) -> 1: 0
1483 result: 0
1504 result: 0
1484 remote output:
1505 remote output:
1506 o> read(-1) -> 0:
1485 e> read(-1) -> 212:
1507 e> read(-1) -> 212:
1486 e> adding changesets\n
1508 e> adding changesets\n
1487 e> adding manifests\n
1509 e> adding manifests\n
1488 e> adding file changes\n
1510 e> adding file changes\n
1489 e> added 1 changesets with 1 changes to 1 files\n
1511 e> added 1 changesets with 1 changes to 1 files\n
1490 e> stderr 1\n
1512 e> stderr 1\n
1491 e> stderr 2\n
1513 e> stderr 2\n
1492 e> transaction abort!\n
1514 e> transaction abort!\n
1493 e> rollback completed\n
1515 e> rollback completed\n
1494 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1516 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1495
1517
1496 Shell hook writing to stdout and stderr has output captured
1518 Shell hook writing to stdout and stderr has output captured
1497
1519
1498 $ cat > $TESTTMP/hook.sh << EOF
1520 $ cat > $TESTTMP/hook.sh << EOF
1499 > echo 'stdout 1'
1521 > echo 'stdout 1'
1500 > echo 'stderr 1' 1>&2
1522 > echo 'stderr 1' 1>&2
1501 > echo 'stdout 2'
1523 > echo 'stdout 2'
1502 > echo 'stderr 2' 1>&2
1524 > echo 'stderr 2' 1>&2
1503 > exit 1
1525 > exit 1
1504 > EOF
1526 > EOF
1505
1527
1506 $ debugwireproto << EOF
1528 $ debugwireproto << EOF
1507 > command unbundle
1529 > command unbundle
1508 > # This is "force" in hex.
1530 > # This is "force" in hex.
1509 > heads 666f726365
1531 > heads 666f726365
1510 > PUSHFILE ../initial.v1.hg
1532 > PUSHFILE ../initial.v1.hg
1511 > readavailable
1533 > readavailable
1512 > EOF
1534 > EOF
1513 testing ssh1
1535 testing ssh1
1514 creating ssh peer from handshake results
1536 creating ssh peer from handshake results
1515 i> write(104) -> 104:
1537 i> write(104) -> 104:
1516 i> hello\n
1538 i> hello\n
1517 i> between\n
1539 i> between\n
1518 i> pairs 81\n
1540 i> pairs 81\n
1519 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1541 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1520 i> flush() -> None
1542 i> flush() -> None
1521 o> readline() -> 4:
1543 o> readline() -> 4:
1522 o> 384\n
1544 o> 384\n
1523 o> readline() -> 384:
1545 o> readline() -> 384:
1524 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1546 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1525 o> readline() -> 2:
1547 o> readline() -> 2:
1526 o> 1\n
1548 o> 1\n
1527 o> readline() -> 1:
1549 o> readline() -> 1:
1528 o> \n
1550 o> \n
1529 sending unbundle command
1551 sending unbundle command
1530 i> write(9) -> 9:
1552 i> write(9) -> 9:
1531 i> unbundle\n
1553 i> unbundle\n
1532 i> write(9) -> 9:
1554 i> write(9) -> 9:
1533 i> heads 10\n
1555 i> heads 10\n
1534 i> write(10) -> 10: 666f726365
1556 i> write(10) -> 10: 666f726365
1535 i> flush() -> None
1557 i> flush() -> None
1536 o> readline() -> 2:
1558 o> readline() -> 2:
1537 o> 0\n
1559 o> 0\n
1538 i> write(4) -> 4:
1560 i> write(4) -> 4:
1539 i> 426\n
1561 i> 426\n
1540 i> write(426) -> 426:
1562 i> write(426) -> 426:
1541 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1563 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1542 i> test\n
1564 i> test\n
1543 i> 0 0\n
1565 i> 0 0\n
1544 i> foo\n
1566 i> foo\n
1545 i> \n
1567 i> \n
1546 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1568 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1547 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1569 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1548 i> \x00\x00\x00\x00\x00\x00\x00\x00
1570 i> \x00\x00\x00\x00\x00\x00\x00\x00
1549 i> write(2) -> 2:
1571 i> write(2) -> 2:
1550 i> 0\n
1572 i> 0\n
1551 i> flush() -> None
1573 i> flush() -> None
1552 o> readline() -> 2:
1574 o> readline() -> 2:
1553 o> 0\n
1575 o> 0\n
1554 o> readline() -> 2:
1576 o> readline() -> 2:
1555 o> 1\n
1577 o> 1\n
1556 o> read(1) -> 1: 0
1578 o> read(1) -> 1: 0
1557 result: 0
1579 result: 0
1558 remote output:
1580 remote output:
1581 o> read(-1) -> 0:
1559 e> read(-1) -> 230:
1582 e> read(-1) -> 230:
1560 e> adding changesets\n
1583 e> adding changesets\n
1561 e> adding manifests\n
1584 e> adding manifests\n
1562 e> adding file changes\n
1585 e> adding file changes\n
1563 e> added 1 changesets with 1 changes to 1 files\n
1586 e> added 1 changesets with 1 changes to 1 files\n
1564 e> stdout 1\n
1587 e> stdout 1\n
1565 e> stderr 1\n
1588 e> stderr 1\n
1566 e> stdout 2\n
1589 e> stdout 2\n
1567 e> stderr 2\n
1590 e> stderr 2\n
1568 e> transaction abort!\n
1591 e> transaction abort!\n
1569 e> rollback completed\n
1592 e> rollback completed\n
1570 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1593 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1571
1594
1572 testing ssh2
1595 testing ssh2
1573 creating ssh peer from handshake results
1596 creating ssh peer from handshake results
1574 i> write(171) -> 171:
1597 i> write(171) -> 171:
1575 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1598 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1576 i> hello\n
1599 i> hello\n
1577 i> between\n
1600 i> between\n
1578 i> pairs 81\n
1601 i> pairs 81\n
1579 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1602 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1580 i> flush() -> None
1603 i> flush() -> None
1581 o> readline() -> 62:
1604 o> readline() -> 62:
1582 o> upgraded * exp-ssh-v2-0001\n (glob)
1605 o> upgraded * exp-ssh-v2-0001\n (glob)
1583 o> readline() -> 4:
1606 o> readline() -> 4:
1584 o> 383\n
1607 o> 383\n
1585 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1608 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1586 o> read(1) -> 1:
1609 o> read(1) -> 1:
1587 o> \n
1610 o> \n
1588 sending unbundle command
1611 sending unbundle command
1589 i> write(9) -> 9:
1612 i> write(9) -> 9:
1590 i> unbundle\n
1613 i> unbundle\n
1591 i> write(9) -> 9:
1614 i> write(9) -> 9:
1592 i> heads 10\n
1615 i> heads 10\n
1593 i> write(10) -> 10: 666f726365
1616 i> write(10) -> 10: 666f726365
1594 i> flush() -> None
1617 i> flush() -> None
1595 o> readline() -> 2:
1618 o> readline() -> 2:
1596 o> 0\n
1619 o> 0\n
1597 i> write(4) -> 4:
1620 i> write(4) -> 4:
1598 i> 426\n
1621 i> 426\n
1599 i> write(426) -> 426:
1622 i> write(426) -> 426:
1600 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1623 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1601 i> test\n
1624 i> test\n
1602 i> 0 0\n
1625 i> 0 0\n
1603 i> foo\n
1626 i> foo\n
1604 i> \n
1627 i> \n
1605 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1628 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1606 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1629 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1607 i> \x00\x00\x00\x00\x00\x00\x00\x00
1630 i> \x00\x00\x00\x00\x00\x00\x00\x00
1608 i> write(2) -> 2:
1631 i> write(2) -> 2:
1609 i> 0\n
1632 i> 0\n
1610 i> flush() -> None
1633 i> flush() -> None
1611 o> readline() -> 2:
1634 o> readline() -> 2:
1612 o> 0\n
1635 o> 0\n
1613 o> readline() -> 2:
1636 o> readline() -> 2:
1614 o> 1\n
1637 o> 1\n
1615 o> read(1) -> 1: 0
1638 o> read(1) -> 1: 0
1616 result: 0
1639 result: 0
1617 remote output:
1640 remote output:
1641 o> read(-1) -> 0:
1618 e> read(-1) -> 230:
1642 e> read(-1) -> 230:
1619 e> adding changesets\n
1643 e> adding changesets\n
1620 e> adding manifests\n
1644 e> adding manifests\n
1621 e> adding file changes\n
1645 e> adding file changes\n
1622 e> added 1 changesets with 1 changes to 1 files\n
1646 e> added 1 changesets with 1 changes to 1 files\n
1623 e> stdout 1\n
1647 e> stdout 1\n
1624 e> stderr 1\n
1648 e> stderr 1\n
1625 e> stdout 2\n
1649 e> stdout 2\n
1626 e> stderr 2\n
1650 e> stderr 2\n
1627 e> transaction abort!\n
1651 e> transaction abort!\n
1628 e> rollback completed\n
1652 e> rollback completed\n
1629 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1653 e> abort: pretxnchangegroup.fail hook exited with status 1\n
1630
1654
1631 Shell and Python hooks writing to stdout and stderr have output captured
1655 Shell and Python hooks writing to stdout and stderr have output captured
1632
1656
1633 $ cat > $TESTTMP/hook.sh << EOF
1657 $ cat > $TESTTMP/hook.sh << EOF
1634 > echo 'shell stdout 1'
1658 > echo 'shell stdout 1'
1635 > echo 'shell stderr 1' 1>&2
1659 > echo 'shell stderr 1' 1>&2
1636 > echo 'shell stdout 2'
1660 > echo 'shell stdout 2'
1637 > echo 'shell stderr 2' 1>&2
1661 > echo 'shell stderr 2' 1>&2
1638 > exit 0
1662 > exit 0
1639 > EOF
1663 > EOF
1640
1664
1641 $ cat > .hg/hgrc << EOF
1665 $ cat > .hg/hgrc << EOF
1642 > [hooks]
1666 > [hooks]
1643 > pretxnchangegroup.a = sh $TESTTMP/hook.sh
1667 > pretxnchangegroup.a = sh $TESTTMP/hook.sh
1644 > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout
1668 > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout
1645 > EOF
1669 > EOF
1646
1670
1647 $ debugwireproto << EOF
1671 $ debugwireproto << EOF
1648 > command unbundle
1672 > command unbundle
1649 > # This is "force" in hex.
1673 > # This is "force" in hex.
1650 > heads 666f726365
1674 > heads 666f726365
1651 > PUSHFILE ../initial.v1.hg
1675 > PUSHFILE ../initial.v1.hg
1652 > readavailable
1676 > readavailable
1653 > EOF
1677 > EOF
1654 testing ssh1
1678 testing ssh1
1655 creating ssh peer from handshake results
1679 creating ssh peer from handshake results
1656 i> write(104) -> 104:
1680 i> write(104) -> 104:
1657 i> hello\n
1681 i> hello\n
1658 i> between\n
1682 i> between\n
1659 i> pairs 81\n
1683 i> pairs 81\n
1660 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1684 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1661 i> flush() -> None
1685 i> flush() -> None
1662 o> readline() -> 4:
1686 o> readline() -> 4:
1663 o> 384\n
1687 o> 384\n
1664 o> readline() -> 384:
1688 o> readline() -> 384:
1665 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1689 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1666 o> readline() -> 2:
1690 o> readline() -> 2:
1667 o> 1\n
1691 o> 1\n
1668 o> readline() -> 1:
1692 o> readline() -> 1:
1669 o> \n
1693 o> \n
1670 sending unbundle command
1694 sending unbundle command
1671 i> write(9) -> 9:
1695 i> write(9) -> 9:
1672 i> unbundle\n
1696 i> unbundle\n
1673 i> write(9) -> 9:
1697 i> write(9) -> 9:
1674 i> heads 10\n
1698 i> heads 10\n
1675 i> write(10) -> 10: 666f726365
1699 i> write(10) -> 10: 666f726365
1676 i> flush() -> None
1700 i> flush() -> None
1677 o> readline() -> 2:
1701 o> readline() -> 2:
1678 o> 0\n
1702 o> 0\n
1679 i> write(4) -> 4:
1703 i> write(4) -> 4:
1680 i> 426\n
1704 i> 426\n
1681 i> write(426) -> 426:
1705 i> write(426) -> 426:
1682 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1706 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1683 i> test\n
1707 i> test\n
1684 i> 0 0\n
1708 i> 0 0\n
1685 i> foo\n
1709 i> foo\n
1686 i> \n
1710 i> \n
1687 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1711 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1688 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1712 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1689 i> \x00\x00\x00\x00\x00\x00\x00\x00
1713 i> \x00\x00\x00\x00\x00\x00\x00\x00
1690 i> write(2) -> 2:
1714 i> write(2) -> 2:
1691 i> 0\n
1715 i> 0\n
1692 i> flush() -> None
1716 i> flush() -> None
1693 o> readline() -> 2:
1717 o> readline() -> 2:
1694 o> 0\n
1718 o> 0\n
1695 o> readline() -> 2:
1719 o> readline() -> 2:
1696 o> 1\n
1720 o> 1\n
1697 o> read(1) -> 1: 0
1721 o> read(1) -> 1: 0
1698 result: 0
1722 result: 0
1699 remote output:
1723 remote output:
1724 o> read(-1) -> 0:
1700 e> read(-1) -> 273:
1725 e> read(-1) -> 273:
1701 e> adding changesets\n
1726 e> adding changesets\n
1702 e> adding manifests\n
1727 e> adding manifests\n
1703 e> adding file changes\n
1728 e> adding file changes\n
1704 e> added 1 changesets with 1 changes to 1 files\n
1729 e> added 1 changesets with 1 changes to 1 files\n
1705 e> shell stdout 1\n
1730 e> shell stdout 1\n
1706 e> shell stderr 1\n
1731 e> shell stderr 1\n
1707 e> shell stdout 2\n
1732 e> shell stdout 2\n
1708 e> shell stderr 2\n
1733 e> shell stderr 2\n
1709 e> stderr 1\n
1734 e> stderr 1\n
1710 e> stderr 2\n
1735 e> stderr 2\n
1711 e> stdout 1\n
1736 e> stdout 1\n
1712 e> stdout 2\n
1737 e> stdout 2\n
1713 e> transaction abort!\n
1738 e> transaction abort!\n
1714 e> rollback completed\n
1739 e> rollback completed\n
1715 e> abort: pretxnchangegroup.b hook failed\n
1740 e> abort: pretxnchangegroup.b hook failed\n
1716
1741
1717 testing ssh2
1742 testing ssh2
1718 creating ssh peer from handshake results
1743 creating ssh peer from handshake results
1719 i> write(171) -> 171:
1744 i> write(171) -> 171:
1720 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1745 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1721 i> hello\n
1746 i> hello\n
1722 i> between\n
1747 i> between\n
1723 i> pairs 81\n
1748 i> pairs 81\n
1724 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1749 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1725 i> flush() -> None
1750 i> flush() -> None
1726 o> readline() -> 62:
1751 o> readline() -> 62:
1727 o> upgraded * exp-ssh-v2-0001\n (glob)
1752 o> upgraded * exp-ssh-v2-0001\n (glob)
1728 o> readline() -> 4:
1753 o> readline() -> 4:
1729 o> 383\n
1754 o> 383\n
1730 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1755 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1731 o> read(1) -> 1:
1756 o> read(1) -> 1:
1732 o> \n
1757 o> \n
1733 sending unbundle command
1758 sending unbundle command
1734 i> write(9) -> 9:
1759 i> write(9) -> 9:
1735 i> unbundle\n
1760 i> unbundle\n
1736 i> write(9) -> 9:
1761 i> write(9) -> 9:
1737 i> heads 10\n
1762 i> heads 10\n
1738 i> write(10) -> 10: 666f726365
1763 i> write(10) -> 10: 666f726365
1739 i> flush() -> None
1764 i> flush() -> None
1740 o> readline() -> 2:
1765 o> readline() -> 2:
1741 o> 0\n
1766 o> 0\n
1742 i> write(4) -> 4:
1767 i> write(4) -> 4:
1743 i> 426\n
1768 i> 426\n
1744 i> write(426) -> 426:
1769 i> write(426) -> 426:
1745 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1770 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1746 i> test\n
1771 i> test\n
1747 i> 0 0\n
1772 i> 0 0\n
1748 i> foo\n
1773 i> foo\n
1749 i> \n
1774 i> \n
1750 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1775 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1751 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1776 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1752 i> \x00\x00\x00\x00\x00\x00\x00\x00
1777 i> \x00\x00\x00\x00\x00\x00\x00\x00
1753 i> write(2) -> 2:
1778 i> write(2) -> 2:
1754 i> 0\n
1779 i> 0\n
1755 i> flush() -> None
1780 i> flush() -> None
1756 o> readline() -> 2:
1781 o> readline() -> 2:
1757 o> 0\n
1782 o> 0\n
1758 o> readline() -> 2:
1783 o> readline() -> 2:
1759 o> 1\n
1784 o> 1\n
1760 o> read(1) -> 1: 0
1785 o> read(1) -> 1: 0
1761 result: 0
1786 result: 0
1762 remote output:
1787 remote output:
1788 o> read(-1) -> 0:
1763 e> read(-1) -> 273:
1789 e> read(-1) -> 273:
1764 e> adding changesets\n
1790 e> adding changesets\n
1765 e> adding manifests\n
1791 e> adding manifests\n
1766 e> adding file changes\n
1792 e> adding file changes\n
1767 e> added 1 changesets with 1 changes to 1 files\n
1793 e> added 1 changesets with 1 changes to 1 files\n
1768 e> shell stdout 1\n
1794 e> shell stdout 1\n
1769 e> shell stderr 1\n
1795 e> shell stderr 1\n
1770 e> shell stdout 2\n
1796 e> shell stdout 2\n
1771 e> shell stderr 2\n
1797 e> shell stderr 2\n
1772 e> stderr 1\n
1798 e> stderr 1\n
1773 e> stderr 2\n
1799 e> stderr 2\n
1774 e> stdout 1\n
1800 e> stdout 1\n
1775 e> stdout 2\n
1801 e> stdout 2\n
1776 e> transaction abort!\n
1802 e> transaction abort!\n
1777 e> rollback completed\n
1803 e> rollback completed\n
1778 e> abort: pretxnchangegroup.b hook failed\n
1804 e> abort: pretxnchangegroup.b hook failed\n
1779
1805
1780 $ cd ..
1806 $ cd ..
1781
1807
1782 Pushing a bundle1 with no output
1808 Pushing a bundle1 with no output
1783
1809
1784 $ hg init simplerepo
1810 $ hg init simplerepo
1785 $ cd simplerepo
1811 $ cd simplerepo
1786
1812
1787 $ debugwireproto 1 << EOF
1813 $ debugwireproto 1 << EOF
1788 > command unbundle
1814 > command unbundle
1789 > # This is "force" in hex.
1815 > # This is "force" in hex.
1790 > heads 666f726365
1816 > heads 666f726365
1791 > PUSHFILE ../initial.v1.hg
1817 > PUSHFILE ../initial.v1.hg
1792 > readavailable
1818 > readavailable
1793 > EOF
1819 > EOF
1794 testing ssh1
1820 testing ssh1
1795 creating ssh peer from handshake results
1821 creating ssh peer from handshake results
1796 i> write(104) -> 104:
1822 i> write(104) -> 104:
1797 i> hello\n
1823 i> hello\n
1798 i> between\n
1824 i> between\n
1799 i> pairs 81\n
1825 i> pairs 81\n
1800 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1826 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1801 i> flush() -> None
1827 i> flush() -> None
1802 o> readline() -> 4:
1828 o> readline() -> 4:
1803 o> 384\n
1829 o> 384\n
1804 o> readline() -> 384:
1830 o> readline() -> 384:
1805 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1831 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1806 o> readline() -> 2:
1832 o> readline() -> 2:
1807 o> 1\n
1833 o> 1\n
1808 o> readline() -> 1:
1834 o> readline() -> 1:
1809 o> \n
1835 o> \n
1810 sending unbundle command
1836 sending unbundle command
1811 i> write(9) -> 9:
1837 i> write(9) -> 9:
1812 i> unbundle\n
1838 i> unbundle\n
1813 i> write(9) -> 9:
1839 i> write(9) -> 9:
1814 i> heads 10\n
1840 i> heads 10\n
1815 i> write(10) -> 10: 666f726365
1841 i> write(10) -> 10: 666f726365
1816 i> flush() -> None
1842 i> flush() -> None
1817 o> readline() -> 2:
1843 o> readline() -> 2:
1818 o> 0\n
1844 o> 0\n
1819 i> write(4) -> 4:
1845 i> write(4) -> 4:
1820 i> 426\n
1846 i> 426\n
1821 i> write(426) -> 426:
1847 i> write(426) -> 426:
1822 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1848 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1823 i> test\n
1849 i> test\n
1824 i> 0 0\n
1850 i> 0 0\n
1825 i> foo\n
1851 i> foo\n
1826 i> \n
1852 i> \n
1827 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1853 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1828 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1854 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1829 i> \x00\x00\x00\x00\x00\x00\x00\x00
1855 i> \x00\x00\x00\x00\x00\x00\x00\x00
1830 i> write(2) -> 2:
1856 i> write(2) -> 2:
1831 i> 0\n
1857 i> 0\n
1832 i> flush() -> None
1858 i> flush() -> None
1833 o> readline() -> 2:
1859 o> readline() -> 2:
1834 o> 0\n
1860 o> 0\n
1835 o> readline() -> 2:
1861 o> readline() -> 2:
1836 o> 1\n
1862 o> 1\n
1837 o> read(1) -> 1: 1
1863 o> read(1) -> 1: 1
1838 result: 1
1864 result: 1
1839 remote output:
1865 remote output:
1866 o> read(-1) -> 0:
1840 e> read(-1) -> 100:
1867 e> read(-1) -> 100:
1841 e> adding changesets\n
1868 e> adding changesets\n
1842 e> adding manifests\n
1869 e> adding manifests\n
1843 e> adding file changes\n
1870 e> adding file changes\n
1844 e> added 1 changesets with 1 changes to 1 files\n
1871 e> added 1 changesets with 1 changes to 1 files\n
1845
1872
1846 testing ssh2
1873 testing ssh2
1847 creating ssh peer from handshake results
1874 creating ssh peer from handshake results
1848 i> write(171) -> 171:
1875 i> write(171) -> 171:
1849 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1876 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1850 i> hello\n
1877 i> hello\n
1851 i> between\n
1878 i> between\n
1852 i> pairs 81\n
1879 i> pairs 81\n
1853 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1880 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1854 i> flush() -> None
1881 i> flush() -> None
1855 o> readline() -> 62:
1882 o> readline() -> 62:
1856 o> upgraded * exp-ssh-v2-0001\n (glob)
1883 o> upgraded * exp-ssh-v2-0001\n (glob)
1857 o> readline() -> 4:
1884 o> readline() -> 4:
1858 o> 383\n
1885 o> 383\n
1859 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1886 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1860 o> read(1) -> 1:
1887 o> read(1) -> 1:
1861 o> \n
1888 o> \n
1862 sending unbundle command
1889 sending unbundle command
1863 i> write(9) -> 9:
1890 i> write(9) -> 9:
1864 i> unbundle\n
1891 i> unbundle\n
1865 i> write(9) -> 9:
1892 i> write(9) -> 9:
1866 i> heads 10\n
1893 i> heads 10\n
1867 i> write(10) -> 10: 666f726365
1894 i> write(10) -> 10: 666f726365
1868 i> flush() -> None
1895 i> flush() -> None
1869 o> readline() -> 2:
1896 o> readline() -> 2:
1870 o> 0\n
1897 o> 0\n
1871 i> write(4) -> 4:
1898 i> write(4) -> 4:
1872 i> 426\n
1899 i> 426\n
1873 i> write(426) -> 426:
1900 i> write(426) -> 426:
1874 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1901 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1875 i> test\n
1902 i> test\n
1876 i> 0 0\n
1903 i> 0 0\n
1877 i> foo\n
1904 i> foo\n
1878 i> \n
1905 i> \n
1879 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1906 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1880 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1907 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1881 i> \x00\x00\x00\x00\x00\x00\x00\x00
1908 i> \x00\x00\x00\x00\x00\x00\x00\x00
1882 i> write(2) -> 2:
1909 i> write(2) -> 2:
1883 i> 0\n
1910 i> 0\n
1884 i> flush() -> None
1911 i> flush() -> None
1885 o> readline() -> 2:
1912 o> readline() -> 2:
1886 o> 0\n
1913 o> 0\n
1887 o> readline() -> 2:
1914 o> readline() -> 2:
1888 o> 1\n
1915 o> 1\n
1889 o> read(1) -> 1: 1
1916 o> read(1) -> 1: 1
1890 result: 1
1917 result: 1
1891 remote output:
1918 remote output:
1919 o> read(-1) -> 0:
1892 e> read(-1) -> 100:
1920 e> read(-1) -> 100:
1893 e> adding changesets\n
1921 e> adding changesets\n
1894 e> adding manifests\n
1922 e> adding manifests\n
1895 e> adding file changes\n
1923 e> adding file changes\n
1896 e> added 1 changesets with 1 changes to 1 files\n
1924 e> added 1 changesets with 1 changes to 1 files\n
1897
1925
1898 $ cd ..
1926 $ cd ..
1899
1927
1900 Pushing a bundle1 with ui.write() and ui.write_err()
1928 Pushing a bundle1 with ui.write() and ui.write_err()
1901
1929
1902 $ cat > $TESTTMP/hook << EOF
1930 $ cat > $TESTTMP/hook << EOF
1903 > def hookuiwrite(ui, repo, **kwargs):
1931 > def hookuiwrite(ui, repo, **kwargs):
1904 > ui.write(b'ui.write 1\n')
1932 > ui.write(b'ui.write 1\n')
1905 > ui.write_err(b'ui.write_err 1\n')
1933 > ui.write_err(b'ui.write_err 1\n')
1906 > ui.write(b'ui.write 2\n')
1934 > ui.write(b'ui.write 2\n')
1907 > ui.write_err(b'ui.write_err 2\n')
1935 > ui.write_err(b'ui.write_err 2\n')
1908 > EOF
1936 > EOF
1909
1937
1910 $ hg init uiwriterepo
1938 $ hg init uiwriterepo
1911 $ cd uiwriterepo
1939 $ cd uiwriterepo
1912 $ cat > .hg/hgrc << EOF
1940 $ cat > .hg/hgrc << EOF
1913 > [hooks]
1941 > [hooks]
1914 > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite
1942 > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite
1915 > EOF
1943 > EOF
1916
1944
1917 $ debugwireproto 1 << EOF
1945 $ debugwireproto 1 << EOF
1918 > command unbundle
1946 > command unbundle
1919 > # This is "force" in hex.
1947 > # This is "force" in hex.
1920 > heads 666f726365
1948 > heads 666f726365
1921 > PUSHFILE ../initial.v1.hg
1949 > PUSHFILE ../initial.v1.hg
1922 > readavailable
1950 > readavailable
1923 > EOF
1951 > EOF
1924 testing ssh1
1952 testing ssh1
1925 creating ssh peer from handshake results
1953 creating ssh peer from handshake results
1926 i> write(104) -> 104:
1954 i> write(104) -> 104:
1927 i> hello\n
1955 i> hello\n
1928 i> between\n
1956 i> between\n
1929 i> pairs 81\n
1957 i> pairs 81\n
1930 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1958 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1931 i> flush() -> None
1959 i> flush() -> None
1932 o> readline() -> 4:
1960 o> readline() -> 4:
1933 o> 384\n
1961 o> 384\n
1934 o> readline() -> 384:
1962 o> readline() -> 384:
1935 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1963 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1936 o> readline() -> 2:
1964 o> readline() -> 2:
1937 o> 1\n
1965 o> 1\n
1938 o> readline() -> 1:
1966 o> readline() -> 1:
1939 o> \n
1967 o> \n
1940 sending unbundle command
1968 sending unbundle command
1941 i> write(9) -> 9:
1969 i> write(9) -> 9:
1942 i> unbundle\n
1970 i> unbundle\n
1943 i> write(9) -> 9:
1971 i> write(9) -> 9:
1944 i> heads 10\n
1972 i> heads 10\n
1945 i> write(10) -> 10: 666f726365
1973 i> write(10) -> 10: 666f726365
1946 i> flush() -> None
1974 i> flush() -> None
1947 o> readline() -> 2:
1975 o> readline() -> 2:
1948 o> 0\n
1976 o> 0\n
1949 i> write(4) -> 4:
1977 i> write(4) -> 4:
1950 i> 426\n
1978 i> 426\n
1951 i> write(426) -> 426:
1979 i> write(426) -> 426:
1952 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1980 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
1953 i> test\n
1981 i> test\n
1954 i> 0 0\n
1982 i> 0 0\n
1955 i> foo\n
1983 i> foo\n
1956 i> \n
1984 i> \n
1957 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1985 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
1958 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1986 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
1959 i> \x00\x00\x00\x00\x00\x00\x00\x00
1987 i> \x00\x00\x00\x00\x00\x00\x00\x00
1960 i> write(2) -> 2:
1988 i> write(2) -> 2:
1961 i> 0\n
1989 i> 0\n
1962 i> flush() -> None
1990 i> flush() -> None
1963 o> readline() -> 2:
1991 o> readline() -> 2:
1964 o> 0\n
1992 o> 0\n
1965 o> readline() -> 2:
1993 o> readline() -> 2:
1966 o> 1\n
1994 o> 1\n
1967 o> read(1) -> 1: 1
1995 o> read(1) -> 1: 1
1968 result: 1
1996 result: 1
1969 remote output:
1997 remote output:
1998 o> read(-1) -> 0:
1970 e> read(-1) -> 152:
1999 e> read(-1) -> 152:
1971 e> adding changesets\n
2000 e> adding changesets\n
1972 e> adding manifests\n
2001 e> adding manifests\n
1973 e> adding file changes\n
2002 e> adding file changes\n
1974 e> added 1 changesets with 1 changes to 1 files\n
2003 e> added 1 changesets with 1 changes to 1 files\n
1975 e> ui.write 1\n
2004 e> ui.write 1\n
1976 e> ui.write_err 1\n
2005 e> ui.write_err 1\n
1977 e> ui.write 2\n
2006 e> ui.write 2\n
1978 e> ui.write_err 2\n
2007 e> ui.write_err 2\n
1979
2008
1980 testing ssh2
2009 testing ssh2
1981 creating ssh peer from handshake results
2010 creating ssh peer from handshake results
1982 i> write(171) -> 171:
2011 i> write(171) -> 171:
1983 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
2012 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1984 i> hello\n
2013 i> hello\n
1985 i> between\n
2014 i> between\n
1986 i> pairs 81\n
2015 i> pairs 81\n
1987 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2016 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1988 i> flush() -> None
2017 i> flush() -> None
1989 o> readline() -> 62:
2018 o> readline() -> 62:
1990 o> upgraded * exp-ssh-v2-0001\n (glob)
2019 o> upgraded * exp-ssh-v2-0001\n (glob)
1991 o> readline() -> 4:
2020 o> readline() -> 4:
1992 o> 383\n
2021 o> 383\n
1993 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
2022 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1994 o> read(1) -> 1:
2023 o> read(1) -> 1:
1995 o> \n
2024 o> \n
1996 sending unbundle command
2025 sending unbundle command
1997 i> write(9) -> 9:
2026 i> write(9) -> 9:
1998 i> unbundle\n
2027 i> unbundle\n
1999 i> write(9) -> 9:
2028 i> write(9) -> 9:
2000 i> heads 10\n
2029 i> heads 10\n
2001 i> write(10) -> 10: 666f726365
2030 i> write(10) -> 10: 666f726365
2002 i> flush() -> None
2031 i> flush() -> None
2003 o> readline() -> 2:
2032 o> readline() -> 2:
2004 o> 0\n
2033 o> 0\n
2005 i> write(4) -> 4:
2034 i> write(4) -> 4:
2006 i> 426\n
2035 i> 426\n
2007 i> write(426) -> 426:
2036 i> write(426) -> 426:
2008 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
2037 i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n
2009 i> test\n
2038 i> test\n
2010 i> 0 0\n
2039 i> 0 0\n
2011 i> foo\n
2040 i> foo\n
2012 i> \n
2041 i> \n
2013 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
2042 i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n
2014 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
2043 i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n
2015 i> \x00\x00\x00\x00\x00\x00\x00\x00
2044 i> \x00\x00\x00\x00\x00\x00\x00\x00
2016 i> write(2) -> 2:
2045 i> write(2) -> 2:
2017 i> 0\n
2046 i> 0\n
2018 i> flush() -> None
2047 i> flush() -> None
2019 o> readline() -> 2:
2048 o> readline() -> 2:
2020 o> 0\n
2049 o> 0\n
2021 o> readline() -> 2:
2050 o> readline() -> 2:
2022 o> 1\n
2051 o> 1\n
2023 o> read(1) -> 1: 1
2052 o> read(1) -> 1: 1
2024 result: 1
2053 result: 1
2025 remote output:
2054 remote output:
2055 o> read(-1) -> 0:
2026 e> read(-1) -> 152:
2056 e> read(-1) -> 152:
2027 e> adding changesets\n
2057 e> adding changesets\n
2028 e> adding manifests\n
2058 e> adding manifests\n
2029 e> adding file changes\n
2059 e> adding file changes\n
2030 e> added 1 changesets with 1 changes to 1 files\n
2060 e> added 1 changesets with 1 changes to 1 files\n
2031 e> ui.write 1\n
2061 e> ui.write 1\n
2032 e> ui.write_err 1\n
2062 e> ui.write_err 1\n
2033 e> ui.write 2\n
2063 e> ui.write 2\n
2034 e> ui.write_err 2\n
2064 e> ui.write_err 2\n
@@ -1,2139 +1,2143 b''
1 $ cat > hgrc-sshv2 << EOF
1 $ cat > hgrc-sshv2 << EOF
2 > %include $HGRCPATH
2 > %include $HGRCPATH
3 > [experimental]
3 > [experimental]
4 > sshpeer.advertise-v2 = true
4 > sshpeer.advertise-v2 = true
5 > sshserver.support-v2 = true
5 > sshserver.support-v2 = true
6 > EOF
6 > EOF
7
7
8 Helper function to run protocol tests against multiple protocol versions.
8 Helper function to run protocol tests against multiple protocol versions.
9 This is easier than using #testcases because managing differences between
9 This is easier than using #testcases because managing differences between
10 protocols with inline conditional output is hard to read.
10 protocols with inline conditional output is hard to read.
11
11
12 $ debugwireproto() {
12 $ debugwireproto() {
13 > commands=`cat -`
13 > commands=`cat -`
14 > echo 'testing ssh1'
14 > echo 'testing ssh1'
15 > echo "${commands}" | hg --verbose debugwireproto --localssh
15 > echo "${commands}" | hg --verbose debugwireproto --localssh
16 > echo ""
16 > echo ""
17 > echo 'testing ssh2'
17 > echo 'testing ssh2'
18 > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh
18 > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh
19 > }
19 > }
20
20
21 $ cat >> $HGRCPATH << EOF
21 $ cat >> $HGRCPATH << EOF
22 > [ui]
22 > [ui]
23 > ssh = $PYTHON "$TESTDIR/dummyssh"
23 > ssh = $PYTHON "$TESTDIR/dummyssh"
24 > [devel]
24 > [devel]
25 > debug.peer-request = true
25 > debug.peer-request = true
26 > [extensions]
26 > [extensions]
27 > sshprotoext = $TESTDIR/sshprotoext.py
27 > sshprotoext = $TESTDIR/sshprotoext.py
28 > EOF
28 > EOF
29
29
30 $ hg init server
30 $ hg init server
31 $ cd server
31 $ cd server
32 $ echo 0 > foo
32 $ echo 0 > foo
33 $ hg -q add foo
33 $ hg -q add foo
34 $ hg commit -m initial
34 $ hg commit -m initial
35
35
36 A no-op connection performs a handshake
36 A no-op connection performs a handshake
37
37
38 $ hg debugwireproto --localssh << EOF
38 $ hg debugwireproto --localssh << EOF
39 > EOF
39 > EOF
40 creating ssh peer from handshake results
40 creating ssh peer from handshake results
41
41
42 Raw peers don't perform any activity
42 Raw peers don't perform any activity
43
43
44 $ hg debugwireproto --localssh --peer raw << EOF
44 $ hg debugwireproto --localssh --peer raw << EOF
45 > EOF
45 > EOF
46 using raw connection to peer
46 using raw connection to peer
47 $ hg debugwireproto --localssh --peer ssh1 << EOF
47 $ hg debugwireproto --localssh --peer ssh1 << EOF
48 > EOF
48 > EOF
49 creating ssh peer for wire protocol version 1
49 creating ssh peer for wire protocol version 1
50 $ hg debugwireproto --localssh --peer ssh2 << EOF
50 $ hg debugwireproto --localssh --peer ssh2 << EOF
51 > EOF
51 > EOF
52 creating ssh peer for wire protocol version 2
52 creating ssh peer for wire protocol version 2
53
53
54 Test a normal behaving server, for sanity
54 Test a normal behaving server, for sanity
55
55
56 $ cd ..
56 $ cd ..
57
57
58 $ hg --debug debugpeer ssh://user@dummy/server
58 $ hg --debug debugpeer ssh://user@dummy/server
59 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
59 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
60 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
60 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
61 devel-peer-request: hello
61 devel-peer-request: hello
62 sending hello command
62 sending hello command
63 devel-peer-request: between
63 devel-peer-request: between
64 devel-peer-request: pairs: 81 bytes
64 devel-peer-request: pairs: 81 bytes
65 sending between command
65 sending between command
66 remote: 384
66 remote: 384
67 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
67 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
68 remote: 1
68 remote: 1
69 url: ssh://user@dummy/server
69 url: ssh://user@dummy/server
70 local: no
70 local: no
71 pushable: yes
71 pushable: yes
72
72
73 Server should answer the "hello" command in isolation
73 Server should answer the "hello" command in isolation
74
74
75 $ hg -R server debugwireproto --localssh --peer raw << EOF
75 $ hg -R server debugwireproto --localssh --peer raw << EOF
76 > raw
76 > raw
77 > hello\n
77 > hello\n
78 > readline
78 > readline
79 > readline
79 > readline
80 > EOF
80 > EOF
81 using raw connection to peer
81 using raw connection to peer
82 i> write(6) -> 6:
82 i> write(6) -> 6:
83 i> hello\n
83 i> hello\n
84 o> readline() -> 4:
84 o> readline() -> 4:
85 o> 384\n
85 o> 384\n
86 o> readline() -> 384:
86 o> readline() -> 384:
87 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
87 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
88
88
89 `hg debugserve --sshstdio` works
89 `hg debugserve --sshstdio` works
90
90
91 $ cd server
91 $ cd server
92 $ hg debugserve --sshstdio << EOF
92 $ hg debugserve --sshstdio << EOF
93 > hello
93 > hello
94 > EOF
94 > EOF
95 384
95 384
96 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
96 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
97
97
98 I/O logging works
98 I/O logging works
99
99
100 $ hg debugserve --sshstdio --logiofd 1 << EOF
100 $ hg debugserve --sshstdio --logiofd 1 << EOF
101 > hello
101 > hello
102 > EOF
102 > EOF
103 o> write(4) -> 4:
103 o> write(4) -> 4:
104 o> 384\n
104 o> 384\n
105 o> write(384) -> 384:
105 o> write(384) -> 384:
106 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
106 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
107 384
107 384
108 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
108 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
109 o> flush() -> None
109 o> flush() -> None
110
110
111 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
111 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
112 > hello
112 > hello
113 > EOF
113 > EOF
114 384
114 384
115 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
115 capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
116
116
117 $ cat $TESTTMP/io
117 $ cat $TESTTMP/io
118 o> write(4) -> 4:
118 o> write(4) -> 4:
119 o> 384\n
119 o> 384\n
120 o> write(384) -> 384:
120 o> write(384) -> 384:
121 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
121 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
122 o> flush() -> None
122 o> flush() -> None
123
123
124 $ cd ..
124 $ cd ..
125
125
126 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
126 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
127 Server should reply with capabilities and should send "1\n\n" as a successful
127 Server should reply with capabilities and should send "1\n\n" as a successful
128 reply with empty response to the "between".
128 reply with empty response to the "between".
129
129
130 $ hg -R server debugwireproto --localssh --peer raw << EOF
130 $ hg -R server debugwireproto --localssh --peer raw << EOF
131 > raw
131 > raw
132 > hello\n
132 > hello\n
133 > readline
133 > readline
134 > readline
134 > readline
135 > raw
135 > raw
136 > between\n
136 > between\n
137 > pairs 81\n
137 > pairs 81\n
138 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
138 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
139 > readline
139 > readline
140 > readline
140 > readline
141 > EOF
141 > EOF
142 using raw connection to peer
142 using raw connection to peer
143 i> write(6) -> 6:
143 i> write(6) -> 6:
144 i> hello\n
144 i> hello\n
145 o> readline() -> 4:
145 o> readline() -> 4:
146 o> 384\n
146 o> 384\n
147 o> readline() -> 384:
147 o> readline() -> 384:
148 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
148 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
149 i> write(98) -> 98:
149 i> write(98) -> 98:
150 i> between\n
150 i> between\n
151 i> pairs 81\n
151 i> pairs 81\n
152 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
152 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
153 o> readline() -> 2:
153 o> readline() -> 2:
154 o> 1\n
154 o> 1\n
155 o> readline() -> 1:
155 o> readline() -> 1:
156 o> \n
156 o> \n
157
157
158 SSH banner is not printed by default, ignored by clients
158 SSH banner is not printed by default, ignored by clients
159
159
160 $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server
160 $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server
161 url: ssh://user@dummy/server
161 url: ssh://user@dummy/server
162 local: no
162 local: no
163 pushable: yes
163 pushable: yes
164
164
165 --debug will print the banner
165 --debug will print the banner
166
166
167 $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
167 $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
168 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
168 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
169 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
169 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
170 devel-peer-request: hello
170 devel-peer-request: hello
171 sending hello command
171 sending hello command
172 devel-peer-request: between
172 devel-peer-request: between
173 devel-peer-request: pairs: 81 bytes
173 devel-peer-request: pairs: 81 bytes
174 sending between command
174 sending between command
175 remote: banner: line 0
175 remote: banner: line 0
176 remote: banner: line 1
176 remote: banner: line 1
177 remote: banner: line 2
177 remote: banner: line 2
178 remote: banner: line 3
178 remote: banner: line 3
179 remote: banner: line 4
179 remote: banner: line 4
180 remote: banner: line 5
180 remote: banner: line 5
181 remote: banner: line 6
181 remote: banner: line 6
182 remote: banner: line 7
182 remote: banner: line 7
183 remote: banner: line 8
183 remote: banner: line 8
184 remote: banner: line 9
184 remote: banner: line 9
185 remote: 384
185 remote: 384
186 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
186 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
187 remote: 1
187 remote: 1
188 url: ssh://user@dummy/server
188 url: ssh://user@dummy/server
189 local: no
189 local: no
190 pushable: yes
190 pushable: yes
191
191
192 And test the banner with the raw protocol
192 And test the banner with the raw protocol
193
193
194 $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF
194 $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF
195 > raw
195 > raw
196 > hello\n
196 > hello\n
197 > readline
197 > readline
198 > readline
198 > readline
199 > readline
199 > readline
200 > readline
200 > readline
201 > readline
201 > readline
202 > readline
202 > readline
203 > readline
203 > readline
204 > readline
204 > readline
205 > readline
205 > readline
206 > readline
206 > readline
207 > readline
207 > readline
208 > readline
208 > readline
209 > raw
209 > raw
210 > between\n
210 > between\n
211 > pairs 81\n
211 > pairs 81\n
212 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
212 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
213 > readline
213 > readline
214 > readline
214 > readline
215 > EOF
215 > EOF
216 using raw connection to peer
216 using raw connection to peer
217 i> write(6) -> 6:
217 i> write(6) -> 6:
218 i> hello\n
218 i> hello\n
219 o> readline() -> 15:
219 o> readline() -> 15:
220 o> banner: line 0\n
220 o> banner: line 0\n
221 o> readline() -> 15:
221 o> readline() -> 15:
222 o> banner: line 1\n
222 o> banner: line 1\n
223 o> readline() -> 15:
223 o> readline() -> 15:
224 o> banner: line 2\n
224 o> banner: line 2\n
225 o> readline() -> 15:
225 o> readline() -> 15:
226 o> banner: line 3\n
226 o> banner: line 3\n
227 o> readline() -> 15:
227 o> readline() -> 15:
228 o> banner: line 4\n
228 o> banner: line 4\n
229 o> readline() -> 15:
229 o> readline() -> 15:
230 o> banner: line 5\n
230 o> banner: line 5\n
231 o> readline() -> 15:
231 o> readline() -> 15:
232 o> banner: line 6\n
232 o> banner: line 6\n
233 o> readline() -> 15:
233 o> readline() -> 15:
234 o> banner: line 7\n
234 o> banner: line 7\n
235 o> readline() -> 15:
235 o> readline() -> 15:
236 o> banner: line 8\n
236 o> banner: line 8\n
237 o> readline() -> 15:
237 o> readline() -> 15:
238 o> banner: line 9\n
238 o> banner: line 9\n
239 o> readline() -> 4:
239 o> readline() -> 4:
240 o> 384\n
240 o> 384\n
241 o> readline() -> 384:
241 o> readline() -> 384:
242 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
242 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
243 i> write(98) -> 98:
243 i> write(98) -> 98:
244 i> between\n
244 i> between\n
245 i> pairs 81\n
245 i> pairs 81\n
246 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
246 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
247 o> readline() -> 2:
247 o> readline() -> 2:
248 o> 1\n
248 o> 1\n
249 o> readline() -> 1:
249 o> readline() -> 1:
250 o> \n
250 o> \n
251
251
252 Connecting to a <0.9.1 server that doesn't support the hello command.
252 Connecting to a <0.9.1 server that doesn't support the hello command.
253 The client should refuse, as we dropped support for connecting to such
253 The client should refuse, as we dropped support for connecting to such
254 servers.
254 servers.
255
255
256 $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
256 $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
257 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
257 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
258 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
258 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
259 devel-peer-request: hello
259 devel-peer-request: hello
260 sending hello command
260 sending hello command
261 devel-peer-request: between
261 devel-peer-request: between
262 devel-peer-request: pairs: 81 bytes
262 devel-peer-request: pairs: 81 bytes
263 sending between command
263 sending between command
264 remote: 0
264 remote: 0
265 remote: 1
265 remote: 1
266 abort: no suitable response from remote hg!
266 abort: no suitable response from remote hg!
267 [255]
267 [255]
268
268
269 Sending an unknown command to the server results in an empty response to that command
269 Sending an unknown command to the server results in an empty response to that command
270
270
271 $ hg -R server debugwireproto --localssh --peer raw << EOF
271 $ hg -R server debugwireproto --localssh --peer raw << EOF
272 > raw
272 > raw
273 > pre-hello\n
273 > pre-hello\n
274 > readline
274 > readline
275 > raw
275 > raw
276 > hello\n
276 > hello\n
277 > readline
277 > readline
278 > raw
278 > raw
279 > between\n
279 > between\n
280 > pairs 81\n
280 > pairs 81\n
281 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
281 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
282 > readline
282 > readline
283 > readline
283 > readline
284 > EOF
284 > EOF
285 using raw connection to peer
285 using raw connection to peer
286 i> write(10) -> 10:
286 i> write(10) -> 10:
287 i> pre-hello\n
287 i> pre-hello\n
288 o> readline() -> 2:
288 o> readline() -> 2:
289 o> 0\n
289 o> 0\n
290 i> write(6) -> 6:
290 i> write(6) -> 6:
291 i> hello\n
291 i> hello\n
292 o> readline() -> 4:
292 o> readline() -> 4:
293 o> 384\n
293 o> 384\n
294 i> write(98) -> 98:
294 i> write(98) -> 98:
295 i> between\n
295 i> between\n
296 i> pairs 81\n
296 i> pairs 81\n
297 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
297 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
298 o> readline() -> 384:
298 o> readline() -> 384:
299 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
299 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
300 o> readline() -> 2:
300 o> readline() -> 2:
301 o> 1\n
301 o> 1\n
302
302
303 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server
303 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server
304 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
304 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
305 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
305 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
306 sending no-args command
306 sending no-args command
307 devel-peer-request: hello
307 devel-peer-request: hello
308 sending hello command
308 sending hello command
309 devel-peer-request: between
309 devel-peer-request: between
310 devel-peer-request: pairs: 81 bytes
310 devel-peer-request: pairs: 81 bytes
311 sending between command
311 sending between command
312 remote: 0
312 remote: 0
313 remote: 384
313 remote: 384
314 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
314 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
315 remote: 1
315 remote: 1
316 url: ssh://user@dummy/server
316 url: ssh://user@dummy/server
317 local: no
317 local: no
318 pushable: yes
318 pushable: yes
319
319
320 Send multiple unknown commands before hello
320 Send multiple unknown commands before hello
321
321
322 $ hg -R server debugwireproto --localssh --peer raw << EOF
322 $ hg -R server debugwireproto --localssh --peer raw << EOF
323 > raw
323 > raw
324 > unknown1\n
324 > unknown1\n
325 > readline
325 > readline
326 > raw
326 > raw
327 > unknown2\n
327 > unknown2\n
328 > readline
328 > readline
329 > raw
329 > raw
330 > unknown3\n
330 > unknown3\n
331 > readline
331 > readline
332 > raw
332 > raw
333 > hello\n
333 > hello\n
334 > readline
334 > readline
335 > readline
335 > readline
336 > raw
336 > raw
337 > between\n
337 > between\n
338 > pairs 81\n
338 > pairs 81\n
339 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
339 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
340 > readline
340 > readline
341 > readline
341 > readline
342 > EOF
342 > EOF
343 using raw connection to peer
343 using raw connection to peer
344 i> write(9) -> 9:
344 i> write(9) -> 9:
345 i> unknown1\n
345 i> unknown1\n
346 o> readline() -> 2:
346 o> readline() -> 2:
347 o> 0\n
347 o> 0\n
348 i> write(9) -> 9:
348 i> write(9) -> 9:
349 i> unknown2\n
349 i> unknown2\n
350 o> readline() -> 2:
350 o> readline() -> 2:
351 o> 0\n
351 o> 0\n
352 i> write(9) -> 9:
352 i> write(9) -> 9:
353 i> unknown3\n
353 i> unknown3\n
354 o> readline() -> 2:
354 o> readline() -> 2:
355 o> 0\n
355 o> 0\n
356 i> write(6) -> 6:
356 i> write(6) -> 6:
357 i> hello\n
357 i> hello\n
358 o> readline() -> 4:
358 o> readline() -> 4:
359 o> 384\n
359 o> 384\n
360 o> readline() -> 384:
360 o> readline() -> 384:
361 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
361 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
362 i> write(98) -> 98:
362 i> write(98) -> 98:
363 i> between\n
363 i> between\n
364 i> pairs 81\n
364 i> pairs 81\n
365 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
365 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
366 o> readline() -> 2:
366 o> readline() -> 2:
367 o> 1\n
367 o> 1\n
368 o> readline() -> 1:
368 o> readline() -> 1:
369 o> \n
369 o> \n
370
370
371 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server
371 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server
372 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
372 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
373 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
373 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
374 sending unknown1 command
374 sending unknown1 command
375 sending unknown2 command
375 sending unknown2 command
376 sending unknown3 command
376 sending unknown3 command
377 devel-peer-request: hello
377 devel-peer-request: hello
378 sending hello command
378 sending hello command
379 devel-peer-request: between
379 devel-peer-request: between
380 devel-peer-request: pairs: 81 bytes
380 devel-peer-request: pairs: 81 bytes
381 sending between command
381 sending between command
382 remote: 0
382 remote: 0
383 remote: 0
383 remote: 0
384 remote: 0
384 remote: 0
385 remote: 384
385 remote: 384
386 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
386 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
387 remote: 1
387 remote: 1
388 url: ssh://user@dummy/server
388 url: ssh://user@dummy/server
389 local: no
389 local: no
390 pushable: yes
390 pushable: yes
391
391
392 Send an unknown command before hello that has arguments
392 Send an unknown command before hello that has arguments
393
393
394 $ cd server
394 $ cd server
395
395
396 $ hg debugwireproto --localssh --peer raw << EOF
396 $ hg debugwireproto --localssh --peer raw << EOF
397 > raw
397 > raw
398 > with-args\n
398 > with-args\n
399 > foo 13\n
399 > foo 13\n
400 > value for foo\n
400 > value for foo\n
401 > bar 13\n
401 > bar 13\n
402 > value for bar\n
402 > value for bar\n
403 > readline
403 > readline
404 > readline
404 > readline
405 > readline
405 > readline
406 > readline
406 > readline
407 > readline
407 > readline
408 > raw
408 > raw
409 > hello\n
409 > hello\n
410 > readline
410 > readline
411 > readline
411 > readline
412 > raw
412 > raw
413 > between\n
413 > between\n
414 > pairs 81\n
414 > pairs 81\n
415 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
415 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
416 > readline
416 > readline
417 > readline
417 > readline
418 > EOF
418 > EOF
419 using raw connection to peer
419 using raw connection to peer
420 i> write(52) -> 52:
420 i> write(52) -> 52:
421 i> with-args\n
421 i> with-args\n
422 i> foo 13\n
422 i> foo 13\n
423 i> value for foo\n
423 i> value for foo\n
424 i> bar 13\n
424 i> bar 13\n
425 i> value for bar\n
425 i> value for bar\n
426 o> readline() -> 2:
426 o> readline() -> 2:
427 o> 0\n
427 o> 0\n
428 o> readline() -> 2:
428 o> readline() -> 2:
429 o> 0\n
429 o> 0\n
430 o> readline() -> 2:
430 o> readline() -> 2:
431 o> 0\n
431 o> 0\n
432 o> readline() -> 2:
432 o> readline() -> 2:
433 o> 0\n
433 o> 0\n
434 o> readline() -> 2:
434 o> readline() -> 2:
435 o> 0\n
435 o> 0\n
436 i> write(6) -> 6:
436 i> write(6) -> 6:
437 i> hello\n
437 i> hello\n
438 o> readline() -> 4:
438 o> readline() -> 4:
439 o> 384\n
439 o> 384\n
440 o> readline() -> 384:
440 o> readline() -> 384:
441 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
441 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
442 i> write(98) -> 98:
442 i> write(98) -> 98:
443 i> between\n
443 i> between\n
444 i> pairs 81\n
444 i> pairs 81\n
445 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
445 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
446 o> readline() -> 2:
446 o> readline() -> 2:
447 o> 1\n
447 o> 1\n
448 o> readline() -> 1:
448 o> readline() -> 1:
449 o> \n
449 o> \n
450
450
451 Send an unknown command having an argument that looks numeric
451 Send an unknown command having an argument that looks numeric
452
452
453 $ hg debugwireproto --localssh --peer raw << EOF
453 $ hg debugwireproto --localssh --peer raw << EOF
454 > raw
454 > raw
455 > unknown\n
455 > unknown\n
456 > foo 1\n
456 > foo 1\n
457 > 0\n
457 > 0\n
458 > readline
458 > readline
459 > readline
459 > readline
460 > readline
460 > readline
461 > raw
461 > raw
462 > hello\n
462 > hello\n
463 > readline
463 > readline
464 > readline
464 > readline
465 > raw
465 > raw
466 > between\n
466 > between\n
467 > pairs 81\n
467 > pairs 81\n
468 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
468 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
469 > readline
469 > readline
470 > readline
470 > readline
471 > EOF
471 > EOF
472 using raw connection to peer
472 using raw connection to peer
473 i> write(16) -> 16:
473 i> write(16) -> 16:
474 i> unknown\n
474 i> unknown\n
475 i> foo 1\n
475 i> foo 1\n
476 i> 0\n
476 i> 0\n
477 o> readline() -> 2:
477 o> readline() -> 2:
478 o> 0\n
478 o> 0\n
479 o> readline() -> 2:
479 o> readline() -> 2:
480 o> 0\n
480 o> 0\n
481 o> readline() -> 2:
481 o> readline() -> 2:
482 o> 0\n
482 o> 0\n
483 i> write(6) -> 6:
483 i> write(6) -> 6:
484 i> hello\n
484 i> hello\n
485 o> readline() -> 4:
485 o> readline() -> 4:
486 o> 384\n
486 o> 384\n
487 o> readline() -> 384:
487 o> readline() -> 384:
488 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
488 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
489 i> write(98) -> 98:
489 i> write(98) -> 98:
490 i> between\n
490 i> between\n
491 i> pairs 81\n
491 i> pairs 81\n
492 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
492 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
493 o> readline() -> 2:
493 o> readline() -> 2:
494 o> 1\n
494 o> 1\n
495 o> readline() -> 1:
495 o> readline() -> 1:
496 o> \n
496 o> \n
497
497
498 $ hg debugwireproto --localssh --peer raw << EOF
498 $ hg debugwireproto --localssh --peer raw << EOF
499 > raw
499 > raw
500 > unknown\n
500 > unknown\n
501 > foo 1\n
501 > foo 1\n
502 > 1\n
502 > 1\n
503 > readline
503 > readline
504 > readline
504 > readline
505 > readline
505 > readline
506 > raw
506 > raw
507 > hello\n
507 > hello\n
508 > readline
508 > readline
509 > readline
509 > readline
510 > raw
510 > raw
511 > between\n
511 > between\n
512 > pairs 81\n
512 > pairs 81\n
513 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
513 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
514 > readline
514 > readline
515 > readline
515 > readline
516 > EOF
516 > EOF
517 using raw connection to peer
517 using raw connection to peer
518 i> write(16) -> 16:
518 i> write(16) -> 16:
519 i> unknown\n
519 i> unknown\n
520 i> foo 1\n
520 i> foo 1\n
521 i> 1\n
521 i> 1\n
522 o> readline() -> 2:
522 o> readline() -> 2:
523 o> 0\n
523 o> 0\n
524 o> readline() -> 2:
524 o> readline() -> 2:
525 o> 0\n
525 o> 0\n
526 o> readline() -> 2:
526 o> readline() -> 2:
527 o> 0\n
527 o> 0\n
528 i> write(6) -> 6:
528 i> write(6) -> 6:
529 i> hello\n
529 i> hello\n
530 o> readline() -> 4:
530 o> readline() -> 4:
531 o> 384\n
531 o> 384\n
532 o> readline() -> 384:
532 o> readline() -> 384:
533 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
533 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
534 i> write(98) -> 98:
534 i> write(98) -> 98:
535 i> between\n
535 i> between\n
536 i> pairs 81\n
536 i> pairs 81\n
537 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
537 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
538 o> readline() -> 2:
538 o> readline() -> 2:
539 o> 1\n
539 o> 1\n
540 o> readline() -> 1:
540 o> readline() -> 1:
541 o> \n
541 o> \n
542
542
543 When sending a dict argument value, it is serialized to
543 When sending a dict argument value, it is serialized to
544 "<arg> <item count>" followed by "<key> <len>\n<value>" for each item
544 "<arg> <item count>" followed by "<key> <len>\n<value>" for each item
545 in the dict.
545 in the dict.
546
546
547 Dictionary value for unknown command
547 Dictionary value for unknown command
548
548
549 $ hg debugwireproto --localssh --peer raw << EOF
549 $ hg debugwireproto --localssh --peer raw << EOF
550 > raw
550 > raw
551 > unknown\n
551 > unknown\n
552 > dict 3\n
552 > dict 3\n
553 > key1 3\n
553 > key1 3\n
554 > foo\n
554 > foo\n
555 > key2 3\n
555 > key2 3\n
556 > bar\n
556 > bar\n
557 > key3 3\n
557 > key3 3\n
558 > baz\n
558 > baz\n
559 > readline
559 > readline
560 > readline
560 > readline
561 > readline
561 > readline
562 > readline
562 > readline
563 > readline
563 > readline
564 > readline
564 > readline
565 > readline
565 > readline
566 > readline
566 > readline
567 > raw
567 > raw
568 > hello\n
568 > hello\n
569 > readline
569 > readline
570 > readline
570 > readline
571 > EOF
571 > EOF
572 using raw connection to peer
572 using raw connection to peer
573 i> write(48) -> 48:
573 i> write(48) -> 48:
574 i> unknown\n
574 i> unknown\n
575 i> dict 3\n
575 i> dict 3\n
576 i> key1 3\n
576 i> key1 3\n
577 i> foo\n
577 i> foo\n
578 i> key2 3\n
578 i> key2 3\n
579 i> bar\n
579 i> bar\n
580 i> key3 3\n
580 i> key3 3\n
581 i> baz\n
581 i> baz\n
582 o> readline() -> 2:
582 o> readline() -> 2:
583 o> 0\n
583 o> 0\n
584 o> readline() -> 2:
584 o> readline() -> 2:
585 o> 0\n
585 o> 0\n
586 o> readline() -> 2:
586 o> readline() -> 2:
587 o> 0\n
587 o> 0\n
588 o> readline() -> 2:
588 o> readline() -> 2:
589 o> 0\n
589 o> 0\n
590 o> readline() -> 2:
590 o> readline() -> 2:
591 o> 0\n
591 o> 0\n
592 o> readline() -> 2:
592 o> readline() -> 2:
593 o> 0\n
593 o> 0\n
594 o> readline() -> 2:
594 o> readline() -> 2:
595 o> 0\n
595 o> 0\n
596 o> readline() -> 2:
596 o> readline() -> 2:
597 o> 0\n
597 o> 0\n
598 i> write(6) -> 6:
598 i> write(6) -> 6:
599 i> hello\n
599 i> hello\n
600 o> readline() -> 4:
600 o> readline() -> 4:
601 o> 384\n
601 o> 384\n
602 o> readline() -> 384:
602 o> readline() -> 384:
603 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
603 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
604
604
605 Incomplete dictionary send
605 Incomplete dictionary send
606
606
607 $ hg debugwireproto --localssh --peer raw << EOF
607 $ hg debugwireproto --localssh --peer raw << EOF
608 > raw
608 > raw
609 > unknown\n
609 > unknown\n
610 > dict 3\n
610 > dict 3\n
611 > key1 3\n
611 > key1 3\n
612 > foo\n
612 > foo\n
613 > readline
613 > readline
614 > readline
614 > readline
615 > readline
615 > readline
616 > readline
616 > readline
617 > EOF
617 > EOF
618 using raw connection to peer
618 using raw connection to peer
619 i> write(26) -> 26:
619 i> write(26) -> 26:
620 i> unknown\n
620 i> unknown\n
621 i> dict 3\n
621 i> dict 3\n
622 i> key1 3\n
622 i> key1 3\n
623 i> foo\n
623 i> foo\n
624 o> readline() -> 2:
624 o> readline() -> 2:
625 o> 0\n
625 o> 0\n
626 o> readline() -> 2:
626 o> readline() -> 2:
627 o> 0\n
627 o> 0\n
628 o> readline() -> 2:
628 o> readline() -> 2:
629 o> 0\n
629 o> 0\n
630 o> readline() -> 2:
630 o> readline() -> 2:
631 o> 0\n
631 o> 0\n
632
632
633 Incomplete value send
633 Incomplete value send
634
634
635 $ hg debugwireproto --localssh --peer raw << EOF
635 $ hg debugwireproto --localssh --peer raw << EOF
636 > raw
636 > raw
637 > unknown\n
637 > unknown\n
638 > dict 3\n
638 > dict 3\n
639 > key1 3\n
639 > key1 3\n
640 > fo
640 > fo
641 > readline
641 > readline
642 > readline
642 > readline
643 > readline
643 > readline
644 > EOF
644 > EOF
645 using raw connection to peer
645 using raw connection to peer
646 i> write(24) -> 24:
646 i> write(24) -> 24:
647 i> unknown\n
647 i> unknown\n
648 i> dict 3\n
648 i> dict 3\n
649 i> key1 3\n
649 i> key1 3\n
650 i> fo
650 i> fo
651 o> readline() -> 2:
651 o> readline() -> 2:
652 o> 0\n
652 o> 0\n
653 o> readline() -> 2:
653 o> readline() -> 2:
654 o> 0\n
654 o> 0\n
655 o> readline() -> 2:
655 o> readline() -> 2:
656 o> 0\n
656 o> 0\n
657
657
658 Send a command line with spaces
658 Send a command line with spaces
659
659
660 $ hg debugwireproto --localssh --peer raw << EOF
660 $ hg debugwireproto --localssh --peer raw << EOF
661 > raw
661 > raw
662 > unknown withspace\n
662 > unknown withspace\n
663 > readline
663 > readline
664 > raw
664 > raw
665 > hello\n
665 > hello\n
666 > readline
666 > readline
667 > readline
667 > readline
668 > raw
668 > raw
669 > between\n
669 > between\n
670 > pairs 81\n
670 > pairs 81\n
671 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
671 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
672 > readline
672 > readline
673 > readline
673 > readline
674 > EOF
674 > EOF
675 using raw connection to peer
675 using raw connection to peer
676 i> write(18) -> 18:
676 i> write(18) -> 18:
677 i> unknown withspace\n
677 i> unknown withspace\n
678 o> readline() -> 2:
678 o> readline() -> 2:
679 o> 0\n
679 o> 0\n
680 i> write(6) -> 6:
680 i> write(6) -> 6:
681 i> hello\n
681 i> hello\n
682 o> readline() -> 4:
682 o> readline() -> 4:
683 o> 384\n
683 o> 384\n
684 o> readline() -> 384:
684 o> readline() -> 384:
685 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
685 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
686 i> write(98) -> 98:
686 i> write(98) -> 98:
687 i> between\n
687 i> between\n
688 i> pairs 81\n
688 i> pairs 81\n
689 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
689 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
690 o> readline() -> 2:
690 o> readline() -> 2:
691 o> 1\n
691 o> 1\n
692 o> readline() -> 1:
692 o> readline() -> 1:
693 o> \n
693 o> \n
694
694
695 $ hg debugwireproto --localssh --peer raw << EOF
695 $ hg debugwireproto --localssh --peer raw << EOF
696 > raw
696 > raw
697 > unknown with multiple spaces\n
697 > unknown with multiple spaces\n
698 > readline
698 > readline
699 > raw
699 > raw
700 > hello\n
700 > hello\n
701 > readline
701 > readline
702 > readline
702 > readline
703 > raw
703 > raw
704 > between\n
704 > between\n
705 > pairs 81\n
705 > pairs 81\n
706 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
706 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
707 > readline
707 > readline
708 > EOF
708 > EOF
709 using raw connection to peer
709 using raw connection to peer
710 i> write(29) -> 29:
710 i> write(29) -> 29:
711 i> unknown with multiple spaces\n
711 i> unknown with multiple spaces\n
712 o> readline() -> 2:
712 o> readline() -> 2:
713 o> 0\n
713 o> 0\n
714 i> write(6) -> 6:
714 i> write(6) -> 6:
715 i> hello\n
715 i> hello\n
716 o> readline() -> 4:
716 o> readline() -> 4:
717 o> 384\n
717 o> 384\n
718 o> readline() -> 384:
718 o> readline() -> 384:
719 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
719 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
720 i> write(98) -> 98:
720 i> write(98) -> 98:
721 i> between\n
721 i> between\n
722 i> pairs 81\n
722 i> pairs 81\n
723 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
723 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
724 o> readline() -> 2:
724 o> readline() -> 2:
725 o> 1\n
725 o> 1\n
726
726
727 $ hg debugwireproto --localssh --peer raw << EOF
727 $ hg debugwireproto --localssh --peer raw << EOF
728 > raw
728 > raw
729 > unknown with spaces\n
729 > unknown with spaces\n
730 > key 10\n
730 > key 10\n
731 > some value\n
731 > some value\n
732 > readline
732 > readline
733 > readline
733 > readline
734 > readline
734 > readline
735 > raw
735 > raw
736 > hello\n
736 > hello\n
737 > readline
737 > readline
738 > readline
738 > readline
739 > raw
739 > raw
740 > between\n
740 > between\n
741 > pairs 81\n
741 > pairs 81\n
742 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
742 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
743 > readline
743 > readline
744 > readline
744 > readline
745 > EOF
745 > EOF
746 using raw connection to peer
746 using raw connection to peer
747 i> write(38) -> 38:
747 i> write(38) -> 38:
748 i> unknown with spaces\n
748 i> unknown with spaces\n
749 i> key 10\n
749 i> key 10\n
750 i> some value\n
750 i> some value\n
751 o> readline() -> 2:
751 o> readline() -> 2:
752 o> 0\n
752 o> 0\n
753 o> readline() -> 2:
753 o> readline() -> 2:
754 o> 0\n
754 o> 0\n
755 o> readline() -> 2:
755 o> readline() -> 2:
756 o> 0\n
756 o> 0\n
757 i> write(6) -> 6:
757 i> write(6) -> 6:
758 i> hello\n
758 i> hello\n
759 o> readline() -> 4:
759 o> readline() -> 4:
760 o> 384\n
760 o> 384\n
761 o> readline() -> 384:
761 o> readline() -> 384:
762 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
762 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
763 i> write(98) -> 98:
763 i> write(98) -> 98:
764 i> between\n
764 i> between\n
765 i> pairs 81\n
765 i> pairs 81\n
766 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
766 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
767 o> readline() -> 2:
767 o> readline() -> 2:
768 o> 1\n
768 o> 1\n
769 o> readline() -> 1:
769 o> readline() -> 1:
770 o> \n
770 o> \n
771
771
772 Send an unknown command after the "between"
772 Send an unknown command after the "between"
773
773
774 $ hg debugwireproto --localssh --peer raw << EOF
774 $ hg debugwireproto --localssh --peer raw << EOF
775 > raw
775 > raw
776 > hello\n
776 > hello\n
777 > readline
777 > readline
778 > readline
778 > readline
779 > raw
779 > raw
780 > between\n
780 > between\n
781 > pairs 81\n
781 > pairs 81\n
782 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
782 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
783 > readline
783 > readline
784 > readline
784 > readline
785 > EOF
785 > EOF
786 using raw connection to peer
786 using raw connection to peer
787 i> write(6) -> 6:
787 i> write(6) -> 6:
788 i> hello\n
788 i> hello\n
789 o> readline() -> 4:
789 o> readline() -> 4:
790 o> 384\n
790 o> 384\n
791 o> readline() -> 384:
791 o> readline() -> 384:
792 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
792 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
793 i> write(105) -> 105:
793 i> write(105) -> 105:
794 i> between\n
794 i> between\n
795 i> pairs 81\n
795 i> pairs 81\n
796 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
796 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
797 o> readline() -> 2:
797 o> readline() -> 2:
798 o> 1\n
798 o> 1\n
799 o> readline() -> 1:
799 o> readline() -> 1:
800 o> \n
800 o> \n
801
801
802 And one with arguments
802 And one with arguments
803
803
804 $ hg debugwireproto --localssh --peer raw << EOF
804 $ hg debugwireproto --localssh --peer raw << EOF
805 > raw
805 > raw
806 > hello\n
806 > hello\n
807 > between\n
807 > between\n
808 > pairs 81\n
808 > pairs 81\n
809 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
809 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
810 > readline
810 > readline
811 > readline
811 > readline
812 > readline
812 > readline
813 > readline
813 > readline
814 > raw
814 > raw
815 > unknown\n
815 > unknown\n
816 > foo 5\n
816 > foo 5\n
817 > \nvalue\n
817 > \nvalue\n
818 > bar 3\n
818 > bar 3\n
819 > baz\n
819 > baz\n
820 > readline
820 > readline
821 > readline
821 > readline
822 > readline
822 > readline
823 > EOF
823 > EOF
824 using raw connection to peer
824 using raw connection to peer
825 i> write(104) -> 104:
825 i> write(104) -> 104:
826 i> hello\n
826 i> hello\n
827 i> between\n
827 i> between\n
828 i> pairs 81\n
828 i> pairs 81\n
829 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
829 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
830 o> readline() -> 4:
830 o> readline() -> 4:
831 o> 384\n
831 o> 384\n
832 o> readline() -> 384:
832 o> readline() -> 384:
833 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
833 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
834 o> readline() -> 2:
834 o> readline() -> 2:
835 o> 1\n
835 o> 1\n
836 o> readline() -> 1:
836 o> readline() -> 1:
837 o> \n
837 o> \n
838 i> write(31) -> 31:
838 i> write(31) -> 31:
839 i> unknown\n
839 i> unknown\n
840 i> foo 5\n
840 i> foo 5\n
841 i> \n
841 i> \n
842 i> value\n
842 i> value\n
843 i> bar 3\n
843 i> bar 3\n
844 i> baz\n
844 i> baz\n
845 o> readline() -> 2:
845 o> readline() -> 2:
846 o> 0\n
846 o> 0\n
847 o> readline() -> 2:
847 o> readline() -> 2:
848 o> 0\n
848 o> 0\n
849 o> readline() -> 0:
849 o> readline() -> 0:
850
850
851 Send a valid command before the handshake
851 Send a valid command before the handshake
852
852
853 $ hg debugwireproto --localssh --peer raw << EOF
853 $ hg debugwireproto --localssh --peer raw << EOF
854 > raw
854 > raw
855 > heads\n
855 > heads\n
856 > readline
856 > readline
857 > raw
857 > raw
858 > hello\n
858 > hello\n
859 > between\n
859 > between\n
860 > pairs 81\n
860 > pairs 81\n
861 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
861 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
862 > readline
862 > readline
863 > readline
863 > readline
864 > readline
864 > readline
865 > readline
865 > readline
866 > EOF
866 > EOF
867 using raw connection to peer
867 using raw connection to peer
868 i> write(6) -> 6:
868 i> write(6) -> 6:
869 i> heads\n
869 i> heads\n
870 o> readline() -> 3:
870 o> readline() -> 3:
871 o> 41\n
871 o> 41\n
872 i> write(104) -> 104:
872 i> write(104) -> 104:
873 i> hello\n
873 i> hello\n
874 i> between\n
874 i> between\n
875 i> pairs 81\n
875 i> pairs 81\n
876 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
876 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
877 o> readline() -> 41:
877 o> readline() -> 41:
878 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
878 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
879 o> readline() -> 4:
879 o> readline() -> 4:
880 o> 384\n
880 o> 384\n
881 o> readline() -> 384:
881 o> readline() -> 384:
882 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
882 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
883 o> readline() -> 2:
883 o> readline() -> 2:
884 o> 1\n
884 o> 1\n
885
885
886 And a variation that doesn't send the between command
886 And a variation that doesn't send the between command
887
887
888 $ hg debugwireproto --localssh --peer raw << EOF
888 $ hg debugwireproto --localssh --peer raw << EOF
889 > raw
889 > raw
890 > heads\n
890 > heads\n
891 > readline
891 > readline
892 > raw
892 > raw
893 > hello\n
893 > hello\n
894 > readline
894 > readline
895 > readline
895 > readline
896 > EOF
896 > EOF
897 using raw connection to peer
897 using raw connection to peer
898 i> write(6) -> 6:
898 i> write(6) -> 6:
899 i> heads\n
899 i> heads\n
900 o> readline() -> 3:
900 o> readline() -> 3:
901 o> 41\n
901 o> 41\n
902 i> write(6) -> 6:
902 i> write(6) -> 6:
903 i> hello\n
903 i> hello\n
904 o> readline() -> 41:
904 o> readline() -> 41:
905 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
905 o> 68986213bd4485ea51533535e3fc9e78007a711f\n
906 o> readline() -> 4:
906 o> readline() -> 4:
907 o> 384\n
907 o> 384\n
908
908
909 Send an upgrade request to a server that doesn't support that command
909 Send an upgrade request to a server that doesn't support that command
910
910
911 $ hg debugwireproto --localssh --peer raw << EOF
911 $ hg debugwireproto --localssh --peer raw << EOF
912 > raw
912 > raw
913 > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
913 > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
914 > readline
914 > readline
915 > raw
915 > raw
916 > hello\n
916 > hello\n
917 > between\n
917 > between\n
918 > pairs 81\n
918 > pairs 81\n
919 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
919 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
920 > readline
920 > readline
921 > readline
921 > readline
922 > readline
922 > readline
923 > readline
923 > readline
924 > EOF
924 > EOF
925 using raw connection to peer
925 using raw connection to peer
926 i> write(77) -> 77:
926 i> write(77) -> 77:
927 i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
927 i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n
928 o> readline() -> 2:
928 o> readline() -> 2:
929 o> 0\n
929 o> 0\n
930 i> write(104) -> 104:
930 i> write(104) -> 104:
931 i> hello\n
931 i> hello\n
932 i> between\n
932 i> between\n
933 i> pairs 81\n
933 i> pairs 81\n
934 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
934 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
935 o> readline() -> 4:
935 o> readline() -> 4:
936 o> 384\n
936 o> 384\n
937 o> readline() -> 384:
937 o> readline() -> 384:
938 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
938 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
939 o> readline() -> 2:
939 o> readline() -> 2:
940 o> 1\n
940 o> 1\n
941 o> readline() -> 1:
941 o> readline() -> 1:
942 o> \n
942 o> \n
943
943
944 $ cd ..
944 $ cd ..
945
945
946 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
946 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
947 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
947 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
948 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
948 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
949 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
949 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
950 devel-peer-request: hello
950 devel-peer-request: hello
951 sending hello command
951 sending hello command
952 devel-peer-request: between
952 devel-peer-request: between
953 devel-peer-request: pairs: 81 bytes
953 devel-peer-request: pairs: 81 bytes
954 sending between command
954 sending between command
955 remote: 0
955 remote: 0
956 remote: 384
956 remote: 384
957 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
957 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
958 remote: 1
958 remote: 1
959 url: ssh://user@dummy/server
959 url: ssh://user@dummy/server
960 local: no
960 local: no
961 pushable: yes
961 pushable: yes
962
962
963 Enable version 2 support on server. We need to do this in hgrc because we can't
963 Enable version 2 support on server. We need to do this in hgrc because we can't
964 use --config with `hg serve --stdio`.
964 use --config with `hg serve --stdio`.
965
965
966 $ cat >> server/.hg/hgrc << EOF
966 $ cat >> server/.hg/hgrc << EOF
967 > [experimental]
967 > [experimental]
968 > sshserver.support-v2 = true
968 > sshserver.support-v2 = true
969 > EOF
969 > EOF
970
970
971 Send an upgrade request to a server that supports upgrade
971 Send an upgrade request to a server that supports upgrade
972
972
973 $ cd server
973 $ cd server
974
974
975 $ hg debugwireproto --localssh --peer raw << EOF
975 $ hg debugwireproto --localssh --peer raw << EOF
976 > raw
976 > raw
977 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
977 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
978 > hello\n
978 > hello\n
979 > between\n
979 > between\n
980 > pairs 81\n
980 > pairs 81\n
981 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
981 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
982 > readline
982 > readline
983 > readline
983 > readline
984 > readline
984 > readline
985 > EOF
985 > EOF
986 using raw connection to peer
986 using raw connection to peer
987 i> write(153) -> 153:
987 i> write(153) -> 153:
988 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
988 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
989 i> hello\n
989 i> hello\n
990 i> between\n
990 i> between\n
991 i> pairs 81\n
991 i> pairs 81\n
992 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
992 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
993 o> readline() -> 44:
993 o> readline() -> 44:
994 o> upgraded this-is-some-token exp-ssh-v2-0001\n
994 o> upgraded this-is-some-token exp-ssh-v2-0001\n
995 o> readline() -> 4:
995 o> readline() -> 4:
996 o> 383\n
996 o> 383\n
997 o> readline() -> 384:
997 o> readline() -> 384:
998 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
998 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
999
999
1000 $ cd ..
1000 $ cd ..
1001
1001
1002 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
1002 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
1003 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
1003 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
1004 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
1004 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
1005 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
1005 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
1006 devel-peer-request: hello
1006 devel-peer-request: hello
1007 sending hello command
1007 sending hello command
1008 devel-peer-request: between
1008 devel-peer-request: between
1009 devel-peer-request: pairs: 81 bytes
1009 devel-peer-request: pairs: 81 bytes
1010 sending between command
1010 sending between command
1011 protocol upgraded to exp-ssh-v2-0001
1011 protocol upgraded to exp-ssh-v2-0001
1012 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1012 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1013 url: ssh://user@dummy/server
1013 url: ssh://user@dummy/server
1014 local: no
1014 local: no
1015 pushable: yes
1015 pushable: yes
1016
1016
1017 Verify the peer has capabilities
1017 Verify the peer has capabilities
1018
1018
1019 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server
1019 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server
1020 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
1020 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
1021 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
1021 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
1022 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
1022 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
1023 devel-peer-request: hello
1023 devel-peer-request: hello
1024 sending hello command
1024 sending hello command
1025 devel-peer-request: between
1025 devel-peer-request: between
1026 devel-peer-request: pairs: 81 bytes
1026 devel-peer-request: pairs: 81 bytes
1027 sending between command
1027 sending between command
1028 protocol upgraded to exp-ssh-v2-0001
1028 protocol upgraded to exp-ssh-v2-0001
1029 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1029 remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1030 Main capabilities:
1030 Main capabilities:
1031 batch
1031 batch
1032 branchmap
1032 branchmap
1033 $USUAL_BUNDLE2_CAPS_SERVER$
1033 $USUAL_BUNDLE2_CAPS_SERVER$
1034 changegroupsubset
1034 changegroupsubset
1035 getbundle
1035 getbundle
1036 known
1036 known
1037 lookup
1037 lookup
1038 pushkey
1038 pushkey
1039 streamreqs=generaldelta,revlogv1
1039 streamreqs=generaldelta,revlogv1
1040 unbundle=HG10GZ,HG10BZ,HG10UN
1040 unbundle=HG10GZ,HG10BZ,HG10UN
1041 unbundlehash
1041 unbundlehash
1042 Bundle2 capabilities:
1042 Bundle2 capabilities:
1043 HG20
1043 HG20
1044 bookmarks
1044 bookmarks
1045 changegroup
1045 changegroup
1046 01
1046 01
1047 02
1047 02
1048 digests
1048 digests
1049 md5
1049 md5
1050 sha1
1050 sha1
1051 sha512
1051 sha512
1052 error
1052 error
1053 abort
1053 abort
1054 unsupportedcontent
1054 unsupportedcontent
1055 pushraced
1055 pushraced
1056 pushkey
1056 pushkey
1057 hgtagsfnodes
1057 hgtagsfnodes
1058 listkeys
1058 listkeys
1059 phases
1059 phases
1060 heads
1060 heads
1061 pushkey
1061 pushkey
1062 remote-changegroup
1062 remote-changegroup
1063 http
1063 http
1064 https
1064 https
1065
1065
1066 Command after upgrade to version 2 is processed
1066 Command after upgrade to version 2 is processed
1067
1067
1068 $ cd server
1068 $ cd server
1069
1069
1070 $ hg debugwireproto --localssh --peer raw << EOF
1070 $ hg debugwireproto --localssh --peer raw << EOF
1071 > raw
1071 > raw
1072 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1072 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1073 > hello\n
1073 > hello\n
1074 > between\n
1074 > between\n
1075 > pairs 81\n
1075 > pairs 81\n
1076 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1076 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1077 > readline
1077 > readline
1078 > readline
1078 > readline
1079 > readline
1079 > readline
1080 > raw
1080 > raw
1081 > hello\n
1081 > hello\n
1082 > readline
1082 > readline
1083 > readline
1083 > readline
1084 > EOF
1084 > EOF
1085 using raw connection to peer
1085 using raw connection to peer
1086 i> write(153) -> 153:
1086 i> write(153) -> 153:
1087 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1087 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1088 i> hello\n
1088 i> hello\n
1089 i> between\n
1089 i> between\n
1090 i> pairs 81\n
1090 i> pairs 81\n
1091 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1091 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1092 o> readline() -> 44:
1092 o> readline() -> 44:
1093 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1093 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1094 o> readline() -> 4:
1094 o> readline() -> 4:
1095 o> 383\n
1095 o> 383\n
1096 o> readline() -> 384:
1096 o> readline() -> 384:
1097 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1097 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1098 i> write(6) -> 6:
1098 i> write(6) -> 6:
1099 i> hello\n
1099 i> hello\n
1100 o> readline() -> 4:
1100 o> readline() -> 4:
1101 o> 366\n
1101 o> 366\n
1102 o> readline() -> 366:
1102 o> readline() -> 366:
1103 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1103 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1104
1104
1105 Multiple upgrades is not allowed
1105 Multiple upgrades is not allowed
1106
1106
1107 $ hg debugwireproto --localssh --peer raw << EOF
1107 $ hg debugwireproto --localssh --peer raw << EOF
1108 > raw
1108 > raw
1109 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1109 > upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1110 > hello\n
1110 > hello\n
1111 > between\n
1111 > between\n
1112 > pairs 81\n
1112 > pairs 81\n
1113 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1113 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1114 > readline
1114 > readline
1115 > readline
1115 > readline
1116 > readline
1116 > readline
1117 > raw
1117 > raw
1118 > upgrade another-token proto=irrelevant\n
1118 > upgrade another-token proto=irrelevant\n
1119 > hello\n
1119 > hello\n
1120 > readline
1120 > readline
1121 > readavailable
1121 > readavailable
1122 > EOF
1122 > EOF
1123 using raw connection to peer
1123 using raw connection to peer
1124 i> write(153) -> 153:
1124 i> write(153) -> 153:
1125 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1125 i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n
1126 i> hello\n
1126 i> hello\n
1127 i> between\n
1127 i> between\n
1128 i> pairs 81\n
1128 i> pairs 81\n
1129 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1129 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1130 o> readline() -> 44:
1130 o> readline() -> 44:
1131 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1131 o> upgraded this-is-some-token exp-ssh-v2-0001\n
1132 o> readline() -> 4:
1132 o> readline() -> 4:
1133 o> 383\n
1133 o> 383\n
1134 o> readline() -> 384:
1134 o> readline() -> 384:
1135 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1135 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1136 i> write(45) -> 45:
1136 i> write(45) -> 45:
1137 i> upgrade another-token proto=irrelevant\n
1137 i> upgrade another-token proto=irrelevant\n
1138 i> hello\n
1138 i> hello\n
1139 o> readline() -> 1:
1139 o> readline() -> 1:
1140 o> \n
1140 o> \n
1141 o> read(-1) -> 0:
1141 e> read(-1) -> 42:
1142 e> read(-1) -> 42:
1142 e> cannot upgrade protocols multiple times\n
1143 e> cannot upgrade protocols multiple times\n
1143 e> -\n
1144 e> -\n
1144
1145
1145 Malformed upgrade request line (not exactly 3 space delimited tokens)
1146 Malformed upgrade request line (not exactly 3 space delimited tokens)
1146
1147
1147 $ hg debugwireproto --localssh --peer raw << EOF
1148 $ hg debugwireproto --localssh --peer raw << EOF
1148 > raw
1149 > raw
1149 > upgrade\n
1150 > upgrade\n
1150 > readline
1151 > readline
1151 > EOF
1152 > EOF
1152 using raw connection to peer
1153 using raw connection to peer
1153 i> write(8) -> 8:
1154 i> write(8) -> 8:
1154 i> upgrade\n
1155 i> upgrade\n
1155 o> readline() -> 2:
1156 o> readline() -> 2:
1156 o> 0\n
1157 o> 0\n
1157
1158
1158 $ hg debugwireproto --localssh --peer raw << EOF
1159 $ hg debugwireproto --localssh --peer raw << EOF
1159 > raw
1160 > raw
1160 > upgrade token\n
1161 > upgrade token\n
1161 > readline
1162 > readline
1162 > EOF
1163 > EOF
1163 using raw connection to peer
1164 using raw connection to peer
1164 i> write(14) -> 14:
1165 i> write(14) -> 14:
1165 i> upgrade token\n
1166 i> upgrade token\n
1166 o> readline() -> 2:
1167 o> readline() -> 2:
1167 o> 0\n
1168 o> 0\n
1168
1169
1169 $ hg debugwireproto --localssh --peer raw << EOF
1170 $ hg debugwireproto --localssh --peer raw << EOF
1170 > raw
1171 > raw
1171 > upgrade token foo=bar extra-token\n
1172 > upgrade token foo=bar extra-token\n
1172 > readline
1173 > readline
1173 > EOF
1174 > EOF
1174 using raw connection to peer
1175 using raw connection to peer
1175 i> write(34) -> 34:
1176 i> write(34) -> 34:
1176 i> upgrade token foo=bar extra-token\n
1177 i> upgrade token foo=bar extra-token\n
1177 o> readline() -> 2:
1178 o> readline() -> 2:
1178 o> 0\n
1179 o> 0\n
1179
1180
1180 Upgrade request to unsupported protocol is ignored
1181 Upgrade request to unsupported protocol is ignored
1181
1182
1182 $ hg debugwireproto --localssh --peer raw << EOF
1183 $ hg debugwireproto --localssh --peer raw << EOF
1183 > raw
1184 > raw
1184 > upgrade this-is-some-token proto=unknown1,unknown2\n
1185 > upgrade this-is-some-token proto=unknown1,unknown2\n
1185 > readline
1186 > readline
1186 > raw
1187 > raw
1187 > hello\n
1188 > hello\n
1188 > readline
1189 > readline
1189 > readline
1190 > readline
1190 > raw
1191 > raw
1191 > between\n
1192 > between\n
1192 > pairs 81\n
1193 > pairs 81\n
1193 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1194 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1194 > readline
1195 > readline
1195 > readline
1196 > readline
1196 > EOF
1197 > EOF
1197 using raw connection to peer
1198 using raw connection to peer
1198 i> write(51) -> 51:
1199 i> write(51) -> 51:
1199 i> upgrade this-is-some-token proto=unknown1,unknown2\n
1200 i> upgrade this-is-some-token proto=unknown1,unknown2\n
1200 o> readline() -> 2:
1201 o> readline() -> 2:
1201 o> 0\n
1202 o> 0\n
1202 i> write(6) -> 6:
1203 i> write(6) -> 6:
1203 i> hello\n
1204 i> hello\n
1204 o> readline() -> 4:
1205 o> readline() -> 4:
1205 o> 384\n
1206 o> 384\n
1206 o> readline() -> 384:
1207 o> readline() -> 384:
1207 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1208 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1208 i> write(98) -> 98:
1209 i> write(98) -> 98:
1209 i> between\n
1210 i> between\n
1210 i> pairs 81\n
1211 i> pairs 81\n
1211 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1212 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1212 o> readline() -> 2:
1213 o> readline() -> 2:
1213 o> 1\n
1214 o> 1\n
1214 o> readline() -> 1:
1215 o> readline() -> 1:
1215 o> \n
1216 o> \n
1216
1217
1217 Upgrade request must be followed by hello + between
1218 Upgrade request must be followed by hello + between
1218
1219
1219 $ hg debugwireproto --localssh --peer raw << EOF
1220 $ hg debugwireproto --localssh --peer raw << EOF
1220 > raw
1221 > raw
1221 > upgrade token proto=exp-ssh-v2-0001\n
1222 > upgrade token proto=exp-ssh-v2-0001\n
1222 > invalid\n
1223 > invalid\n
1223 > readline
1224 > readline
1224 > readavailable
1225 > readavailable
1225 > EOF
1226 > EOF
1226 using raw connection to peer
1227 using raw connection to peer
1227 i> write(44) -> 44:
1228 i> write(44) -> 44:
1228 i> upgrade token proto=exp-ssh-v2-0001\n
1229 i> upgrade token proto=exp-ssh-v2-0001\n
1229 i> invalid\n
1230 i> invalid\n
1230 o> readline() -> 1:
1231 o> readline() -> 1:
1231 o> \n
1232 o> \n
1233 o> read(-1) -> 0:
1232 e> read(-1) -> 46:
1234 e> read(-1) -> 46:
1233 e> malformed handshake protocol: missing hello\n
1235 e> malformed handshake protocol: missing hello\n
1234 e> -\n
1236 e> -\n
1235
1237
1236 $ hg debugwireproto --localssh --peer raw << EOF
1238 $ hg debugwireproto --localssh --peer raw << EOF
1237 > raw
1239 > raw
1238 > upgrade token proto=exp-ssh-v2-0001\n
1240 > upgrade token proto=exp-ssh-v2-0001\n
1239 > hello\n
1241 > hello\n
1240 > invalid\n
1242 > invalid\n
1241 > readline
1243 > readline
1242 > readavailable
1244 > readavailable
1243 > EOF
1245 > EOF
1244 using raw connection to peer
1246 using raw connection to peer
1245 i> write(50) -> 50:
1247 i> write(50) -> 50:
1246 i> upgrade token proto=exp-ssh-v2-0001\n
1248 i> upgrade token proto=exp-ssh-v2-0001\n
1247 i> hello\n
1249 i> hello\n
1248 i> invalid\n
1250 i> invalid\n
1249 o> readline() -> 1:
1251 o> readline() -> 1:
1250 o> \n
1252 o> \n
1253 o> read(-1) -> 0:
1251 e> read(-1) -> 48:
1254 e> read(-1) -> 48:
1252 e> malformed handshake protocol: missing between\n
1255 e> malformed handshake protocol: missing between\n
1253 e> -\n
1256 e> -\n
1254
1257
1255 $ hg debugwireproto --localssh --peer raw << EOF
1258 $ hg debugwireproto --localssh --peer raw << EOF
1256 > raw
1259 > raw
1257 > upgrade token proto=exp-ssh-v2-0001\n
1260 > upgrade token proto=exp-ssh-v2-0001\n
1258 > hello\n
1261 > hello\n
1259 > between\n
1262 > between\n
1260 > invalid\n
1263 > invalid\n
1261 > readline
1264 > readline
1262 > readavailable
1265 > readavailable
1263 > EOF
1266 > EOF
1264 using raw connection to peer
1267 using raw connection to peer
1265 i> write(58) -> 58:
1268 i> write(58) -> 58:
1266 i> upgrade token proto=exp-ssh-v2-0001\n
1269 i> upgrade token proto=exp-ssh-v2-0001\n
1267 i> hello\n
1270 i> hello\n
1268 i> between\n
1271 i> between\n
1269 i> invalid\n
1272 i> invalid\n
1270 o> readline() -> 1:
1273 o> readline() -> 1:
1271 o> \n
1274 o> \n
1275 o> read(-1) -> 0:
1272 e> read(-1) -> 49:
1276 e> read(-1) -> 49:
1273 e> malformed handshake protocol: missing pairs 81\n
1277 e> malformed handshake protocol: missing pairs 81\n
1274 e> -\n
1278 e> -\n
1275
1279
1276 Legacy commands are not exposed to version 2 of protocol
1280 Legacy commands are not exposed to version 2 of protocol
1277
1281
1278 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1282 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1279 > command branches
1283 > command branches
1280 > nodes 0000000000000000000000000000000000000000
1284 > nodes 0000000000000000000000000000000000000000
1281 > EOF
1285 > EOF
1282 creating ssh peer from handshake results
1286 creating ssh peer from handshake results
1283 sending branches command
1287 sending branches command
1284 response:
1288 response:
1285
1289
1286 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1290 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1287 > command changegroup
1291 > command changegroup
1288 > roots 0000000000000000000000000000000000000000
1292 > roots 0000000000000000000000000000000000000000
1289 > EOF
1293 > EOF
1290 creating ssh peer from handshake results
1294 creating ssh peer from handshake results
1291 sending changegroup command
1295 sending changegroup command
1292 response:
1296 response:
1293
1297
1294 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1298 $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF
1295 > command changegroupsubset
1299 > command changegroupsubset
1296 > bases 0000000000000000000000000000000000000000
1300 > bases 0000000000000000000000000000000000000000
1297 > heads 0000000000000000000000000000000000000000
1301 > heads 0000000000000000000000000000000000000000
1298 > EOF
1302 > EOF
1299 creating ssh peer from handshake results
1303 creating ssh peer from handshake results
1300 sending changegroupsubset command
1304 sending changegroupsubset command
1301 response:
1305 response:
1302
1306
1303 $ cd ..
1307 $ cd ..
1304
1308
1305 Test listkeys for listing namespaces
1309 Test listkeys for listing namespaces
1306
1310
1307 $ hg init empty
1311 $ hg init empty
1308 $ cd empty
1312 $ cd empty
1309 $ debugwireproto << EOF
1313 $ debugwireproto << EOF
1310 > command listkeys
1314 > command listkeys
1311 > namespace namespaces
1315 > namespace namespaces
1312 > EOF
1316 > EOF
1313 testing ssh1
1317 testing ssh1
1314 creating ssh peer from handshake results
1318 creating ssh peer from handshake results
1315 i> write(104) -> 104:
1319 i> write(104) -> 104:
1316 i> hello\n
1320 i> hello\n
1317 i> between\n
1321 i> between\n
1318 i> pairs 81\n
1322 i> pairs 81\n
1319 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1323 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1320 i> flush() -> None
1324 i> flush() -> None
1321 o> readline() -> 4:
1325 o> readline() -> 4:
1322 o> 384\n
1326 o> 384\n
1323 o> readline() -> 384:
1327 o> readline() -> 384:
1324 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1328 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1325 o> readline() -> 2:
1329 o> readline() -> 2:
1326 o> 1\n
1330 o> 1\n
1327 o> readline() -> 1:
1331 o> readline() -> 1:
1328 o> \n
1332 o> \n
1329 sending listkeys command
1333 sending listkeys command
1330 i> write(9) -> 9:
1334 i> write(9) -> 9:
1331 i> listkeys\n
1335 i> listkeys\n
1332 i> write(13) -> 13:
1336 i> write(13) -> 13:
1333 i> namespace 10\n
1337 i> namespace 10\n
1334 i> write(10) -> 10: namespaces
1338 i> write(10) -> 10: namespaces
1335 i> flush() -> None
1339 i> flush() -> None
1336 o> bufferedreadline() -> 3:
1340 o> bufferedreadline() -> 3:
1337 o> 30\n
1341 o> 30\n
1338 o> bufferedread(30) -> 30:
1342 o> bufferedread(30) -> 30:
1339 o> bookmarks \n
1343 o> bookmarks \n
1340 o> namespaces \n
1344 o> namespaces \n
1341 o> phases
1345 o> phases
1342 response: bookmarks \nnamespaces \nphases
1346 response: bookmarks \nnamespaces \nphases
1343
1347
1344 testing ssh2
1348 testing ssh2
1345 creating ssh peer from handshake results
1349 creating ssh peer from handshake results
1346 i> write(171) -> 171:
1350 i> write(171) -> 171:
1347 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1351 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1348 i> hello\n
1352 i> hello\n
1349 i> between\n
1353 i> between\n
1350 i> pairs 81\n
1354 i> pairs 81\n
1351 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1355 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1352 i> flush() -> None
1356 i> flush() -> None
1353 o> readline() -> 62:
1357 o> readline() -> 62:
1354 o> upgraded * exp-ssh-v2-0001\n (glob)
1358 o> upgraded * exp-ssh-v2-0001\n (glob)
1355 o> readline() -> 4:
1359 o> readline() -> 4:
1356 o> 383\n
1360 o> 383\n
1357 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1361 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1358 o> read(1) -> 1:
1362 o> read(1) -> 1:
1359 o> \n
1363 o> \n
1360 sending listkeys command
1364 sending listkeys command
1361 i> write(9) -> 9:
1365 i> write(9) -> 9:
1362 i> listkeys\n
1366 i> listkeys\n
1363 i> write(13) -> 13:
1367 i> write(13) -> 13:
1364 i> namespace 10\n
1368 i> namespace 10\n
1365 i> write(10) -> 10: namespaces
1369 i> write(10) -> 10: namespaces
1366 i> flush() -> None
1370 i> flush() -> None
1367 o> bufferedreadline() -> 3:
1371 o> bufferedreadline() -> 3:
1368 o> 30\n
1372 o> 30\n
1369 o> bufferedread(30) -> 30:
1373 o> bufferedread(30) -> 30:
1370 o> bookmarks \n
1374 o> bookmarks \n
1371 o> namespaces \n
1375 o> namespaces \n
1372 o> phases
1376 o> phases
1373 response: bookmarks \nnamespaces \nphases
1377 response: bookmarks \nnamespaces \nphases
1374
1378
1375 $ cd ..
1379 $ cd ..
1376
1380
1377 Test listkeys for bookmarks
1381 Test listkeys for bookmarks
1378
1382
1379 $ hg init bookmarkrepo
1383 $ hg init bookmarkrepo
1380 $ cd bookmarkrepo
1384 $ cd bookmarkrepo
1381 $ echo 0 > foo
1385 $ echo 0 > foo
1382 $ hg add foo
1386 $ hg add foo
1383 $ hg -q commit -m initial
1387 $ hg -q commit -m initial
1384 $ echo 1 > foo
1388 $ echo 1 > foo
1385 $ hg commit -m second
1389 $ hg commit -m second
1386
1390
1387 With no bookmarks set
1391 With no bookmarks set
1388
1392
1389 $ debugwireproto << EOF
1393 $ debugwireproto << EOF
1390 > command listkeys
1394 > command listkeys
1391 > namespace bookmarks
1395 > namespace bookmarks
1392 > EOF
1396 > EOF
1393 testing ssh1
1397 testing ssh1
1394 creating ssh peer from handshake results
1398 creating ssh peer from handshake results
1395 i> write(104) -> 104:
1399 i> write(104) -> 104:
1396 i> hello\n
1400 i> hello\n
1397 i> between\n
1401 i> between\n
1398 i> pairs 81\n
1402 i> pairs 81\n
1399 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1403 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1400 i> flush() -> None
1404 i> flush() -> None
1401 o> readline() -> 4:
1405 o> readline() -> 4:
1402 o> 384\n
1406 o> 384\n
1403 o> readline() -> 384:
1407 o> readline() -> 384:
1404 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1408 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1405 o> readline() -> 2:
1409 o> readline() -> 2:
1406 o> 1\n
1410 o> 1\n
1407 o> readline() -> 1:
1411 o> readline() -> 1:
1408 o> \n
1412 o> \n
1409 sending listkeys command
1413 sending listkeys command
1410 i> write(9) -> 9:
1414 i> write(9) -> 9:
1411 i> listkeys\n
1415 i> listkeys\n
1412 i> write(12) -> 12:
1416 i> write(12) -> 12:
1413 i> namespace 9\n
1417 i> namespace 9\n
1414 i> write(9) -> 9: bookmarks
1418 i> write(9) -> 9: bookmarks
1415 i> flush() -> None
1419 i> flush() -> None
1416 o> bufferedreadline() -> 2:
1420 o> bufferedreadline() -> 2:
1417 o> 0\n
1421 o> 0\n
1418 response:
1422 response:
1419
1423
1420 testing ssh2
1424 testing ssh2
1421 creating ssh peer from handshake results
1425 creating ssh peer from handshake results
1422 i> write(171) -> 171:
1426 i> write(171) -> 171:
1423 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1427 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1424 i> hello\n
1428 i> hello\n
1425 i> between\n
1429 i> between\n
1426 i> pairs 81\n
1430 i> pairs 81\n
1427 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1431 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1428 i> flush() -> None
1432 i> flush() -> None
1429 o> readline() -> 62:
1433 o> readline() -> 62:
1430 o> upgraded * exp-ssh-v2-0001\n (glob)
1434 o> upgraded * exp-ssh-v2-0001\n (glob)
1431 o> readline() -> 4:
1435 o> readline() -> 4:
1432 o> 383\n
1436 o> 383\n
1433 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1437 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1434 o> read(1) -> 1:
1438 o> read(1) -> 1:
1435 o> \n
1439 o> \n
1436 sending listkeys command
1440 sending listkeys command
1437 i> write(9) -> 9:
1441 i> write(9) -> 9:
1438 i> listkeys\n
1442 i> listkeys\n
1439 i> write(12) -> 12:
1443 i> write(12) -> 12:
1440 i> namespace 9\n
1444 i> namespace 9\n
1441 i> write(9) -> 9: bookmarks
1445 i> write(9) -> 9: bookmarks
1442 i> flush() -> None
1446 i> flush() -> None
1443 o> bufferedreadline() -> 2:
1447 o> bufferedreadline() -> 2:
1444 o> 0\n
1448 o> 0\n
1445 response:
1449 response:
1446
1450
1447 With a single bookmark set
1451 With a single bookmark set
1448
1452
1449 $ hg book -r 0 bookA
1453 $ hg book -r 0 bookA
1450 $ debugwireproto << EOF
1454 $ debugwireproto << EOF
1451 > command listkeys
1455 > command listkeys
1452 > namespace bookmarks
1456 > namespace bookmarks
1453 > EOF
1457 > EOF
1454 testing ssh1
1458 testing ssh1
1455 creating ssh peer from handshake results
1459 creating ssh peer from handshake results
1456 i> write(104) -> 104:
1460 i> write(104) -> 104:
1457 i> hello\n
1461 i> hello\n
1458 i> between\n
1462 i> between\n
1459 i> pairs 81\n
1463 i> pairs 81\n
1460 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1464 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1461 i> flush() -> None
1465 i> flush() -> None
1462 o> readline() -> 4:
1466 o> readline() -> 4:
1463 o> 384\n
1467 o> 384\n
1464 o> readline() -> 384:
1468 o> readline() -> 384:
1465 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1469 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1466 o> readline() -> 2:
1470 o> readline() -> 2:
1467 o> 1\n
1471 o> 1\n
1468 o> readline() -> 1:
1472 o> readline() -> 1:
1469 o> \n
1473 o> \n
1470 sending listkeys command
1474 sending listkeys command
1471 i> write(9) -> 9:
1475 i> write(9) -> 9:
1472 i> listkeys\n
1476 i> listkeys\n
1473 i> write(12) -> 12:
1477 i> write(12) -> 12:
1474 i> namespace 9\n
1478 i> namespace 9\n
1475 i> write(9) -> 9: bookmarks
1479 i> write(9) -> 9: bookmarks
1476 i> flush() -> None
1480 i> flush() -> None
1477 o> bufferedreadline() -> 3:
1481 o> bufferedreadline() -> 3:
1478 o> 46\n
1482 o> 46\n
1479 o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1483 o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1480 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1484 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1481
1485
1482 testing ssh2
1486 testing ssh2
1483 creating ssh peer from handshake results
1487 creating ssh peer from handshake results
1484 i> write(171) -> 171:
1488 i> write(171) -> 171:
1485 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1489 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1486 i> hello\n
1490 i> hello\n
1487 i> between\n
1491 i> between\n
1488 i> pairs 81\n
1492 i> pairs 81\n
1489 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1493 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1490 i> flush() -> None
1494 i> flush() -> None
1491 o> readline() -> 62:
1495 o> readline() -> 62:
1492 o> upgraded * exp-ssh-v2-0001\n (glob)
1496 o> upgraded * exp-ssh-v2-0001\n (glob)
1493 o> readline() -> 4:
1497 o> readline() -> 4:
1494 o> 383\n
1498 o> 383\n
1495 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1499 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1496 o> read(1) -> 1:
1500 o> read(1) -> 1:
1497 o> \n
1501 o> \n
1498 sending listkeys command
1502 sending listkeys command
1499 i> write(9) -> 9:
1503 i> write(9) -> 9:
1500 i> listkeys\n
1504 i> listkeys\n
1501 i> write(12) -> 12:
1505 i> write(12) -> 12:
1502 i> namespace 9\n
1506 i> namespace 9\n
1503 i> write(9) -> 9: bookmarks
1507 i> write(9) -> 9: bookmarks
1504 i> flush() -> None
1508 i> flush() -> None
1505 o> bufferedreadline() -> 3:
1509 o> bufferedreadline() -> 3:
1506 o> 46\n
1510 o> 46\n
1507 o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1511 o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1508 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1512 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f
1509
1513
1510 With multiple bookmarks set
1514 With multiple bookmarks set
1511
1515
1512 $ hg book -r 1 bookB
1516 $ hg book -r 1 bookB
1513 $ debugwireproto << EOF
1517 $ debugwireproto << EOF
1514 > command listkeys
1518 > command listkeys
1515 > namespace bookmarks
1519 > namespace bookmarks
1516 > EOF
1520 > EOF
1517 testing ssh1
1521 testing ssh1
1518 creating ssh peer from handshake results
1522 creating ssh peer from handshake results
1519 i> write(104) -> 104:
1523 i> write(104) -> 104:
1520 i> hello\n
1524 i> hello\n
1521 i> between\n
1525 i> between\n
1522 i> pairs 81\n
1526 i> pairs 81\n
1523 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1527 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1524 i> flush() -> None
1528 i> flush() -> None
1525 o> readline() -> 4:
1529 o> readline() -> 4:
1526 o> 384\n
1530 o> 384\n
1527 o> readline() -> 384:
1531 o> readline() -> 384:
1528 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1532 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1529 o> readline() -> 2:
1533 o> readline() -> 2:
1530 o> 1\n
1534 o> 1\n
1531 o> readline() -> 1:
1535 o> readline() -> 1:
1532 o> \n
1536 o> \n
1533 sending listkeys command
1537 sending listkeys command
1534 i> write(9) -> 9:
1538 i> write(9) -> 9:
1535 i> listkeys\n
1539 i> listkeys\n
1536 i> write(12) -> 12:
1540 i> write(12) -> 12:
1537 i> namespace 9\n
1541 i> namespace 9\n
1538 i> write(9) -> 9: bookmarks
1542 i> write(9) -> 9: bookmarks
1539 i> flush() -> None
1543 i> flush() -> None
1540 o> bufferedreadline() -> 3:
1544 o> bufferedreadline() -> 3:
1541 o> 93\n
1545 o> 93\n
1542 o> bufferedread(93) -> 93:
1546 o> bufferedread(93) -> 93:
1543 o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n
1547 o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n
1544 o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1548 o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1545 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1549 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1546
1550
1547 testing ssh2
1551 testing ssh2
1548 creating ssh peer from handshake results
1552 creating ssh peer from handshake results
1549 i> write(171) -> 171:
1553 i> write(171) -> 171:
1550 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1554 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1551 i> hello\n
1555 i> hello\n
1552 i> between\n
1556 i> between\n
1553 i> pairs 81\n
1557 i> pairs 81\n
1554 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1558 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1555 i> flush() -> None
1559 i> flush() -> None
1556 o> readline() -> 62:
1560 o> readline() -> 62:
1557 o> upgraded * exp-ssh-v2-0001\n (glob)
1561 o> upgraded * exp-ssh-v2-0001\n (glob)
1558 o> readline() -> 4:
1562 o> readline() -> 4:
1559 o> 383\n
1563 o> 383\n
1560 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1564 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1561 o> read(1) -> 1:
1565 o> read(1) -> 1:
1562 o> \n
1566 o> \n
1563 sending listkeys command
1567 sending listkeys command
1564 i> write(9) -> 9:
1568 i> write(9) -> 9:
1565 i> listkeys\n
1569 i> listkeys\n
1566 i> write(12) -> 12:
1570 i> write(12) -> 12:
1567 i> namespace 9\n
1571 i> namespace 9\n
1568 i> write(9) -> 9: bookmarks
1572 i> write(9) -> 9: bookmarks
1569 i> flush() -> None
1573 i> flush() -> None
1570 o> bufferedreadline() -> 3:
1574 o> bufferedreadline() -> 3:
1571 o> 93\n
1575 o> 93\n
1572 o> bufferedread(93) -> 93:
1576 o> bufferedread(93) -> 93:
1573 o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n
1577 o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n
1574 o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1578 o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1575 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1579 response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d
1576
1580
1577 Test pushkey for bookmarks
1581 Test pushkey for bookmarks
1578
1582
1579 $ debugwireproto << EOF
1583 $ debugwireproto << EOF
1580 > command pushkey
1584 > command pushkey
1581 > namespace bookmarks
1585 > namespace bookmarks
1582 > key remote
1586 > key remote
1583 > old
1587 > old
1584 > new 68986213bd4485ea51533535e3fc9e78007a711f
1588 > new 68986213bd4485ea51533535e3fc9e78007a711f
1585 > EOF
1589 > EOF
1586 testing ssh1
1590 testing ssh1
1587 creating ssh peer from handshake results
1591 creating ssh peer from handshake results
1588 i> write(104) -> 104:
1592 i> write(104) -> 104:
1589 i> hello\n
1593 i> hello\n
1590 i> between\n
1594 i> between\n
1591 i> pairs 81\n
1595 i> pairs 81\n
1592 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1596 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1593 i> flush() -> None
1597 i> flush() -> None
1594 o> readline() -> 4:
1598 o> readline() -> 4:
1595 o> 384\n
1599 o> 384\n
1596 o> readline() -> 384:
1600 o> readline() -> 384:
1597 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1601 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1598 o> readline() -> 2:
1602 o> readline() -> 2:
1599 o> 1\n
1603 o> 1\n
1600 o> readline() -> 1:
1604 o> readline() -> 1:
1601 o> \n
1605 o> \n
1602 sending pushkey command
1606 sending pushkey command
1603 i> write(8) -> 8:
1607 i> write(8) -> 8:
1604 i> pushkey\n
1608 i> pushkey\n
1605 i> write(6) -> 6:
1609 i> write(6) -> 6:
1606 i> key 6\n
1610 i> key 6\n
1607 i> write(6) -> 6: remote
1611 i> write(6) -> 6: remote
1608 i> write(12) -> 12:
1612 i> write(12) -> 12:
1609 i> namespace 9\n
1613 i> namespace 9\n
1610 i> write(9) -> 9: bookmarks
1614 i> write(9) -> 9: bookmarks
1611 i> write(7) -> 7:
1615 i> write(7) -> 7:
1612 i> new 40\n
1616 i> new 40\n
1613 i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f
1617 i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f
1614 i> write(6) -> 6:
1618 i> write(6) -> 6:
1615 i> old 0\n
1619 i> old 0\n
1616 i> flush() -> None
1620 i> flush() -> None
1617 o> bufferedreadline() -> 2:
1621 o> bufferedreadline() -> 2:
1618 o> 2\n
1622 o> 2\n
1619 o> bufferedread(2) -> 2:
1623 o> bufferedread(2) -> 2:
1620 o> 1\n
1624 o> 1\n
1621 response: 1\n
1625 response: 1\n
1622
1626
1623 testing ssh2
1627 testing ssh2
1624 creating ssh peer from handshake results
1628 creating ssh peer from handshake results
1625 i> write(171) -> 171:
1629 i> write(171) -> 171:
1626 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1630 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1627 i> hello\n
1631 i> hello\n
1628 i> between\n
1632 i> between\n
1629 i> pairs 81\n
1633 i> pairs 81\n
1630 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1634 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1631 i> flush() -> None
1635 i> flush() -> None
1632 o> readline() -> 62:
1636 o> readline() -> 62:
1633 o> upgraded * exp-ssh-v2-0001\n (glob)
1637 o> upgraded * exp-ssh-v2-0001\n (glob)
1634 o> readline() -> 4:
1638 o> readline() -> 4:
1635 o> 383\n
1639 o> 383\n
1636 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1640 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1637 o> read(1) -> 1:
1641 o> read(1) -> 1:
1638 o> \n
1642 o> \n
1639 sending pushkey command
1643 sending pushkey command
1640 i> write(8) -> 8:
1644 i> write(8) -> 8:
1641 i> pushkey\n
1645 i> pushkey\n
1642 i> write(6) -> 6:
1646 i> write(6) -> 6:
1643 i> key 6\n
1647 i> key 6\n
1644 i> write(6) -> 6: remote
1648 i> write(6) -> 6: remote
1645 i> write(12) -> 12:
1649 i> write(12) -> 12:
1646 i> namespace 9\n
1650 i> namespace 9\n
1647 i> write(9) -> 9: bookmarks
1651 i> write(9) -> 9: bookmarks
1648 i> write(7) -> 7:
1652 i> write(7) -> 7:
1649 i> new 40\n
1653 i> new 40\n
1650 i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f
1654 i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f
1651 i> write(6) -> 6:
1655 i> write(6) -> 6:
1652 i> old 0\n
1656 i> old 0\n
1653 i> flush() -> None
1657 i> flush() -> None
1654 o> bufferedreadline() -> 2:
1658 o> bufferedreadline() -> 2:
1655 o> 2\n
1659 o> 2\n
1656 o> bufferedread(2) -> 2:
1660 o> bufferedread(2) -> 2:
1657 o> 1\n
1661 o> 1\n
1658 response: 1\n
1662 response: 1\n
1659
1663
1660 $ hg bookmarks
1664 $ hg bookmarks
1661 bookA 0:68986213bd44
1665 bookA 0:68986213bd44
1662 bookB 1:1880f3755e2e
1666 bookB 1:1880f3755e2e
1663 remote 0:68986213bd44
1667 remote 0:68986213bd44
1664
1668
1665 $ cd ..
1669 $ cd ..
1666
1670
1667 Test listkeys for phases
1671 Test listkeys for phases
1668
1672
1669 $ hg init phasesrepo
1673 $ hg init phasesrepo
1670 $ cd phasesrepo
1674 $ cd phasesrepo
1671
1675
1672 Phases on empty repo
1676 Phases on empty repo
1673
1677
1674 $ debugwireproto << EOF
1678 $ debugwireproto << EOF
1675 > command listkeys
1679 > command listkeys
1676 > namespace phases
1680 > namespace phases
1677 > EOF
1681 > EOF
1678 testing ssh1
1682 testing ssh1
1679 creating ssh peer from handshake results
1683 creating ssh peer from handshake results
1680 i> write(104) -> 104:
1684 i> write(104) -> 104:
1681 i> hello\n
1685 i> hello\n
1682 i> between\n
1686 i> between\n
1683 i> pairs 81\n
1687 i> pairs 81\n
1684 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1688 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1685 i> flush() -> None
1689 i> flush() -> None
1686 o> readline() -> 4:
1690 o> readline() -> 4:
1687 o> 384\n
1691 o> 384\n
1688 o> readline() -> 384:
1692 o> readline() -> 384:
1689 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1693 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1690 o> readline() -> 2:
1694 o> readline() -> 2:
1691 o> 1\n
1695 o> 1\n
1692 o> readline() -> 1:
1696 o> readline() -> 1:
1693 o> \n
1697 o> \n
1694 sending listkeys command
1698 sending listkeys command
1695 i> write(9) -> 9:
1699 i> write(9) -> 9:
1696 i> listkeys\n
1700 i> listkeys\n
1697 i> write(12) -> 12:
1701 i> write(12) -> 12:
1698 i> namespace 6\n
1702 i> namespace 6\n
1699 i> write(6) -> 6: phases
1703 i> write(6) -> 6: phases
1700 i> flush() -> None
1704 i> flush() -> None
1701 o> bufferedreadline() -> 3:
1705 o> bufferedreadline() -> 3:
1702 o> 15\n
1706 o> 15\n
1703 o> bufferedread(15) -> 15: publishing True
1707 o> bufferedread(15) -> 15: publishing True
1704 response: publishing True
1708 response: publishing True
1705
1709
1706 testing ssh2
1710 testing ssh2
1707 creating ssh peer from handshake results
1711 creating ssh peer from handshake results
1708 i> write(171) -> 171:
1712 i> write(171) -> 171:
1709 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1713 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1710 i> hello\n
1714 i> hello\n
1711 i> between\n
1715 i> between\n
1712 i> pairs 81\n
1716 i> pairs 81\n
1713 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1717 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1714 i> flush() -> None
1718 i> flush() -> None
1715 o> readline() -> 62:
1719 o> readline() -> 62:
1716 o> upgraded * exp-ssh-v2-0001\n (glob)
1720 o> upgraded * exp-ssh-v2-0001\n (glob)
1717 o> readline() -> 4:
1721 o> readline() -> 4:
1718 o> 383\n
1722 o> 383\n
1719 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1723 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1720 o> read(1) -> 1:
1724 o> read(1) -> 1:
1721 o> \n
1725 o> \n
1722 sending listkeys command
1726 sending listkeys command
1723 i> write(9) -> 9:
1727 i> write(9) -> 9:
1724 i> listkeys\n
1728 i> listkeys\n
1725 i> write(12) -> 12:
1729 i> write(12) -> 12:
1726 i> namespace 6\n
1730 i> namespace 6\n
1727 i> write(6) -> 6: phases
1731 i> write(6) -> 6: phases
1728 i> flush() -> None
1732 i> flush() -> None
1729 o> bufferedreadline() -> 3:
1733 o> bufferedreadline() -> 3:
1730 o> 15\n
1734 o> 15\n
1731 o> bufferedread(15) -> 15: publishing True
1735 o> bufferedread(15) -> 15: publishing True
1732 response: publishing True
1736 response: publishing True
1733
1737
1734 Create some commits
1738 Create some commits
1735
1739
1736 $ echo 0 > foo
1740 $ echo 0 > foo
1737 $ hg add foo
1741 $ hg add foo
1738 $ hg -q commit -m initial
1742 $ hg -q commit -m initial
1739 $ hg phase --public
1743 $ hg phase --public
1740 $ echo 1 > foo
1744 $ echo 1 > foo
1741 $ hg commit -m 'head 1 commit 1'
1745 $ hg commit -m 'head 1 commit 1'
1742 $ echo 2 > foo
1746 $ echo 2 > foo
1743 $ hg commit -m 'head 1 commit 2'
1747 $ hg commit -m 'head 1 commit 2'
1744 $ hg -q up 0
1748 $ hg -q up 0
1745 $ echo 1a > foo
1749 $ echo 1a > foo
1746 $ hg commit -m 'head 2 commit 1'
1750 $ hg commit -m 'head 2 commit 1'
1747 created new head
1751 created new head
1748 $ echo 2a > foo
1752 $ echo 2a > foo
1749 $ hg commit -m 'head 2 commit 2'
1753 $ hg commit -m 'head 2 commit 2'
1750
1754
1751 Two draft heads
1755 Two draft heads
1752
1756
1753 $ debugwireproto << EOF
1757 $ debugwireproto << EOF
1754 > command listkeys
1758 > command listkeys
1755 > namespace phases
1759 > namespace phases
1756 > EOF
1760 > EOF
1757 testing ssh1
1761 testing ssh1
1758 creating ssh peer from handshake results
1762 creating ssh peer from handshake results
1759 i> write(104) -> 104:
1763 i> write(104) -> 104:
1760 i> hello\n
1764 i> hello\n
1761 i> between\n
1765 i> between\n
1762 i> pairs 81\n
1766 i> pairs 81\n
1763 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1767 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1764 i> flush() -> None
1768 i> flush() -> None
1765 o> readline() -> 4:
1769 o> readline() -> 4:
1766 o> 384\n
1770 o> 384\n
1767 o> readline() -> 384:
1771 o> readline() -> 384:
1768 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1772 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1769 o> readline() -> 2:
1773 o> readline() -> 2:
1770 o> 1\n
1774 o> 1\n
1771 o> readline() -> 1:
1775 o> readline() -> 1:
1772 o> \n
1776 o> \n
1773 sending listkeys command
1777 sending listkeys command
1774 i> write(9) -> 9:
1778 i> write(9) -> 9:
1775 i> listkeys\n
1779 i> listkeys\n
1776 i> write(12) -> 12:
1780 i> write(12) -> 12:
1777 i> namespace 6\n
1781 i> namespace 6\n
1778 i> write(6) -> 6: phases
1782 i> write(6) -> 6: phases
1779 i> flush() -> None
1783 i> flush() -> None
1780 o> bufferedreadline() -> 4:
1784 o> bufferedreadline() -> 4:
1781 o> 101\n
1785 o> 101\n
1782 o> bufferedread(101) -> 101:
1786 o> bufferedread(101) -> 101:
1783 o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n
1787 o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n
1784 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1788 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1785 o> publishing True
1789 o> publishing True
1786 response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1790 response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1787
1791
1788 testing ssh2
1792 testing ssh2
1789 creating ssh peer from handshake results
1793 creating ssh peer from handshake results
1790 i> write(171) -> 171:
1794 i> write(171) -> 171:
1791 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1795 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1792 i> hello\n
1796 i> hello\n
1793 i> between\n
1797 i> between\n
1794 i> pairs 81\n
1798 i> pairs 81\n
1795 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1799 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1796 i> flush() -> None
1800 i> flush() -> None
1797 o> readline() -> 62:
1801 o> readline() -> 62:
1798 o> upgraded * exp-ssh-v2-0001\n (glob)
1802 o> upgraded * exp-ssh-v2-0001\n (glob)
1799 o> readline() -> 4:
1803 o> readline() -> 4:
1800 o> 383\n
1804 o> 383\n
1801 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1805 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1802 o> read(1) -> 1:
1806 o> read(1) -> 1:
1803 o> \n
1807 o> \n
1804 sending listkeys command
1808 sending listkeys command
1805 i> write(9) -> 9:
1809 i> write(9) -> 9:
1806 i> listkeys\n
1810 i> listkeys\n
1807 i> write(12) -> 12:
1811 i> write(12) -> 12:
1808 i> namespace 6\n
1812 i> namespace 6\n
1809 i> write(6) -> 6: phases
1813 i> write(6) -> 6: phases
1810 i> flush() -> None
1814 i> flush() -> None
1811 o> bufferedreadline() -> 4:
1815 o> bufferedreadline() -> 4:
1812 o> 101\n
1816 o> 101\n
1813 o> bufferedread(101) -> 101:
1817 o> bufferedread(101) -> 101:
1814 o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n
1818 o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n
1815 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1819 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1816 o> publishing True
1820 o> publishing True
1817 response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1821 response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1818
1822
1819 Single draft head
1823 Single draft head
1820
1824
1821 $ hg phase --public -r 2
1825 $ hg phase --public -r 2
1822 $ debugwireproto << EOF
1826 $ debugwireproto << EOF
1823 > command listkeys
1827 > command listkeys
1824 > namespace phases
1828 > namespace phases
1825 > EOF
1829 > EOF
1826 testing ssh1
1830 testing ssh1
1827 creating ssh peer from handshake results
1831 creating ssh peer from handshake results
1828 i> write(104) -> 104:
1832 i> write(104) -> 104:
1829 i> hello\n
1833 i> hello\n
1830 i> between\n
1834 i> between\n
1831 i> pairs 81\n
1835 i> pairs 81\n
1832 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1836 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1833 i> flush() -> None
1837 i> flush() -> None
1834 o> readline() -> 4:
1838 o> readline() -> 4:
1835 o> 384\n
1839 o> 384\n
1836 o> readline() -> 384:
1840 o> readline() -> 384:
1837 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1841 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1838 o> readline() -> 2:
1842 o> readline() -> 2:
1839 o> 1\n
1843 o> 1\n
1840 o> readline() -> 1:
1844 o> readline() -> 1:
1841 o> \n
1845 o> \n
1842 sending listkeys command
1846 sending listkeys command
1843 i> write(9) -> 9:
1847 i> write(9) -> 9:
1844 i> listkeys\n
1848 i> listkeys\n
1845 i> write(12) -> 12:
1849 i> write(12) -> 12:
1846 i> namespace 6\n
1850 i> namespace 6\n
1847 i> write(6) -> 6: phases
1851 i> write(6) -> 6: phases
1848 i> flush() -> None
1852 i> flush() -> None
1849 o> bufferedreadline() -> 3:
1853 o> bufferedreadline() -> 3:
1850 o> 58\n
1854 o> 58\n
1851 o> bufferedread(58) -> 58:
1855 o> bufferedread(58) -> 58:
1852 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1856 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1853 o> publishing True
1857 o> publishing True
1854 response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1858 response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1855
1859
1856 testing ssh2
1860 testing ssh2
1857 creating ssh peer from handshake results
1861 creating ssh peer from handshake results
1858 i> write(171) -> 171:
1862 i> write(171) -> 171:
1859 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1863 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1860 i> hello\n
1864 i> hello\n
1861 i> between\n
1865 i> between\n
1862 i> pairs 81\n
1866 i> pairs 81\n
1863 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1867 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1864 i> flush() -> None
1868 i> flush() -> None
1865 o> readline() -> 62:
1869 o> readline() -> 62:
1866 o> upgraded * exp-ssh-v2-0001\n (glob)
1870 o> upgraded * exp-ssh-v2-0001\n (glob)
1867 o> readline() -> 4:
1871 o> readline() -> 4:
1868 o> 383\n
1872 o> 383\n
1869 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1873 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1870 o> read(1) -> 1:
1874 o> read(1) -> 1:
1871 o> \n
1875 o> \n
1872 sending listkeys command
1876 sending listkeys command
1873 i> write(9) -> 9:
1877 i> write(9) -> 9:
1874 i> listkeys\n
1878 i> listkeys\n
1875 i> write(12) -> 12:
1879 i> write(12) -> 12:
1876 i> namespace 6\n
1880 i> namespace 6\n
1877 i> write(6) -> 6: phases
1881 i> write(6) -> 6: phases
1878 i> flush() -> None
1882 i> flush() -> None
1879 o> bufferedreadline() -> 3:
1883 o> bufferedreadline() -> 3:
1880 o> 58\n
1884 o> 58\n
1881 o> bufferedread(58) -> 58:
1885 o> bufferedread(58) -> 58:
1882 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1886 o> c4750011d906c18ea2f0527419cbc1a544435150 1\n
1883 o> publishing True
1887 o> publishing True
1884 response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1888 response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True
1885
1889
1886 All public heads
1890 All public heads
1887
1891
1888 $ hg phase --public -r 4
1892 $ hg phase --public -r 4
1889 $ debugwireproto << EOF
1893 $ debugwireproto << EOF
1890 > command listkeys
1894 > command listkeys
1891 > namespace phases
1895 > namespace phases
1892 > EOF
1896 > EOF
1893 testing ssh1
1897 testing ssh1
1894 creating ssh peer from handshake results
1898 creating ssh peer from handshake results
1895 i> write(104) -> 104:
1899 i> write(104) -> 104:
1896 i> hello\n
1900 i> hello\n
1897 i> between\n
1901 i> between\n
1898 i> pairs 81\n
1902 i> pairs 81\n
1899 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1903 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1900 i> flush() -> None
1904 i> flush() -> None
1901 o> readline() -> 4:
1905 o> readline() -> 4:
1902 o> 384\n
1906 o> 384\n
1903 o> readline() -> 384:
1907 o> readline() -> 384:
1904 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1908 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1905 o> readline() -> 2:
1909 o> readline() -> 2:
1906 o> 1\n
1910 o> 1\n
1907 o> readline() -> 1:
1911 o> readline() -> 1:
1908 o> \n
1912 o> \n
1909 sending listkeys command
1913 sending listkeys command
1910 i> write(9) -> 9:
1914 i> write(9) -> 9:
1911 i> listkeys\n
1915 i> listkeys\n
1912 i> write(12) -> 12:
1916 i> write(12) -> 12:
1913 i> namespace 6\n
1917 i> namespace 6\n
1914 i> write(6) -> 6: phases
1918 i> write(6) -> 6: phases
1915 i> flush() -> None
1919 i> flush() -> None
1916 o> bufferedreadline() -> 3:
1920 o> bufferedreadline() -> 3:
1917 o> 15\n
1921 o> 15\n
1918 o> bufferedread(15) -> 15: publishing True
1922 o> bufferedread(15) -> 15: publishing True
1919 response: publishing True
1923 response: publishing True
1920
1924
1921 testing ssh2
1925 testing ssh2
1922 creating ssh peer from handshake results
1926 creating ssh peer from handshake results
1923 i> write(171) -> 171:
1927 i> write(171) -> 171:
1924 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1928 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
1925 i> hello\n
1929 i> hello\n
1926 i> between\n
1930 i> between\n
1927 i> pairs 81\n
1931 i> pairs 81\n
1928 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1932 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1929 i> flush() -> None
1933 i> flush() -> None
1930 o> readline() -> 62:
1934 o> readline() -> 62:
1931 o> upgraded * exp-ssh-v2-0001\n (glob)
1935 o> upgraded * exp-ssh-v2-0001\n (glob)
1932 o> readline() -> 4:
1936 o> readline() -> 4:
1933 o> 383\n
1937 o> 383\n
1934 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1938 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
1935 o> read(1) -> 1:
1939 o> read(1) -> 1:
1936 o> \n
1940 o> \n
1937 sending listkeys command
1941 sending listkeys command
1938 i> write(9) -> 9:
1942 i> write(9) -> 9:
1939 i> listkeys\n
1943 i> listkeys\n
1940 i> write(12) -> 12:
1944 i> write(12) -> 12:
1941 i> namespace 6\n
1945 i> namespace 6\n
1942 i> write(6) -> 6: phases
1946 i> write(6) -> 6: phases
1943 i> flush() -> None
1947 i> flush() -> None
1944 o> bufferedreadline() -> 3:
1948 o> bufferedreadline() -> 3:
1945 o> 15\n
1949 o> 15\n
1946 o> bufferedread(15) -> 15: publishing True
1950 o> bufferedread(15) -> 15: publishing True
1947 response: publishing True
1951 response: publishing True
1948
1952
1949 Setting public phase via pushkey
1953 Setting public phase via pushkey
1950
1954
1951 $ hg phase --draft --force -r .
1955 $ hg phase --draft --force -r .
1952
1956
1953 $ debugwireproto << EOF
1957 $ debugwireproto << EOF
1954 > command pushkey
1958 > command pushkey
1955 > namespace phases
1959 > namespace phases
1956 > key 7127240a084fd9dc86fe8d1f98e26229161ec82b
1960 > key 7127240a084fd9dc86fe8d1f98e26229161ec82b
1957 > old 1
1961 > old 1
1958 > new 0
1962 > new 0
1959 > EOF
1963 > EOF
1960 testing ssh1
1964 testing ssh1
1961 creating ssh peer from handshake results
1965 creating ssh peer from handshake results
1962 i> write(104) -> 104:
1966 i> write(104) -> 104:
1963 i> hello\n
1967 i> hello\n
1964 i> between\n
1968 i> between\n
1965 i> pairs 81\n
1969 i> pairs 81\n
1966 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1970 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
1967 i> flush() -> None
1971 i> flush() -> None
1968 o> readline() -> 4:
1972 o> readline() -> 4:
1969 o> 384\n
1973 o> 384\n
1970 o> readline() -> 384:
1974 o> readline() -> 384:
1971 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1975 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
1972 o> readline() -> 2:
1976 o> readline() -> 2:
1973 o> 1\n
1977 o> 1\n
1974 o> readline() -> 1:
1978 o> readline() -> 1:
1975 o> \n
1979 o> \n
1976 sending pushkey command
1980 sending pushkey command
1977 i> write(8) -> 8:
1981 i> write(8) -> 8:
1978 i> pushkey\n
1982 i> pushkey\n
1979 i> write(7) -> 7:
1983 i> write(7) -> 7:
1980 i> key 40\n
1984 i> key 40\n
1981 i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b
1985 i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b
1982 i> write(12) -> 12:
1986 i> write(12) -> 12:
1983 i> namespace 6\n
1987 i> namespace 6\n
1984 i> write(6) -> 6: phases
1988 i> write(6) -> 6: phases
1985 i> write(6) -> 6:
1989 i> write(6) -> 6:
1986 i> new 1\n
1990 i> new 1\n
1987 i> write(1) -> 1: 0
1991 i> write(1) -> 1: 0
1988 i> write(6) -> 6:
1992 i> write(6) -> 6:
1989 i> old 1\n
1993 i> old 1\n
1990 i> write(1) -> 1: 1
1994 i> write(1) -> 1: 1
1991 i> flush() -> None
1995 i> flush() -> None
1992 o> bufferedreadline() -> 2:
1996 o> bufferedreadline() -> 2:
1993 o> 2\n
1997 o> 2\n
1994 o> bufferedread(2) -> 2:
1998 o> bufferedread(2) -> 2:
1995 o> 1\n
1999 o> 1\n
1996 response: 1\n
2000 response: 1\n
1997
2001
1998 testing ssh2
2002 testing ssh2
1999 creating ssh peer from handshake results
2003 creating ssh peer from handshake results
2000 i> write(171) -> 171:
2004 i> write(171) -> 171:
2001 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
2005 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
2002 i> hello\n
2006 i> hello\n
2003 i> between\n
2007 i> between\n
2004 i> pairs 81\n
2008 i> pairs 81\n
2005 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2009 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2006 i> flush() -> None
2010 i> flush() -> None
2007 o> readline() -> 62:
2011 o> readline() -> 62:
2008 o> upgraded * exp-ssh-v2-0001\n (glob)
2012 o> upgraded * exp-ssh-v2-0001\n (glob)
2009 o> readline() -> 4:
2013 o> readline() -> 4:
2010 o> 383\n
2014 o> 383\n
2011 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
2015 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
2012 o> read(1) -> 1:
2016 o> read(1) -> 1:
2013 o> \n
2017 o> \n
2014 sending pushkey command
2018 sending pushkey command
2015 i> write(8) -> 8:
2019 i> write(8) -> 8:
2016 i> pushkey\n
2020 i> pushkey\n
2017 i> write(7) -> 7:
2021 i> write(7) -> 7:
2018 i> key 40\n
2022 i> key 40\n
2019 i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b
2023 i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b
2020 i> write(12) -> 12:
2024 i> write(12) -> 12:
2021 i> namespace 6\n
2025 i> namespace 6\n
2022 i> write(6) -> 6: phases
2026 i> write(6) -> 6: phases
2023 i> write(6) -> 6:
2027 i> write(6) -> 6:
2024 i> new 1\n
2028 i> new 1\n
2025 i> write(1) -> 1: 0
2029 i> write(1) -> 1: 0
2026 i> write(6) -> 6:
2030 i> write(6) -> 6:
2027 i> old 1\n
2031 i> old 1\n
2028 i> write(1) -> 1: 1
2032 i> write(1) -> 1: 1
2029 i> flush() -> None
2033 i> flush() -> None
2030 o> bufferedreadline() -> 2:
2034 o> bufferedreadline() -> 2:
2031 o> 2\n
2035 o> 2\n
2032 o> bufferedread(2) -> 2:
2036 o> bufferedread(2) -> 2:
2033 o> 1\n
2037 o> 1\n
2034 response: 1\n
2038 response: 1\n
2035
2039
2036 $ hg phase .
2040 $ hg phase .
2037 4: public
2041 4: public
2038
2042
2039 $ cd ..
2043 $ cd ..
2040
2044
2041 Test batching of requests
2045 Test batching of requests
2042
2046
2043 $ hg init batching
2047 $ hg init batching
2044 $ cd batching
2048 $ cd batching
2045 $ echo 0 > foo
2049 $ echo 0 > foo
2046 $ hg add foo
2050 $ hg add foo
2047 $ hg -q commit -m initial
2051 $ hg -q commit -m initial
2048 $ hg phase --public
2052 $ hg phase --public
2049 $ echo 1 > foo
2053 $ echo 1 > foo
2050 $ hg commit -m 'commit 1'
2054 $ hg commit -m 'commit 1'
2051 $ hg -q up 0
2055 $ hg -q up 0
2052 $ echo 2 > foo
2056 $ echo 2 > foo
2053 $ hg commit -m 'commit 2'
2057 $ hg commit -m 'commit 2'
2054 created new head
2058 created new head
2055 $ hg book -r 1 bookA
2059 $ hg book -r 1 bookA
2056 $ hg book -r 2 bookB
2060 $ hg book -r 2 bookB
2057
2061
2058 $ debugwireproto << EOF
2062 $ debugwireproto << EOF
2059 > batchbegin
2063 > batchbegin
2060 > command heads
2064 > command heads
2061 > command listkeys
2065 > command listkeys
2062 > namespace bookmarks
2066 > namespace bookmarks
2063 > command listkeys
2067 > command listkeys
2064 > namespace phases
2068 > namespace phases
2065 > batchsubmit
2069 > batchsubmit
2066 > EOF
2070 > EOF
2067 testing ssh1
2071 testing ssh1
2068 creating ssh peer from handshake results
2072 creating ssh peer from handshake results
2069 i> write(104) -> 104:
2073 i> write(104) -> 104:
2070 i> hello\n
2074 i> hello\n
2071 i> between\n
2075 i> between\n
2072 i> pairs 81\n
2076 i> pairs 81\n
2073 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2077 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2074 i> flush() -> None
2078 i> flush() -> None
2075 o> readline() -> 4:
2079 o> readline() -> 4:
2076 o> 384\n
2080 o> 384\n
2077 o> readline() -> 384:
2081 o> readline() -> 384:
2078 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
2082 o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
2079 o> readline() -> 2:
2083 o> readline() -> 2:
2080 o> 1\n
2084 o> 1\n
2081 o> readline() -> 1:
2085 o> readline() -> 1:
2082 o> \n
2086 o> \n
2083 sending batch with 3 sub-commands
2087 sending batch with 3 sub-commands
2084 i> write(6) -> 6:
2088 i> write(6) -> 6:
2085 i> batch\n
2089 i> batch\n
2086 i> write(4) -> 4:
2090 i> write(4) -> 4:
2087 i> * 0\n
2091 i> * 0\n
2088 i> write(8) -> 8:
2092 i> write(8) -> 8:
2089 i> cmds 61\n
2093 i> cmds 61\n
2090 i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases
2094 i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases
2091 i> flush() -> None
2095 i> flush() -> None
2092 o> bufferedreadline() -> 4:
2096 o> bufferedreadline() -> 4:
2093 o> 278\n
2097 o> 278\n
2094 o> bufferedread(278) -> 278:
2098 o> bufferedread(278) -> 278:
2095 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2099 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2096 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2100 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2097 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n
2101 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n
2098 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n
2102 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n
2099 o> publishing True
2103 o> publishing True
2100 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2104 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2101 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6
2105 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6
2102 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True
2106 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True
2103
2107
2104 testing ssh2
2108 testing ssh2
2105 creating ssh peer from handshake results
2109 creating ssh peer from handshake results
2106 i> write(171) -> 171:
2110 i> write(171) -> 171:
2107 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
2111 i> upgrade * proto=exp-ssh-v2-0001\n (glob)
2108 i> hello\n
2112 i> hello\n
2109 i> between\n
2113 i> between\n
2110 i> pairs 81\n
2114 i> pairs 81\n
2111 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2115 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
2112 i> flush() -> None
2116 i> flush() -> None
2113 o> readline() -> 62:
2117 o> readline() -> 62:
2114 o> upgraded * exp-ssh-v2-0001\n (glob)
2118 o> upgraded * exp-ssh-v2-0001\n (glob)
2115 o> readline() -> 4:
2119 o> readline() -> 4:
2116 o> 383\n
2120 o> 383\n
2117 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
2121 o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
2118 o> read(1) -> 1:
2122 o> read(1) -> 1:
2119 o> \n
2123 o> \n
2120 sending batch with 3 sub-commands
2124 sending batch with 3 sub-commands
2121 i> write(6) -> 6:
2125 i> write(6) -> 6:
2122 i> batch\n
2126 i> batch\n
2123 i> write(4) -> 4:
2127 i> write(4) -> 4:
2124 i> * 0\n
2128 i> * 0\n
2125 i> write(8) -> 8:
2129 i> write(8) -> 8:
2126 i> cmds 61\n
2130 i> cmds 61\n
2127 i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases
2131 i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases
2128 i> flush() -> None
2132 i> flush() -> None
2129 o> bufferedreadline() -> 4:
2133 o> bufferedreadline() -> 4:
2130 o> 278\n
2134 o> 278\n
2131 o> bufferedread(278) -> 278:
2135 o> bufferedread(278) -> 278:
2132 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2136 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2133 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2137 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2134 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n
2138 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n
2135 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n
2139 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n
2136 o> publishing True
2140 o> publishing True
2137 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2141 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n
2138 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6
2142 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6
2139 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True
2143 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True
General Comments 0
You need to be logged in to leave comments. Login now