Show More
@@ -1,2861 +1,2854 b'' | |||
|
1 | 1 | # debugcommands.py - command processing for debug* commands |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2016 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import codecs |
|
11 | 11 | import collections |
|
12 | 12 | import difflib |
|
13 | 13 | import errno |
|
14 | 14 | import operator |
|
15 | 15 | import os |
|
16 | 16 | import random |
|
17 | 17 | import socket |
|
18 | 18 | import ssl |
|
19 | 19 | import stat |
|
20 | 20 | import string |
|
21 | 21 | import subprocess |
|
22 | 22 | import sys |
|
23 | 23 | import tempfile |
|
24 | 24 | import time |
|
25 | 25 | |
|
26 | 26 | from .i18n import _ |
|
27 | 27 | from .node import ( |
|
28 | 28 | bin, |
|
29 | 29 | hex, |
|
30 | 30 | nullhex, |
|
31 | 31 | nullid, |
|
32 | 32 | nullrev, |
|
33 | 33 | short, |
|
34 | 34 | ) |
|
35 | 35 | from . import ( |
|
36 | 36 | bundle2, |
|
37 | 37 | changegroup, |
|
38 | 38 | cmdutil, |
|
39 | 39 | color, |
|
40 | 40 | context, |
|
41 | 41 | dagparser, |
|
42 | 42 | dagutil, |
|
43 | 43 | encoding, |
|
44 | 44 | error, |
|
45 | 45 | exchange, |
|
46 | 46 | extensions, |
|
47 | 47 | filemerge, |
|
48 | 48 | fileset, |
|
49 | 49 | formatter, |
|
50 | 50 | hg, |
|
51 | 51 | localrepo, |
|
52 | 52 | lock as lockmod, |
|
53 | 53 | logcmdutil, |
|
54 | 54 | merge as mergemod, |
|
55 | 55 | obsolete, |
|
56 | 56 | obsutil, |
|
57 | 57 | phases, |
|
58 | 58 | policy, |
|
59 | 59 | pvec, |
|
60 | 60 | pycompat, |
|
61 | 61 | registrar, |
|
62 | 62 | repair, |
|
63 | 63 | revlog, |
|
64 | 64 | revset, |
|
65 | 65 | revsetlang, |
|
66 | 66 | scmutil, |
|
67 | 67 | setdiscovery, |
|
68 | 68 | simplemerge, |
|
69 | 69 | smartset, |
|
70 | 70 | sshpeer, |
|
71 | 71 | sslutil, |
|
72 | 72 | streamclone, |
|
73 | 73 | templater, |
|
74 | 74 | treediscovery, |
|
75 | 75 | upgrade, |
|
76 | 76 | url as urlmod, |
|
77 | 77 | util, |
|
78 | 78 | vfs as vfsmod, |
|
79 | 79 | wireprotoserver, |
|
80 | 80 | ) |
|
81 | 81 | from .utils import dateutil |
|
82 | 82 | |
|
83 | 83 | release = lockmod.release |
|
84 | 84 | |
|
85 | 85 | command = registrar.command() |
|
86 | 86 | |
|
87 | 87 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
|
88 | 88 | def debugancestor(ui, repo, *args): |
|
89 | 89 | """find the ancestor revision of two revisions in a given index""" |
|
90 | 90 | if len(args) == 3: |
|
91 | 91 | index, rev1, rev2 = args |
|
92 | 92 | r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index) |
|
93 | 93 | lookup = r.lookup |
|
94 | 94 | elif len(args) == 2: |
|
95 | 95 | if not repo: |
|
96 | 96 | raise error.Abort(_('there is no Mercurial repository here ' |
|
97 | 97 | '(.hg not found)')) |
|
98 | 98 | rev1, rev2 = args |
|
99 | 99 | r = repo.changelog |
|
100 | 100 | lookup = repo.lookup |
|
101 | 101 | else: |
|
102 | 102 | raise error.Abort(_('either two or three arguments required')) |
|
103 | 103 | a = r.ancestor(lookup(rev1), lookup(rev2)) |
|
104 | 104 | ui.write('%d:%s\n' % (r.rev(a), hex(a))) |
|
105 | 105 | |
|
106 | 106 | @command('debugapplystreamclonebundle', [], 'FILE') |
|
107 | 107 | def debugapplystreamclonebundle(ui, repo, fname): |
|
108 | 108 | """apply a stream clone bundle file""" |
|
109 | 109 | f = hg.openpath(ui, fname) |
|
110 | 110 | gen = exchange.readbundle(ui, f, fname) |
|
111 | 111 | gen.apply(repo) |
|
112 | 112 | |
|
113 | 113 | @command('debugbuilddag', |
|
114 | 114 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), |
|
115 | 115 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), |
|
116 | 116 | ('n', 'new-file', None, _('add new file at each rev'))], |
|
117 | 117 | _('[OPTION]... [TEXT]')) |
|
118 | 118 | def debugbuilddag(ui, repo, text=None, |
|
119 | 119 | mergeable_file=False, |
|
120 | 120 | overwritten_file=False, |
|
121 | 121 | new_file=False): |
|
122 | 122 | """builds a repo with a given DAG from scratch in the current empty repo |
|
123 | 123 | |
|
124 | 124 | The description of the DAG is read from stdin if not given on the |
|
125 | 125 | command line. |
|
126 | 126 | |
|
127 | 127 | Elements: |
|
128 | 128 | |
|
129 | 129 | - "+n" is a linear run of n nodes based on the current default parent |
|
130 | 130 | - "." is a single node based on the current default parent |
|
131 | 131 | - "$" resets the default parent to null (implied at the start); |
|
132 | 132 | otherwise the default parent is always the last node created |
|
133 | 133 | - "<p" sets the default parent to the backref p |
|
134 | 134 | - "*p" is a fork at parent p, which is a backref |
|
135 | 135 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs |
|
136 | 136 | - "/p2" is a merge of the preceding node and p2 |
|
137 | 137 | - ":tag" defines a local tag for the preceding node |
|
138 | 138 | - "@branch" sets the named branch for subsequent nodes |
|
139 | 139 | - "#...\\n" is a comment up to the end of the line |
|
140 | 140 | |
|
141 | 141 | Whitespace between the above elements is ignored. |
|
142 | 142 | |
|
143 | 143 | A backref is either |
|
144 | 144 | |
|
145 | 145 | - a number n, which references the node curr-n, where curr is the current |
|
146 | 146 | node, or |
|
147 | 147 | - the name of a local tag you placed earlier using ":tag", or |
|
148 | 148 | - empty to denote the default parent. |
|
149 | 149 | |
|
150 | 150 | All string valued-elements are either strictly alphanumeric, or must |
|
151 | 151 | be enclosed in double quotes ("..."), with "\\" as escape character. |
|
152 | 152 | """ |
|
153 | 153 | |
|
154 | 154 | if text is None: |
|
155 | 155 | ui.status(_("reading DAG from stdin\n")) |
|
156 | 156 | text = ui.fin.read() |
|
157 | 157 | |
|
158 | 158 | cl = repo.changelog |
|
159 | 159 | if len(cl) > 0: |
|
160 | 160 | raise error.Abort(_('repository is not empty')) |
|
161 | 161 | |
|
162 | 162 | # determine number of revs in DAG |
|
163 | 163 | total = 0 |
|
164 | 164 | for type, data in dagparser.parsedag(text): |
|
165 | 165 | if type == 'n': |
|
166 | 166 | total += 1 |
|
167 | 167 | |
|
168 | 168 | if mergeable_file: |
|
169 | 169 | linesperrev = 2 |
|
170 | 170 | # make a file with k lines per rev |
|
171 | 171 | initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)] |
|
172 | 172 | initialmergedlines.append("") |
|
173 | 173 | |
|
174 | 174 | tags = [] |
|
175 | 175 | |
|
176 | 176 | wlock = lock = tr = None |
|
177 | 177 | try: |
|
178 | 178 | wlock = repo.wlock() |
|
179 | 179 | lock = repo.lock() |
|
180 | 180 | tr = repo.transaction("builddag") |
|
181 | 181 | |
|
182 | 182 | at = -1 |
|
183 | 183 | atbranch = 'default' |
|
184 | 184 | nodeids = [] |
|
185 | 185 | id = 0 |
|
186 | 186 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
187 | 187 | for type, data in dagparser.parsedag(text): |
|
188 | 188 | if type == 'n': |
|
189 | 189 | ui.note(('node %s\n' % pycompat.bytestr(data))) |
|
190 | 190 | id, ps = data |
|
191 | 191 | |
|
192 | 192 | files = [] |
|
193 | 193 | filecontent = {} |
|
194 | 194 | |
|
195 | 195 | p2 = None |
|
196 | 196 | if mergeable_file: |
|
197 | 197 | fn = "mf" |
|
198 | 198 | p1 = repo[ps[0]] |
|
199 | 199 | if len(ps) > 1: |
|
200 | 200 | p2 = repo[ps[1]] |
|
201 | 201 | pa = p1.ancestor(p2) |
|
202 | 202 | base, local, other = [x[fn].data() for x in (pa, p1, |
|
203 | 203 | p2)] |
|
204 | 204 | m3 = simplemerge.Merge3Text(base, local, other) |
|
205 | 205 | ml = [l.strip() for l in m3.merge_lines()] |
|
206 | 206 | ml.append("") |
|
207 | 207 | elif at > 0: |
|
208 | 208 | ml = p1[fn].data().split("\n") |
|
209 | 209 | else: |
|
210 | 210 | ml = initialmergedlines |
|
211 | 211 | ml[id * linesperrev] += " r%i" % id |
|
212 | 212 | mergedtext = "\n".join(ml) |
|
213 | 213 | files.append(fn) |
|
214 | 214 | filecontent[fn] = mergedtext |
|
215 | 215 | |
|
216 | 216 | if overwritten_file: |
|
217 | 217 | fn = "of" |
|
218 | 218 | files.append(fn) |
|
219 | 219 | filecontent[fn] = "r%i\n" % id |
|
220 | 220 | |
|
221 | 221 | if new_file: |
|
222 | 222 | fn = "nf%i" % id |
|
223 | 223 | files.append(fn) |
|
224 | 224 | filecontent[fn] = "r%i\n" % id |
|
225 | 225 | if len(ps) > 1: |
|
226 | 226 | if not p2: |
|
227 | 227 | p2 = repo[ps[1]] |
|
228 | 228 | for fn in p2: |
|
229 | 229 | if fn.startswith("nf"): |
|
230 | 230 | files.append(fn) |
|
231 | 231 | filecontent[fn] = p2[fn].data() |
|
232 | 232 | |
|
233 | 233 | def fctxfn(repo, cx, path): |
|
234 | 234 | if path in filecontent: |
|
235 | 235 | return context.memfilectx(repo, cx, path, |
|
236 | 236 | filecontent[path]) |
|
237 | 237 | return None |
|
238 | 238 | |
|
239 | 239 | if len(ps) == 0 or ps[0] < 0: |
|
240 | 240 | pars = [None, None] |
|
241 | 241 | elif len(ps) == 1: |
|
242 | 242 | pars = [nodeids[ps[0]], None] |
|
243 | 243 | else: |
|
244 | 244 | pars = [nodeids[p] for p in ps] |
|
245 | 245 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, |
|
246 | 246 | date=(id, 0), |
|
247 | 247 | user="debugbuilddag", |
|
248 | 248 | extra={'branch': atbranch}) |
|
249 | 249 | nodeid = repo.commitctx(cx) |
|
250 | 250 | nodeids.append(nodeid) |
|
251 | 251 | at = id |
|
252 | 252 | elif type == 'l': |
|
253 | 253 | id, name = data |
|
254 | 254 | ui.note(('tag %s\n' % name)) |
|
255 | 255 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
|
256 | 256 | elif type == 'a': |
|
257 | 257 | ui.note(('branch %s\n' % data)) |
|
258 | 258 | atbranch = data |
|
259 | 259 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
260 | 260 | tr.close() |
|
261 | 261 | |
|
262 | 262 | if tags: |
|
263 | 263 | repo.vfs.write("localtags", "".join(tags)) |
|
264 | 264 | finally: |
|
265 | 265 | ui.progress(_('building'), None) |
|
266 | 266 | release(tr, lock, wlock) |
|
267 | 267 | |
|
268 | 268 | def _debugchangegroup(ui, gen, all=None, indent=0, **opts): |
|
269 | 269 | indent_string = ' ' * indent |
|
270 | 270 | if all: |
|
271 | 271 | ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n") |
|
272 | 272 | % indent_string) |
|
273 | 273 | |
|
274 | 274 | def showchunks(named): |
|
275 | 275 | ui.write("\n%s%s\n" % (indent_string, named)) |
|
276 | 276 | for deltadata in gen.deltaiter(): |
|
277 | 277 | node, p1, p2, cs, deltabase, delta, flags = deltadata |
|
278 | 278 | ui.write("%s%s %s %s %s %s %d\n" % |
|
279 | 279 | (indent_string, hex(node), hex(p1), hex(p2), |
|
280 | 280 | hex(cs), hex(deltabase), len(delta))) |
|
281 | 281 | |
|
282 | 282 | chunkdata = gen.changelogheader() |
|
283 | 283 | showchunks("changelog") |
|
284 | 284 | chunkdata = gen.manifestheader() |
|
285 | 285 | showchunks("manifest") |
|
286 | 286 | for chunkdata in iter(gen.filelogheader, {}): |
|
287 | 287 | fname = chunkdata['filename'] |
|
288 | 288 | showchunks(fname) |
|
289 | 289 | else: |
|
290 | 290 | if isinstance(gen, bundle2.unbundle20): |
|
291 | 291 | raise error.Abort(_('use debugbundle2 for this file')) |
|
292 | 292 | chunkdata = gen.changelogheader() |
|
293 | 293 | for deltadata in gen.deltaiter(): |
|
294 | 294 | node, p1, p2, cs, deltabase, delta, flags = deltadata |
|
295 | 295 | ui.write("%s%s\n" % (indent_string, hex(node))) |
|
296 | 296 | |
|
297 | 297 | def _debugobsmarkers(ui, part, indent=0, **opts): |
|
298 | 298 | """display version and markers contained in 'data'""" |
|
299 | 299 | opts = pycompat.byteskwargs(opts) |
|
300 | 300 | data = part.read() |
|
301 | 301 | indent_string = ' ' * indent |
|
302 | 302 | try: |
|
303 | 303 | version, markers = obsolete._readmarkers(data) |
|
304 | 304 | except error.UnknownVersion as exc: |
|
305 | 305 | msg = "%sunsupported version: %s (%d bytes)\n" |
|
306 | 306 | msg %= indent_string, exc.version, len(data) |
|
307 | 307 | ui.write(msg) |
|
308 | 308 | else: |
|
309 | 309 | msg = "%sversion: %d (%d bytes)\n" |
|
310 | 310 | msg %= indent_string, version, len(data) |
|
311 | 311 | ui.write(msg) |
|
312 | 312 | fm = ui.formatter('debugobsolete', opts) |
|
313 | 313 | for rawmarker in sorted(markers): |
|
314 | 314 | m = obsutil.marker(None, rawmarker) |
|
315 | 315 | fm.startitem() |
|
316 | 316 | fm.plain(indent_string) |
|
317 | 317 | cmdutil.showmarker(fm, m) |
|
318 | 318 | fm.end() |
|
319 | 319 | |
|
320 | 320 | def _debugphaseheads(ui, data, indent=0): |
|
321 | 321 | """display version and markers contained in 'data'""" |
|
322 | 322 | indent_string = ' ' * indent |
|
323 | 323 | headsbyphase = phases.binarydecode(data) |
|
324 | 324 | for phase in phases.allphases: |
|
325 | 325 | for head in headsbyphase[phase]: |
|
326 | 326 | ui.write(indent_string) |
|
327 | 327 | ui.write('%s %s\n' % (hex(head), phases.phasenames[phase])) |
|
328 | 328 | |
|
329 | 329 | def _quasirepr(thing): |
|
330 | 330 | if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)): |
|
331 | 331 | return '{%s}' % ( |
|
332 | 332 | b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing))) |
|
333 | 333 | return pycompat.bytestr(repr(thing)) |
|
334 | 334 | |
|
335 | 335 | def _debugbundle2(ui, gen, all=None, **opts): |
|
336 | 336 | """lists the contents of a bundle2""" |
|
337 | 337 | if not isinstance(gen, bundle2.unbundle20): |
|
338 | 338 | raise error.Abort(_('not a bundle2 file')) |
|
339 | 339 | ui.write(('Stream params: %s\n' % _quasirepr(gen.params))) |
|
340 | 340 | parttypes = opts.get(r'part_type', []) |
|
341 | 341 | for part in gen.iterparts(): |
|
342 | 342 | if parttypes and part.type not in parttypes: |
|
343 | 343 | continue |
|
344 | 344 | ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params))) |
|
345 | 345 | if part.type == 'changegroup': |
|
346 | 346 | version = part.params.get('version', '01') |
|
347 | 347 | cg = changegroup.getunbundler(version, part, 'UN') |
|
348 | 348 | _debugchangegroup(ui, cg, all=all, indent=4, **opts) |
|
349 | 349 | if part.type == 'obsmarkers': |
|
350 | 350 | _debugobsmarkers(ui, part, indent=4, **opts) |
|
351 | 351 | if part.type == 'phase-heads': |
|
352 | 352 | _debugphaseheads(ui, part, indent=4) |
|
353 | 353 | |
|
354 | 354 | @command('debugbundle', |
|
355 | 355 | [('a', 'all', None, _('show all details')), |
|
356 | 356 | ('', 'part-type', [], _('show only the named part type')), |
|
357 | 357 | ('', 'spec', None, _('print the bundlespec of the bundle'))], |
|
358 | 358 | _('FILE'), |
|
359 | 359 | norepo=True) |
|
360 | 360 | def debugbundle(ui, bundlepath, all=None, spec=None, **opts): |
|
361 | 361 | """lists the contents of a bundle""" |
|
362 | 362 | with hg.openpath(ui, bundlepath) as f: |
|
363 | 363 | if spec: |
|
364 | 364 | spec = exchange.getbundlespec(ui, f) |
|
365 | 365 | ui.write('%s\n' % spec) |
|
366 | 366 | return |
|
367 | 367 | |
|
368 | 368 | gen = exchange.readbundle(ui, f, bundlepath) |
|
369 | 369 | if isinstance(gen, bundle2.unbundle20): |
|
370 | 370 | return _debugbundle2(ui, gen, all=all, **opts) |
|
371 | 371 | _debugchangegroup(ui, gen, all=all, **opts) |
|
372 | 372 | |
|
373 | 373 | @command('debugcapabilities', |
|
374 | 374 | [], _('PATH'), |
|
375 | 375 | norepo=True) |
|
376 | 376 | def debugcapabilities(ui, path, **opts): |
|
377 | 377 | """lists the capabilities of a remote peer""" |
|
378 | 378 | opts = pycompat.byteskwargs(opts) |
|
379 | 379 | peer = hg.peer(ui, opts, path) |
|
380 | 380 | caps = peer.capabilities() |
|
381 | 381 | ui.write(('Main capabilities:\n')) |
|
382 | 382 | for c in sorted(caps): |
|
383 | 383 | ui.write((' %s\n') % c) |
|
384 | 384 | b2caps = bundle2.bundle2caps(peer) |
|
385 | 385 | if b2caps: |
|
386 | 386 | ui.write(('Bundle2 capabilities:\n')) |
|
387 | 387 | for key, values in sorted(b2caps.iteritems()): |
|
388 | 388 | ui.write((' %s\n') % key) |
|
389 | 389 | for v in values: |
|
390 | 390 | ui.write((' %s\n') % v) |
|
391 | 391 | |
|
392 | 392 | @command('debugcheckstate', [], '') |
|
393 | 393 | def debugcheckstate(ui, repo): |
|
394 | 394 | """validate the correctness of the current dirstate""" |
|
395 | 395 | parent1, parent2 = repo.dirstate.parents() |
|
396 | 396 | m1 = repo[parent1].manifest() |
|
397 | 397 | m2 = repo[parent2].manifest() |
|
398 | 398 | errors = 0 |
|
399 | 399 | for f in repo.dirstate: |
|
400 | 400 | state = repo.dirstate[f] |
|
401 | 401 | if state in "nr" and f not in m1: |
|
402 | 402 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
|
403 | 403 | errors += 1 |
|
404 | 404 | if state in "a" and f in m1: |
|
405 | 405 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
|
406 | 406 | errors += 1 |
|
407 | 407 | if state in "m" and f not in m1 and f not in m2: |
|
408 | 408 | ui.warn(_("%s in state %s, but not in either manifest\n") % |
|
409 | 409 | (f, state)) |
|
410 | 410 | errors += 1 |
|
411 | 411 | for f in m1: |
|
412 | 412 | state = repo.dirstate[f] |
|
413 | 413 | if state not in "nrm": |
|
414 | 414 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
415 | 415 | errors += 1 |
|
416 | 416 | if errors: |
|
417 | 417 | error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
418 | 418 | raise error.Abort(error) |
|
419 | 419 | |
|
420 | 420 | @command('debugcolor', |
|
421 | 421 | [('', 'style', None, _('show all configured styles'))], |
|
422 | 422 | 'hg debugcolor') |
|
423 | 423 | def debugcolor(ui, repo, **opts): |
|
424 | 424 | """show available color, effects or style""" |
|
425 | 425 | ui.write(('color mode: %s\n') % ui._colormode) |
|
426 | 426 | if opts.get(r'style'): |
|
427 | 427 | return _debugdisplaystyle(ui) |
|
428 | 428 | else: |
|
429 | 429 | return _debugdisplaycolor(ui) |
|
430 | 430 | |
|
431 | 431 | def _debugdisplaycolor(ui): |
|
432 | 432 | ui = ui.copy() |
|
433 | 433 | ui._styles.clear() |
|
434 | 434 | for effect in color._activeeffects(ui).keys(): |
|
435 | 435 | ui._styles[effect] = effect |
|
436 | 436 | if ui._terminfoparams: |
|
437 | 437 | for k, v in ui.configitems('color'): |
|
438 | 438 | if k.startswith('color.'): |
|
439 | 439 | ui._styles[k] = k[6:] |
|
440 | 440 | elif k.startswith('terminfo.'): |
|
441 | 441 | ui._styles[k] = k[9:] |
|
442 | 442 | ui.write(_('available colors:\n')) |
|
443 | 443 | # sort label with a '_' after the other to group '_background' entry. |
|
444 | 444 | items = sorted(ui._styles.items(), |
|
445 | 445 | key=lambda i: ('_' in i[0], i[0], i[1])) |
|
446 | 446 | for colorname, label in items: |
|
447 | 447 | ui.write(('%s\n') % colorname, label=label) |
|
448 | 448 | |
|
449 | 449 | def _debugdisplaystyle(ui): |
|
450 | 450 | ui.write(_('available style:\n')) |
|
451 | 451 | width = max(len(s) for s in ui._styles) |
|
452 | 452 | for label, effects in sorted(ui._styles.items()): |
|
453 | 453 | ui.write('%s' % label, label=label) |
|
454 | 454 | if effects: |
|
455 | 455 | # 50 |
|
456 | 456 | ui.write(': ') |
|
457 | 457 | ui.write(' ' * (max(0, width - len(label)))) |
|
458 | 458 | ui.write(', '.join(ui.label(e, e) for e in effects.split())) |
|
459 | 459 | ui.write('\n') |
|
460 | 460 | |
|
461 | 461 | @command('debugcreatestreamclonebundle', [], 'FILE') |
|
462 | 462 | def debugcreatestreamclonebundle(ui, repo, fname): |
|
463 | 463 | """create a stream clone bundle file |
|
464 | 464 | |
|
465 | 465 | Stream bundles are special bundles that are essentially archives of |
|
466 | 466 | revlog files. They are commonly used for cloning very quickly. |
|
467 | 467 | """ |
|
468 | 468 | # TODO we may want to turn this into an abort when this functionality |
|
469 | 469 | # is moved into `hg bundle`. |
|
470 | 470 | if phases.hassecret(repo): |
|
471 | 471 | ui.warn(_('(warning: stream clone bundle will contain secret ' |
|
472 | 472 | 'revisions)\n')) |
|
473 | 473 | |
|
474 | 474 | requirements, gen = streamclone.generatebundlev1(repo) |
|
475 | 475 | changegroup.writechunks(ui, gen, fname) |
|
476 | 476 | |
|
477 | 477 | ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements))) |
|
478 | 478 | |
|
479 | 479 | @command('debugdag', |
|
480 | 480 | [('t', 'tags', None, _('use tags as labels')), |
|
481 | 481 | ('b', 'branches', None, _('annotate with branch names')), |
|
482 | 482 | ('', 'dots', None, _('use dots for runs')), |
|
483 | 483 | ('s', 'spaces', None, _('separate elements by spaces'))], |
|
484 | 484 | _('[OPTION]... [FILE [REV]...]'), |
|
485 | 485 | optionalrepo=True) |
|
486 | 486 | def debugdag(ui, repo, file_=None, *revs, **opts): |
|
487 | 487 | """format the changelog or an index DAG as a concise textual description |
|
488 | 488 | |
|
489 | 489 | If you pass a revlog index, the revlog's DAG is emitted. If you list |
|
490 | 490 | revision numbers, they get labeled in the output as rN. |
|
491 | 491 | |
|
492 | 492 | Otherwise, the changelog DAG of the current repo is emitted. |
|
493 | 493 | """ |
|
494 | 494 | spaces = opts.get(r'spaces') |
|
495 | 495 | dots = opts.get(r'dots') |
|
496 | 496 | if file_: |
|
497 | 497 | rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), |
|
498 | 498 | file_) |
|
499 | 499 | revs = set((int(r) for r in revs)) |
|
500 | 500 | def events(): |
|
501 | 501 | for r in rlog: |
|
502 | 502 | yield 'n', (r, list(p for p in rlog.parentrevs(r) |
|
503 | 503 | if p != -1)) |
|
504 | 504 | if r in revs: |
|
505 | 505 | yield 'l', (r, "r%i" % r) |
|
506 | 506 | elif repo: |
|
507 | 507 | cl = repo.changelog |
|
508 | 508 | tags = opts.get(r'tags') |
|
509 | 509 | branches = opts.get(r'branches') |
|
510 | 510 | if tags: |
|
511 | 511 | labels = {} |
|
512 | 512 | for l, n in repo.tags().items(): |
|
513 | 513 | labels.setdefault(cl.rev(n), []).append(l) |
|
514 | 514 | def events(): |
|
515 | 515 | b = "default" |
|
516 | 516 | for r in cl: |
|
517 | 517 | if branches: |
|
518 | 518 | newb = cl.read(cl.node(r))[5]['branch'] |
|
519 | 519 | if newb != b: |
|
520 | 520 | yield 'a', newb |
|
521 | 521 | b = newb |
|
522 | 522 | yield 'n', (r, list(p for p in cl.parentrevs(r) |
|
523 | 523 | if p != -1)) |
|
524 | 524 | if tags: |
|
525 | 525 | ls = labels.get(r) |
|
526 | 526 | if ls: |
|
527 | 527 | for l in ls: |
|
528 | 528 | yield 'l', (r, l) |
|
529 | 529 | else: |
|
530 | 530 | raise error.Abort(_('need repo for changelog dag')) |
|
531 | 531 | |
|
532 | 532 | for line in dagparser.dagtextlines(events(), |
|
533 | 533 | addspaces=spaces, |
|
534 | 534 | wraplabels=True, |
|
535 | 535 | wrapannotations=True, |
|
536 | 536 | wrapnonlinear=dots, |
|
537 | 537 | usedots=dots, |
|
538 | 538 | maxlinewidth=70): |
|
539 | 539 | ui.write(line) |
|
540 | 540 | ui.write("\n") |
|
541 | 541 | |
|
542 | 542 | @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV')) |
|
543 | 543 | def debugdata(ui, repo, file_, rev=None, **opts): |
|
544 | 544 | """dump the contents of a data file revision""" |
|
545 | 545 | opts = pycompat.byteskwargs(opts) |
|
546 | 546 | if opts.get('changelog') or opts.get('manifest') or opts.get('dir'): |
|
547 | 547 | if rev is not None: |
|
548 | 548 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
549 | 549 | file_, rev = None, file_ |
|
550 | 550 | elif rev is None: |
|
551 | 551 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
552 | 552 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
|
553 | 553 | try: |
|
554 | 554 | ui.write(r.revision(r.lookup(rev), raw=True)) |
|
555 | 555 | except KeyError: |
|
556 | 556 | raise error.Abort(_('invalid revision identifier %s') % rev) |
|
557 | 557 | |
|
558 | 558 | @command('debugdate', |
|
559 | 559 | [('e', 'extended', None, _('try extended date formats'))], |
|
560 | 560 | _('[-e] DATE [RANGE]'), |
|
561 | 561 | norepo=True, optionalrepo=True) |
|
562 | 562 | def debugdate(ui, date, range=None, **opts): |
|
563 | 563 | """parse and display a date""" |
|
564 | 564 | if opts[r"extended"]: |
|
565 | 565 | d = dateutil.parsedate(date, util.extendeddateformats) |
|
566 | 566 | else: |
|
567 | 567 | d = dateutil.parsedate(date) |
|
568 | 568 | ui.write(("internal: %d %d\n") % d) |
|
569 | 569 | ui.write(("standard: %s\n") % dateutil.datestr(d)) |
|
570 | 570 | if range: |
|
571 | 571 | m = dateutil.matchdate(range) |
|
572 | 572 | ui.write(("match: %s\n") % m(d[0])) |
|
573 | 573 | |
|
574 | 574 | @command('debugdeltachain', |
|
575 | 575 | cmdutil.debugrevlogopts + cmdutil.formatteropts, |
|
576 | 576 | _('-c|-m|FILE'), |
|
577 | 577 | optionalrepo=True) |
|
578 | 578 | def debugdeltachain(ui, repo, file_=None, **opts): |
|
579 | 579 | """dump information about delta chains in a revlog |
|
580 | 580 | |
|
581 | 581 | Output can be templatized. Available template keywords are: |
|
582 | 582 | |
|
583 | 583 | :``rev``: revision number |
|
584 | 584 | :``chainid``: delta chain identifier (numbered by unique base) |
|
585 | 585 | :``chainlen``: delta chain length to this revision |
|
586 | 586 | :``prevrev``: previous revision in delta chain |
|
587 | 587 | :``deltatype``: role of delta / how it was computed |
|
588 | 588 | :``compsize``: compressed size of revision |
|
589 | 589 | :``uncompsize``: uncompressed size of revision |
|
590 | 590 | :``chainsize``: total size of compressed revisions in chain |
|
591 | 591 | :``chainratio``: total chain size divided by uncompressed revision size |
|
592 | 592 | (new delta chains typically start at ratio 2.00) |
|
593 | 593 | :``lindist``: linear distance from base revision in delta chain to end |
|
594 | 594 | of this revision |
|
595 | 595 | :``extradist``: total size of revisions not part of this delta chain from |
|
596 | 596 | base of delta chain to end of this revision; a measurement |
|
597 | 597 | of how much extra data we need to read/seek across to read |
|
598 | 598 | the delta chain for this revision |
|
599 | 599 | :``extraratio``: extradist divided by chainsize; another representation of |
|
600 | 600 | how much unrelated data is needed to load this delta chain |
|
601 | 601 | |
|
602 | 602 | If the repository is configured to use the sparse read, additional keywords |
|
603 | 603 | are available: |
|
604 | 604 | |
|
605 | 605 | :``readsize``: total size of data read from the disk for a revision |
|
606 | 606 | (sum of the sizes of all the blocks) |
|
607 | 607 | :``largestblock``: size of the largest block of data read from the disk |
|
608 | 608 | :``readdensity``: density of useful bytes in the data read from the disk |
|
609 | 609 | :``srchunks``: in how many data hunks the whole revision would be read |
|
610 | 610 | |
|
611 | 611 | The sparse read can be enabled with experimental.sparse-read = True |
|
612 | 612 | """ |
|
613 | 613 | opts = pycompat.byteskwargs(opts) |
|
614 | 614 | r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) |
|
615 | 615 | index = r.index |
|
616 | 616 | generaldelta = r.version & revlog.FLAG_GENERALDELTA |
|
617 | 617 | withsparseread = getattr(r, '_withsparseread', False) |
|
618 | 618 | |
|
619 | 619 | def revinfo(rev): |
|
620 | 620 | e = index[rev] |
|
621 | 621 | compsize = e[1] |
|
622 | 622 | uncompsize = e[2] |
|
623 | 623 | chainsize = 0 |
|
624 | 624 | |
|
625 | 625 | if generaldelta: |
|
626 | 626 | if e[3] == e[5]: |
|
627 | 627 | deltatype = 'p1' |
|
628 | 628 | elif e[3] == e[6]: |
|
629 | 629 | deltatype = 'p2' |
|
630 | 630 | elif e[3] == rev - 1: |
|
631 | 631 | deltatype = 'prev' |
|
632 | 632 | elif e[3] == rev: |
|
633 | 633 | deltatype = 'base' |
|
634 | 634 | else: |
|
635 | 635 | deltatype = 'other' |
|
636 | 636 | else: |
|
637 | 637 | if e[3] == rev: |
|
638 | 638 | deltatype = 'base' |
|
639 | 639 | else: |
|
640 | 640 | deltatype = 'prev' |
|
641 | 641 | |
|
642 | 642 | chain = r._deltachain(rev)[0] |
|
643 | 643 | for iterrev in chain: |
|
644 | 644 | e = index[iterrev] |
|
645 | 645 | chainsize += e[1] |
|
646 | 646 | |
|
647 | 647 | return compsize, uncompsize, deltatype, chain, chainsize |
|
648 | 648 | |
|
649 | 649 | fm = ui.formatter('debugdeltachain', opts) |
|
650 | 650 | |
|
651 | 651 | fm.plain(' rev chain# chainlen prev delta ' |
|
652 | 652 | 'size rawsize chainsize ratio lindist extradist ' |
|
653 | 653 | 'extraratio') |
|
654 | 654 | if withsparseread: |
|
655 | 655 | fm.plain(' readsize largestblk rddensity srchunks') |
|
656 | 656 | fm.plain('\n') |
|
657 | 657 | |
|
658 | 658 | chainbases = {} |
|
659 | 659 | for rev in r: |
|
660 | 660 | comp, uncomp, deltatype, chain, chainsize = revinfo(rev) |
|
661 | 661 | chainbase = chain[0] |
|
662 | 662 | chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) |
|
663 | 663 | start = r.start |
|
664 | 664 | length = r.length |
|
665 | 665 | basestart = start(chainbase) |
|
666 | 666 | revstart = start(rev) |
|
667 | 667 | lineardist = revstart + comp - basestart |
|
668 | 668 | extradist = lineardist - chainsize |
|
669 | 669 | try: |
|
670 | 670 | prevrev = chain[-2] |
|
671 | 671 | except IndexError: |
|
672 | 672 | prevrev = -1 |
|
673 | 673 | |
|
674 | 674 | chainratio = float(chainsize) / float(uncomp) |
|
675 | 675 | extraratio = float(extradist) / float(chainsize) |
|
676 | 676 | |
|
677 | 677 | fm.startitem() |
|
678 | 678 | fm.write('rev chainid chainlen prevrev deltatype compsize ' |
|
679 | 679 | 'uncompsize chainsize chainratio lindist extradist ' |
|
680 | 680 | 'extraratio', |
|
681 | 681 | '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f', |
|
682 | 682 | rev, chainid, len(chain), prevrev, deltatype, comp, |
|
683 | 683 | uncomp, chainsize, chainratio, lineardist, extradist, |
|
684 | 684 | extraratio, |
|
685 | 685 | rev=rev, chainid=chainid, chainlen=len(chain), |
|
686 | 686 | prevrev=prevrev, deltatype=deltatype, compsize=comp, |
|
687 | 687 | uncompsize=uncomp, chainsize=chainsize, |
|
688 | 688 | chainratio=chainratio, lindist=lineardist, |
|
689 | 689 | extradist=extradist, extraratio=extraratio) |
|
690 | 690 | if withsparseread: |
|
691 | 691 | readsize = 0 |
|
692 | 692 | largestblock = 0 |
|
693 | 693 | srchunks = 0 |
|
694 | 694 | |
|
695 | 695 | for revschunk in revlog._slicechunk(r, chain): |
|
696 | 696 | srchunks += 1 |
|
697 | 697 | blkend = start(revschunk[-1]) + length(revschunk[-1]) |
|
698 | 698 | blksize = blkend - start(revschunk[0]) |
|
699 | 699 | |
|
700 | 700 | readsize += blksize |
|
701 | 701 | if largestblock < blksize: |
|
702 | 702 | largestblock = blksize |
|
703 | 703 | |
|
704 | 704 | readdensity = float(chainsize) / float(readsize) |
|
705 | 705 | |
|
706 | 706 | fm.write('readsize largestblock readdensity srchunks', |
|
707 | 707 | ' %10d %10d %9.5f %8d', |
|
708 | 708 | readsize, largestblock, readdensity, srchunks, |
|
709 | 709 | readsize=readsize, largestblock=largestblock, |
|
710 | 710 | readdensity=readdensity, srchunks=srchunks) |
|
711 | 711 | |
|
712 | 712 | fm.plain('\n') |
|
713 | 713 | |
|
714 | 714 | fm.end() |
|
715 | 715 | |
|
716 | 716 | @command('debugdirstate|debugstate', |
|
717 | 717 | [('', 'nodates', None, _('do not display the saved mtime')), |
|
718 | 718 | ('', 'datesort', None, _('sort by saved mtime'))], |
|
719 | 719 | _('[OPTION]...')) |
|
720 | 720 | def debugstate(ui, repo, **opts): |
|
721 | 721 | """show the contents of the current dirstate""" |
|
722 | 722 | |
|
723 | 723 | nodates = opts.get(r'nodates') |
|
724 | 724 | datesort = opts.get(r'datesort') |
|
725 | 725 | |
|
726 | 726 | timestr = "" |
|
727 | 727 | if datesort: |
|
728 | 728 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
|
729 | 729 | else: |
|
730 | 730 | keyfunc = None # sort by filename |
|
731 | 731 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
|
732 | 732 | if ent[3] == -1: |
|
733 | 733 | timestr = 'unset ' |
|
734 | 734 | elif nodates: |
|
735 | 735 | timestr = 'set ' |
|
736 | 736 | else: |
|
737 | 737 | timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ", |
|
738 | 738 | time.localtime(ent[3])) |
|
739 | 739 | timestr = encoding.strtolocal(timestr) |
|
740 | 740 | if ent[1] & 0o20000: |
|
741 | 741 | mode = 'lnk' |
|
742 | 742 | else: |
|
743 | 743 | mode = '%3o' % (ent[1] & 0o777 & ~util.umask) |
|
744 | 744 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
|
745 | 745 | for f in repo.dirstate.copies(): |
|
746 | 746 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
747 | 747 | |
|
748 | 748 | @command('debugdiscovery', |
|
749 | 749 | [('', 'old', None, _('use old-style discovery')), |
|
750 | 750 | ('', 'nonheads', None, |
|
751 | 751 | _('use old-style discovery with non-heads included')), |
|
752 | 752 | ('', 'rev', [], 'restrict discovery to this set of revs'), |
|
753 | 753 | ] + cmdutil.remoteopts, |
|
754 | 754 | _('[--rev REV] [OTHER]')) |
|
755 | 755 | def debugdiscovery(ui, repo, remoteurl="default", **opts): |
|
756 | 756 | """runs the changeset discovery protocol in isolation""" |
|
757 | 757 | opts = pycompat.byteskwargs(opts) |
|
758 | 758 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) |
|
759 | 759 | remote = hg.peer(repo, opts, remoteurl) |
|
760 | 760 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) |
|
761 | 761 | |
|
762 | 762 | # make sure tests are repeatable |
|
763 | 763 | random.seed(12323) |
|
764 | 764 | |
|
765 | 765 | def doit(pushedrevs, remoteheads, remote=remote): |
|
766 | 766 | if opts.get('old'): |
|
767 | 767 | if not util.safehasattr(remote, 'branches'): |
|
768 | 768 | # enable in-client legacy support |
|
769 | 769 | remote = localrepo.locallegacypeer(remote.local()) |
|
770 | 770 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, |
|
771 | 771 | force=True) |
|
772 | 772 | common = set(common) |
|
773 | 773 | if not opts.get('nonheads'): |
|
774 | 774 | ui.write(("unpruned common: %s\n") % |
|
775 | 775 | " ".join(sorted(short(n) for n in common))) |
|
776 | 776 | dag = dagutil.revlogdag(repo.changelog) |
|
777 | 777 | all = dag.ancestorset(dag.internalizeall(common)) |
|
778 | 778 | common = dag.externalizeall(dag.headsetofconnecteds(all)) |
|
779 | 779 | else: |
|
780 | 780 | nodes = None |
|
781 | 781 | if pushedrevs: |
|
782 | 782 | revs = scmutil.revrange(repo, pushedrevs) |
|
783 | 783 | nodes = [repo[r].node() for r in revs] |
|
784 | 784 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote, |
|
785 | 785 | ancestorsof=nodes) |
|
786 | 786 | common = set(common) |
|
787 | 787 | rheads = set(hds) |
|
788 | 788 | lheads = set(repo.heads()) |
|
789 | 789 | ui.write(("common heads: %s\n") % |
|
790 | 790 | " ".join(sorted(short(n) for n in common))) |
|
791 | 791 | if lheads <= common: |
|
792 | 792 | ui.write(("local is subset\n")) |
|
793 | 793 | elif rheads <= common: |
|
794 | 794 | ui.write(("remote is subset\n")) |
|
795 | 795 | |
|
796 | 796 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) |
|
797 | 797 | localrevs = opts['rev'] |
|
798 | 798 | doit(localrevs, remoterevs) |
|
799 | 799 | |
|
800 | 800 | _chunksize = 4 << 10 |
|
801 | 801 | |
|
802 | 802 | @command('debugdownload', |
|
803 | 803 | [ |
|
804 | 804 | ('o', 'output', '', _('path')), |
|
805 | 805 | ], |
|
806 | 806 | optionalrepo=True) |
|
807 | 807 | def debugdownload(ui, repo, url, output=None, **opts): |
|
808 | 808 | """download a resource using Mercurial logic and config |
|
809 | 809 | """ |
|
810 | 810 | fh = urlmod.open(ui, url, output) |
|
811 | 811 | |
|
812 | 812 | dest = ui |
|
813 | 813 | if output: |
|
814 | 814 | dest = open(output, "wb", _chunksize) |
|
815 | 815 | try: |
|
816 | 816 | data = fh.read(_chunksize) |
|
817 | 817 | while data: |
|
818 | 818 | dest.write(data) |
|
819 | 819 | data = fh.read(_chunksize) |
|
820 | 820 | finally: |
|
821 | 821 | if output: |
|
822 | 822 | dest.close() |
|
823 | 823 | |
|
824 | 824 | @command('debugextensions', cmdutil.formatteropts, [], norepo=True) |
|
825 | 825 | def debugextensions(ui, **opts): |
|
826 | 826 | '''show information about active extensions''' |
|
827 | 827 | opts = pycompat.byteskwargs(opts) |
|
828 | 828 | exts = extensions.extensions(ui) |
|
829 | 829 | hgver = util.version() |
|
830 | 830 | fm = ui.formatter('debugextensions', opts) |
|
831 | 831 | for extname, extmod in sorted(exts, key=operator.itemgetter(0)): |
|
832 | 832 | isinternal = extensions.ismoduleinternal(extmod) |
|
833 | 833 | extsource = pycompat.fsencode(extmod.__file__) |
|
834 | 834 | if isinternal: |
|
835 | 835 | exttestedwith = [] # never expose magic string to users |
|
836 | 836 | else: |
|
837 | 837 | exttestedwith = getattr(extmod, 'testedwith', '').split() |
|
838 | 838 | extbuglink = getattr(extmod, 'buglink', None) |
|
839 | 839 | |
|
840 | 840 | fm.startitem() |
|
841 | 841 | |
|
842 | 842 | if ui.quiet or ui.verbose: |
|
843 | 843 | fm.write('name', '%s\n', extname) |
|
844 | 844 | else: |
|
845 | 845 | fm.write('name', '%s', extname) |
|
846 | 846 | if isinternal or hgver in exttestedwith: |
|
847 | 847 | fm.plain('\n') |
|
848 | 848 | elif not exttestedwith: |
|
849 | 849 | fm.plain(_(' (untested!)\n')) |
|
850 | 850 | else: |
|
851 | 851 | lasttestedversion = exttestedwith[-1] |
|
852 | 852 | fm.plain(' (%s!)\n' % lasttestedversion) |
|
853 | 853 | |
|
854 | 854 | fm.condwrite(ui.verbose and extsource, 'source', |
|
855 | 855 | _(' location: %s\n'), extsource or "") |
|
856 | 856 | |
|
857 | 857 | if ui.verbose: |
|
858 | 858 | fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal]) |
|
859 | 859 | fm.data(bundled=isinternal) |
|
860 | 860 | |
|
861 | 861 | fm.condwrite(ui.verbose and exttestedwith, 'testedwith', |
|
862 | 862 | _(' tested with: %s\n'), |
|
863 | 863 | fm.formatlist(exttestedwith, name='ver')) |
|
864 | 864 | |
|
865 | 865 | fm.condwrite(ui.verbose and extbuglink, 'buglink', |
|
866 | 866 | _(' bug reporting: %s\n'), extbuglink or "") |
|
867 | 867 | |
|
868 | 868 | fm.end() |
|
869 | 869 | |
|
870 | 870 | @command('debugfileset', |
|
871 | 871 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], |
|
872 | 872 | _('[-r REV] FILESPEC')) |
|
873 | 873 | def debugfileset(ui, repo, expr, **opts): |
|
874 | 874 | '''parse and apply a fileset specification''' |
|
875 | 875 | ctx = scmutil.revsingle(repo, opts.get(r'rev'), None) |
|
876 | 876 | if ui.verbose: |
|
877 | 877 | tree = fileset.parse(expr) |
|
878 | 878 | ui.note(fileset.prettyformat(tree), "\n") |
|
879 | 879 | |
|
880 | 880 | for f in ctx.getfileset(expr): |
|
881 | 881 | ui.write("%s\n" % f) |
|
882 | 882 | |
|
883 | 883 | @command('debugformat', |
|
884 | 884 | [] + cmdutil.formatteropts, |
|
885 | 885 | _('')) |
|
886 | 886 | def debugformat(ui, repo, **opts): |
|
887 | 887 | """display format information about the current repository |
|
888 | 888 | |
|
889 | 889 | Use --verbose to get extra information about current config value and |
|
890 | 890 | Mercurial default.""" |
|
891 | 891 | opts = pycompat.byteskwargs(opts) |
|
892 | 892 | maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) |
|
893 | 893 | maxvariantlength = max(len('format-variant'), maxvariantlength) |
|
894 | 894 | |
|
895 | 895 | def makeformatname(name): |
|
896 | 896 | return '%s:' + (' ' * (maxvariantlength - len(name))) |
|
897 | 897 | |
|
898 | 898 | fm = ui.formatter('debugformat', opts) |
|
899 | 899 | if fm.isplain(): |
|
900 | 900 | def formatvalue(value): |
|
901 | 901 | if util.safehasattr(value, 'startswith'): |
|
902 | 902 | return value |
|
903 | 903 | if value: |
|
904 | 904 | return 'yes' |
|
905 | 905 | else: |
|
906 | 906 | return 'no' |
|
907 | 907 | else: |
|
908 | 908 | formatvalue = pycompat.identity |
|
909 | 909 | |
|
910 | 910 | fm.plain('format-variant') |
|
911 | 911 | fm.plain(' ' * (maxvariantlength - len('format-variant'))) |
|
912 | 912 | fm.plain(' repo') |
|
913 | 913 | if ui.verbose: |
|
914 | 914 | fm.plain(' config default') |
|
915 | 915 | fm.plain('\n') |
|
916 | 916 | for fv in upgrade.allformatvariant: |
|
917 | 917 | fm.startitem() |
|
918 | 918 | repovalue = fv.fromrepo(repo) |
|
919 | 919 | configvalue = fv.fromconfig(repo) |
|
920 | 920 | |
|
921 | 921 | if repovalue != configvalue: |
|
922 | 922 | namelabel = 'formatvariant.name.mismatchconfig' |
|
923 | 923 | repolabel = 'formatvariant.repo.mismatchconfig' |
|
924 | 924 | elif repovalue != fv.default: |
|
925 | 925 | namelabel = 'formatvariant.name.mismatchdefault' |
|
926 | 926 | repolabel = 'formatvariant.repo.mismatchdefault' |
|
927 | 927 | else: |
|
928 | 928 | namelabel = 'formatvariant.name.uptodate' |
|
929 | 929 | repolabel = 'formatvariant.repo.uptodate' |
|
930 | 930 | |
|
931 | 931 | fm.write('name', makeformatname(fv.name), fv.name, |
|
932 | 932 | label=namelabel) |
|
933 | 933 | fm.write('repo', ' %3s', formatvalue(repovalue), |
|
934 | 934 | label=repolabel) |
|
935 | 935 | if fv.default != configvalue: |
|
936 | 936 | configlabel = 'formatvariant.config.special' |
|
937 | 937 | else: |
|
938 | 938 | configlabel = 'formatvariant.config.default' |
|
939 | 939 | fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue), |
|
940 | 940 | label=configlabel) |
|
941 | 941 | fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default), |
|
942 | 942 | label='formatvariant.default') |
|
943 | 943 | fm.plain('\n') |
|
944 | 944 | fm.end() |
|
945 | 945 | |
|
946 | 946 | @command('debugfsinfo', [], _('[PATH]'), norepo=True) |
|
947 | 947 | def debugfsinfo(ui, path="."): |
|
948 | 948 | """show information detected about current filesystem""" |
|
949 | 949 | ui.write(('path: %s\n') % path) |
|
950 | 950 | ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)')) |
|
951 | 951 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) |
|
952 | 952 | ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)')) |
|
953 | 953 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) |
|
954 | 954 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) |
|
955 | 955 | casesensitive = '(unknown)' |
|
956 | 956 | try: |
|
957 | 957 | with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f: |
|
958 | 958 | casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no' |
|
959 | 959 | except OSError: |
|
960 | 960 | pass |
|
961 | 961 | ui.write(('case-sensitive: %s\n') % casesensitive) |
|
962 | 962 | |
|
963 | 963 | @command('debuggetbundle', |
|
964 | 964 | [('H', 'head', [], _('id of head node'), _('ID')), |
|
965 | 965 | ('C', 'common', [], _('id of common node'), _('ID')), |
|
966 | 966 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], |
|
967 | 967 | _('REPO FILE [-H|-C ID]...'), |
|
968 | 968 | norepo=True) |
|
969 | 969 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
|
970 | 970 | """retrieves a bundle from a repo |
|
971 | 971 | |
|
972 | 972 | Every ID must be a full-length hex node id string. Saves the bundle to the |
|
973 | 973 | given file. |
|
974 | 974 | """ |
|
975 | 975 | opts = pycompat.byteskwargs(opts) |
|
976 | 976 | repo = hg.peer(ui, opts, repopath) |
|
977 | 977 | if not repo.capable('getbundle'): |
|
978 | 978 | raise error.Abort("getbundle() not supported by target repository") |
|
979 | 979 | args = {} |
|
980 | 980 | if common: |
|
981 | 981 | args[r'common'] = [bin(s) for s in common] |
|
982 | 982 | if head: |
|
983 | 983 | args[r'heads'] = [bin(s) for s in head] |
|
984 | 984 | # TODO: get desired bundlecaps from command line. |
|
985 | 985 | args[r'bundlecaps'] = None |
|
986 | 986 | bundle = repo.getbundle('debug', **args) |
|
987 | 987 | |
|
988 | 988 | bundletype = opts.get('type', 'bzip2').lower() |
|
989 | 989 | btypes = {'none': 'HG10UN', |
|
990 | 990 | 'bzip2': 'HG10BZ', |
|
991 | 991 | 'gzip': 'HG10GZ', |
|
992 | 992 | 'bundle2': 'HG20'} |
|
993 | 993 | bundletype = btypes.get(bundletype) |
|
994 | 994 | if bundletype not in bundle2.bundletypes: |
|
995 | 995 | raise error.Abort(_('unknown bundle type specified with --type')) |
|
996 | 996 | bundle2.writebundle(ui, bundle, bundlepath, bundletype) |
|
997 | 997 | |
|
998 | 998 | @command('debugignore', [], '[FILE]') |
|
999 | 999 | def debugignore(ui, repo, *files, **opts): |
|
1000 | 1000 | """display the combined ignore pattern and information about ignored files |
|
1001 | 1001 | |
|
1002 | 1002 | With no argument display the combined ignore pattern. |
|
1003 | 1003 | |
|
1004 | 1004 | Given space separated file names, shows if the given file is ignored and |
|
1005 | 1005 | if so, show the ignore rule (file and line number) that matched it. |
|
1006 | 1006 | """ |
|
1007 | 1007 | ignore = repo.dirstate._ignore |
|
1008 | 1008 | if not files: |
|
1009 | 1009 | # Show all the patterns |
|
1010 | 1010 | ui.write("%s\n" % pycompat.byterepr(ignore)) |
|
1011 | 1011 | else: |
|
1012 | 1012 | m = scmutil.match(repo[None], pats=files) |
|
1013 | 1013 | for f in m.files(): |
|
1014 | 1014 | nf = util.normpath(f) |
|
1015 | 1015 | ignored = None |
|
1016 | 1016 | ignoredata = None |
|
1017 | 1017 | if nf != '.': |
|
1018 | 1018 | if ignore(nf): |
|
1019 | 1019 | ignored = nf |
|
1020 | 1020 | ignoredata = repo.dirstate._ignorefileandline(nf) |
|
1021 | 1021 | else: |
|
1022 | 1022 | for p in util.finddirs(nf): |
|
1023 | 1023 | if ignore(p): |
|
1024 | 1024 | ignored = p |
|
1025 | 1025 | ignoredata = repo.dirstate._ignorefileandline(p) |
|
1026 | 1026 | break |
|
1027 | 1027 | if ignored: |
|
1028 | 1028 | if ignored == nf: |
|
1029 | 1029 | ui.write(_("%s is ignored\n") % m.uipath(f)) |
|
1030 | 1030 | else: |
|
1031 | 1031 | ui.write(_("%s is ignored because of " |
|
1032 | 1032 | "containing folder %s\n") |
|
1033 | 1033 | % (m.uipath(f), ignored)) |
|
1034 | 1034 | ignorefile, lineno, line = ignoredata |
|
1035 | 1035 | ui.write(_("(ignore rule in %s, line %d: '%s')\n") |
|
1036 | 1036 | % (ignorefile, lineno, line)) |
|
1037 | 1037 | else: |
|
1038 | 1038 | ui.write(_("%s is not ignored\n") % m.uipath(f)) |
|
1039 | 1039 | |
|
1040 | 1040 | @command('debugindex', cmdutil.debugrevlogopts + |
|
1041 | 1041 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
1042 | 1042 | _('[-f FORMAT] -c|-m|FILE'), |
|
1043 | 1043 | optionalrepo=True) |
|
1044 | 1044 | def debugindex(ui, repo, file_=None, **opts): |
|
1045 | 1045 | """dump the contents of an index file""" |
|
1046 | 1046 | opts = pycompat.byteskwargs(opts) |
|
1047 | 1047 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
|
1048 | 1048 | format = opts.get('format', 0) |
|
1049 | 1049 | if format not in (0, 1): |
|
1050 | 1050 | raise error.Abort(_("unknown format %d") % format) |
|
1051 | 1051 | |
|
1052 | 1052 | generaldelta = r.version & revlog.FLAG_GENERALDELTA |
|
1053 | 1053 | if generaldelta: |
|
1054 | 1054 | basehdr = ' delta' |
|
1055 | 1055 | else: |
|
1056 | 1056 | basehdr = ' base' |
|
1057 | 1057 | |
|
1058 | 1058 | if ui.debugflag: |
|
1059 | 1059 | shortfn = hex |
|
1060 | 1060 | else: |
|
1061 | 1061 | shortfn = short |
|
1062 | 1062 | |
|
1063 | 1063 | # There might not be anything in r, so have a sane default |
|
1064 | 1064 | idlen = 12 |
|
1065 | 1065 | for i in r: |
|
1066 | 1066 | idlen = len(shortfn(r.node(i))) |
|
1067 | 1067 | break |
|
1068 | 1068 | |
|
1069 | 1069 | if format == 0: |
|
1070 | 1070 | ui.write((" rev offset length " + basehdr + " linkrev" |
|
1071 | 1071 | " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen))) |
|
1072 | 1072 | elif format == 1: |
|
1073 | 1073 | ui.write((" rev flag offset length" |
|
1074 | 1074 | " size " + basehdr + " link p1 p2" |
|
1075 | 1075 | " %s\n") % "nodeid".rjust(idlen)) |
|
1076 | 1076 | |
|
1077 | 1077 | for i in r: |
|
1078 | 1078 | node = r.node(i) |
|
1079 | 1079 | if generaldelta: |
|
1080 | 1080 | base = r.deltaparent(i) |
|
1081 | 1081 | else: |
|
1082 | 1082 | base = r.chainbase(i) |
|
1083 | 1083 | if format == 0: |
|
1084 | 1084 | try: |
|
1085 | 1085 | pp = r.parents(node) |
|
1086 | 1086 | except Exception: |
|
1087 | 1087 | pp = [nullid, nullid] |
|
1088 | 1088 | ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
|
1089 | 1089 | i, r.start(i), r.length(i), base, r.linkrev(i), |
|
1090 | 1090 | shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) |
|
1091 | 1091 | elif format == 1: |
|
1092 | 1092 | pr = r.parentrevs(i) |
|
1093 | 1093 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( |
|
1094 | 1094 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
|
1095 | 1095 | base, r.linkrev(i), pr[0], pr[1], shortfn(node))) |
|
1096 | 1096 | |
|
1097 | 1097 | @command('debugindexdot', cmdutil.debugrevlogopts, |
|
1098 | 1098 | _('-c|-m|FILE'), optionalrepo=True) |
|
1099 | 1099 | def debugindexdot(ui, repo, file_=None, **opts): |
|
1100 | 1100 | """dump an index DAG as a graphviz dot file""" |
|
1101 | 1101 | opts = pycompat.byteskwargs(opts) |
|
1102 | 1102 | r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts) |
|
1103 | 1103 | ui.write(("digraph G {\n")) |
|
1104 | 1104 | for i in r: |
|
1105 | 1105 | node = r.node(i) |
|
1106 | 1106 | pp = r.parents(node) |
|
1107 | 1107 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
|
1108 | 1108 | if pp[1] != nullid: |
|
1109 | 1109 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
|
1110 | 1110 | ui.write("}\n") |
|
1111 | 1111 | |
|
1112 | 1112 | @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True) |
|
1113 | 1113 | def debuginstall(ui, **opts): |
|
1114 | 1114 | '''test Mercurial installation |
|
1115 | 1115 | |
|
1116 | 1116 | Returns 0 on success. |
|
1117 | 1117 | ''' |
|
1118 | 1118 | opts = pycompat.byteskwargs(opts) |
|
1119 | 1119 | |
|
1120 | 1120 | def writetemp(contents): |
|
1121 | 1121 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
|
1122 | 1122 | f = os.fdopen(fd, r"wb") |
|
1123 | 1123 | f.write(contents) |
|
1124 | 1124 | f.close() |
|
1125 | 1125 | return name |
|
1126 | 1126 | |
|
1127 | 1127 | problems = 0 |
|
1128 | 1128 | |
|
1129 | 1129 | fm = ui.formatter('debuginstall', opts) |
|
1130 | 1130 | fm.startitem() |
|
1131 | 1131 | |
|
1132 | 1132 | # encoding |
|
1133 | 1133 | fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding) |
|
1134 | 1134 | err = None |
|
1135 | 1135 | try: |
|
1136 | 1136 | codecs.lookup(pycompat.sysstr(encoding.encoding)) |
|
1137 | 1137 | except LookupError as inst: |
|
1138 | 1138 | err = util.forcebytestr(inst) |
|
1139 | 1139 | problems += 1 |
|
1140 | 1140 | fm.condwrite(err, 'encodingerror', _(" %s\n" |
|
1141 | 1141 | " (check that your locale is properly set)\n"), err) |
|
1142 | 1142 | |
|
1143 | 1143 | # Python |
|
1144 | 1144 | fm.write('pythonexe', _("checking Python executable (%s)\n"), |
|
1145 | 1145 | pycompat.sysexecutable) |
|
1146 | 1146 | fm.write('pythonver', _("checking Python version (%s)\n"), |
|
1147 | 1147 | ("%d.%d.%d" % sys.version_info[:3])) |
|
1148 | 1148 | fm.write('pythonlib', _("checking Python lib (%s)...\n"), |
|
1149 | 1149 | os.path.dirname(pycompat.fsencode(os.__file__))) |
|
1150 | 1150 | |
|
1151 | 1151 | security = set(sslutil.supportedprotocols) |
|
1152 | 1152 | if sslutil.hassni: |
|
1153 | 1153 | security.add('sni') |
|
1154 | 1154 | |
|
1155 | 1155 | fm.write('pythonsecurity', _("checking Python security support (%s)\n"), |
|
1156 | 1156 | fm.formatlist(sorted(security), name='protocol', |
|
1157 | 1157 | fmt='%s', sep=',')) |
|
1158 | 1158 | |
|
1159 | 1159 | # These are warnings, not errors. So don't increment problem count. This |
|
1160 | 1160 | # may change in the future. |
|
1161 | 1161 | if 'tls1.2' not in security: |
|
1162 | 1162 | fm.plain(_(' TLS 1.2 not supported by Python install; ' |
|
1163 | 1163 | 'network connections lack modern security\n')) |
|
1164 | 1164 | if 'sni' not in security: |
|
1165 | 1165 | fm.plain(_(' SNI not supported by Python install; may have ' |
|
1166 | 1166 | 'connectivity issues with some servers\n')) |
|
1167 | 1167 | |
|
1168 | 1168 | # TODO print CA cert info |
|
1169 | 1169 | |
|
1170 | 1170 | # hg version |
|
1171 | 1171 | hgver = util.version() |
|
1172 | 1172 | fm.write('hgver', _("checking Mercurial version (%s)\n"), |
|
1173 | 1173 | hgver.split('+')[0]) |
|
1174 | 1174 | fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"), |
|
1175 | 1175 | '+'.join(hgver.split('+')[1:])) |
|
1176 | 1176 | |
|
1177 | 1177 | # compiled modules |
|
1178 | 1178 | fm.write('hgmodulepolicy', _("checking module policy (%s)\n"), |
|
1179 | 1179 | policy.policy) |
|
1180 | 1180 | fm.write('hgmodules', _("checking installed modules (%s)...\n"), |
|
1181 | 1181 | os.path.dirname(pycompat.fsencode(__file__))) |
|
1182 | 1182 | |
|
1183 | 1183 | if policy.policy in ('c', 'allow'): |
|
1184 | 1184 | err = None |
|
1185 | 1185 | try: |
|
1186 | 1186 | from .cext import ( |
|
1187 | 1187 | base85, |
|
1188 | 1188 | bdiff, |
|
1189 | 1189 | mpatch, |
|
1190 | 1190 | osutil, |
|
1191 | 1191 | ) |
|
1192 | 1192 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
|
1193 | 1193 | except Exception as inst: |
|
1194 | 1194 | err = util.forcebytestr(inst) |
|
1195 | 1195 | problems += 1 |
|
1196 | 1196 | fm.condwrite(err, 'extensionserror', " %s\n", err) |
|
1197 | 1197 | |
|
1198 | 1198 | compengines = util.compengines._engines.values() |
|
1199 | 1199 | fm.write('compengines', _('checking registered compression engines (%s)\n'), |
|
1200 | 1200 | fm.formatlist(sorted(e.name() for e in compengines), |
|
1201 | 1201 | name='compengine', fmt='%s', sep=', ')) |
|
1202 | 1202 | fm.write('compenginesavail', _('checking available compression engines ' |
|
1203 | 1203 | '(%s)\n'), |
|
1204 | 1204 | fm.formatlist(sorted(e.name() for e in compengines |
|
1205 | 1205 | if e.available()), |
|
1206 | 1206 | name='compengine', fmt='%s', sep=', ')) |
|
1207 | 1207 | wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE) |
|
1208 | 1208 | fm.write('compenginesserver', _('checking available compression engines ' |
|
1209 | 1209 | 'for wire protocol (%s)\n'), |
|
1210 | 1210 | fm.formatlist([e.name() for e in wirecompengines |
|
1211 | 1211 | if e.wireprotosupport()], |
|
1212 | 1212 | name='compengine', fmt='%s', sep=', ')) |
|
1213 | 1213 | re2 = 'missing' |
|
1214 | 1214 | if util._re2: |
|
1215 | 1215 | re2 = 'available' |
|
1216 | 1216 | fm.plain(_('checking "re2" regexp engine (%s)\n') % re2) |
|
1217 | 1217 | fm.data(re2=bool(util._re2)) |
|
1218 | 1218 | |
|
1219 | 1219 | # templates |
|
1220 | 1220 | p = templater.templatepaths() |
|
1221 | 1221 | fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p)) |
|
1222 | 1222 | fm.condwrite(not p, '', _(" no template directories found\n")) |
|
1223 | 1223 | if p: |
|
1224 | 1224 | m = templater.templatepath("map-cmdline.default") |
|
1225 | 1225 | if m: |
|
1226 | 1226 | # template found, check if it is working |
|
1227 | 1227 | err = None |
|
1228 | 1228 | try: |
|
1229 | 1229 | templater.templater.frommapfile(m) |
|
1230 | 1230 | except Exception as inst: |
|
1231 | 1231 | err = util.forcebytestr(inst) |
|
1232 | 1232 | p = None |
|
1233 | 1233 | fm.condwrite(err, 'defaulttemplateerror', " %s\n", err) |
|
1234 | 1234 | else: |
|
1235 | 1235 | p = None |
|
1236 | 1236 | fm.condwrite(p, 'defaulttemplate', |
|
1237 | 1237 | _("checking default template (%s)\n"), m) |
|
1238 | 1238 | fm.condwrite(not m, 'defaulttemplatenotfound', |
|
1239 | 1239 | _(" template '%s' not found\n"), "default") |
|
1240 | 1240 | if not p: |
|
1241 | 1241 | problems += 1 |
|
1242 | 1242 | fm.condwrite(not p, '', |
|
1243 | 1243 | _(" (templates seem to have been installed incorrectly)\n")) |
|
1244 | 1244 | |
|
1245 | 1245 | # editor |
|
1246 | 1246 | editor = ui.geteditor() |
|
1247 | 1247 | editor = util.expandpath(editor) |
|
1248 | 1248 | editorbin = util.shellsplit(editor)[0] |
|
1249 | 1249 | fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) |
|
1250 | 1250 | cmdpath = util.findexe(editorbin) |
|
1251 | 1251 | fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', |
|
1252 | 1252 | _(" No commit editor set and can't find %s in PATH\n" |
|
1253 | 1253 | " (specify a commit editor in your configuration" |
|
1254 | 1254 | " file)\n"), not cmdpath and editor == 'vi' and editorbin) |
|
1255 | 1255 | fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', |
|
1256 | 1256 | _(" Can't find editor '%s' in PATH\n" |
|
1257 | 1257 | " (specify a commit editor in your configuration" |
|
1258 | 1258 | " file)\n"), not cmdpath and editorbin) |
|
1259 | 1259 | if not cmdpath and editor != 'vi': |
|
1260 | 1260 | problems += 1 |
|
1261 | 1261 | |
|
1262 | 1262 | # check username |
|
1263 | 1263 | username = None |
|
1264 | 1264 | err = None |
|
1265 | 1265 | try: |
|
1266 | 1266 | username = ui.username() |
|
1267 | 1267 | except error.Abort as e: |
|
1268 | 1268 | err = util.forcebytestr(e) |
|
1269 | 1269 | problems += 1 |
|
1270 | 1270 | |
|
1271 | 1271 | fm.condwrite(username, 'username', _("checking username (%s)\n"), username) |
|
1272 | 1272 | fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n" |
|
1273 | 1273 | " (specify a username in your configuration file)\n"), err) |
|
1274 | 1274 | |
|
1275 | 1275 | fm.condwrite(not problems, '', |
|
1276 | 1276 | _("no problems detected\n")) |
|
1277 | 1277 | if not problems: |
|
1278 | 1278 | fm.data(problems=problems) |
|
1279 | 1279 | fm.condwrite(problems, 'problems', |
|
1280 | 1280 | _("%d problems detected," |
|
1281 | 1281 | " please check your install!\n"), problems) |
|
1282 | 1282 | fm.end() |
|
1283 | 1283 | |
|
1284 | 1284 | return problems |
|
1285 | 1285 | |
|
1286 | 1286 | @command('debugknown', [], _('REPO ID...'), norepo=True) |
|
1287 | 1287 | def debugknown(ui, repopath, *ids, **opts): |
|
1288 | 1288 | """test whether node ids are known to a repo |
|
1289 | 1289 | |
|
1290 | 1290 | Every ID must be a full-length hex node id string. Returns a list of 0s |
|
1291 | 1291 | and 1s indicating unknown/known. |
|
1292 | 1292 | """ |
|
1293 | 1293 | opts = pycompat.byteskwargs(opts) |
|
1294 | 1294 | repo = hg.peer(ui, opts, repopath) |
|
1295 | 1295 | if not repo.capable('known'): |
|
1296 | 1296 | raise error.Abort("known() not supported by target repository") |
|
1297 | 1297 | flags = repo.known([bin(s) for s in ids]) |
|
1298 | 1298 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
|
1299 | 1299 | |
|
1300 | 1300 | @command('debuglabelcomplete', [], _('LABEL...')) |
|
1301 | 1301 | def debuglabelcomplete(ui, repo, *args): |
|
1302 | 1302 | '''backwards compatibility with old bash completion scripts (DEPRECATED)''' |
|
1303 | 1303 | debugnamecomplete(ui, repo, *args) |
|
1304 | 1304 | |
|
1305 | 1305 | @command('debuglocks', |
|
1306 | 1306 | [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), |
|
1307 | 1307 | ('W', 'force-wlock', None, |
|
1308 | 1308 | _('free the working state lock (DANGEROUS)')), |
|
1309 | 1309 | ('s', 'set-lock', None, _('set the store lock until stopped')), |
|
1310 | 1310 | ('S', 'set-wlock', None, |
|
1311 | 1311 | _('set the working state lock until stopped'))], |
|
1312 | 1312 | _('[OPTION]...')) |
|
1313 | 1313 | def debuglocks(ui, repo, **opts): |
|
1314 | 1314 | """show or modify state of locks |
|
1315 | 1315 | |
|
1316 | 1316 | By default, this command will show which locks are held. This |
|
1317 | 1317 | includes the user and process holding the lock, the amount of time |
|
1318 | 1318 | the lock has been held, and the machine name where the process is |
|
1319 | 1319 | running if it's not local. |
|
1320 | 1320 | |
|
1321 | 1321 | Locks protect the integrity of Mercurial's data, so should be |
|
1322 | 1322 | treated with care. System crashes or other interruptions may cause |
|
1323 | 1323 | locks to not be properly released, though Mercurial will usually |
|
1324 | 1324 | detect and remove such stale locks automatically. |
|
1325 | 1325 | |
|
1326 | 1326 | However, detecting stale locks may not always be possible (for |
|
1327 | 1327 | instance, on a shared filesystem). Removing locks may also be |
|
1328 | 1328 | blocked by filesystem permissions. |
|
1329 | 1329 | |
|
1330 | 1330 | Setting a lock will prevent other commands from changing the data. |
|
1331 | 1331 | The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs. |
|
1332 | 1332 | The set locks are removed when the command exits. |
|
1333 | 1333 | |
|
1334 | 1334 | Returns 0 if no locks are held. |
|
1335 | 1335 | |
|
1336 | 1336 | """ |
|
1337 | 1337 | |
|
1338 | 1338 | if opts.get(r'force_lock'): |
|
1339 | 1339 | repo.svfs.unlink('lock') |
|
1340 | 1340 | if opts.get(r'force_wlock'): |
|
1341 | 1341 | repo.vfs.unlink('wlock') |
|
1342 | 1342 | if opts.get(r'force_lock') or opts.get(r'force_wlock'): |
|
1343 | 1343 | return 0 |
|
1344 | 1344 | |
|
1345 | 1345 | locks = [] |
|
1346 | 1346 | try: |
|
1347 | 1347 | if opts.get(r'set_wlock'): |
|
1348 | 1348 | try: |
|
1349 | 1349 | locks.append(repo.wlock(False)) |
|
1350 | 1350 | except error.LockHeld: |
|
1351 | 1351 | raise error.Abort(_('wlock is already held')) |
|
1352 | 1352 | if opts.get(r'set_lock'): |
|
1353 | 1353 | try: |
|
1354 | 1354 | locks.append(repo.lock(False)) |
|
1355 | 1355 | except error.LockHeld: |
|
1356 | 1356 | raise error.Abort(_('lock is already held')) |
|
1357 | 1357 | if len(locks): |
|
1358 | 1358 | ui.promptchoice(_("ready to release the lock (y)? $$ &Yes")) |
|
1359 | 1359 | return 0 |
|
1360 | 1360 | finally: |
|
1361 | 1361 | release(*locks) |
|
1362 | 1362 | |
|
1363 | 1363 | now = time.time() |
|
1364 | 1364 | held = 0 |
|
1365 | 1365 | |
|
1366 | 1366 | def report(vfs, name, method): |
|
1367 | 1367 | # this causes stale locks to get reaped for more accurate reporting |
|
1368 | 1368 | try: |
|
1369 | 1369 | l = method(False) |
|
1370 | 1370 | except error.LockHeld: |
|
1371 | 1371 | l = None |
|
1372 | 1372 | |
|
1373 | 1373 | if l: |
|
1374 | 1374 | l.release() |
|
1375 | 1375 | else: |
|
1376 | 1376 | try: |
|
1377 | 1377 | st = vfs.lstat(name) |
|
1378 | 1378 | age = now - st[stat.ST_MTIME] |
|
1379 | 1379 | user = util.username(st.st_uid) |
|
1380 | 1380 | locker = vfs.readlock(name) |
|
1381 | 1381 | if ":" in locker: |
|
1382 | 1382 | host, pid = locker.split(':') |
|
1383 | 1383 | if host == socket.gethostname(): |
|
1384 | 1384 | locker = 'user %s, process %s' % (user, pid) |
|
1385 | 1385 | else: |
|
1386 | 1386 | locker = 'user %s, process %s, host %s' \ |
|
1387 | 1387 | % (user, pid, host) |
|
1388 | 1388 | ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age)) |
|
1389 | 1389 | return 1 |
|
1390 | 1390 | except OSError as e: |
|
1391 | 1391 | if e.errno != errno.ENOENT: |
|
1392 | 1392 | raise |
|
1393 | 1393 | |
|
1394 | 1394 | ui.write(("%-6s free\n") % (name + ":")) |
|
1395 | 1395 | return 0 |
|
1396 | 1396 | |
|
1397 | 1397 | held += report(repo.svfs, "lock", repo.lock) |
|
1398 | 1398 | held += report(repo.vfs, "wlock", repo.wlock) |
|
1399 | 1399 | |
|
1400 | 1400 | return held |
|
1401 | 1401 | |
|
1402 | 1402 | @command('debugmergestate', [], '') |
|
1403 | 1403 | def debugmergestate(ui, repo, *args): |
|
1404 | 1404 | """print merge state |
|
1405 | 1405 | |
|
1406 | 1406 | Use --verbose to print out information about whether v1 or v2 merge state |
|
1407 | 1407 | was chosen.""" |
|
1408 | 1408 | def _hashornull(h): |
|
1409 | 1409 | if h == nullhex: |
|
1410 | 1410 | return 'null' |
|
1411 | 1411 | else: |
|
1412 | 1412 | return h |
|
1413 | 1413 | |
|
1414 | 1414 | def printrecords(version): |
|
1415 | 1415 | ui.write(('* version %d records\n') % version) |
|
1416 | 1416 | if version == 1: |
|
1417 | 1417 | records = v1records |
|
1418 | 1418 | else: |
|
1419 | 1419 | records = v2records |
|
1420 | 1420 | |
|
1421 | 1421 | for rtype, record in records: |
|
1422 | 1422 | # pretty print some record types |
|
1423 | 1423 | if rtype == 'L': |
|
1424 | 1424 | ui.write(('local: %s\n') % record) |
|
1425 | 1425 | elif rtype == 'O': |
|
1426 | 1426 | ui.write(('other: %s\n') % record) |
|
1427 | 1427 | elif rtype == 'm': |
|
1428 | 1428 | driver, mdstate = record.split('\0', 1) |
|
1429 | 1429 | ui.write(('merge driver: %s (state "%s")\n') |
|
1430 | 1430 | % (driver, mdstate)) |
|
1431 | 1431 | elif rtype in 'FDC': |
|
1432 | 1432 | r = record.split('\0') |
|
1433 | 1433 | f, state, hash, lfile, afile, anode, ofile = r[0:7] |
|
1434 | 1434 | if version == 1: |
|
1435 | 1435 | onode = 'not stored in v1 format' |
|
1436 | 1436 | flags = r[7] |
|
1437 | 1437 | else: |
|
1438 | 1438 | onode, flags = r[7:9] |
|
1439 | 1439 | ui.write(('file: %s (record type "%s", state "%s", hash %s)\n') |
|
1440 | 1440 | % (f, rtype, state, _hashornull(hash))) |
|
1441 | 1441 | ui.write((' local path: %s (flags "%s")\n') % (lfile, flags)) |
|
1442 | 1442 | ui.write((' ancestor path: %s (node %s)\n') |
|
1443 | 1443 | % (afile, _hashornull(anode))) |
|
1444 | 1444 | ui.write((' other path: %s (node %s)\n') |
|
1445 | 1445 | % (ofile, _hashornull(onode))) |
|
1446 | 1446 | elif rtype == 'f': |
|
1447 | 1447 | filename, rawextras = record.split('\0', 1) |
|
1448 | 1448 | extras = rawextras.split('\0') |
|
1449 | 1449 | i = 0 |
|
1450 | 1450 | extrastrings = [] |
|
1451 | 1451 | while i < len(extras): |
|
1452 | 1452 | extrastrings.append('%s = %s' % (extras[i], extras[i + 1])) |
|
1453 | 1453 | i += 2 |
|
1454 | 1454 | |
|
1455 | 1455 | ui.write(('file extras: %s (%s)\n') |
|
1456 | 1456 | % (filename, ', '.join(extrastrings))) |
|
1457 | 1457 | elif rtype == 'l': |
|
1458 | 1458 | labels = record.split('\0', 2) |
|
1459 | 1459 | labels = [l for l in labels if len(l) > 0] |
|
1460 | 1460 | ui.write(('labels:\n')) |
|
1461 | 1461 | ui.write((' local: %s\n' % labels[0])) |
|
1462 | 1462 | ui.write((' other: %s\n' % labels[1])) |
|
1463 | 1463 | if len(labels) > 2: |
|
1464 | 1464 | ui.write((' base: %s\n' % labels[2])) |
|
1465 | 1465 | else: |
|
1466 | 1466 | ui.write(('unrecognized entry: %s\t%s\n') |
|
1467 | 1467 | % (rtype, record.replace('\0', '\t'))) |
|
1468 | 1468 | |
|
1469 | 1469 | # Avoid mergestate.read() since it may raise an exception for unsupported |
|
1470 | 1470 | # merge state records. We shouldn't be doing this, but this is OK since this |
|
1471 | 1471 | # command is pretty low-level. |
|
1472 | 1472 | ms = mergemod.mergestate(repo) |
|
1473 | 1473 | |
|
1474 | 1474 | # sort so that reasonable information is on top |
|
1475 | 1475 | v1records = ms._readrecordsv1() |
|
1476 | 1476 | v2records = ms._readrecordsv2() |
|
1477 | 1477 | order = 'LOml' |
|
1478 | 1478 | def key(r): |
|
1479 | 1479 | idx = order.find(r[0]) |
|
1480 | 1480 | if idx == -1: |
|
1481 | 1481 | return (1, r[1]) |
|
1482 | 1482 | else: |
|
1483 | 1483 | return (0, idx) |
|
1484 | 1484 | v1records.sort(key=key) |
|
1485 | 1485 | v2records.sort(key=key) |
|
1486 | 1486 | |
|
1487 | 1487 | if not v1records and not v2records: |
|
1488 | 1488 | ui.write(('no merge state found\n')) |
|
1489 | 1489 | elif not v2records: |
|
1490 | 1490 | ui.note(('no version 2 merge state\n')) |
|
1491 | 1491 | printrecords(1) |
|
1492 | 1492 | elif ms._v1v2match(v1records, v2records): |
|
1493 | 1493 | ui.note(('v1 and v2 states match: using v2\n')) |
|
1494 | 1494 | printrecords(2) |
|
1495 | 1495 | else: |
|
1496 | 1496 | ui.note(('v1 and v2 states mismatch: using v1\n')) |
|
1497 | 1497 | printrecords(1) |
|
1498 | 1498 | if ui.verbose: |
|
1499 | 1499 | printrecords(2) |
|
1500 | 1500 | |
|
1501 | 1501 | @command('debugnamecomplete', [], _('NAME...')) |
|
1502 | 1502 | def debugnamecomplete(ui, repo, *args): |
|
1503 | 1503 | '''complete "names" - tags, open branch names, bookmark names''' |
|
1504 | 1504 | |
|
1505 | 1505 | names = set() |
|
1506 | 1506 | # since we previously only listed open branches, we will handle that |
|
1507 | 1507 | # specially (after this for loop) |
|
1508 | 1508 | for name, ns in repo.names.iteritems(): |
|
1509 | 1509 | if name != 'branches': |
|
1510 | 1510 | names.update(ns.listnames(repo)) |
|
1511 | 1511 | names.update(tag for (tag, heads, tip, closed) |
|
1512 | 1512 | in repo.branchmap().iterbranches() if not closed) |
|
1513 | 1513 | completions = set() |
|
1514 | 1514 | if not args: |
|
1515 | 1515 | args = [''] |
|
1516 | 1516 | for a in args: |
|
1517 | 1517 | completions.update(n for n in names if n.startswith(a)) |
|
1518 | 1518 | ui.write('\n'.join(sorted(completions))) |
|
1519 | 1519 | ui.write('\n') |
|
1520 | 1520 | |
|
1521 | 1521 | @command('debugobsolete', |
|
1522 | 1522 | [('', 'flags', 0, _('markers flag')), |
|
1523 | 1523 | ('', 'record-parents', False, |
|
1524 | 1524 | _('record parent information for the precursor')), |
|
1525 | 1525 | ('r', 'rev', [], _('display markers relevant to REV')), |
|
1526 | 1526 | ('', 'exclusive', False, _('restrict display to markers only ' |
|
1527 | 1527 | 'relevant to REV')), |
|
1528 | 1528 | ('', 'index', False, _('display index of the marker')), |
|
1529 | 1529 | ('', 'delete', [], _('delete markers specified by indices')), |
|
1530 | 1530 | ] + cmdutil.commitopts2 + cmdutil.formatteropts, |
|
1531 | 1531 | _('[OBSOLETED [REPLACEMENT ...]]')) |
|
1532 | 1532 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
|
1533 | 1533 | """create arbitrary obsolete marker |
|
1534 | 1534 | |
|
1535 | 1535 | With no arguments, displays the list of obsolescence markers.""" |
|
1536 | 1536 | |
|
1537 | 1537 | opts = pycompat.byteskwargs(opts) |
|
1538 | 1538 | |
|
1539 | 1539 | def parsenodeid(s): |
|
1540 | 1540 | try: |
|
1541 | 1541 | # We do not use revsingle/revrange functions here to accept |
|
1542 | 1542 | # arbitrary node identifiers, possibly not present in the |
|
1543 | 1543 | # local repository. |
|
1544 | 1544 | n = bin(s) |
|
1545 | 1545 | if len(n) != len(nullid): |
|
1546 | 1546 | raise TypeError() |
|
1547 | 1547 | return n |
|
1548 | 1548 | except TypeError: |
|
1549 | 1549 | raise error.Abort('changeset references must be full hexadecimal ' |
|
1550 | 1550 | 'node identifiers') |
|
1551 | 1551 | |
|
1552 | 1552 | if opts.get('delete'): |
|
1553 | 1553 | indices = [] |
|
1554 | 1554 | for v in opts.get('delete'): |
|
1555 | 1555 | try: |
|
1556 | 1556 | indices.append(int(v)) |
|
1557 | 1557 | except ValueError: |
|
1558 | 1558 | raise error.Abort(_('invalid index value: %r') % v, |
|
1559 | 1559 | hint=_('use integers for indices')) |
|
1560 | 1560 | |
|
1561 | 1561 | if repo.currenttransaction(): |
|
1562 | 1562 | raise error.Abort(_('cannot delete obsmarkers in the middle ' |
|
1563 | 1563 | 'of transaction.')) |
|
1564 | 1564 | |
|
1565 | 1565 | with repo.lock(): |
|
1566 | 1566 | n = repair.deleteobsmarkers(repo.obsstore, indices) |
|
1567 | 1567 | ui.write(_('deleted %i obsolescence markers\n') % n) |
|
1568 | 1568 | |
|
1569 | 1569 | return |
|
1570 | 1570 | |
|
1571 | 1571 | if precursor is not None: |
|
1572 | 1572 | if opts['rev']: |
|
1573 | 1573 | raise error.Abort('cannot select revision when creating marker') |
|
1574 | 1574 | metadata = {} |
|
1575 | 1575 | metadata['user'] = opts['user'] or ui.username() |
|
1576 | 1576 | succs = tuple(parsenodeid(succ) for succ in successors) |
|
1577 | 1577 | l = repo.lock() |
|
1578 | 1578 | try: |
|
1579 | 1579 | tr = repo.transaction('debugobsolete') |
|
1580 | 1580 | try: |
|
1581 | 1581 | date = opts.get('date') |
|
1582 | 1582 | if date: |
|
1583 | 1583 | date = dateutil.parsedate(date) |
|
1584 | 1584 | else: |
|
1585 | 1585 | date = None |
|
1586 | 1586 | prec = parsenodeid(precursor) |
|
1587 | 1587 | parents = None |
|
1588 | 1588 | if opts['record_parents']: |
|
1589 | 1589 | if prec not in repo.unfiltered(): |
|
1590 | 1590 | raise error.Abort('cannot used --record-parents on ' |
|
1591 | 1591 | 'unknown changesets') |
|
1592 | 1592 | parents = repo.unfiltered()[prec].parents() |
|
1593 | 1593 | parents = tuple(p.node() for p in parents) |
|
1594 | 1594 | repo.obsstore.create(tr, prec, succs, opts['flags'], |
|
1595 | 1595 | parents=parents, date=date, |
|
1596 | 1596 | metadata=metadata, ui=ui) |
|
1597 | 1597 | tr.close() |
|
1598 | 1598 | except ValueError as exc: |
|
1599 | 1599 | raise error.Abort(_('bad obsmarker input: %s') % |
|
1600 | 1600 | pycompat.bytestr(exc)) |
|
1601 | 1601 | finally: |
|
1602 | 1602 | tr.release() |
|
1603 | 1603 | finally: |
|
1604 | 1604 | l.release() |
|
1605 | 1605 | else: |
|
1606 | 1606 | if opts['rev']: |
|
1607 | 1607 | revs = scmutil.revrange(repo, opts['rev']) |
|
1608 | 1608 | nodes = [repo[r].node() for r in revs] |
|
1609 | 1609 | markers = list(obsutil.getmarkers(repo, nodes=nodes, |
|
1610 | 1610 | exclusive=opts['exclusive'])) |
|
1611 | 1611 | markers.sort(key=lambda x: x._data) |
|
1612 | 1612 | else: |
|
1613 | 1613 | markers = obsutil.getmarkers(repo) |
|
1614 | 1614 | |
|
1615 | 1615 | markerstoiter = markers |
|
1616 | 1616 | isrelevant = lambda m: True |
|
1617 | 1617 | if opts.get('rev') and opts.get('index'): |
|
1618 | 1618 | markerstoiter = obsutil.getmarkers(repo) |
|
1619 | 1619 | markerset = set(markers) |
|
1620 | 1620 | isrelevant = lambda m: m in markerset |
|
1621 | 1621 | |
|
1622 | 1622 | fm = ui.formatter('debugobsolete', opts) |
|
1623 | 1623 | for i, m in enumerate(markerstoiter): |
|
1624 | 1624 | if not isrelevant(m): |
|
1625 | 1625 | # marker can be irrelevant when we're iterating over a set |
|
1626 | 1626 | # of markers (markerstoiter) which is bigger than the set |
|
1627 | 1627 | # of markers we want to display (markers) |
|
1628 | 1628 | # this can happen if both --index and --rev options are |
|
1629 | 1629 | # provided and thus we need to iterate over all of the markers |
|
1630 | 1630 | # to get the correct indices, but only display the ones that |
|
1631 | 1631 | # are relevant to --rev value |
|
1632 | 1632 | continue |
|
1633 | 1633 | fm.startitem() |
|
1634 | 1634 | ind = i if opts.get('index') else None |
|
1635 | 1635 | cmdutil.showmarker(fm, m, index=ind) |
|
1636 | 1636 | fm.end() |
|
1637 | 1637 | |
|
1638 | 1638 | @command('debugpathcomplete', |
|
1639 | 1639 | [('f', 'full', None, _('complete an entire path')), |
|
1640 | 1640 | ('n', 'normal', None, _('show only normal files')), |
|
1641 | 1641 | ('a', 'added', None, _('show only added files')), |
|
1642 | 1642 | ('r', 'removed', None, _('show only removed files'))], |
|
1643 | 1643 | _('FILESPEC...')) |
|
1644 | 1644 | def debugpathcomplete(ui, repo, *specs, **opts): |
|
1645 | 1645 | '''complete part or all of a tracked path |
|
1646 | 1646 | |
|
1647 | 1647 | This command supports shells that offer path name completion. It |
|
1648 | 1648 | currently completes only files already known to the dirstate. |
|
1649 | 1649 | |
|
1650 | 1650 | Completion extends only to the next path segment unless |
|
1651 | 1651 | --full is specified, in which case entire paths are used.''' |
|
1652 | 1652 | |
|
1653 | 1653 | def complete(path, acceptable): |
|
1654 | 1654 | dirstate = repo.dirstate |
|
1655 | 1655 | spec = os.path.normpath(os.path.join(pycompat.getcwd(), path)) |
|
1656 | 1656 | rootdir = repo.root + pycompat.ossep |
|
1657 | 1657 | if spec != repo.root and not spec.startswith(rootdir): |
|
1658 | 1658 | return [], [] |
|
1659 | 1659 | if os.path.isdir(spec): |
|
1660 | 1660 | spec += '/' |
|
1661 | 1661 | spec = spec[len(rootdir):] |
|
1662 | 1662 | fixpaths = pycompat.ossep != '/' |
|
1663 | 1663 | if fixpaths: |
|
1664 | 1664 | spec = spec.replace(pycompat.ossep, '/') |
|
1665 | 1665 | speclen = len(spec) |
|
1666 | 1666 | fullpaths = opts[r'full'] |
|
1667 | 1667 | files, dirs = set(), set() |
|
1668 | 1668 | adddir, addfile = dirs.add, files.add |
|
1669 | 1669 | for f, st in dirstate.iteritems(): |
|
1670 | 1670 | if f.startswith(spec) and st[0] in acceptable: |
|
1671 | 1671 | if fixpaths: |
|
1672 | 1672 | f = f.replace('/', pycompat.ossep) |
|
1673 | 1673 | if fullpaths: |
|
1674 | 1674 | addfile(f) |
|
1675 | 1675 | continue |
|
1676 | 1676 | s = f.find(pycompat.ossep, speclen) |
|
1677 | 1677 | if s >= 0: |
|
1678 | 1678 | adddir(f[:s]) |
|
1679 | 1679 | else: |
|
1680 | 1680 | addfile(f) |
|
1681 | 1681 | return files, dirs |
|
1682 | 1682 | |
|
1683 | 1683 | acceptable = '' |
|
1684 | 1684 | if opts[r'normal']: |
|
1685 | 1685 | acceptable += 'nm' |
|
1686 | 1686 | if opts[r'added']: |
|
1687 | 1687 | acceptable += 'a' |
|
1688 | 1688 | if opts[r'removed']: |
|
1689 | 1689 | acceptable += 'r' |
|
1690 | 1690 | cwd = repo.getcwd() |
|
1691 | 1691 | if not specs: |
|
1692 | 1692 | specs = ['.'] |
|
1693 | 1693 | |
|
1694 | 1694 | files, dirs = set(), set() |
|
1695 | 1695 | for spec in specs: |
|
1696 | 1696 | f, d = complete(spec, acceptable or 'nmar') |
|
1697 | 1697 | files.update(f) |
|
1698 | 1698 | dirs.update(d) |
|
1699 | 1699 | files.update(dirs) |
|
1700 | 1700 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) |
|
1701 | 1701 | ui.write('\n') |
|
1702 | 1702 | |
|
1703 | 1703 | @command('debugpeer', [], _('PATH'), norepo=True) |
|
1704 | 1704 | def debugpeer(ui, path): |
|
1705 | 1705 | """establish a connection to a peer repository""" |
|
1706 | 1706 | # Always enable peer request logging. Requires --debug to display |
|
1707 | 1707 | # though. |
|
1708 | 1708 | overrides = { |
|
1709 | 1709 | ('devel', 'debug.peer-request'): True, |
|
1710 | 1710 | } |
|
1711 | 1711 | |
|
1712 | 1712 | with ui.configoverride(overrides): |
|
1713 | 1713 | peer = hg.peer(ui, {}, path) |
|
1714 | 1714 | |
|
1715 | 1715 | local = peer.local() is not None |
|
1716 | 1716 | canpush = peer.canpush() |
|
1717 | 1717 | |
|
1718 | 1718 | ui.write(_('url: %s\n') % peer.url()) |
|
1719 | 1719 | ui.write(_('local: %s\n') % (_('yes') if local else _('no'))) |
|
1720 | 1720 | ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no'))) |
|
1721 | 1721 | |
|
1722 | 1722 | @command('debugpickmergetool', |
|
1723 | 1723 | [('r', 'rev', '', _('check for files in this revision'), _('REV')), |
|
1724 | 1724 | ('', 'changedelete', None, _('emulate merging change and delete')), |
|
1725 | 1725 | ] + cmdutil.walkopts + cmdutil.mergetoolopts, |
|
1726 | 1726 | _('[PATTERN]...'), |
|
1727 | 1727 | inferrepo=True) |
|
1728 | 1728 | def debugpickmergetool(ui, repo, *pats, **opts): |
|
1729 | 1729 | """examine which merge tool is chosen for specified file |
|
1730 | 1730 | |
|
1731 | 1731 | As described in :hg:`help merge-tools`, Mercurial examines |
|
1732 | 1732 | configurations below in this order to decide which merge tool is |
|
1733 | 1733 | chosen for specified file. |
|
1734 | 1734 | |
|
1735 | 1735 | 1. ``--tool`` option |
|
1736 | 1736 | 2. ``HGMERGE`` environment variable |
|
1737 | 1737 | 3. configurations in ``merge-patterns`` section |
|
1738 | 1738 | 4. configuration of ``ui.merge`` |
|
1739 | 1739 | 5. configurations in ``merge-tools`` section |
|
1740 | 1740 | 6. ``hgmerge`` tool (for historical reason only) |
|
1741 | 1741 | 7. default tool for fallback (``:merge`` or ``:prompt``) |
|
1742 | 1742 | |
|
1743 | 1743 | This command writes out examination result in the style below:: |
|
1744 | 1744 | |
|
1745 | 1745 | FILE = MERGETOOL |
|
1746 | 1746 | |
|
1747 | 1747 | By default, all files known in the first parent context of the |
|
1748 | 1748 | working directory are examined. Use file patterns and/or -I/-X |
|
1749 | 1749 | options to limit target files. -r/--rev is also useful to examine |
|
1750 | 1750 | files in another context without actual updating to it. |
|
1751 | 1751 | |
|
1752 | 1752 | With --debug, this command shows warning messages while matching |
|
1753 | 1753 | against ``merge-patterns`` and so on, too. It is recommended to |
|
1754 | 1754 | use this option with explicit file patterns and/or -I/-X options, |
|
1755 | 1755 | because this option increases amount of output per file according |
|
1756 | 1756 | to configurations in hgrc. |
|
1757 | 1757 | |
|
1758 | 1758 | With -v/--verbose, this command shows configurations below at |
|
1759 | 1759 | first (only if specified). |
|
1760 | 1760 | |
|
1761 | 1761 | - ``--tool`` option |
|
1762 | 1762 | - ``HGMERGE`` environment variable |
|
1763 | 1763 | - configuration of ``ui.merge`` |
|
1764 | 1764 | |
|
1765 | 1765 | If merge tool is chosen before matching against |
|
1766 | 1766 | ``merge-patterns``, this command can't show any helpful |
|
1767 | 1767 | information, even with --debug. In such case, information above is |
|
1768 | 1768 | useful to know why a merge tool is chosen. |
|
1769 | 1769 | """ |
|
1770 | 1770 | opts = pycompat.byteskwargs(opts) |
|
1771 | 1771 | overrides = {} |
|
1772 | 1772 | if opts['tool']: |
|
1773 | 1773 | overrides[('ui', 'forcemerge')] = opts['tool'] |
|
1774 | 1774 | ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool']))) |
|
1775 | 1775 | |
|
1776 | 1776 | with ui.configoverride(overrides, 'debugmergepatterns'): |
|
1777 | 1777 | hgmerge = encoding.environ.get("HGMERGE") |
|
1778 | 1778 | if hgmerge is not None: |
|
1779 | 1779 | ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge))) |
|
1780 | 1780 | uimerge = ui.config("ui", "merge") |
|
1781 | 1781 | if uimerge: |
|
1782 | 1782 | ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge))) |
|
1783 | 1783 | |
|
1784 | 1784 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1785 | 1785 | m = scmutil.match(ctx, pats, opts) |
|
1786 | 1786 | changedelete = opts['changedelete'] |
|
1787 | 1787 | for path in ctx.walk(m): |
|
1788 | 1788 | fctx = ctx[path] |
|
1789 | 1789 | try: |
|
1790 | 1790 | if not ui.debugflag: |
|
1791 | 1791 | ui.pushbuffer(error=True) |
|
1792 | 1792 | tool, toolpath = filemerge._picktool(repo, ui, path, |
|
1793 | 1793 | fctx.isbinary(), |
|
1794 | 1794 | 'l' in fctx.flags(), |
|
1795 | 1795 | changedelete) |
|
1796 | 1796 | finally: |
|
1797 | 1797 | if not ui.debugflag: |
|
1798 | 1798 | ui.popbuffer() |
|
1799 | 1799 | ui.write(('%s = %s\n') % (path, tool)) |
|
1800 | 1800 | |
|
1801 | 1801 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) |
|
1802 | 1802 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
|
1803 | 1803 | '''access the pushkey key/value protocol |
|
1804 | 1804 | |
|
1805 | 1805 | With two args, list the keys in the given namespace. |
|
1806 | 1806 | |
|
1807 | 1807 | With five args, set a key to new if it currently is set to old. |
|
1808 | 1808 | Reports success or failure. |
|
1809 | 1809 | ''' |
|
1810 | 1810 | |
|
1811 | 1811 | target = hg.peer(ui, {}, repopath) |
|
1812 | 1812 | if keyinfo: |
|
1813 | 1813 | key, old, new = keyinfo |
|
1814 | 1814 | r = target.pushkey(namespace, key, old, new) |
|
1815 | 1815 | ui.status(pycompat.bytestr(r) + '\n') |
|
1816 | 1816 | return not r |
|
1817 | 1817 | else: |
|
1818 | 1818 | for k, v in sorted(target.listkeys(namespace).iteritems()): |
|
1819 | 1819 | ui.write("%s\t%s\n" % (util.escapestr(k), |
|
1820 | 1820 | util.escapestr(v))) |
|
1821 | 1821 | |
|
1822 | 1822 | @command('debugpvec', [], _('A B')) |
|
1823 | 1823 | def debugpvec(ui, repo, a, b=None): |
|
1824 | 1824 | ca = scmutil.revsingle(repo, a) |
|
1825 | 1825 | cb = scmutil.revsingle(repo, b) |
|
1826 | 1826 | pa = pvec.ctxpvec(ca) |
|
1827 | 1827 | pb = pvec.ctxpvec(cb) |
|
1828 | 1828 | if pa == pb: |
|
1829 | 1829 | rel = "=" |
|
1830 | 1830 | elif pa > pb: |
|
1831 | 1831 | rel = ">" |
|
1832 | 1832 | elif pa < pb: |
|
1833 | 1833 | rel = "<" |
|
1834 | 1834 | elif pa | pb: |
|
1835 | 1835 | rel = "|" |
|
1836 | 1836 | ui.write(_("a: %s\n") % pa) |
|
1837 | 1837 | ui.write(_("b: %s\n") % pb) |
|
1838 | 1838 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) |
|
1839 | 1839 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % |
|
1840 | 1840 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), |
|
1841 | 1841 | pa.distance(pb), rel)) |
|
1842 | 1842 | |
|
1843 | 1843 | @command('debugrebuilddirstate|debugrebuildstate', |
|
1844 | 1844 | [('r', 'rev', '', _('revision to rebuild to'), _('REV')), |
|
1845 | 1845 | ('', 'minimal', None, _('only rebuild files that are inconsistent with ' |
|
1846 | 1846 | 'the working copy parent')), |
|
1847 | 1847 | ], |
|
1848 | 1848 | _('[-r REV]')) |
|
1849 | 1849 | def debugrebuilddirstate(ui, repo, rev, **opts): |
|
1850 | 1850 | """rebuild the dirstate as it would look like for the given revision |
|
1851 | 1851 | |
|
1852 | 1852 | If no revision is specified the first current parent will be used. |
|
1853 | 1853 | |
|
1854 | 1854 | The dirstate will be set to the files of the given revision. |
|
1855 | 1855 | The actual working directory content or existing dirstate |
|
1856 | 1856 | information such as adds or removes is not considered. |
|
1857 | 1857 | |
|
1858 | 1858 | ``minimal`` will only rebuild the dirstate status for files that claim to be |
|
1859 | 1859 | tracked but are not in the parent manifest, or that exist in the parent |
|
1860 | 1860 | manifest but are not in the dirstate. It will not change adds, removes, or |
|
1861 | 1861 | modified files that are in the working copy parent. |
|
1862 | 1862 | |
|
1863 | 1863 | One use of this command is to make the next :hg:`status` invocation |
|
1864 | 1864 | check the actual file content. |
|
1865 | 1865 | """ |
|
1866 | 1866 | ctx = scmutil.revsingle(repo, rev) |
|
1867 | 1867 | with repo.wlock(): |
|
1868 | 1868 | dirstate = repo.dirstate |
|
1869 | 1869 | changedfiles = None |
|
1870 | 1870 | # See command doc for what minimal does. |
|
1871 | 1871 | if opts.get(r'minimal'): |
|
1872 | 1872 | manifestfiles = set(ctx.manifest().keys()) |
|
1873 | 1873 | dirstatefiles = set(dirstate) |
|
1874 | 1874 | manifestonly = manifestfiles - dirstatefiles |
|
1875 | 1875 | dsonly = dirstatefiles - manifestfiles |
|
1876 | 1876 | dsnotadded = set(f for f in dsonly if dirstate[f] != 'a') |
|
1877 | 1877 | changedfiles = manifestonly | dsnotadded |
|
1878 | 1878 | |
|
1879 | 1879 | dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) |
|
1880 | 1880 | |
|
1881 | 1881 | @command('debugrebuildfncache', [], '') |
|
1882 | 1882 | def debugrebuildfncache(ui, repo): |
|
1883 | 1883 | """rebuild the fncache file""" |
|
1884 | 1884 | repair.rebuildfncache(ui, repo) |
|
1885 | 1885 | |
|
1886 | 1886 | @command('debugrename', |
|
1887 | 1887 | [('r', 'rev', '', _('revision to debug'), _('REV'))], |
|
1888 | 1888 | _('[-r REV] FILE')) |
|
1889 | 1889 | def debugrename(ui, repo, file1, *pats, **opts): |
|
1890 | 1890 | """dump rename information""" |
|
1891 | 1891 | |
|
1892 | 1892 | opts = pycompat.byteskwargs(opts) |
|
1893 | 1893 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1894 | 1894 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1895 | 1895 | for abs in ctx.walk(m): |
|
1896 | 1896 | fctx = ctx[abs] |
|
1897 | 1897 | o = fctx.filelog().renamed(fctx.filenode()) |
|
1898 | 1898 | rel = m.rel(abs) |
|
1899 | 1899 | if o: |
|
1900 | 1900 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
|
1901 | 1901 | else: |
|
1902 | 1902 | ui.write(_("%s not renamed\n") % rel) |
|
1903 | 1903 | |
|
1904 | 1904 | @command('debugrevlog', cmdutil.debugrevlogopts + |
|
1905 | 1905 | [('d', 'dump', False, _('dump index data'))], |
|
1906 | 1906 | _('-c|-m|FILE'), |
|
1907 | 1907 | optionalrepo=True) |
|
1908 | 1908 | def debugrevlog(ui, repo, file_=None, **opts): |
|
1909 | 1909 | """show data and statistics about a revlog""" |
|
1910 | 1910 | opts = pycompat.byteskwargs(opts) |
|
1911 | 1911 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
|
1912 | 1912 | |
|
1913 | 1913 | if opts.get("dump"): |
|
1914 | 1914 | numrevs = len(r) |
|
1915 | 1915 | ui.write(("# rev p1rev p2rev start end deltastart base p1 p2" |
|
1916 | 1916 | " rawsize totalsize compression heads chainlen\n")) |
|
1917 | 1917 | ts = 0 |
|
1918 | 1918 | heads = set() |
|
1919 | 1919 | |
|
1920 | 1920 | for rev in xrange(numrevs): |
|
1921 | 1921 | dbase = r.deltaparent(rev) |
|
1922 | 1922 | if dbase == -1: |
|
1923 | 1923 | dbase = rev |
|
1924 | 1924 | cbase = r.chainbase(rev) |
|
1925 | 1925 | clen = r.chainlen(rev) |
|
1926 | 1926 | p1, p2 = r.parentrevs(rev) |
|
1927 | 1927 | rs = r.rawsize(rev) |
|
1928 | 1928 | ts = ts + rs |
|
1929 | 1929 | heads -= set(r.parentrevs(rev)) |
|
1930 | 1930 | heads.add(rev) |
|
1931 | 1931 | try: |
|
1932 | 1932 | compression = ts / r.end(rev) |
|
1933 | 1933 | except ZeroDivisionError: |
|
1934 | 1934 | compression = 0 |
|
1935 | 1935 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " |
|
1936 | 1936 | "%11d %5d %8d\n" % |
|
1937 | 1937 | (rev, p1, p2, r.start(rev), r.end(rev), |
|
1938 | 1938 | r.start(dbase), r.start(cbase), |
|
1939 | 1939 | r.start(p1), r.start(p2), |
|
1940 | 1940 | rs, ts, compression, len(heads), clen)) |
|
1941 | 1941 | return 0 |
|
1942 | 1942 | |
|
1943 | 1943 | v = r.version |
|
1944 | 1944 | format = v & 0xFFFF |
|
1945 | 1945 | flags = [] |
|
1946 | 1946 | gdelta = False |
|
1947 | 1947 | if v & revlog.FLAG_INLINE_DATA: |
|
1948 | 1948 | flags.append('inline') |
|
1949 | 1949 | if v & revlog.FLAG_GENERALDELTA: |
|
1950 | 1950 | gdelta = True |
|
1951 | 1951 | flags.append('generaldelta') |
|
1952 | 1952 | if not flags: |
|
1953 | 1953 | flags = ['(none)'] |
|
1954 | 1954 | |
|
1955 | 1955 | nummerges = 0 |
|
1956 | 1956 | numfull = 0 |
|
1957 | 1957 | numprev = 0 |
|
1958 | 1958 | nump1 = 0 |
|
1959 | 1959 | nump2 = 0 |
|
1960 | 1960 | numother = 0 |
|
1961 | 1961 | nump1prev = 0 |
|
1962 | 1962 | nump2prev = 0 |
|
1963 | 1963 | chainlengths = [] |
|
1964 | 1964 | chainbases = [] |
|
1965 | 1965 | chainspans = [] |
|
1966 | 1966 | |
|
1967 | 1967 | datasize = [None, 0, 0] |
|
1968 | 1968 | fullsize = [None, 0, 0] |
|
1969 | 1969 | deltasize = [None, 0, 0] |
|
1970 | 1970 | chunktypecounts = {} |
|
1971 | 1971 | chunktypesizes = {} |
|
1972 | 1972 | |
|
1973 | 1973 | def addsize(size, l): |
|
1974 | 1974 | if l[0] is None or size < l[0]: |
|
1975 | 1975 | l[0] = size |
|
1976 | 1976 | if size > l[1]: |
|
1977 | 1977 | l[1] = size |
|
1978 | 1978 | l[2] += size |
|
1979 | 1979 | |
|
1980 | 1980 | numrevs = len(r) |
|
1981 | 1981 | for rev in xrange(numrevs): |
|
1982 | 1982 | p1, p2 = r.parentrevs(rev) |
|
1983 | 1983 | delta = r.deltaparent(rev) |
|
1984 | 1984 | if format > 0: |
|
1985 | 1985 | addsize(r.rawsize(rev), datasize) |
|
1986 | 1986 | if p2 != nullrev: |
|
1987 | 1987 | nummerges += 1 |
|
1988 | 1988 | size = r.length(rev) |
|
1989 | 1989 | if delta == nullrev: |
|
1990 | 1990 | chainlengths.append(0) |
|
1991 | 1991 | chainbases.append(r.start(rev)) |
|
1992 | 1992 | chainspans.append(size) |
|
1993 | 1993 | numfull += 1 |
|
1994 | 1994 | addsize(size, fullsize) |
|
1995 | 1995 | else: |
|
1996 | 1996 | chainlengths.append(chainlengths[delta] + 1) |
|
1997 | 1997 | baseaddr = chainbases[delta] |
|
1998 | 1998 | revaddr = r.start(rev) |
|
1999 | 1999 | chainbases.append(baseaddr) |
|
2000 | 2000 | chainspans.append((revaddr - baseaddr) + size) |
|
2001 | 2001 | addsize(size, deltasize) |
|
2002 | 2002 | if delta == rev - 1: |
|
2003 | 2003 | numprev += 1 |
|
2004 | 2004 | if delta == p1: |
|
2005 | 2005 | nump1prev += 1 |
|
2006 | 2006 | elif delta == p2: |
|
2007 | 2007 | nump2prev += 1 |
|
2008 | 2008 | elif delta == p1: |
|
2009 | 2009 | nump1 += 1 |
|
2010 | 2010 | elif delta == p2: |
|
2011 | 2011 | nump2 += 1 |
|
2012 | 2012 | elif delta != nullrev: |
|
2013 | 2013 | numother += 1 |
|
2014 | 2014 | |
|
2015 | 2015 | # Obtain data on the raw chunks in the revlog. |
|
2016 | 2016 | segment = r._getsegmentforrevs(rev, rev)[1] |
|
2017 | 2017 | if segment: |
|
2018 | 2018 | chunktype = bytes(segment[0:1]) |
|
2019 | 2019 | else: |
|
2020 | 2020 | chunktype = 'empty' |
|
2021 | 2021 | |
|
2022 | 2022 | if chunktype not in chunktypecounts: |
|
2023 | 2023 | chunktypecounts[chunktype] = 0 |
|
2024 | 2024 | chunktypesizes[chunktype] = 0 |
|
2025 | 2025 | |
|
2026 | 2026 | chunktypecounts[chunktype] += 1 |
|
2027 | 2027 | chunktypesizes[chunktype] += size |
|
2028 | 2028 | |
|
2029 | 2029 | # Adjust size min value for empty cases |
|
2030 | 2030 | for size in (datasize, fullsize, deltasize): |
|
2031 | 2031 | if size[0] is None: |
|
2032 | 2032 | size[0] = 0 |
|
2033 | 2033 | |
|
2034 | 2034 | numdeltas = numrevs - numfull |
|
2035 | 2035 | numoprev = numprev - nump1prev - nump2prev |
|
2036 | 2036 | totalrawsize = datasize[2] |
|
2037 | 2037 | datasize[2] /= numrevs |
|
2038 | 2038 | fulltotal = fullsize[2] |
|
2039 | 2039 | fullsize[2] /= numfull |
|
2040 | 2040 | deltatotal = deltasize[2] |
|
2041 | 2041 | if numrevs - numfull > 0: |
|
2042 | 2042 | deltasize[2] /= numrevs - numfull |
|
2043 | 2043 | totalsize = fulltotal + deltatotal |
|
2044 | 2044 | avgchainlen = sum(chainlengths) / numrevs |
|
2045 | 2045 | maxchainlen = max(chainlengths) |
|
2046 | 2046 | maxchainspan = max(chainspans) |
|
2047 | 2047 | compratio = 1 |
|
2048 | 2048 | if totalsize: |
|
2049 | 2049 | compratio = totalrawsize / totalsize |
|
2050 | 2050 | |
|
2051 | 2051 | basedfmtstr = '%%%dd\n' |
|
2052 | 2052 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' |
|
2053 | 2053 | |
|
2054 | 2054 | def dfmtstr(max): |
|
2055 | 2055 | return basedfmtstr % len(str(max)) |
|
2056 | 2056 | def pcfmtstr(max, padding=0): |
|
2057 | 2057 | return basepcfmtstr % (len(str(max)), ' ' * padding) |
|
2058 | 2058 | |
|
2059 | 2059 | def pcfmt(value, total): |
|
2060 | 2060 | if total: |
|
2061 | 2061 | return (value, 100 * float(value) / total) |
|
2062 | 2062 | else: |
|
2063 | 2063 | return value, 100.0 |
|
2064 | 2064 | |
|
2065 | 2065 | ui.write(('format : %d\n') % format) |
|
2066 | 2066 | ui.write(('flags : %s\n') % ', '.join(flags)) |
|
2067 | 2067 | |
|
2068 | 2068 | ui.write('\n') |
|
2069 | 2069 | fmt = pcfmtstr(totalsize) |
|
2070 | 2070 | fmt2 = dfmtstr(totalsize) |
|
2071 | 2071 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2072 | 2072 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) |
|
2073 | 2073 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) |
|
2074 | 2074 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2075 | 2075 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) |
|
2076 | 2076 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) |
|
2077 | 2077 | ui.write(('revision size : ') + fmt2 % totalsize) |
|
2078 | 2078 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) |
|
2079 | 2079 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) |
|
2080 | 2080 | |
|
2081 | 2081 | def fmtchunktype(chunktype): |
|
2082 | 2082 | if chunktype == 'empty': |
|
2083 | 2083 | return ' %s : ' % chunktype |
|
2084 | 2084 | elif chunktype in pycompat.bytestr(string.ascii_letters): |
|
2085 | 2085 | return ' 0x%s (%s) : ' % (hex(chunktype), chunktype) |
|
2086 | 2086 | else: |
|
2087 | 2087 | return ' 0x%s : ' % hex(chunktype) |
|
2088 | 2088 | |
|
2089 | 2089 | ui.write('\n') |
|
2090 | 2090 | ui.write(('chunks : ') + fmt2 % numrevs) |
|
2091 | 2091 | for chunktype in sorted(chunktypecounts): |
|
2092 | 2092 | ui.write(fmtchunktype(chunktype)) |
|
2093 | 2093 | ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs)) |
|
2094 | 2094 | ui.write(('chunks size : ') + fmt2 % totalsize) |
|
2095 | 2095 | for chunktype in sorted(chunktypecounts): |
|
2096 | 2096 | ui.write(fmtchunktype(chunktype)) |
|
2097 | 2097 | ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize)) |
|
2098 | 2098 | |
|
2099 | 2099 | ui.write('\n') |
|
2100 | 2100 | fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio)) |
|
2101 | 2101 | ui.write(('avg chain length : ') + fmt % avgchainlen) |
|
2102 | 2102 | ui.write(('max chain length : ') + fmt % maxchainlen) |
|
2103 | 2103 | ui.write(('max chain reach : ') + fmt % maxchainspan) |
|
2104 | 2104 | ui.write(('compression ratio : ') + fmt % compratio) |
|
2105 | 2105 | |
|
2106 | 2106 | if format > 0: |
|
2107 | 2107 | ui.write('\n') |
|
2108 | 2108 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |
|
2109 | 2109 | % tuple(datasize)) |
|
2110 | 2110 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') |
|
2111 | 2111 | % tuple(fullsize)) |
|
2112 | 2112 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') |
|
2113 | 2113 | % tuple(deltasize)) |
|
2114 | 2114 | |
|
2115 | 2115 | if numdeltas > 0: |
|
2116 | 2116 | ui.write('\n') |
|
2117 | 2117 | fmt = pcfmtstr(numdeltas) |
|
2118 | 2118 | fmt2 = pcfmtstr(numdeltas, 4) |
|
2119 | 2119 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) |
|
2120 | 2120 | if numprev > 0: |
|
2121 | 2121 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, |
|
2122 | 2122 | numprev)) |
|
2123 | 2123 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, |
|
2124 | 2124 | numprev)) |
|
2125 | 2125 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, |
|
2126 | 2126 | numprev)) |
|
2127 | 2127 | if gdelta: |
|
2128 | 2128 | ui.write(('deltas against p1 : ') |
|
2129 | 2129 | + fmt % pcfmt(nump1, numdeltas)) |
|
2130 | 2130 | ui.write(('deltas against p2 : ') |
|
2131 | 2131 | + fmt % pcfmt(nump2, numdeltas)) |
|
2132 | 2132 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
|
2133 | 2133 | numdeltas)) |
|
2134 | 2134 | |
|
2135 | 2135 | @command('debugrevspec', |
|
2136 | 2136 | [('', 'optimize', None, |
|
2137 | 2137 | _('print parsed tree after optimizing (DEPRECATED)')), |
|
2138 | 2138 | ('', 'show-revs', True, _('print list of result revisions (default)')), |
|
2139 | 2139 | ('s', 'show-set', None, _('print internal representation of result set')), |
|
2140 | 2140 | ('p', 'show-stage', [], |
|
2141 | 2141 | _('print parsed tree at the given stage'), _('NAME')), |
|
2142 | 2142 | ('', 'no-optimized', False, _('evaluate tree without optimization')), |
|
2143 | 2143 | ('', 'verify-optimized', False, _('verify optimized result')), |
|
2144 | 2144 | ], |
|
2145 | 2145 | ('REVSPEC')) |
|
2146 | 2146 | def debugrevspec(ui, repo, expr, **opts): |
|
2147 | 2147 | """parse and apply a revision specification |
|
2148 | 2148 | |
|
2149 | 2149 | Use -p/--show-stage option to print the parsed tree at the given stages. |
|
2150 | 2150 | Use -p all to print tree at every stage. |
|
2151 | 2151 | |
|
2152 | 2152 | Use --no-show-revs option with -s or -p to print only the set |
|
2153 | 2153 | representation or the parsed tree respectively. |
|
2154 | 2154 | |
|
2155 | 2155 | Use --verify-optimized to compare the optimized result with the unoptimized |
|
2156 | 2156 | one. Returns 1 if the optimized result differs. |
|
2157 | 2157 | """ |
|
2158 | 2158 | opts = pycompat.byteskwargs(opts) |
|
2159 | 2159 | aliases = ui.configitems('revsetalias') |
|
2160 | 2160 | stages = [ |
|
2161 | 2161 | ('parsed', lambda tree: tree), |
|
2162 | 2162 | ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases, |
|
2163 | 2163 | ui.warn)), |
|
2164 | 2164 | ('concatenated', revsetlang.foldconcat), |
|
2165 | 2165 | ('analyzed', revsetlang.analyze), |
|
2166 | 2166 | ('optimized', revsetlang.optimize), |
|
2167 | 2167 | ] |
|
2168 | 2168 | if opts['no_optimized']: |
|
2169 | 2169 | stages = stages[:-1] |
|
2170 | 2170 | if opts['verify_optimized'] and opts['no_optimized']: |
|
2171 | 2171 | raise error.Abort(_('cannot use --verify-optimized with ' |
|
2172 | 2172 | '--no-optimized')) |
|
2173 | 2173 | stagenames = set(n for n, f in stages) |
|
2174 | 2174 | |
|
2175 | 2175 | showalways = set() |
|
2176 | 2176 | showchanged = set() |
|
2177 | 2177 | if ui.verbose and not opts['show_stage']: |
|
2178 | 2178 | # show parsed tree by --verbose (deprecated) |
|
2179 | 2179 | showalways.add('parsed') |
|
2180 | 2180 | showchanged.update(['expanded', 'concatenated']) |
|
2181 | 2181 | if opts['optimize']: |
|
2182 | 2182 | showalways.add('optimized') |
|
2183 | 2183 | if opts['show_stage'] and opts['optimize']: |
|
2184 | 2184 | raise error.Abort(_('cannot use --optimize with --show-stage')) |
|
2185 | 2185 | if opts['show_stage'] == ['all']: |
|
2186 | 2186 | showalways.update(stagenames) |
|
2187 | 2187 | else: |
|
2188 | 2188 | for n in opts['show_stage']: |
|
2189 | 2189 | if n not in stagenames: |
|
2190 | 2190 | raise error.Abort(_('invalid stage name: %s') % n) |
|
2191 | 2191 | showalways.update(opts['show_stage']) |
|
2192 | 2192 | |
|
2193 | 2193 | treebystage = {} |
|
2194 | 2194 | printedtree = None |
|
2195 | 2195 | tree = revsetlang.parse(expr, lookup=repo.__contains__) |
|
2196 | 2196 | for n, f in stages: |
|
2197 | 2197 | treebystage[n] = tree = f(tree) |
|
2198 | 2198 | if n in showalways or (n in showchanged and tree != printedtree): |
|
2199 | 2199 | if opts['show_stage'] or n != 'parsed': |
|
2200 | 2200 | ui.write(("* %s:\n") % n) |
|
2201 | 2201 | ui.write(revsetlang.prettyformat(tree), "\n") |
|
2202 | 2202 | printedtree = tree |
|
2203 | 2203 | |
|
2204 | 2204 | if opts['verify_optimized']: |
|
2205 | 2205 | arevs = revset.makematcher(treebystage['analyzed'])(repo) |
|
2206 | 2206 | brevs = revset.makematcher(treebystage['optimized'])(repo) |
|
2207 | 2207 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2208 | 2208 | ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n") |
|
2209 | 2209 | ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n") |
|
2210 | 2210 | arevs = list(arevs) |
|
2211 | 2211 | brevs = list(brevs) |
|
2212 | 2212 | if arevs == brevs: |
|
2213 | 2213 | return 0 |
|
2214 | 2214 | ui.write(('--- analyzed\n'), label='diff.file_a') |
|
2215 | 2215 | ui.write(('+++ optimized\n'), label='diff.file_b') |
|
2216 | 2216 | sm = difflib.SequenceMatcher(None, arevs, brevs) |
|
2217 | 2217 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
|
2218 | 2218 | if tag in ('delete', 'replace'): |
|
2219 | 2219 | for c in arevs[alo:ahi]: |
|
2220 | 2220 | ui.write('-%s\n' % c, label='diff.deleted') |
|
2221 | 2221 | if tag in ('insert', 'replace'): |
|
2222 | 2222 | for c in brevs[blo:bhi]: |
|
2223 | 2223 | ui.write('+%s\n' % c, label='diff.inserted') |
|
2224 | 2224 | if tag == 'equal': |
|
2225 | 2225 | for c in arevs[alo:ahi]: |
|
2226 | 2226 | ui.write(' %s\n' % c) |
|
2227 | 2227 | return 1 |
|
2228 | 2228 | |
|
2229 | 2229 | func = revset.makematcher(tree) |
|
2230 | 2230 | revs = func(repo) |
|
2231 | 2231 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2232 | 2232 | ui.write(("* set:\n"), smartset.prettyformat(revs), "\n") |
|
2233 | 2233 | if not opts['show_revs']: |
|
2234 | 2234 | return |
|
2235 | 2235 | for c in revs: |
|
2236 | 2236 | ui.write("%d\n" % c) |
|
2237 | 2237 | |
|
2238 | 2238 | @command('debugserve', [ |
|
2239 | 2239 | ('', 'sshstdio', False, _('run an SSH server bound to process handles')), |
|
2240 | 2240 | ('', 'logiofd', '', _('file descriptor to log server I/O to')), |
|
2241 | 2241 | ('', 'logiofile', '', _('file to log server I/O to')), |
|
2242 | 2242 | ], '') |
|
2243 | 2243 | def debugserve(ui, repo, **opts): |
|
2244 | 2244 | """run a server with advanced settings |
|
2245 | 2245 | |
|
2246 | 2246 | This command is similar to :hg:`serve`. It exists partially as a |
|
2247 | 2247 | workaround to the fact that ``hg serve --stdio`` must have specific |
|
2248 | 2248 | arguments for security reasons. |
|
2249 | 2249 | """ |
|
2250 | 2250 | opts = pycompat.byteskwargs(opts) |
|
2251 | 2251 | |
|
2252 | 2252 | if not opts['sshstdio']: |
|
2253 | 2253 | raise error.Abort(_('only --sshstdio is currently supported')) |
|
2254 | 2254 | |
|
2255 | 2255 | logfh = None |
|
2256 | 2256 | |
|
2257 | 2257 | if opts['logiofd'] and opts['logiofile']: |
|
2258 | 2258 | raise error.Abort(_('cannot use both --logiofd and --logiofile')) |
|
2259 | 2259 | |
|
2260 | 2260 | if opts['logiofd']: |
|
2261 | 2261 | # Line buffered because output is line based. |
|
2262 | 2262 | logfh = os.fdopen(int(opts['logiofd']), r'ab', 1) |
|
2263 | 2263 | elif opts['logiofile']: |
|
2264 | 2264 | logfh = open(opts['logiofile'], 'ab', 1) |
|
2265 | 2265 | |
|
2266 | 2266 | s = wireprotoserver.sshserver(ui, repo, logfh=logfh) |
|
2267 | 2267 | s.serve_forever() |
|
2268 | 2268 | |
|
2269 | 2269 | @command('debugsetparents', [], _('REV1 [REV2]')) |
|
2270 | 2270 | def debugsetparents(ui, repo, rev1, rev2=None): |
|
2271 | 2271 | """manually set the parents of the current working directory |
|
2272 | 2272 | |
|
2273 | 2273 | This is useful for writing repository conversion tools, but should |
|
2274 | 2274 | be used with care. For example, neither the working directory nor the |
|
2275 | 2275 | dirstate is updated, so file status may be incorrect after running this |
|
2276 | 2276 | command. |
|
2277 | 2277 | |
|
2278 | 2278 | Returns 0 on success. |
|
2279 | 2279 | """ |
|
2280 | 2280 | |
|
2281 | 2281 | r1 = scmutil.revsingle(repo, rev1).node() |
|
2282 | 2282 | r2 = scmutil.revsingle(repo, rev2, 'null').node() |
|
2283 | 2283 | |
|
2284 | 2284 | with repo.wlock(): |
|
2285 | 2285 | repo.setparents(r1, r2) |
|
2286 | 2286 | |
|
2287 | 2287 | @command('debugssl', [], '[SOURCE]', optionalrepo=True) |
|
2288 | 2288 | def debugssl(ui, repo, source=None, **opts): |
|
2289 | 2289 | '''test a secure connection to a server |
|
2290 | 2290 | |
|
2291 | 2291 | This builds the certificate chain for the server on Windows, installing the |
|
2292 | 2292 | missing intermediates and trusted root via Windows Update if necessary. It |
|
2293 | 2293 | does nothing on other platforms. |
|
2294 | 2294 | |
|
2295 | 2295 | If SOURCE is omitted, the 'default' path will be used. If a URL is given, |
|
2296 | 2296 | that server is used. See :hg:`help urls` for more information. |
|
2297 | 2297 | |
|
2298 | 2298 | If the update succeeds, retry the original operation. Otherwise, the cause |
|
2299 | 2299 | of the SSL error is likely another issue. |
|
2300 | 2300 | ''' |
|
2301 | 2301 | if not pycompat.iswindows: |
|
2302 | 2302 | raise error.Abort(_('certificate chain building is only possible on ' |
|
2303 | 2303 | 'Windows')) |
|
2304 | 2304 | |
|
2305 | 2305 | if not source: |
|
2306 | 2306 | if not repo: |
|
2307 | 2307 | raise error.Abort(_("there is no Mercurial repository here, and no " |
|
2308 | 2308 | "server specified")) |
|
2309 | 2309 | source = "default" |
|
2310 | 2310 | |
|
2311 | 2311 | source, branches = hg.parseurl(ui.expandpath(source)) |
|
2312 | 2312 | url = util.url(source) |
|
2313 | 2313 | addr = None |
|
2314 | 2314 | |
|
2315 | 2315 | defaultport = {'https': 443, 'ssh': 22} |
|
2316 | 2316 | if url.scheme in defaultport: |
|
2317 | 2317 | try: |
|
2318 | 2318 | addr = (url.host, int(url.port or defaultport[url.scheme])) |
|
2319 | 2319 | except ValueError: |
|
2320 | 2320 | raise error.Abort(_("malformed port number in URL")) |
|
2321 | 2321 | else: |
|
2322 | 2322 | raise error.Abort(_("only https and ssh connections are supported")) |
|
2323 | 2323 | |
|
2324 | 2324 | from . import win32 |
|
2325 | 2325 | |
|
2326 | 2326 | s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS, |
|
2327 | 2327 | cert_reqs=ssl.CERT_NONE, ca_certs=None) |
|
2328 | 2328 | |
|
2329 | 2329 | try: |
|
2330 | 2330 | s.connect(addr) |
|
2331 | 2331 | cert = s.getpeercert(True) |
|
2332 | 2332 | |
|
2333 | 2333 | ui.status(_('checking the certificate chain for %s\n') % url.host) |
|
2334 | 2334 | |
|
2335 | 2335 | complete = win32.checkcertificatechain(cert, build=False) |
|
2336 | 2336 | |
|
2337 | 2337 | if not complete: |
|
2338 | 2338 | ui.status(_('certificate chain is incomplete, updating... ')) |
|
2339 | 2339 | |
|
2340 | 2340 | if not win32.checkcertificatechain(cert): |
|
2341 | 2341 | ui.status(_('failed.\n')) |
|
2342 | 2342 | else: |
|
2343 | 2343 | ui.status(_('done.\n')) |
|
2344 | 2344 | else: |
|
2345 | 2345 | ui.status(_('full certificate chain is available\n')) |
|
2346 | 2346 | finally: |
|
2347 | 2347 | s.close() |
|
2348 | 2348 | |
|
2349 | 2349 | @command('debugsub', |
|
2350 | 2350 | [('r', 'rev', '', |
|
2351 | 2351 | _('revision to check'), _('REV'))], |
|
2352 | 2352 | _('[-r REV] [REV]')) |
|
2353 | 2353 | def debugsub(ui, repo, rev=None): |
|
2354 | 2354 | ctx = scmutil.revsingle(repo, rev, None) |
|
2355 | 2355 | for k, v in sorted(ctx.substate.items()): |
|
2356 | 2356 | ui.write(('path %s\n') % k) |
|
2357 | 2357 | ui.write((' source %s\n') % v[0]) |
|
2358 | 2358 | ui.write((' revision %s\n') % v[1]) |
|
2359 | 2359 | |
|
2360 | 2360 | @command('debugsuccessorssets', |
|
2361 | 2361 | [('', 'closest', False, _('return closest successors sets only'))], |
|
2362 | 2362 | _('[REV]')) |
|
2363 | 2363 | def debugsuccessorssets(ui, repo, *revs, **opts): |
|
2364 | 2364 | """show set of successors for revision |
|
2365 | 2365 | |
|
2366 | 2366 | A successors set of changeset A is a consistent group of revisions that |
|
2367 | 2367 | succeed A. It contains non-obsolete changesets only unless closests |
|
2368 | 2368 | successors set is set. |
|
2369 | 2369 | |
|
2370 | 2370 | In most cases a changeset A has a single successors set containing a single |
|
2371 | 2371 | successor (changeset A replaced by A'). |
|
2372 | 2372 | |
|
2373 | 2373 | A changeset that is made obsolete with no successors are called "pruned". |
|
2374 | 2374 | Such changesets have no successors sets at all. |
|
2375 | 2375 | |
|
2376 | 2376 | A changeset that has been "split" will have a successors set containing |
|
2377 | 2377 | more than one successor. |
|
2378 | 2378 | |
|
2379 | 2379 | A changeset that has been rewritten in multiple different ways is called |
|
2380 | 2380 | "divergent". Such changesets have multiple successor sets (each of which |
|
2381 | 2381 | may also be split, i.e. have multiple successors). |
|
2382 | 2382 | |
|
2383 | 2383 | Results are displayed as follows:: |
|
2384 | 2384 | |
|
2385 | 2385 | <rev1> |
|
2386 | 2386 | <successors-1A> |
|
2387 | 2387 | <rev2> |
|
2388 | 2388 | <successors-2A> |
|
2389 | 2389 | <successors-2B1> <successors-2B2> <successors-2B3> |
|
2390 | 2390 | |
|
2391 | 2391 | Here rev2 has two possible (i.e. divergent) successors sets. The first |
|
2392 | 2392 | holds one element, whereas the second holds three (i.e. the changeset has |
|
2393 | 2393 | been split). |
|
2394 | 2394 | """ |
|
2395 | 2395 | # passed to successorssets caching computation from one call to another |
|
2396 | 2396 | cache = {} |
|
2397 | 2397 | ctx2str = bytes |
|
2398 | 2398 | node2str = short |
|
2399 | 2399 | for rev in scmutil.revrange(repo, revs): |
|
2400 | 2400 | ctx = repo[rev] |
|
2401 | 2401 | ui.write('%s\n'% ctx2str(ctx)) |
|
2402 | 2402 | for succsset in obsutil.successorssets(repo, ctx.node(), |
|
2403 | 2403 | closest=opts[r'closest'], |
|
2404 | 2404 | cache=cache): |
|
2405 | 2405 | if succsset: |
|
2406 | 2406 | ui.write(' ') |
|
2407 | 2407 | ui.write(node2str(succsset[0])) |
|
2408 | 2408 | for node in succsset[1:]: |
|
2409 | 2409 | ui.write(' ') |
|
2410 | 2410 | ui.write(node2str(node)) |
|
2411 | 2411 | ui.write('\n') |
|
2412 | 2412 | |
|
2413 | 2413 | @command('debugtemplate', |
|
2414 | 2414 | [('r', 'rev', [], _('apply template on changesets'), _('REV')), |
|
2415 | 2415 | ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))], |
|
2416 | 2416 | _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'), |
|
2417 | 2417 | optionalrepo=True) |
|
2418 | 2418 | def debugtemplate(ui, repo, tmpl, **opts): |
|
2419 | 2419 | """parse and apply a template |
|
2420 | 2420 | |
|
2421 | 2421 | If -r/--rev is given, the template is processed as a log template and |
|
2422 | 2422 | applied to the given changesets. Otherwise, it is processed as a generic |
|
2423 | 2423 | template. |
|
2424 | 2424 | |
|
2425 | 2425 | Use --verbose to print the parsed tree. |
|
2426 | 2426 | """ |
|
2427 | 2427 | revs = None |
|
2428 | 2428 | if opts[r'rev']: |
|
2429 | 2429 | if repo is None: |
|
2430 | 2430 | raise error.RepoError(_('there is no Mercurial repository here ' |
|
2431 | 2431 | '(.hg not found)')) |
|
2432 | 2432 | revs = scmutil.revrange(repo, opts[r'rev']) |
|
2433 | 2433 | |
|
2434 | 2434 | props = {} |
|
2435 | 2435 | for d in opts[r'define']: |
|
2436 | 2436 | try: |
|
2437 | 2437 | k, v = (e.strip() for e in d.split('=', 1)) |
|
2438 | 2438 | if not k or k == 'ui': |
|
2439 | 2439 | raise ValueError |
|
2440 | 2440 | props[k] = v |
|
2441 | 2441 | except ValueError: |
|
2442 | 2442 | raise error.Abort(_('malformed keyword definition: %s') % d) |
|
2443 | 2443 | |
|
2444 | 2444 | if ui.verbose: |
|
2445 | 2445 | aliases = ui.configitems('templatealias') |
|
2446 | 2446 | tree = templater.parse(tmpl) |
|
2447 | 2447 | ui.note(templater.prettyformat(tree), '\n') |
|
2448 | 2448 | newtree = templater.expandaliases(tree, aliases) |
|
2449 | 2449 | if newtree != tree: |
|
2450 | 2450 | ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n') |
|
2451 | 2451 | |
|
2452 | 2452 | if revs is None: |
|
2453 | 2453 | tres = formatter.templateresources(ui, repo) |
|
2454 | 2454 | t = formatter.maketemplater(ui, tmpl, resources=tres) |
|
2455 | 2455 | ui.write(t.render(props)) |
|
2456 | 2456 | else: |
|
2457 | 2457 | displayer = logcmdutil.maketemplater(ui, repo, tmpl) |
|
2458 | 2458 | for r in revs: |
|
2459 | 2459 | displayer.show(repo[r], **pycompat.strkwargs(props)) |
|
2460 | 2460 | displayer.close() |
|
2461 | 2461 | |
|
2462 | 2462 | @command('debuguigetpass', [ |
|
2463 | 2463 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), |
|
2464 | 2464 | ], _('[-p TEXT]'), norepo=True) |
|
2465 | 2465 | def debuguigetpass(ui, prompt=''): |
|
2466 | 2466 | """show prompt to type password""" |
|
2467 | 2467 | r = ui.getpass(prompt) |
|
2468 | 2468 | ui.write(('respose: %s\n') % r) |
|
2469 | 2469 | |
|
2470 | 2470 | @command('debuguiprompt', [ |
|
2471 | 2471 | ('p', 'prompt', '', _('prompt text'), _('TEXT')), |
|
2472 | 2472 | ], _('[-p TEXT]'), norepo=True) |
|
2473 | 2473 | def debuguiprompt(ui, prompt=''): |
|
2474 | 2474 | """show plain prompt""" |
|
2475 | 2475 | r = ui.prompt(prompt) |
|
2476 | 2476 | ui.write(('response: %s\n') % r) |
|
2477 | 2477 | |
|
2478 | 2478 | @command('debugupdatecaches', []) |
|
2479 | 2479 | def debugupdatecaches(ui, repo, *pats, **opts): |
|
2480 | 2480 | """warm all known caches in the repository""" |
|
2481 | 2481 | with repo.wlock(), repo.lock(): |
|
2482 | 2482 | repo.updatecaches() |
|
2483 | 2483 | |
|
2484 | 2484 | @command('debugupgraderepo', [ |
|
2485 | 2485 | ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), |
|
2486 | 2486 | ('', 'run', False, _('performs an upgrade')), |
|
2487 | 2487 | ]) |
|
2488 | 2488 | def debugupgraderepo(ui, repo, run=False, optimize=None): |
|
2489 | 2489 | """upgrade a repository to use different features |
|
2490 | 2490 | |
|
2491 | 2491 | If no arguments are specified, the repository is evaluated for upgrade |
|
2492 | 2492 | and a list of problems and potential optimizations is printed. |
|
2493 | 2493 | |
|
2494 | 2494 | With ``--run``, a repository upgrade is performed. Behavior of the upgrade |
|
2495 | 2495 | can be influenced via additional arguments. More details will be provided |
|
2496 | 2496 | by the command output when run without ``--run``. |
|
2497 | 2497 | |
|
2498 | 2498 | During the upgrade, the repository will be locked and no writes will be |
|
2499 | 2499 | allowed. |
|
2500 | 2500 | |
|
2501 | 2501 | At the end of the upgrade, the repository may not be readable while new |
|
2502 | 2502 | repository data is swapped in. This window will be as long as it takes to |
|
2503 | 2503 | rename some directories inside the ``.hg`` directory. On most machines, this |
|
2504 | 2504 | should complete almost instantaneously and the chances of a consumer being |
|
2505 | 2505 | unable to access the repository should be low. |
|
2506 | 2506 | """ |
|
2507 | 2507 | return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize) |
|
2508 | 2508 | |
|
2509 | 2509 | @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'), |
|
2510 | 2510 | inferrepo=True) |
|
2511 | 2511 | def debugwalk(ui, repo, *pats, **opts): |
|
2512 | 2512 | """show how files match on given patterns""" |
|
2513 | 2513 | opts = pycompat.byteskwargs(opts) |
|
2514 | 2514 | m = scmutil.match(repo[None], pats, opts) |
|
2515 | 2515 | ui.write(('matcher: %r\n' % m)) |
|
2516 | 2516 | items = list(repo[None].walk(m)) |
|
2517 | 2517 | if not items: |
|
2518 | 2518 | return |
|
2519 | 2519 | f = lambda fn: fn |
|
2520 | 2520 | if ui.configbool('ui', 'slash') and pycompat.ossep != '/': |
|
2521 | 2521 | f = lambda fn: util.normpath(fn) |
|
2522 | 2522 | fmt = 'f %%-%ds %%-%ds %%s' % ( |
|
2523 | 2523 | max([len(abs) for abs in items]), |
|
2524 | 2524 | max([len(m.rel(abs)) for abs in items])) |
|
2525 | 2525 | for abs in items: |
|
2526 | 2526 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') |
|
2527 | 2527 | ui.write("%s\n" % line.rstrip()) |
|
2528 | 2528 | |
|
2529 | 2529 | @command('debugwireargs', |
|
2530 | 2530 | [('', 'three', '', 'three'), |
|
2531 | 2531 | ('', 'four', '', 'four'), |
|
2532 | 2532 | ('', 'five', '', 'five'), |
|
2533 | 2533 | ] + cmdutil.remoteopts, |
|
2534 | 2534 | _('REPO [OPTIONS]... [ONE [TWO]]'), |
|
2535 | 2535 | norepo=True) |
|
2536 | 2536 | def debugwireargs(ui, repopath, *vals, **opts): |
|
2537 | 2537 | opts = pycompat.byteskwargs(opts) |
|
2538 | 2538 | repo = hg.peer(ui, opts, repopath) |
|
2539 | 2539 | for opt in cmdutil.remoteopts: |
|
2540 | 2540 | del opts[opt[1]] |
|
2541 | 2541 | args = {} |
|
2542 | 2542 | for k, v in opts.iteritems(): |
|
2543 | 2543 | if v: |
|
2544 | 2544 | args[k] = v |
|
2545 | 2545 | args = pycompat.strkwargs(args) |
|
2546 | 2546 | # run twice to check that we don't mess up the stream for the next command |
|
2547 | 2547 | res1 = repo.debugwireargs(*vals, **args) |
|
2548 | 2548 | res2 = repo.debugwireargs(*vals, **args) |
|
2549 | 2549 | ui.write("%s\n" % res1) |
|
2550 | 2550 | if res1 != res2: |
|
2551 | 2551 | ui.warn("%s\n" % res2) |
|
2552 | 2552 | |
|
2553 | 2553 | def _parsewirelangblocks(fh): |
|
2554 | 2554 | activeaction = None |
|
2555 | 2555 | blocklines = [] |
|
2556 | 2556 | |
|
2557 | 2557 | for line in fh: |
|
2558 | 2558 | line = line.rstrip() |
|
2559 | 2559 | if not line: |
|
2560 | 2560 | continue |
|
2561 | 2561 | |
|
2562 | 2562 | if line.startswith(b'#'): |
|
2563 | 2563 | continue |
|
2564 | 2564 | |
|
2565 | 2565 | if not line.startswith(' '): |
|
2566 | 2566 | # New block. Flush previous one. |
|
2567 | 2567 | if activeaction: |
|
2568 | 2568 | yield activeaction, blocklines |
|
2569 | 2569 | |
|
2570 | 2570 | activeaction = line |
|
2571 | 2571 | blocklines = [] |
|
2572 | 2572 | continue |
|
2573 | 2573 | |
|
2574 | 2574 | # Else we start with an indent. |
|
2575 | 2575 | |
|
2576 | 2576 | if not activeaction: |
|
2577 | 2577 | raise error.Abort(_('indented line outside of block')) |
|
2578 | 2578 | |
|
2579 | 2579 | blocklines.append(line) |
|
2580 | 2580 | |
|
2581 | 2581 | # Flush last block. |
|
2582 | 2582 | if activeaction: |
|
2583 | 2583 | yield activeaction, blocklines |
|
2584 | 2584 | |
|
2585 | 2585 | @command('debugwireproto', |
|
2586 | 2586 | [ |
|
2587 | 2587 | ('', 'localssh', False, _('start an SSH server for this repo')), |
|
2588 | 2588 | ('', 'peer', '', _('construct a specific version of the peer')), |
|
2589 | 2589 | ('', 'noreadstderr', False, _('do not read from stderr of the remote')), |
|
2590 | 2590 | ] + cmdutil.remoteopts, |
|
2591 | 2591 | _('[REPO]'), |
|
2592 | 2592 | optionalrepo=True) |
|
2593 | 2593 | def debugwireproto(ui, repo, **opts): |
|
2594 | 2594 | """send wire protocol commands to a server |
|
2595 | 2595 | |
|
2596 | 2596 | This command can be used to issue wire protocol commands to remote |
|
2597 | 2597 | peers and to debug the raw data being exchanged. |
|
2598 | 2598 | |
|
2599 | 2599 | ``--localssh`` will start an SSH server against the current repository |
|
2600 | 2600 | and connect to that. By default, the connection will perform a handshake |
|
2601 | 2601 | and establish an appropriate peer instance. |
|
2602 | 2602 | |
|
2603 | 2603 | ``--peer`` can be used to bypass the handshake protocol and construct a |
|
2604 | 2604 | peer instance using the specified class type. Valid values are ``raw``, |
|
2605 | 2605 | ``ssh1``, and ``ssh2``. ``raw`` instances only allow sending raw data |
|
2606 | 2606 | payloads and don't support higher-level command actions. |
|
2607 | 2607 | |
|
2608 | 2608 | ``--noreadstderr`` can be used to disable automatic reading from stderr |
|
2609 | 2609 | of the peer (for SSH connections only). Disabling automatic reading of |
|
2610 | 2610 | stderr is useful for making output more deterministic. |
|
2611 | 2611 | |
|
2612 | 2612 | Commands are issued via a mini language which is specified via stdin. |
|
2613 | 2613 | The language consists of individual actions to perform. An action is |
|
2614 | 2614 | defined by a block. A block is defined as a line with no leading |
|
2615 | 2615 | space followed by 0 or more lines with leading space. Blocks are |
|
2616 | 2616 | effectively a high-level command with additional metadata. |
|
2617 | 2617 | |
|
2618 | 2618 | Lines beginning with ``#`` are ignored. |
|
2619 | 2619 | |
|
2620 | 2620 | The following sections denote available actions. |
|
2621 | 2621 | |
|
2622 | 2622 | raw |
|
2623 | 2623 | --- |
|
2624 | 2624 | |
|
2625 | 2625 | Send raw data to the server. |
|
2626 | 2626 | |
|
2627 | 2627 | The block payload contains the raw data to send as one atomic send |
|
2628 | 2628 | operation. The data may not actually be delivered in a single system |
|
2629 | 2629 | call: it depends on the abilities of the transport being used. |
|
2630 | 2630 | |
|
2631 | 2631 | Each line in the block is de-indented and concatenated. Then, that |
|
2632 | 2632 | value is evaluated as a Python b'' literal. This allows the use of |
|
2633 | 2633 | backslash escaping, etc. |
|
2634 | 2634 | |
|
2635 | 2635 | raw+ |
|
2636 | 2636 | ---- |
|
2637 | 2637 | |
|
2638 | 2638 | Behaves like ``raw`` except flushes output afterwards. |
|
2639 | 2639 | |
|
2640 | 2640 | command <X> |
|
2641 | 2641 | ----------- |
|
2642 | 2642 | |
|
2643 | 2643 | Send a request to run a named command, whose name follows the ``command`` |
|
2644 | 2644 | string. |
|
2645 | 2645 | |
|
2646 | 2646 | Arguments to the command are defined as lines in this block. The format of |
|
2647 | 2647 | each line is ``<key> <value>``. e.g.:: |
|
2648 | 2648 | |
|
2649 | 2649 | command listkeys |
|
2650 | 2650 | namespace bookmarks |
|
2651 | 2651 | |
|
2652 | 2652 | Values are interpreted as Python b'' literals. This allows encoding |
|
2653 | 2653 | special byte sequences via backslash escaping. |
|
2654 | 2654 | |
|
2655 | 2655 | The following arguments have special meaning: |
|
2656 | 2656 | |
|
2657 | 2657 | ``PUSHFILE`` |
|
2658 | 2658 | When defined, the *push* mechanism of the peer will be used instead |
|
2659 | 2659 | of the static request-response mechanism and the content of the |
|
2660 | 2660 | file specified in the value of this argument will be sent as the |
|
2661 | 2661 | command payload. |
|
2662 | 2662 | |
|
2663 | 2663 | This can be used to submit a local bundle file to the remote. |
|
2664 | 2664 | |
|
2665 | 2665 | batchbegin |
|
2666 | 2666 | ---------- |
|
2667 | 2667 | |
|
2668 | 2668 | Instruct the peer to begin a batched send. |
|
2669 | 2669 | |
|
2670 | 2670 | All ``command`` blocks are queued for execution until the next |
|
2671 | 2671 | ``batchsubmit`` block. |
|
2672 | 2672 | |
|
2673 | 2673 | batchsubmit |
|
2674 | 2674 | ----------- |
|
2675 | 2675 | |
|
2676 | 2676 | Submit previously queued ``command`` blocks as a batch request. |
|
2677 | 2677 | |
|
2678 | 2678 | This action MUST be paired with a ``batchbegin`` action. |
|
2679 | 2679 | |
|
2680 | 2680 | close |
|
2681 | 2681 | ----- |
|
2682 | 2682 | |
|
2683 | 2683 | Close the connection to the server. |
|
2684 | 2684 | |
|
2685 | 2685 | flush |
|
2686 | 2686 | ----- |
|
2687 | 2687 | |
|
2688 | 2688 | Flush data written to the server. |
|
2689 | 2689 | |
|
2690 | 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 | 2696 | If the connection to the server encompasses multiple pipes, we poll both |
|
2696 | 2697 | pipes and read available data. |
|
2697 | 2698 | |
|
2698 | 2699 | readline |
|
2699 | 2700 | -------- |
|
2700 | 2701 | |
|
2701 | 2702 | Read a line of output from the server. If there are multiple output |
|
2702 | 2703 | pipes, reads only the main pipe. |
|
2703 | 2704 | """ |
|
2704 | 2705 | opts = pycompat.byteskwargs(opts) |
|
2705 | 2706 | |
|
2706 | 2707 | if opts['localssh'] and not repo: |
|
2707 | 2708 | raise error.Abort(_('--localssh requires a repository')) |
|
2708 | 2709 | |
|
2709 | 2710 | if opts['peer'] and opts['peer'] not in ('raw', 'ssh1', 'ssh2'): |
|
2710 | 2711 | raise error.Abort(_('invalid value for --peer'), |
|
2711 | 2712 | hint=_('valid values are "raw", "ssh1", and "ssh2"')) |
|
2712 | 2713 | |
|
2713 | 2714 | if ui.interactive(): |
|
2714 | 2715 | ui.write(_('(waiting for commands on stdin)\n')) |
|
2715 | 2716 | |
|
2716 | 2717 | blocks = list(_parsewirelangblocks(ui.fin)) |
|
2717 | 2718 | |
|
2718 | 2719 | proc = None |
|
2719 | 2720 | |
|
2720 | 2721 | if opts['localssh']: |
|
2721 | 2722 | # We start the SSH server in its own process so there is process |
|
2722 | 2723 | # separation. This prevents a whole class of potential bugs around |
|
2723 | 2724 | # shared state from interfering with server operation. |
|
2724 | 2725 | args = util.hgcmd() + [ |
|
2725 | 2726 | '-R', repo.root, |
|
2726 | 2727 | 'debugserve', '--sshstdio', |
|
2727 | 2728 | ] |
|
2728 | 2729 | proc = subprocess.Popen(args, stdin=subprocess.PIPE, |
|
2729 | 2730 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
|
2730 | 2731 | bufsize=0) |
|
2731 | 2732 | |
|
2732 | 2733 | stdin = proc.stdin |
|
2733 | 2734 | stdout = proc.stdout |
|
2734 | 2735 | stderr = proc.stderr |
|
2735 | 2736 | |
|
2736 | 2737 | # We turn the pipes into observers so we can log I/O. |
|
2737 | 2738 | if ui.verbose or opts['peer'] == 'raw': |
|
2738 | 2739 | stdin = util.makeloggingfileobject(ui, proc.stdin, b'i', |
|
2739 | 2740 | logdata=True) |
|
2740 | 2741 | stdout = util.makeloggingfileobject(ui, proc.stdout, b'o', |
|
2741 | 2742 | logdata=True) |
|
2742 | 2743 | stderr = util.makeloggingfileobject(ui, proc.stderr, b'e', |
|
2743 | 2744 | logdata=True) |
|
2744 | 2745 | |
|
2745 | 2746 | # --localssh also implies the peer connection settings. |
|
2746 | 2747 | |
|
2747 | 2748 | url = 'ssh://localserver' |
|
2748 | 2749 | autoreadstderr = not opts['noreadstderr'] |
|
2749 | 2750 | |
|
2750 | 2751 | if opts['peer'] == 'ssh1': |
|
2751 | 2752 | ui.write(_('creating ssh peer for wire protocol version 1\n')) |
|
2752 | 2753 | peer = sshpeer.sshv1peer(ui, url, proc, stdin, stdout, stderr, |
|
2753 | 2754 | None, autoreadstderr=autoreadstderr) |
|
2754 | 2755 | elif opts['peer'] == 'ssh2': |
|
2755 | 2756 | ui.write(_('creating ssh peer for wire protocol version 2\n')) |
|
2756 | 2757 | peer = sshpeer.sshv2peer(ui, url, proc, stdin, stdout, stderr, |
|
2757 | 2758 | None, autoreadstderr=autoreadstderr) |
|
2758 | 2759 | elif opts['peer'] == 'raw': |
|
2759 | 2760 | ui.write(_('using raw connection to peer\n')) |
|
2760 | 2761 | peer = None |
|
2761 | 2762 | else: |
|
2762 | 2763 | ui.write(_('creating ssh peer from handshake results\n')) |
|
2763 | 2764 | peer = sshpeer.makepeer(ui, url, proc, stdin, stdout, stderr, |
|
2764 | 2765 | autoreadstderr=autoreadstderr) |
|
2765 | 2766 | |
|
2766 | 2767 | else: |
|
2767 | 2768 | raise error.Abort(_('only --localssh is currently supported')) |
|
2768 | 2769 | |
|
2769 | 2770 | batchedcommands = None |
|
2770 | 2771 | |
|
2771 | 2772 | # Now perform actions based on the parsed wire language instructions. |
|
2772 | 2773 | for action, lines in blocks: |
|
2773 | 2774 | if action in ('raw', 'raw+'): |
|
2774 | 2775 | # Concatenate the data together. |
|
2775 | 2776 | data = ''.join(l.lstrip() for l in lines) |
|
2776 | 2777 | data = util.unescapestr(data) |
|
2777 | 2778 | stdin.write(data) |
|
2778 | 2779 | |
|
2779 | 2780 | if action == 'raw+': |
|
2780 | 2781 | stdin.flush() |
|
2781 | 2782 | elif action == 'flush': |
|
2782 | 2783 | stdin.flush() |
|
2783 | 2784 | elif action.startswith('command'): |
|
2784 | 2785 | if not peer: |
|
2785 | 2786 | raise error.Abort(_('cannot send commands unless peer instance ' |
|
2786 | 2787 | 'is available')) |
|
2787 | 2788 | |
|
2788 | 2789 | command = action.split(' ', 1)[1] |
|
2789 | 2790 | |
|
2790 | 2791 | args = {} |
|
2791 | 2792 | for line in lines: |
|
2792 | 2793 | # We need to allow empty values. |
|
2793 | 2794 | fields = line.lstrip().split(' ', 1) |
|
2794 | 2795 | if len(fields) == 1: |
|
2795 | 2796 | key = fields[0] |
|
2796 | 2797 | value = '' |
|
2797 | 2798 | else: |
|
2798 | 2799 | key, value = fields |
|
2799 | 2800 | |
|
2800 | 2801 | args[key] = util.unescapestr(value) |
|
2801 | 2802 | |
|
2802 | 2803 | if batchedcommands is not None: |
|
2803 | 2804 | batchedcommands.append((command, args)) |
|
2804 | 2805 | continue |
|
2805 | 2806 | |
|
2806 | 2807 | ui.status(_('sending %s command\n') % command) |
|
2807 | 2808 | |
|
2808 | 2809 | if 'PUSHFILE' in args: |
|
2809 | 2810 | with open(args['PUSHFILE'], r'rb') as fh: |
|
2810 | 2811 | del args['PUSHFILE'] |
|
2811 | 2812 | res, output = peer._callpush(command, fh, |
|
2812 | 2813 | **pycompat.strkwargs(args)) |
|
2813 | 2814 | ui.status(_('result: %s\n') % util.escapedata(res)) |
|
2814 | 2815 | ui.status(_('remote output: %s\n') % |
|
2815 | 2816 | util.escapedata(output)) |
|
2816 | 2817 | else: |
|
2817 | 2818 | res = peer._call(command, **pycompat.strkwargs(args)) |
|
2818 | 2819 | ui.status(_('response: %s\n') % util.escapedata(res)) |
|
2819 | 2820 | |
|
2820 | 2821 | elif action == 'batchbegin': |
|
2821 | 2822 | if batchedcommands is not None: |
|
2822 | 2823 | raise error.Abort(_('nested batchbegin not allowed')) |
|
2823 | 2824 | |
|
2824 | 2825 | batchedcommands = [] |
|
2825 | 2826 | elif action == 'batchsubmit': |
|
2826 | 2827 | # There is a batching API we could go through. But it would be |
|
2827 | 2828 | # difficult to normalize requests into function calls. It is easier |
|
2828 | 2829 | # to bypass this layer and normalize to commands + args. |
|
2829 | 2830 | ui.status(_('sending batch with %d sub-commands\n') % |
|
2830 | 2831 | len(batchedcommands)) |
|
2831 | 2832 | for i, chunk in enumerate(peer._submitbatch(batchedcommands)): |
|
2832 | 2833 | ui.status(_('response #%d: %s\n') % (i, util.escapedata(chunk))) |
|
2833 | 2834 | |
|
2834 | 2835 | batchedcommands = None |
|
2835 | 2836 | elif action == 'close': |
|
2836 | 2837 | peer.close() |
|
2837 | 2838 | elif action == 'readavailable': |
|
2838 | fds = [stdout.fileno(), stderr.fileno()] | |
|
2839 |
|
|
|
2840 | act = util.poll(fds) | |
|
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) | |
|
2839 | stdin.close() | |
|
2840 | stdout.read() | |
|
2841 | stderr.read() | |
|
2849 | 2842 | elif action == 'readline': |
|
2850 | 2843 | stdout.readline() |
|
2851 | 2844 | else: |
|
2852 | 2845 | raise error.Abort(_('unknown action: %s') % action) |
|
2853 | 2846 | |
|
2854 | 2847 | if batchedcommands is not None: |
|
2855 | 2848 | raise error.Abort(_('unclosed "batchbegin" request')) |
|
2856 | 2849 | |
|
2857 | 2850 | if peer: |
|
2858 | 2851 | peer.close() |
|
2859 | 2852 | |
|
2860 | 2853 | if proc: |
|
2861 | 2854 | proc.kill() |
@@ -1,2034 +1,2064 b'' | |||
|
1 | 1 | $ cat > hgrc-sshv2 << EOF |
|
2 | 2 | > %include $HGRCPATH |
|
3 | 3 | > [experimental] |
|
4 | 4 | > sshpeer.advertise-v2 = true |
|
5 | 5 | > sshserver.support-v2 = true |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ debugwireproto() { |
|
9 | 9 | > commands=`cat -` |
|
10 | 10 | > echo 'testing ssh1' |
|
11 | 11 | > tip=`hg log -r tip -T '{node}'` |
|
12 | 12 | > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr |
|
13 | 13 | > if [ -n "$1" ]; then |
|
14 | 14 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" |
|
15 | 15 | > fi |
|
16 | 16 | > echo "" |
|
17 | 17 | > echo 'testing ssh2' |
|
18 | 18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr |
|
19 | 19 | > if [ -n "$1" ]; then |
|
20 | 20 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" |
|
21 | 21 | > fi |
|
22 | 22 | > } |
|
23 | 23 | |
|
24 | 24 | Generate some bundle files |
|
25 | 25 | |
|
26 | 26 | $ hg init repo |
|
27 | 27 | $ cd repo |
|
28 | 28 | $ echo 0 > foo |
|
29 | 29 | $ hg -q commit -A -m initial |
|
30 | 30 | $ hg bundle --all -t none-v1 ../initial.v1.hg |
|
31 | 31 | 1 changesets found |
|
32 | 32 | $ cd .. |
|
33 | 33 | |
|
34 | 34 | Test pushing bundle1 payload to a server with bundle1 disabled |
|
35 | 35 | |
|
36 | 36 | $ hg init no-bundle1 |
|
37 | 37 | $ cd no-bundle1 |
|
38 | 38 | $ cat > .hg/hgrc << EOF |
|
39 | 39 | > [server] |
|
40 | 40 | > bundle1 = false |
|
41 | 41 | > EOF |
|
42 | 42 | |
|
43 | 43 | $ debugwireproto << EOF |
|
44 | 44 | > command unbundle |
|
45 | 45 | > # This is "force" in hex. |
|
46 | 46 | > heads 666f726365 |
|
47 | 47 | > PUSHFILE ../initial.v1.hg |
|
48 | 48 | > readavailable |
|
49 | 49 | > EOF |
|
50 | 50 | testing ssh1 |
|
51 | 51 | creating ssh peer from handshake results |
|
52 | 52 | i> write(104) -> 104: |
|
53 | 53 | i> hello\n |
|
54 | 54 | i> between\n |
|
55 | 55 | i> pairs 81\n |
|
56 | 56 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
57 | 57 | i> flush() -> None |
|
58 | 58 | o> readline() -> 4: |
|
59 | 59 | o> 384\n |
|
60 | 60 | o> readline() -> 384: |
|
61 | 61 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
62 | 62 | o> readline() -> 2: |
|
63 | 63 | o> 1\n |
|
64 | 64 | o> readline() -> 1: |
|
65 | 65 | o> \n |
|
66 | 66 | sending unbundle command |
|
67 | 67 | i> write(9) -> 9: |
|
68 | 68 | i> unbundle\n |
|
69 | 69 | i> write(9) -> 9: |
|
70 | 70 | i> heads 10\n |
|
71 | 71 | i> write(10) -> 10: 666f726365 |
|
72 | 72 | i> flush() -> None |
|
73 | 73 | o> readline() -> 2: |
|
74 | 74 | o> 0\n |
|
75 | 75 | i> write(4) -> 4: |
|
76 | 76 | i> 426\n |
|
77 | 77 | i> write(426) -> 426: |
|
78 | 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 | 79 | i> test\n |
|
80 | 80 | i> 0 0\n |
|
81 | 81 | i> foo\n |
|
82 | 82 | i> \n |
|
83 | 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 | 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 | 85 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
86 | 86 | i> write(2) -> 2: |
|
87 | 87 | i> 0\n |
|
88 | 88 | i> flush() -> None |
|
89 | 89 | o> readline() -> 2: |
|
90 | 90 | o> 0\n |
|
91 | 91 | o> readline() -> 2: |
|
92 | 92 | o> 1\n |
|
93 | 93 | o> read(1) -> 1: 0 |
|
94 | 94 | result: 0 |
|
95 | 95 | remote output: |
|
96 | o> read(-1) -> 0: | |
|
96 | 97 | e> read(-1) -> 115: |
|
97 | 98 | e> abort: incompatible Mercurial client; bundle2 required\n |
|
98 | 99 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n |
|
99 | 100 | |
|
100 | 101 | testing ssh2 |
|
101 | 102 | creating ssh peer from handshake results |
|
102 | 103 | i> write(171) -> 171: |
|
103 | 104 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
104 | 105 | i> hello\n |
|
105 | 106 | i> between\n |
|
106 | 107 | i> pairs 81\n |
|
107 | 108 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
108 | 109 | i> flush() -> None |
|
109 | 110 | o> readline() -> 62: |
|
110 | 111 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
111 | 112 | o> readline() -> 4: |
|
112 | 113 | o> 383\n |
|
113 | 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 | 115 | o> read(1) -> 1: |
|
115 | 116 | o> \n |
|
116 | 117 | sending unbundle command |
|
117 | 118 | i> write(9) -> 9: |
|
118 | 119 | i> unbundle\n |
|
119 | 120 | i> write(9) -> 9: |
|
120 | 121 | i> heads 10\n |
|
121 | 122 | i> write(10) -> 10: 666f726365 |
|
122 | 123 | i> flush() -> None |
|
123 | 124 | o> readline() -> 2: |
|
124 | 125 | o> 0\n |
|
125 | 126 | i> write(4) -> 4: |
|
126 | 127 | i> 426\n |
|
127 | 128 | i> write(426) -> 426: |
|
128 | 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 | 130 | i> test\n |
|
130 | 131 | i> 0 0\n |
|
131 | 132 | i> foo\n |
|
132 | 133 | i> \n |
|
133 | 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 | 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 | 136 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
136 | 137 | i> write(2) -> 2: |
|
137 | 138 | i> 0\n |
|
138 | 139 | i> flush() -> None |
|
139 | 140 | o> readline() -> 2: |
|
140 | 141 | o> 0\n |
|
141 | 142 | o> readline() -> 2: |
|
142 | 143 | o> 1\n |
|
143 | 144 | o> read(1) -> 1: 0 |
|
144 | 145 | result: 0 |
|
145 | 146 | remote output: |
|
147 | o> read(-1) -> 0: | |
|
146 | 148 | e> read(-1) -> 115: |
|
147 | 149 | e> abort: incompatible Mercurial client; bundle2 required\n |
|
148 | 150 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n |
|
149 | 151 | |
|
150 | 152 | $ cd .. |
|
151 | 153 | |
|
152 | 154 | Create a pretxnchangegroup hook that fails. Give it multiple modes of printing |
|
153 | 155 | output so we can test I/O capture and behavior. |
|
154 | 156 | |
|
155 | 157 | Test pushing to a server that has a pretxnchangegroup Python hook that fails |
|
156 | 158 | |
|
157 | 159 | $ cat > $TESTTMP/failhook << EOF |
|
158 | 160 | > from __future__ import print_function |
|
159 | 161 | > import sys |
|
160 | 162 | > def hook1line(ui, repo, **kwargs): |
|
161 | 163 | > ui.write(b'ui.write 1 line\n') |
|
162 | 164 | > return 1 |
|
163 | 165 | > def hook2lines(ui, repo, **kwargs): |
|
164 | 166 | > ui.write(b'ui.write 2 lines 1\n') |
|
165 | 167 | > ui.write(b'ui.write 2 lines 2\n') |
|
166 | 168 | > return 1 |
|
167 | 169 | > def hook1lineflush(ui, repo, **kwargs): |
|
168 | 170 | > ui.write(b'ui.write 1 line flush\n') |
|
169 | 171 | > ui.flush() |
|
170 | 172 | > return 1 |
|
171 | 173 | > def hookmultiflush(ui, repo, **kwargs): |
|
172 | 174 | > ui.write(b'ui.write 1st\n') |
|
173 | 175 | > ui.flush() |
|
174 | 176 | > ui.write(b'ui.write 2nd\n') |
|
175 | 177 | > ui.flush() |
|
176 | 178 | > return 1 |
|
177 | 179 | > def hookwriteandwriteerr(ui, repo, **kwargs): |
|
178 | 180 | > ui.write(b'ui.write 1\n') |
|
179 | 181 | > ui.write_err(b'ui.write_err 1\n') |
|
180 | 182 | > ui.write(b'ui.write 2\n') |
|
181 | 183 | > ui.write_err(b'ui.write_err 2\n') |
|
182 | 184 | > return 1 |
|
183 | 185 | > def hookprintstdout(ui, repo, **kwargs): |
|
184 | 186 | > print('printed line') |
|
185 | 187 | > return 1 |
|
186 | 188 | > def hookprintandwrite(ui, repo, **kwargs): |
|
187 | 189 | > print('print 1') |
|
188 | 190 | > ui.write(b'ui.write 1\n') |
|
189 | 191 | > print('print 2') |
|
190 | 192 | > ui.write(b'ui.write 2\n') |
|
191 | 193 | > return 1 |
|
192 | 194 | > def hookprintstderrandstdout(ui, repo, **kwargs): |
|
193 | 195 | > print('stdout 1') |
|
194 | 196 | > print('stderr 1', file=sys.stderr) |
|
195 | 197 | > print('stdout 2') |
|
196 | 198 | > print('stderr 2', file=sys.stderr) |
|
197 | 199 | > return 1 |
|
198 | 200 | > EOF |
|
199 | 201 | |
|
200 | 202 | $ hg init failrepo |
|
201 | 203 | $ cd failrepo |
|
202 | 204 | |
|
203 | 205 | ui.write() in hook is redirected to stderr |
|
204 | 206 | |
|
205 | 207 | $ cat > .hg/hgrc << EOF |
|
206 | 208 | > [hooks] |
|
207 | 209 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line |
|
208 | 210 | > EOF |
|
209 | 211 | |
|
210 | 212 | $ debugwireproto << EOF |
|
211 | 213 | > command unbundle |
|
212 | 214 | > # This is "force" in hex. |
|
213 | 215 | > heads 666f726365 |
|
214 | 216 | > PUSHFILE ../initial.v1.hg |
|
215 | 217 | > readavailable |
|
216 | 218 | > EOF |
|
217 | 219 | testing ssh1 |
|
218 | 220 | creating ssh peer from handshake results |
|
219 | 221 | i> write(104) -> 104: |
|
220 | 222 | i> hello\n |
|
221 | 223 | i> between\n |
|
222 | 224 | i> pairs 81\n |
|
223 | 225 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
224 | 226 | i> flush() -> None |
|
225 | 227 | o> readline() -> 4: |
|
226 | 228 | o> 384\n |
|
227 | 229 | o> readline() -> 384: |
|
228 | 230 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
229 | 231 | o> readline() -> 2: |
|
230 | 232 | o> 1\n |
|
231 | 233 | o> readline() -> 1: |
|
232 | 234 | o> \n |
|
233 | 235 | sending unbundle command |
|
234 | 236 | i> write(9) -> 9: |
|
235 | 237 | i> unbundle\n |
|
236 | 238 | i> write(9) -> 9: |
|
237 | 239 | i> heads 10\n |
|
238 | 240 | i> write(10) -> 10: 666f726365 |
|
239 | 241 | i> flush() -> None |
|
240 | 242 | o> readline() -> 2: |
|
241 | 243 | o> 0\n |
|
242 | 244 | i> write(4) -> 4: |
|
243 | 245 | i> 426\n |
|
244 | 246 | i> write(426) -> 426: |
|
245 | 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 | 248 | i> test\n |
|
247 | 249 | i> 0 0\n |
|
248 | 250 | i> foo\n |
|
249 | 251 | i> \n |
|
250 | 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 | 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 | 254 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
253 | 255 | i> write(2) -> 2: |
|
254 | 256 | i> 0\n |
|
255 | 257 | i> flush() -> None |
|
256 | 258 | o> readline() -> 2: |
|
257 | 259 | o> 0\n |
|
258 | 260 | o> readline() -> 2: |
|
259 | 261 | o> 1\n |
|
260 | 262 | o> read(1) -> 1: 0 |
|
261 | 263 | result: 0 |
|
262 | 264 | remote output: |
|
265 | o> read(-1) -> 0: | |
|
263 | 266 | e> read(-1) -> 196: |
|
264 | 267 | e> adding changesets\n |
|
265 | 268 | e> adding manifests\n |
|
266 | 269 | e> adding file changes\n |
|
267 | 270 | e> added 1 changesets with 1 changes to 1 files\n |
|
268 | 271 | e> ui.write 1 line\n |
|
269 | 272 | e> transaction abort!\n |
|
270 | 273 | e> rollback completed\n |
|
271 | 274 | e> abort: pretxnchangegroup.fail hook failed\n |
|
272 | 275 | |
|
273 | 276 | testing ssh2 |
|
274 | 277 | creating ssh peer from handshake results |
|
275 | 278 | i> write(171) -> 171: |
|
276 | 279 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
277 | 280 | i> hello\n |
|
278 | 281 | i> between\n |
|
279 | 282 | i> pairs 81\n |
|
280 | 283 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
281 | 284 | i> flush() -> None |
|
282 | 285 | o> readline() -> 62: |
|
283 | 286 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
284 | 287 | o> readline() -> 4: |
|
285 | 288 | o> 383\n |
|
286 | 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 | 290 | o> read(1) -> 1: |
|
288 | 291 | o> \n |
|
289 | 292 | sending unbundle command |
|
290 | 293 | i> write(9) -> 9: |
|
291 | 294 | i> unbundle\n |
|
292 | 295 | i> write(9) -> 9: |
|
293 | 296 | i> heads 10\n |
|
294 | 297 | i> write(10) -> 10: 666f726365 |
|
295 | 298 | i> flush() -> None |
|
296 | 299 | o> readline() -> 2: |
|
297 | 300 | o> 0\n |
|
298 | 301 | i> write(4) -> 4: |
|
299 | 302 | i> 426\n |
|
300 | 303 | i> write(426) -> 426: |
|
301 | 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 | 305 | i> test\n |
|
303 | 306 | i> 0 0\n |
|
304 | 307 | i> foo\n |
|
305 | 308 | i> \n |
|
306 | 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 | 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 | 311 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
309 | 312 | i> write(2) -> 2: |
|
310 | 313 | i> 0\n |
|
311 | 314 | i> flush() -> None |
|
312 | 315 | o> readline() -> 2: |
|
313 | 316 | o> 0\n |
|
314 | 317 | o> readline() -> 2: |
|
315 | 318 | o> 1\n |
|
316 | 319 | o> read(1) -> 1: 0 |
|
317 | 320 | result: 0 |
|
318 | 321 | remote output: |
|
322 | o> read(-1) -> 0: | |
|
319 | 323 | e> read(-1) -> 196: |
|
320 | 324 | e> adding changesets\n |
|
321 | 325 | e> adding manifests\n |
|
322 | 326 | e> adding file changes\n |
|
323 | 327 | e> added 1 changesets with 1 changes to 1 files\n |
|
324 | 328 | e> ui.write 1 line\n |
|
325 | 329 | e> transaction abort!\n |
|
326 | 330 | e> rollback completed\n |
|
327 | 331 | e> abort: pretxnchangegroup.fail hook failed\n |
|
328 | 332 | |
|
329 | 333 | And a variation that writes multiple lines using ui.write |
|
330 | 334 | |
|
331 | 335 | $ cat > .hg/hgrc << EOF |
|
332 | 336 | > [hooks] |
|
333 | 337 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines |
|
334 | 338 | > EOF |
|
335 | 339 | |
|
336 | 340 | $ debugwireproto << EOF |
|
337 | 341 | > command unbundle |
|
338 | 342 | > # This is "force" in hex. |
|
339 | 343 | > heads 666f726365 |
|
340 | 344 | > PUSHFILE ../initial.v1.hg |
|
341 | 345 | > readavailable |
|
342 | 346 | > EOF |
|
343 | 347 | testing ssh1 |
|
344 | 348 | creating ssh peer from handshake results |
|
345 | 349 | i> write(104) -> 104: |
|
346 | 350 | i> hello\n |
|
347 | 351 | i> between\n |
|
348 | 352 | i> pairs 81\n |
|
349 | 353 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
350 | 354 | i> flush() -> None |
|
351 | 355 | o> readline() -> 4: |
|
352 | 356 | o> 384\n |
|
353 | 357 | o> readline() -> 384: |
|
354 | 358 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
355 | 359 | o> readline() -> 2: |
|
356 | 360 | o> 1\n |
|
357 | 361 | o> readline() -> 1: |
|
358 | 362 | o> \n |
|
359 | 363 | sending unbundle command |
|
360 | 364 | i> write(9) -> 9: |
|
361 | 365 | i> unbundle\n |
|
362 | 366 | i> write(9) -> 9: |
|
363 | 367 | i> heads 10\n |
|
364 | 368 | i> write(10) -> 10: 666f726365 |
|
365 | 369 | i> flush() -> None |
|
366 | 370 | o> readline() -> 2: |
|
367 | 371 | o> 0\n |
|
368 | 372 | i> write(4) -> 4: |
|
369 | 373 | i> 426\n |
|
370 | 374 | i> write(426) -> 426: |
|
371 | 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 | 376 | i> test\n |
|
373 | 377 | i> 0 0\n |
|
374 | 378 | i> foo\n |
|
375 | 379 | i> \n |
|
376 | 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 | 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 | 382 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
379 | 383 | i> write(2) -> 2: |
|
380 | 384 | i> 0\n |
|
381 | 385 | i> flush() -> None |
|
382 | 386 | o> readline() -> 2: |
|
383 | 387 | o> 0\n |
|
384 | 388 | o> readline() -> 2: |
|
385 | 389 | o> 1\n |
|
386 | 390 | o> read(1) -> 1: 0 |
|
387 | 391 | result: 0 |
|
388 | 392 | remote output: |
|
393 | o> read(-1) -> 0: | |
|
389 | 394 | e> read(-1) -> 218: |
|
390 | 395 | e> adding changesets\n |
|
391 | 396 | e> adding manifests\n |
|
392 | 397 | e> adding file changes\n |
|
393 | 398 | e> added 1 changesets with 1 changes to 1 files\n |
|
394 | 399 | e> ui.write 2 lines 1\n |
|
395 | 400 | e> ui.write 2 lines 2\n |
|
396 | 401 | e> transaction abort!\n |
|
397 | 402 | e> rollback completed\n |
|
398 | 403 | e> abort: pretxnchangegroup.fail hook failed\n |
|
399 | 404 | |
|
400 | 405 | testing ssh2 |
|
401 | 406 | creating ssh peer from handshake results |
|
402 | 407 | i> write(171) -> 171: |
|
403 | 408 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
404 | 409 | i> hello\n |
|
405 | 410 | i> between\n |
|
406 | 411 | i> pairs 81\n |
|
407 | 412 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
408 | 413 | i> flush() -> None |
|
409 | 414 | o> readline() -> 62: |
|
410 | 415 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
411 | 416 | o> readline() -> 4: |
|
412 | 417 | o> 383\n |
|
413 | 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 | 419 | o> read(1) -> 1: |
|
415 | 420 | o> \n |
|
416 | 421 | sending unbundle command |
|
417 | 422 | i> write(9) -> 9: |
|
418 | 423 | i> unbundle\n |
|
419 | 424 | i> write(9) -> 9: |
|
420 | 425 | i> heads 10\n |
|
421 | 426 | i> write(10) -> 10: 666f726365 |
|
422 | 427 | i> flush() -> None |
|
423 | 428 | o> readline() -> 2: |
|
424 | 429 | o> 0\n |
|
425 | 430 | i> write(4) -> 4: |
|
426 | 431 | i> 426\n |
|
427 | 432 | i> write(426) -> 426: |
|
428 | 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 | 434 | i> test\n |
|
430 | 435 | i> 0 0\n |
|
431 | 436 | i> foo\n |
|
432 | 437 | i> \n |
|
433 | 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 | 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 | 440 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
436 | 441 | i> write(2) -> 2: |
|
437 | 442 | i> 0\n |
|
438 | 443 | i> flush() -> None |
|
439 | 444 | o> readline() -> 2: |
|
440 | 445 | o> 0\n |
|
441 | 446 | o> readline() -> 2: |
|
442 | 447 | o> 1\n |
|
443 | 448 | o> read(1) -> 1: 0 |
|
444 | 449 | result: 0 |
|
445 | 450 | remote output: |
|
451 | o> read(-1) -> 0: | |
|
446 | 452 | e> read(-1) -> 218: |
|
447 | 453 | e> adding changesets\n |
|
448 | 454 | e> adding manifests\n |
|
449 | 455 | e> adding file changes\n |
|
450 | 456 | e> added 1 changesets with 1 changes to 1 files\n |
|
451 | 457 | e> ui.write 2 lines 1\n |
|
452 | 458 | e> ui.write 2 lines 2\n |
|
453 | 459 | e> transaction abort!\n |
|
454 | 460 | e> rollback completed\n |
|
455 | 461 | e> abort: pretxnchangegroup.fail hook failed\n |
|
456 | 462 | |
|
457 | 463 | And a variation that does a ui.flush() after writing output |
|
458 | 464 | |
|
459 | 465 | $ cat > .hg/hgrc << EOF |
|
460 | 466 | > [hooks] |
|
461 | 467 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush |
|
462 | 468 | > EOF |
|
463 | 469 | |
|
464 | 470 | $ debugwireproto << EOF |
|
465 | 471 | > command unbundle |
|
466 | 472 | > # This is "force" in hex. |
|
467 | 473 | > heads 666f726365 |
|
468 | 474 | > PUSHFILE ../initial.v1.hg |
|
469 | 475 | > readavailable |
|
470 | 476 | > EOF |
|
471 | 477 | testing ssh1 |
|
472 | 478 | creating ssh peer from handshake results |
|
473 | 479 | i> write(104) -> 104: |
|
474 | 480 | i> hello\n |
|
475 | 481 | i> between\n |
|
476 | 482 | i> pairs 81\n |
|
477 | 483 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
478 | 484 | i> flush() -> None |
|
479 | 485 | o> readline() -> 4: |
|
480 | 486 | o> 384\n |
|
481 | 487 | o> readline() -> 384: |
|
482 | 488 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
483 | 489 | o> readline() -> 2: |
|
484 | 490 | o> 1\n |
|
485 | 491 | o> readline() -> 1: |
|
486 | 492 | o> \n |
|
487 | 493 | sending unbundle command |
|
488 | 494 | i> write(9) -> 9: |
|
489 | 495 | i> unbundle\n |
|
490 | 496 | i> write(9) -> 9: |
|
491 | 497 | i> heads 10\n |
|
492 | 498 | i> write(10) -> 10: 666f726365 |
|
493 | 499 | i> flush() -> None |
|
494 | 500 | o> readline() -> 2: |
|
495 | 501 | o> 0\n |
|
496 | 502 | i> write(4) -> 4: |
|
497 | 503 | i> 426\n |
|
498 | 504 | i> write(426) -> 426: |
|
499 | 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 | 506 | i> test\n |
|
501 | 507 | i> 0 0\n |
|
502 | 508 | i> foo\n |
|
503 | 509 | i> \n |
|
504 | 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 | 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 | 512 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
507 | 513 | i> write(2) -> 2: |
|
508 | 514 | i> 0\n |
|
509 | 515 | i> flush() -> None |
|
510 | 516 | o> readline() -> 2: |
|
511 | 517 | o> 0\n |
|
512 | 518 | o> readline() -> 2: |
|
513 | 519 | o> 1\n |
|
514 | 520 | o> read(1) -> 1: 0 |
|
515 | 521 | result: 0 |
|
516 | 522 | remote output: |
|
523 | o> read(-1) -> 0: | |
|
517 | 524 | e> read(-1) -> 202: |
|
518 | 525 | e> adding changesets\n |
|
519 | 526 | e> adding manifests\n |
|
520 | 527 | e> adding file changes\n |
|
521 | 528 | e> added 1 changesets with 1 changes to 1 files\n |
|
522 | 529 | e> ui.write 1 line flush\n |
|
523 | 530 | e> transaction abort!\n |
|
524 | 531 | e> rollback completed\n |
|
525 | 532 | e> abort: pretxnchangegroup.fail hook failed\n |
|
526 | 533 | |
|
527 | 534 | testing ssh2 |
|
528 | 535 | creating ssh peer from handshake results |
|
529 | 536 | i> write(171) -> 171: |
|
530 | 537 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
531 | 538 | i> hello\n |
|
532 | 539 | i> between\n |
|
533 | 540 | i> pairs 81\n |
|
534 | 541 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
535 | 542 | i> flush() -> None |
|
536 | 543 | o> readline() -> 62: |
|
537 | 544 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
538 | 545 | o> readline() -> 4: |
|
539 | 546 | o> 383\n |
|
540 | 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 | 548 | o> read(1) -> 1: |
|
542 | 549 | o> \n |
|
543 | 550 | sending unbundle command |
|
544 | 551 | i> write(9) -> 9: |
|
545 | 552 | i> unbundle\n |
|
546 | 553 | i> write(9) -> 9: |
|
547 | 554 | i> heads 10\n |
|
548 | 555 | i> write(10) -> 10: 666f726365 |
|
549 | 556 | i> flush() -> None |
|
550 | 557 | o> readline() -> 2: |
|
551 | 558 | o> 0\n |
|
552 | 559 | i> write(4) -> 4: |
|
553 | 560 | i> 426\n |
|
554 | 561 | i> write(426) -> 426: |
|
555 | 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 | 563 | i> test\n |
|
557 | 564 | i> 0 0\n |
|
558 | 565 | i> foo\n |
|
559 | 566 | i> \n |
|
560 | 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 | 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 | 569 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
563 | 570 | i> write(2) -> 2: |
|
564 | 571 | i> 0\n |
|
565 | 572 | i> flush() -> None |
|
566 | 573 | o> readline() -> 2: |
|
567 | 574 | o> 0\n |
|
568 | 575 | o> readline() -> 2: |
|
569 | 576 | o> 1\n |
|
570 | 577 | o> read(1) -> 1: 0 |
|
571 | 578 | result: 0 |
|
572 | 579 | remote output: |
|
580 | o> read(-1) -> 0: | |
|
573 | 581 | e> read(-1) -> 202: |
|
574 | 582 | e> adding changesets\n |
|
575 | 583 | e> adding manifests\n |
|
576 | 584 | e> adding file changes\n |
|
577 | 585 | e> added 1 changesets with 1 changes to 1 files\n |
|
578 | 586 | e> ui.write 1 line flush\n |
|
579 | 587 | e> transaction abort!\n |
|
580 | 588 | e> rollback completed\n |
|
581 | 589 | e> abort: pretxnchangegroup.fail hook failed\n |
|
582 | 590 | |
|
583 | 591 | Multiple writes + flush |
|
584 | 592 | |
|
585 | 593 | $ cat > .hg/hgrc << EOF |
|
586 | 594 | > [hooks] |
|
587 | 595 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush |
|
588 | 596 | > EOF |
|
589 | 597 | |
|
590 | 598 | $ debugwireproto << EOF |
|
591 | 599 | > command unbundle |
|
592 | 600 | > # This is "force" in hex. |
|
593 | 601 | > heads 666f726365 |
|
594 | 602 | > PUSHFILE ../initial.v1.hg |
|
595 | 603 | > readavailable |
|
596 | 604 | > EOF |
|
597 | 605 | testing ssh1 |
|
598 | 606 | creating ssh peer from handshake results |
|
599 | 607 | i> write(104) -> 104: |
|
600 | 608 | i> hello\n |
|
601 | 609 | i> between\n |
|
602 | 610 | i> pairs 81\n |
|
603 | 611 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
604 | 612 | i> flush() -> None |
|
605 | 613 | o> readline() -> 4: |
|
606 | 614 | o> 384\n |
|
607 | 615 | o> readline() -> 384: |
|
608 | 616 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
609 | 617 | o> readline() -> 2: |
|
610 | 618 | o> 1\n |
|
611 | 619 | o> readline() -> 1: |
|
612 | 620 | o> \n |
|
613 | 621 | sending unbundle command |
|
614 | 622 | i> write(9) -> 9: |
|
615 | 623 | i> unbundle\n |
|
616 | 624 | i> write(9) -> 9: |
|
617 | 625 | i> heads 10\n |
|
618 | 626 | i> write(10) -> 10: 666f726365 |
|
619 | 627 | i> flush() -> None |
|
620 | 628 | o> readline() -> 2: |
|
621 | 629 | o> 0\n |
|
622 | 630 | i> write(4) -> 4: |
|
623 | 631 | i> 426\n |
|
624 | 632 | i> write(426) -> 426: |
|
625 | 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 | 634 | i> test\n |
|
627 | 635 | i> 0 0\n |
|
628 | 636 | i> foo\n |
|
629 | 637 | i> \n |
|
630 | 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 | 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 | 640 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
633 | 641 | i> write(2) -> 2: |
|
634 | 642 | i> 0\n |
|
635 | 643 | i> flush() -> None |
|
636 | 644 | o> readline() -> 2: |
|
637 | 645 | o> 0\n |
|
638 | 646 | o> readline() -> 2: |
|
639 | 647 | o> 1\n |
|
640 | 648 | o> read(1) -> 1: 0 |
|
641 | 649 | result: 0 |
|
642 | 650 | remote output: |
|
651 | o> read(-1) -> 0: | |
|
643 | 652 | e> read(-1) -> 206: |
|
644 | 653 | e> adding changesets\n |
|
645 | 654 | e> adding manifests\n |
|
646 | 655 | e> adding file changes\n |
|
647 | 656 | e> added 1 changesets with 1 changes to 1 files\n |
|
648 | 657 | e> ui.write 1st\n |
|
649 | 658 | e> ui.write 2nd\n |
|
650 | 659 | e> transaction abort!\n |
|
651 | 660 | e> rollback completed\n |
|
652 | 661 | e> abort: pretxnchangegroup.fail hook failed\n |
|
653 | 662 | |
|
654 | 663 | testing ssh2 |
|
655 | 664 | creating ssh peer from handshake results |
|
656 | 665 | i> write(171) -> 171: |
|
657 | 666 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
658 | 667 | i> hello\n |
|
659 | 668 | i> between\n |
|
660 | 669 | i> pairs 81\n |
|
661 | 670 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
662 | 671 | i> flush() -> None |
|
663 | 672 | o> readline() -> 62: |
|
664 | 673 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
665 | 674 | o> readline() -> 4: |
|
666 | 675 | o> 383\n |
|
667 | 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 | 677 | o> read(1) -> 1: |
|
669 | 678 | o> \n |
|
670 | 679 | sending unbundle command |
|
671 | 680 | i> write(9) -> 9: |
|
672 | 681 | i> unbundle\n |
|
673 | 682 | i> write(9) -> 9: |
|
674 | 683 | i> heads 10\n |
|
675 | 684 | i> write(10) -> 10: 666f726365 |
|
676 | 685 | i> flush() -> None |
|
677 | 686 | o> readline() -> 2: |
|
678 | 687 | o> 0\n |
|
679 | 688 | i> write(4) -> 4: |
|
680 | 689 | i> 426\n |
|
681 | 690 | i> write(426) -> 426: |
|
682 | 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 | 692 | i> test\n |
|
684 | 693 | i> 0 0\n |
|
685 | 694 | i> foo\n |
|
686 | 695 | i> \n |
|
687 | 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 | 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 | 698 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
690 | 699 | i> write(2) -> 2: |
|
691 | 700 | i> 0\n |
|
692 | 701 | i> flush() -> None |
|
693 | 702 | o> readline() -> 2: |
|
694 | 703 | o> 0\n |
|
695 | 704 | o> readline() -> 2: |
|
696 | 705 | o> 1\n |
|
697 | 706 | o> read(1) -> 1: 0 |
|
698 | 707 | result: 0 |
|
699 | 708 | remote output: |
|
709 | o> read(-1) -> 0: | |
|
700 | 710 | e> read(-1) -> 206: |
|
701 | 711 | e> adding changesets\n |
|
702 | 712 | e> adding manifests\n |
|
703 | 713 | e> adding file changes\n |
|
704 | 714 | e> added 1 changesets with 1 changes to 1 files\n |
|
705 | 715 | e> ui.write 1st\n |
|
706 | 716 | e> ui.write 2nd\n |
|
707 | 717 | e> transaction abort!\n |
|
708 | 718 | e> rollback completed\n |
|
709 | 719 | e> abort: pretxnchangegroup.fail hook failed\n |
|
710 | 720 | |
|
711 | 721 | ui.write() + ui.write_err() output is captured |
|
712 | 722 | |
|
713 | 723 | $ cat > .hg/hgrc << EOF |
|
714 | 724 | > [hooks] |
|
715 | 725 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr |
|
716 | 726 | > EOF |
|
717 | 727 | |
|
718 | 728 | $ debugwireproto << EOF |
|
719 | 729 | > command unbundle |
|
720 | 730 | > # This is "force" in hex. |
|
721 | 731 | > heads 666f726365 |
|
722 | 732 | > PUSHFILE ../initial.v1.hg |
|
723 | 733 | > readavailable |
|
724 | 734 | > EOF |
|
725 | 735 | testing ssh1 |
|
726 | 736 | creating ssh peer from handshake results |
|
727 | 737 | i> write(104) -> 104: |
|
728 | 738 | i> hello\n |
|
729 | 739 | i> between\n |
|
730 | 740 | i> pairs 81\n |
|
731 | 741 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
732 | 742 | i> flush() -> None |
|
733 | 743 | o> readline() -> 4: |
|
734 | 744 | o> 384\n |
|
735 | 745 | o> readline() -> 384: |
|
736 | 746 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
737 | 747 | o> readline() -> 2: |
|
738 | 748 | o> 1\n |
|
739 | 749 | o> readline() -> 1: |
|
740 | 750 | o> \n |
|
741 | 751 | sending unbundle command |
|
742 | 752 | i> write(9) -> 9: |
|
743 | 753 | i> unbundle\n |
|
744 | 754 | i> write(9) -> 9: |
|
745 | 755 | i> heads 10\n |
|
746 | 756 | i> write(10) -> 10: 666f726365 |
|
747 | 757 | i> flush() -> None |
|
748 | 758 | o> readline() -> 2: |
|
749 | 759 | o> 0\n |
|
750 | 760 | i> write(4) -> 4: |
|
751 | 761 | i> 426\n |
|
752 | 762 | i> write(426) -> 426: |
|
753 | 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 | 764 | i> test\n |
|
755 | 765 | i> 0 0\n |
|
756 | 766 | i> foo\n |
|
757 | 767 | i> \n |
|
758 | 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 | 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 | 770 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
761 | 771 | i> write(2) -> 2: |
|
762 | 772 | i> 0\n |
|
763 | 773 | i> flush() -> None |
|
764 | 774 | o> readline() -> 2: |
|
765 | 775 | o> 0\n |
|
766 | 776 | o> readline() -> 2: |
|
767 | 777 | o> 1\n |
|
768 | 778 | o> read(1) -> 1: 0 |
|
769 | 779 | result: 0 |
|
770 | 780 | remote output: |
|
781 | o> read(-1) -> 0: | |
|
771 | 782 | e> read(-1) -> 232: |
|
772 | 783 | e> adding changesets\n |
|
773 | 784 | e> adding manifests\n |
|
774 | 785 | e> adding file changes\n |
|
775 | 786 | e> added 1 changesets with 1 changes to 1 files\n |
|
776 | 787 | e> ui.write 1\n |
|
777 | 788 | e> ui.write_err 1\n |
|
778 | 789 | e> ui.write 2\n |
|
779 | 790 | e> ui.write_err 2\n |
|
780 | 791 | e> transaction abort!\n |
|
781 | 792 | e> rollback completed\n |
|
782 | 793 | e> abort: pretxnchangegroup.fail hook failed\n |
|
783 | 794 | |
|
784 | 795 | testing ssh2 |
|
785 | 796 | creating ssh peer from handshake results |
|
786 | 797 | i> write(171) -> 171: |
|
787 | 798 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
788 | 799 | i> hello\n |
|
789 | 800 | i> between\n |
|
790 | 801 | i> pairs 81\n |
|
791 | 802 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
792 | 803 | i> flush() -> None |
|
793 | 804 | o> readline() -> 62: |
|
794 | 805 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
795 | 806 | o> readline() -> 4: |
|
796 | 807 | o> 383\n |
|
797 | 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 | 809 | o> read(1) -> 1: |
|
799 | 810 | o> \n |
|
800 | 811 | sending unbundle command |
|
801 | 812 | i> write(9) -> 9: |
|
802 | 813 | i> unbundle\n |
|
803 | 814 | i> write(9) -> 9: |
|
804 | 815 | i> heads 10\n |
|
805 | 816 | i> write(10) -> 10: 666f726365 |
|
806 | 817 | i> flush() -> None |
|
807 | 818 | o> readline() -> 2: |
|
808 | 819 | o> 0\n |
|
809 | 820 | i> write(4) -> 4: |
|
810 | 821 | i> 426\n |
|
811 | 822 | i> write(426) -> 426: |
|
812 | 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 | 824 | i> test\n |
|
814 | 825 | i> 0 0\n |
|
815 | 826 | i> foo\n |
|
816 | 827 | i> \n |
|
817 | 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 | 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 | 830 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
820 | 831 | i> write(2) -> 2: |
|
821 | 832 | i> 0\n |
|
822 | 833 | i> flush() -> None |
|
823 | 834 | o> readline() -> 2: |
|
824 | 835 | o> 0\n |
|
825 | 836 | o> readline() -> 2: |
|
826 | 837 | o> 1\n |
|
827 | 838 | o> read(1) -> 1: 0 |
|
828 | 839 | result: 0 |
|
829 | 840 | remote output: |
|
841 | o> read(-1) -> 0: | |
|
830 | 842 | e> read(-1) -> 232: |
|
831 | 843 | e> adding changesets\n |
|
832 | 844 | e> adding manifests\n |
|
833 | 845 | e> adding file changes\n |
|
834 | 846 | e> added 1 changesets with 1 changes to 1 files\n |
|
835 | 847 | e> ui.write 1\n |
|
836 | 848 | e> ui.write_err 1\n |
|
837 | 849 | e> ui.write 2\n |
|
838 | 850 | e> ui.write_err 2\n |
|
839 | 851 | e> transaction abort!\n |
|
840 | 852 | e> rollback completed\n |
|
841 | 853 | e> abort: pretxnchangegroup.fail hook failed\n |
|
842 | 854 | |
|
843 | 855 | print() output is captured |
|
844 | 856 | |
|
845 | 857 | $ cat > .hg/hgrc << EOF |
|
846 | 858 | > [hooks] |
|
847 | 859 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout |
|
848 | 860 | > EOF |
|
849 | 861 | |
|
850 | 862 | $ debugwireproto << EOF |
|
851 | 863 | > command unbundle |
|
852 | 864 | > # This is "force" in hex. |
|
853 | 865 | > heads 666f726365 |
|
854 | 866 | > PUSHFILE ../initial.v1.hg |
|
855 | 867 | > readavailable |
|
856 | 868 | > EOF |
|
857 | 869 | testing ssh1 |
|
858 | 870 | creating ssh peer from handshake results |
|
859 | 871 | i> write(104) -> 104: |
|
860 | 872 | i> hello\n |
|
861 | 873 | i> between\n |
|
862 | 874 | i> pairs 81\n |
|
863 | 875 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
864 | 876 | i> flush() -> None |
|
865 | 877 | o> readline() -> 4: |
|
866 | 878 | o> 384\n |
|
867 | 879 | o> readline() -> 384: |
|
868 | 880 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
869 | 881 | o> readline() -> 2: |
|
870 | 882 | o> 1\n |
|
871 | 883 | o> readline() -> 1: |
|
872 | 884 | o> \n |
|
873 | 885 | sending unbundle command |
|
874 | 886 | i> write(9) -> 9: |
|
875 | 887 | i> unbundle\n |
|
876 | 888 | i> write(9) -> 9: |
|
877 | 889 | i> heads 10\n |
|
878 | 890 | i> write(10) -> 10: 666f726365 |
|
879 | 891 | i> flush() -> None |
|
880 | 892 | o> readline() -> 2: |
|
881 | 893 | o> 0\n |
|
882 | 894 | i> write(4) -> 4: |
|
883 | 895 | i> 426\n |
|
884 | 896 | i> write(426) -> 426: |
|
885 | 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 | 898 | i> test\n |
|
887 | 899 | i> 0 0\n |
|
888 | 900 | i> foo\n |
|
889 | 901 | i> \n |
|
890 | 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 | 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 | 904 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
893 | 905 | i> write(2) -> 2: |
|
894 | 906 | i> 0\n |
|
895 | 907 | i> flush() -> None |
|
896 | 908 | o> readline() -> 2: |
|
897 | 909 | o> 0\n |
|
898 | 910 | o> readline() -> 2: |
|
899 | 911 | o> 1\n |
|
900 | 912 | o> read(1) -> 1: 0 |
|
901 | 913 | result: 0 |
|
902 | 914 | remote output: |
|
915 | o> read(-1) -> 0: | |
|
903 | 916 | e> read(-1) -> 193: |
|
904 | 917 | e> adding changesets\n |
|
905 | 918 | e> adding manifests\n |
|
906 | 919 | e> adding file changes\n |
|
907 | 920 | e> added 1 changesets with 1 changes to 1 files\n |
|
908 | 921 | e> printed line\n |
|
909 | 922 | e> transaction abort!\n |
|
910 | 923 | e> rollback completed\n |
|
911 | 924 | e> abort: pretxnchangegroup.fail hook failed\n |
|
912 | 925 | |
|
913 | 926 | testing ssh2 |
|
914 | 927 | creating ssh peer from handshake results |
|
915 | 928 | i> write(171) -> 171: |
|
916 | 929 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
917 | 930 | i> hello\n |
|
918 | 931 | i> between\n |
|
919 | 932 | i> pairs 81\n |
|
920 | 933 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
921 | 934 | i> flush() -> None |
|
922 | 935 | o> readline() -> 62: |
|
923 | 936 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
924 | 937 | o> readline() -> 4: |
|
925 | 938 | o> 383\n |
|
926 | 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 | 940 | o> read(1) -> 1: |
|
928 | 941 | o> \n |
|
929 | 942 | sending unbundle command |
|
930 | 943 | i> write(9) -> 9: |
|
931 | 944 | i> unbundle\n |
|
932 | 945 | i> write(9) -> 9: |
|
933 | 946 | i> heads 10\n |
|
934 | 947 | i> write(10) -> 10: 666f726365 |
|
935 | 948 | i> flush() -> None |
|
936 | 949 | o> readline() -> 2: |
|
937 | 950 | o> 0\n |
|
938 | 951 | i> write(4) -> 4: |
|
939 | 952 | i> 426\n |
|
940 | 953 | i> write(426) -> 426: |
|
941 | 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 | 955 | i> test\n |
|
943 | 956 | i> 0 0\n |
|
944 | 957 | i> foo\n |
|
945 | 958 | i> \n |
|
946 | 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 | 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 | 961 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
949 | 962 | i> write(2) -> 2: |
|
950 | 963 | i> 0\n |
|
951 | 964 | i> flush() -> None |
|
952 | 965 | o> readline() -> 2: |
|
953 | 966 | o> 0\n |
|
954 | 967 | o> readline() -> 2: |
|
955 | 968 | o> 1\n |
|
956 | 969 | o> read(1) -> 1: 0 |
|
957 | 970 | result: 0 |
|
958 | 971 | remote output: |
|
972 | o> read(-1) -> 0: | |
|
959 | 973 | e> read(-1) -> 193: |
|
960 | 974 | e> adding changesets\n |
|
961 | 975 | e> adding manifests\n |
|
962 | 976 | e> adding file changes\n |
|
963 | 977 | e> added 1 changesets with 1 changes to 1 files\n |
|
964 | 978 | e> printed line\n |
|
965 | 979 | e> transaction abort!\n |
|
966 | 980 | e> rollback completed\n |
|
967 | 981 | e> abort: pretxnchangegroup.fail hook failed\n |
|
968 | 982 | |
|
969 | 983 | Mixed print() and ui.write() are both captured |
|
970 | 984 | |
|
971 | 985 | $ cat > .hg/hgrc << EOF |
|
972 | 986 | > [hooks] |
|
973 | 987 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite |
|
974 | 988 | > EOF |
|
975 | 989 | |
|
976 | 990 | $ debugwireproto << EOF |
|
977 | 991 | > command unbundle |
|
978 | 992 | > # This is "force" in hex. |
|
979 | 993 | > heads 666f726365 |
|
980 | 994 | > PUSHFILE ../initial.v1.hg |
|
981 | 995 | > readavailable |
|
982 | 996 | > EOF |
|
983 | 997 | testing ssh1 |
|
984 | 998 | creating ssh peer from handshake results |
|
985 | 999 | i> write(104) -> 104: |
|
986 | 1000 | i> hello\n |
|
987 | 1001 | i> between\n |
|
988 | 1002 | i> pairs 81\n |
|
989 | 1003 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
990 | 1004 | i> flush() -> None |
|
991 | 1005 | o> readline() -> 4: |
|
992 | 1006 | o> 384\n |
|
993 | 1007 | o> readline() -> 384: |
|
994 | 1008 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
995 | 1009 | o> readline() -> 2: |
|
996 | 1010 | o> 1\n |
|
997 | 1011 | o> readline() -> 1: |
|
998 | 1012 | o> \n |
|
999 | 1013 | sending unbundle command |
|
1000 | 1014 | i> write(9) -> 9: |
|
1001 | 1015 | i> unbundle\n |
|
1002 | 1016 | i> write(9) -> 9: |
|
1003 | 1017 | i> heads 10\n |
|
1004 | 1018 | i> write(10) -> 10: 666f726365 |
|
1005 | 1019 | i> flush() -> None |
|
1006 | 1020 | o> readline() -> 2: |
|
1007 | 1021 | o> 0\n |
|
1008 | 1022 | i> write(4) -> 4: |
|
1009 | 1023 | i> 426\n |
|
1010 | 1024 | i> write(426) -> 426: |
|
1011 | 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 | 1026 | i> test\n |
|
1013 | 1027 | i> 0 0\n |
|
1014 | 1028 | i> foo\n |
|
1015 | 1029 | i> \n |
|
1016 | 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 | 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 | 1032 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1019 | 1033 | i> write(2) -> 2: |
|
1020 | 1034 | i> 0\n |
|
1021 | 1035 | i> flush() -> None |
|
1022 | 1036 | o> readline() -> 2: |
|
1023 | 1037 | o> 0\n |
|
1024 | 1038 | o> readline() -> 2: |
|
1025 | 1039 | o> 1\n |
|
1026 | 1040 | o> read(1) -> 1: 0 |
|
1027 | 1041 | result: 0 |
|
1028 | 1042 | remote output: |
|
1043 | o> read(-1) -> 0: | |
|
1029 | 1044 | e> read(-1) -> 218: |
|
1030 | 1045 | e> adding changesets\n |
|
1031 | 1046 | e> adding manifests\n |
|
1032 | 1047 | e> adding file changes\n |
|
1033 | 1048 | e> added 1 changesets with 1 changes to 1 files\n |
|
1034 | 1049 | e> ui.write 1\n |
|
1035 | 1050 | e> ui.write 2\n |
|
1036 | 1051 | e> print 1\n |
|
1037 | 1052 | e> print 2\n |
|
1038 | 1053 | e> transaction abort!\n |
|
1039 | 1054 | e> rollback completed\n |
|
1040 | 1055 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1041 | 1056 | |
|
1042 | 1057 | testing ssh2 |
|
1043 | 1058 | creating ssh peer from handshake results |
|
1044 | 1059 | i> write(171) -> 171: |
|
1045 | 1060 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1046 | 1061 | i> hello\n |
|
1047 | 1062 | i> between\n |
|
1048 | 1063 | i> pairs 81\n |
|
1049 | 1064 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1050 | 1065 | i> flush() -> None |
|
1051 | 1066 | o> readline() -> 62: |
|
1052 | 1067 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1053 | 1068 | o> readline() -> 4: |
|
1054 | 1069 | o> 383\n |
|
1055 | 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 | 1071 | o> read(1) -> 1: |
|
1057 | 1072 | o> \n |
|
1058 | 1073 | sending unbundle command |
|
1059 | 1074 | i> write(9) -> 9: |
|
1060 | 1075 | i> unbundle\n |
|
1061 | 1076 | i> write(9) -> 9: |
|
1062 | 1077 | i> heads 10\n |
|
1063 | 1078 | i> write(10) -> 10: 666f726365 |
|
1064 | 1079 | i> flush() -> None |
|
1065 | 1080 | o> readline() -> 2: |
|
1066 | 1081 | o> 0\n |
|
1067 | 1082 | i> write(4) -> 4: |
|
1068 | 1083 | i> 426\n |
|
1069 | 1084 | i> write(426) -> 426: |
|
1070 | 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 | 1086 | i> test\n |
|
1072 | 1087 | i> 0 0\n |
|
1073 | 1088 | i> foo\n |
|
1074 | 1089 | i> \n |
|
1075 | 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 | 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 | 1092 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1078 | 1093 | i> write(2) -> 2: |
|
1079 | 1094 | i> 0\n |
|
1080 | 1095 | i> flush() -> None |
|
1081 | 1096 | o> readline() -> 2: |
|
1082 | 1097 | o> 0\n |
|
1083 | 1098 | o> readline() -> 2: |
|
1084 | 1099 | o> 1\n |
|
1085 | 1100 | o> read(1) -> 1: 0 |
|
1086 | 1101 | result: 0 |
|
1087 | 1102 | remote output: |
|
1103 | o> read(-1) -> 0: | |
|
1088 | 1104 | e> read(-1) -> 218: |
|
1089 | 1105 | e> adding changesets\n |
|
1090 | 1106 | e> adding manifests\n |
|
1091 | 1107 | e> adding file changes\n |
|
1092 | 1108 | e> added 1 changesets with 1 changes to 1 files\n |
|
1093 | 1109 | e> ui.write 1\n |
|
1094 | 1110 | e> ui.write 2\n |
|
1095 | 1111 | e> print 1\n |
|
1096 | 1112 | e> print 2\n |
|
1097 | 1113 | e> transaction abort!\n |
|
1098 | 1114 | e> rollback completed\n |
|
1099 | 1115 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1100 | 1116 | |
|
1101 | 1117 | print() to stdout and stderr both get captured |
|
1102 | 1118 | |
|
1103 | 1119 | $ cat > .hg/hgrc << EOF |
|
1104 | 1120 | > [hooks] |
|
1105 | 1121 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout |
|
1106 | 1122 | > EOF |
|
1107 | 1123 | |
|
1108 | 1124 | $ debugwireproto << EOF |
|
1109 | 1125 | > command unbundle |
|
1110 | 1126 | > # This is "force" in hex. |
|
1111 | 1127 | > heads 666f726365 |
|
1112 | 1128 | > PUSHFILE ../initial.v1.hg |
|
1113 | 1129 | > readavailable |
|
1114 | 1130 | > EOF |
|
1115 | 1131 | testing ssh1 |
|
1116 | 1132 | creating ssh peer from handshake results |
|
1117 | 1133 | i> write(104) -> 104: |
|
1118 | 1134 | i> hello\n |
|
1119 | 1135 | i> between\n |
|
1120 | 1136 | i> pairs 81\n |
|
1121 | 1137 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1122 | 1138 | i> flush() -> None |
|
1123 | 1139 | o> readline() -> 4: |
|
1124 | 1140 | o> 384\n |
|
1125 | 1141 | o> readline() -> 384: |
|
1126 | 1142 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1127 | 1143 | o> readline() -> 2: |
|
1128 | 1144 | o> 1\n |
|
1129 | 1145 | o> readline() -> 1: |
|
1130 | 1146 | o> \n |
|
1131 | 1147 | sending unbundle command |
|
1132 | 1148 | i> write(9) -> 9: |
|
1133 | 1149 | i> unbundle\n |
|
1134 | 1150 | i> write(9) -> 9: |
|
1135 | 1151 | i> heads 10\n |
|
1136 | 1152 | i> write(10) -> 10: 666f726365 |
|
1137 | 1153 | i> flush() -> None |
|
1138 | 1154 | o> readline() -> 2: |
|
1139 | 1155 | o> 0\n |
|
1140 | 1156 | i> write(4) -> 4: |
|
1141 | 1157 | i> 426\n |
|
1142 | 1158 | i> write(426) -> 426: |
|
1143 | 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 | 1160 | i> test\n |
|
1145 | 1161 | i> 0 0\n |
|
1146 | 1162 | i> foo\n |
|
1147 | 1163 | i> \n |
|
1148 | 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 | 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 | 1166 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1151 | 1167 | i> write(2) -> 2: |
|
1152 | 1168 | i> 0\n |
|
1153 | 1169 | i> flush() -> None |
|
1154 | 1170 | o> readline() -> 2: |
|
1155 | 1171 | o> 0\n |
|
1156 | 1172 | o> readline() -> 2: |
|
1157 | 1173 | o> 1\n |
|
1158 | 1174 | o> read(1) -> 1: 0 |
|
1159 | 1175 | result: 0 |
|
1160 | 1176 | remote output: |
|
1177 | o> read(-1) -> 0: | |
|
1161 | 1178 | e> read(-1) -> 216: |
|
1162 | 1179 | e> adding changesets\n |
|
1163 | 1180 | e> adding manifests\n |
|
1164 | 1181 | e> adding file changes\n |
|
1165 | 1182 | e> added 1 changesets with 1 changes to 1 files\n |
|
1166 | 1183 | e> stderr 1\n |
|
1167 | 1184 | e> stderr 2\n |
|
1168 | 1185 | e> stdout 1\n |
|
1169 | 1186 | e> stdout 2\n |
|
1170 | 1187 | e> transaction abort!\n |
|
1171 | 1188 | e> rollback completed\n |
|
1172 | 1189 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1173 | 1190 | |
|
1174 | 1191 | testing ssh2 |
|
1175 | 1192 | creating ssh peer from handshake results |
|
1176 | 1193 | i> write(171) -> 171: |
|
1177 | 1194 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1178 | 1195 | i> hello\n |
|
1179 | 1196 | i> between\n |
|
1180 | 1197 | i> pairs 81\n |
|
1181 | 1198 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1182 | 1199 | i> flush() -> None |
|
1183 | 1200 | o> readline() -> 62: |
|
1184 | 1201 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1185 | 1202 | o> readline() -> 4: |
|
1186 | 1203 | o> 383\n |
|
1187 | 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 | 1205 | o> read(1) -> 1: |
|
1189 | 1206 | o> \n |
|
1190 | 1207 | sending unbundle command |
|
1191 | 1208 | i> write(9) -> 9: |
|
1192 | 1209 | i> unbundle\n |
|
1193 | 1210 | i> write(9) -> 9: |
|
1194 | 1211 | i> heads 10\n |
|
1195 | 1212 | i> write(10) -> 10: 666f726365 |
|
1196 | 1213 | i> flush() -> None |
|
1197 | 1214 | o> readline() -> 2: |
|
1198 | 1215 | o> 0\n |
|
1199 | 1216 | i> write(4) -> 4: |
|
1200 | 1217 | i> 426\n |
|
1201 | 1218 | i> write(426) -> 426: |
|
1202 | 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 | 1220 | i> test\n |
|
1204 | 1221 | i> 0 0\n |
|
1205 | 1222 | i> foo\n |
|
1206 | 1223 | i> \n |
|
1207 | 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 | 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 | 1226 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1210 | 1227 | i> write(2) -> 2: |
|
1211 | 1228 | i> 0\n |
|
1212 | 1229 | i> flush() -> None |
|
1213 | 1230 | o> readline() -> 2: |
|
1214 | 1231 | o> 0\n |
|
1215 | 1232 | o> readline() -> 2: |
|
1216 | 1233 | o> 1\n |
|
1217 | 1234 | o> read(1) -> 1: 0 |
|
1218 | 1235 | result: 0 |
|
1219 | 1236 | remote output: |
|
1237 | o> read(-1) -> 0: | |
|
1220 | 1238 | e> read(-1) -> 216: |
|
1221 | 1239 | e> adding changesets\n |
|
1222 | 1240 | e> adding manifests\n |
|
1223 | 1241 | e> adding file changes\n |
|
1224 | 1242 | e> added 1 changesets with 1 changes to 1 files\n |
|
1225 | 1243 | e> stderr 1\n |
|
1226 | 1244 | e> stderr 2\n |
|
1227 | 1245 | e> stdout 1\n |
|
1228 | 1246 | e> stdout 2\n |
|
1229 | 1247 | e> transaction abort!\n |
|
1230 | 1248 | e> rollback completed\n |
|
1231 | 1249 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1232 | 1250 | |
|
1233 | 1251 | Shell hook writing to stdout has output captured |
|
1234 | 1252 | |
|
1235 | 1253 | $ cat > $TESTTMP/hook.sh << EOF |
|
1236 | 1254 | > echo 'stdout 1' |
|
1237 | 1255 | > echo 'stdout 2' |
|
1238 | 1256 | > exit 1 |
|
1239 | 1257 | > EOF |
|
1240 | 1258 | |
|
1241 | 1259 | $ cat > .hg/hgrc << EOF |
|
1242 | 1260 | > [hooks] |
|
1243 | 1261 | > pretxnchangegroup.fail = sh $TESTTMP/hook.sh |
|
1244 | 1262 | > EOF |
|
1245 | 1263 | |
|
1246 | 1264 | $ debugwireproto << EOF |
|
1247 | 1265 | > command unbundle |
|
1248 | 1266 | > # This is "force" in hex. |
|
1249 | 1267 | > heads 666f726365 |
|
1250 | 1268 | > PUSHFILE ../initial.v1.hg |
|
1251 | 1269 | > readavailable |
|
1252 | 1270 | > EOF |
|
1253 | 1271 | testing ssh1 |
|
1254 | 1272 | creating ssh peer from handshake results |
|
1255 | 1273 | i> write(104) -> 104: |
|
1256 | 1274 | i> hello\n |
|
1257 | 1275 | i> between\n |
|
1258 | 1276 | i> pairs 81\n |
|
1259 | 1277 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1260 | 1278 | i> flush() -> None |
|
1261 | 1279 | o> readline() -> 4: |
|
1262 | 1280 | o> 384\n |
|
1263 | 1281 | o> readline() -> 384: |
|
1264 | 1282 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1265 | 1283 | o> readline() -> 2: |
|
1266 | 1284 | o> 1\n |
|
1267 | 1285 | o> readline() -> 1: |
|
1268 | 1286 | o> \n |
|
1269 | 1287 | sending unbundle command |
|
1270 | 1288 | i> write(9) -> 9: |
|
1271 | 1289 | i> unbundle\n |
|
1272 | 1290 | i> write(9) -> 9: |
|
1273 | 1291 | i> heads 10\n |
|
1274 | 1292 | i> write(10) -> 10: 666f726365 |
|
1275 | 1293 | i> flush() -> None |
|
1276 | 1294 | o> readline() -> 2: |
|
1277 | 1295 | o> 0\n |
|
1278 | 1296 | i> write(4) -> 4: |
|
1279 | 1297 | i> 426\n |
|
1280 | 1298 | i> write(426) -> 426: |
|
1281 | 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 | 1300 | i> test\n |
|
1283 | 1301 | i> 0 0\n |
|
1284 | 1302 | i> foo\n |
|
1285 | 1303 | i> \n |
|
1286 | 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 | 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 | 1306 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1289 | 1307 | i> write(2) -> 2: |
|
1290 | 1308 | i> 0\n |
|
1291 | 1309 | i> flush() -> None |
|
1292 | 1310 | o> readline() -> 2: |
|
1293 | 1311 | o> 0\n |
|
1294 | 1312 | o> readline() -> 2: |
|
1295 | 1313 | o> 1\n |
|
1296 | 1314 | o> read(1) -> 1: 0 |
|
1297 | 1315 | result: 0 |
|
1298 | 1316 | remote output: |
|
1317 | o> read(-1) -> 0: | |
|
1299 | 1318 | e> read(-1) -> 212: |
|
1300 | 1319 | e> adding changesets\n |
|
1301 | 1320 | e> adding manifests\n |
|
1302 | 1321 | e> adding file changes\n |
|
1303 | 1322 | e> added 1 changesets with 1 changes to 1 files\n |
|
1304 | 1323 | e> stdout 1\n |
|
1305 | 1324 | e> stdout 2\n |
|
1306 | 1325 | e> transaction abort!\n |
|
1307 | 1326 | e> rollback completed\n |
|
1308 | 1327 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1309 | 1328 | |
|
1310 | 1329 | testing ssh2 |
|
1311 | 1330 | creating ssh peer from handshake results |
|
1312 | 1331 | i> write(171) -> 171: |
|
1313 | 1332 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1314 | 1333 | i> hello\n |
|
1315 | 1334 | i> between\n |
|
1316 | 1335 | i> pairs 81\n |
|
1317 | 1336 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1318 | 1337 | i> flush() -> None |
|
1319 | 1338 | o> readline() -> 62: |
|
1320 | 1339 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1321 | 1340 | o> readline() -> 4: |
|
1322 | 1341 | o> 383\n |
|
1323 | 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 | 1343 | o> read(1) -> 1: |
|
1325 | 1344 | o> \n |
|
1326 | 1345 | sending unbundle command |
|
1327 | 1346 | i> write(9) -> 9: |
|
1328 | 1347 | i> unbundle\n |
|
1329 | 1348 | i> write(9) -> 9: |
|
1330 | 1349 | i> heads 10\n |
|
1331 | 1350 | i> write(10) -> 10: 666f726365 |
|
1332 | 1351 | i> flush() -> None |
|
1333 | 1352 | o> readline() -> 2: |
|
1334 | 1353 | o> 0\n |
|
1335 | 1354 | i> write(4) -> 4: |
|
1336 | 1355 | i> 426\n |
|
1337 | 1356 | i> write(426) -> 426: |
|
1338 | 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 | 1358 | i> test\n |
|
1340 | 1359 | i> 0 0\n |
|
1341 | 1360 | i> foo\n |
|
1342 | 1361 | i> \n |
|
1343 | 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 | 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 | 1364 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1346 | 1365 | i> write(2) -> 2: |
|
1347 | 1366 | i> 0\n |
|
1348 | 1367 | i> flush() -> None |
|
1349 | 1368 | o> readline() -> 2: |
|
1350 | 1369 | o> 0\n |
|
1351 | 1370 | o> readline() -> 2: |
|
1352 | 1371 | o> 1\n |
|
1353 | 1372 | o> read(1) -> 1: 0 |
|
1354 | 1373 | result: 0 |
|
1355 | 1374 | remote output: |
|
1375 | o> read(-1) -> 0: | |
|
1356 | 1376 | e> read(-1) -> 212: |
|
1357 | 1377 | e> adding changesets\n |
|
1358 | 1378 | e> adding manifests\n |
|
1359 | 1379 | e> adding file changes\n |
|
1360 | 1380 | e> added 1 changesets with 1 changes to 1 files\n |
|
1361 | 1381 | e> stdout 1\n |
|
1362 | 1382 | e> stdout 2\n |
|
1363 | 1383 | e> transaction abort!\n |
|
1364 | 1384 | e> rollback completed\n |
|
1365 | 1385 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1366 | 1386 | |
|
1367 | 1387 | Shell hook writing to stderr has output captured |
|
1368 | 1388 | |
|
1369 | 1389 | $ cat > $TESTTMP/hook.sh << EOF |
|
1370 | 1390 | > echo 'stderr 1' 1>&2 |
|
1371 | 1391 | > echo 'stderr 2' 1>&2 |
|
1372 | 1392 | > exit 1 |
|
1373 | 1393 | > EOF |
|
1374 | 1394 | |
|
1375 | 1395 | $ debugwireproto << EOF |
|
1376 | 1396 | > command unbundle |
|
1377 | 1397 | > # This is "force" in hex. |
|
1378 | 1398 | > heads 666f726365 |
|
1379 | 1399 | > PUSHFILE ../initial.v1.hg |
|
1380 | 1400 | > readavailable |
|
1381 | 1401 | > EOF |
|
1382 | 1402 | testing ssh1 |
|
1383 | 1403 | creating ssh peer from handshake results |
|
1384 | 1404 | i> write(104) -> 104: |
|
1385 | 1405 | i> hello\n |
|
1386 | 1406 | i> between\n |
|
1387 | 1407 | i> pairs 81\n |
|
1388 | 1408 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1389 | 1409 | i> flush() -> None |
|
1390 | 1410 | o> readline() -> 4: |
|
1391 | 1411 | o> 384\n |
|
1392 | 1412 | o> readline() -> 384: |
|
1393 | 1413 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1394 | 1414 | o> readline() -> 2: |
|
1395 | 1415 | o> 1\n |
|
1396 | 1416 | o> readline() -> 1: |
|
1397 | 1417 | o> \n |
|
1398 | 1418 | sending unbundle command |
|
1399 | 1419 | i> write(9) -> 9: |
|
1400 | 1420 | i> unbundle\n |
|
1401 | 1421 | i> write(9) -> 9: |
|
1402 | 1422 | i> heads 10\n |
|
1403 | 1423 | i> write(10) -> 10: 666f726365 |
|
1404 | 1424 | i> flush() -> None |
|
1405 | 1425 | o> readline() -> 2: |
|
1406 | 1426 | o> 0\n |
|
1407 | 1427 | i> write(4) -> 4: |
|
1408 | 1428 | i> 426\n |
|
1409 | 1429 | i> write(426) -> 426: |
|
1410 | 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 | 1431 | i> test\n |
|
1412 | 1432 | i> 0 0\n |
|
1413 | 1433 | i> foo\n |
|
1414 | 1434 | i> \n |
|
1415 | 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 | 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 | 1437 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1418 | 1438 | i> write(2) -> 2: |
|
1419 | 1439 | i> 0\n |
|
1420 | 1440 | i> flush() -> None |
|
1421 | 1441 | o> readline() -> 2: |
|
1422 | 1442 | o> 0\n |
|
1423 | 1443 | o> readline() -> 2: |
|
1424 | 1444 | o> 1\n |
|
1425 | 1445 | o> read(1) -> 1: 0 |
|
1426 | 1446 | result: 0 |
|
1427 | 1447 | remote output: |
|
1448 | o> read(-1) -> 0: | |
|
1428 | 1449 | e> read(-1) -> 212: |
|
1429 | 1450 | e> adding changesets\n |
|
1430 | 1451 | e> adding manifests\n |
|
1431 | 1452 | e> adding file changes\n |
|
1432 | 1453 | e> added 1 changesets with 1 changes to 1 files\n |
|
1433 | 1454 | e> stderr 1\n |
|
1434 | 1455 | e> stderr 2\n |
|
1435 | 1456 | e> transaction abort!\n |
|
1436 | 1457 | e> rollback completed\n |
|
1437 | 1458 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1438 | 1459 | |
|
1439 | 1460 | testing ssh2 |
|
1440 | 1461 | creating ssh peer from handshake results |
|
1441 | 1462 | i> write(171) -> 171: |
|
1442 | 1463 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1443 | 1464 | i> hello\n |
|
1444 | 1465 | i> between\n |
|
1445 | 1466 | i> pairs 81\n |
|
1446 | 1467 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1447 | 1468 | i> flush() -> None |
|
1448 | 1469 | o> readline() -> 62: |
|
1449 | 1470 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1450 | 1471 | o> readline() -> 4: |
|
1451 | 1472 | o> 383\n |
|
1452 | 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 | 1474 | o> read(1) -> 1: |
|
1454 | 1475 | o> \n |
|
1455 | 1476 | sending unbundle command |
|
1456 | 1477 | i> write(9) -> 9: |
|
1457 | 1478 | i> unbundle\n |
|
1458 | 1479 | i> write(9) -> 9: |
|
1459 | 1480 | i> heads 10\n |
|
1460 | 1481 | i> write(10) -> 10: 666f726365 |
|
1461 | 1482 | i> flush() -> None |
|
1462 | 1483 | o> readline() -> 2: |
|
1463 | 1484 | o> 0\n |
|
1464 | 1485 | i> write(4) -> 4: |
|
1465 | 1486 | i> 426\n |
|
1466 | 1487 | i> write(426) -> 426: |
|
1467 | 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 | 1489 | i> test\n |
|
1469 | 1490 | i> 0 0\n |
|
1470 | 1491 | i> foo\n |
|
1471 | 1492 | i> \n |
|
1472 | 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 | 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 | 1495 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1475 | 1496 | i> write(2) -> 2: |
|
1476 | 1497 | i> 0\n |
|
1477 | 1498 | i> flush() -> None |
|
1478 | 1499 | o> readline() -> 2: |
|
1479 | 1500 | o> 0\n |
|
1480 | 1501 | o> readline() -> 2: |
|
1481 | 1502 | o> 1\n |
|
1482 | 1503 | o> read(1) -> 1: 0 |
|
1483 | 1504 | result: 0 |
|
1484 | 1505 | remote output: |
|
1506 | o> read(-1) -> 0: | |
|
1485 | 1507 | e> read(-1) -> 212: |
|
1486 | 1508 | e> adding changesets\n |
|
1487 | 1509 | e> adding manifests\n |
|
1488 | 1510 | e> adding file changes\n |
|
1489 | 1511 | e> added 1 changesets with 1 changes to 1 files\n |
|
1490 | 1512 | e> stderr 1\n |
|
1491 | 1513 | e> stderr 2\n |
|
1492 | 1514 | e> transaction abort!\n |
|
1493 | 1515 | e> rollback completed\n |
|
1494 | 1516 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1495 | 1517 | |
|
1496 | 1518 | Shell hook writing to stdout and stderr has output captured |
|
1497 | 1519 | |
|
1498 | 1520 | $ cat > $TESTTMP/hook.sh << EOF |
|
1499 | 1521 | > echo 'stdout 1' |
|
1500 | 1522 | > echo 'stderr 1' 1>&2 |
|
1501 | 1523 | > echo 'stdout 2' |
|
1502 | 1524 | > echo 'stderr 2' 1>&2 |
|
1503 | 1525 | > exit 1 |
|
1504 | 1526 | > EOF |
|
1505 | 1527 | |
|
1506 | 1528 | $ debugwireproto << EOF |
|
1507 | 1529 | > command unbundle |
|
1508 | 1530 | > # This is "force" in hex. |
|
1509 | 1531 | > heads 666f726365 |
|
1510 | 1532 | > PUSHFILE ../initial.v1.hg |
|
1511 | 1533 | > readavailable |
|
1512 | 1534 | > EOF |
|
1513 | 1535 | testing ssh1 |
|
1514 | 1536 | creating ssh peer from handshake results |
|
1515 | 1537 | i> write(104) -> 104: |
|
1516 | 1538 | i> hello\n |
|
1517 | 1539 | i> between\n |
|
1518 | 1540 | i> pairs 81\n |
|
1519 | 1541 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1520 | 1542 | i> flush() -> None |
|
1521 | 1543 | o> readline() -> 4: |
|
1522 | 1544 | o> 384\n |
|
1523 | 1545 | o> readline() -> 384: |
|
1524 | 1546 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1525 | 1547 | o> readline() -> 2: |
|
1526 | 1548 | o> 1\n |
|
1527 | 1549 | o> readline() -> 1: |
|
1528 | 1550 | o> \n |
|
1529 | 1551 | sending unbundle command |
|
1530 | 1552 | i> write(9) -> 9: |
|
1531 | 1553 | i> unbundle\n |
|
1532 | 1554 | i> write(9) -> 9: |
|
1533 | 1555 | i> heads 10\n |
|
1534 | 1556 | i> write(10) -> 10: 666f726365 |
|
1535 | 1557 | i> flush() -> None |
|
1536 | 1558 | o> readline() -> 2: |
|
1537 | 1559 | o> 0\n |
|
1538 | 1560 | i> write(4) -> 4: |
|
1539 | 1561 | i> 426\n |
|
1540 | 1562 | i> write(426) -> 426: |
|
1541 | 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 | 1564 | i> test\n |
|
1543 | 1565 | i> 0 0\n |
|
1544 | 1566 | i> foo\n |
|
1545 | 1567 | i> \n |
|
1546 | 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 | 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 | 1570 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1549 | 1571 | i> write(2) -> 2: |
|
1550 | 1572 | i> 0\n |
|
1551 | 1573 | i> flush() -> None |
|
1552 | 1574 | o> readline() -> 2: |
|
1553 | 1575 | o> 0\n |
|
1554 | 1576 | o> readline() -> 2: |
|
1555 | 1577 | o> 1\n |
|
1556 | 1578 | o> read(1) -> 1: 0 |
|
1557 | 1579 | result: 0 |
|
1558 | 1580 | remote output: |
|
1581 | o> read(-1) -> 0: | |
|
1559 | 1582 | e> read(-1) -> 230: |
|
1560 | 1583 | e> adding changesets\n |
|
1561 | 1584 | e> adding manifests\n |
|
1562 | 1585 | e> adding file changes\n |
|
1563 | 1586 | e> added 1 changesets with 1 changes to 1 files\n |
|
1564 | 1587 | e> stdout 1\n |
|
1565 | 1588 | e> stderr 1\n |
|
1566 | 1589 | e> stdout 2\n |
|
1567 | 1590 | e> stderr 2\n |
|
1568 | 1591 | e> transaction abort!\n |
|
1569 | 1592 | e> rollback completed\n |
|
1570 | 1593 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1571 | 1594 | |
|
1572 | 1595 | testing ssh2 |
|
1573 | 1596 | creating ssh peer from handshake results |
|
1574 | 1597 | i> write(171) -> 171: |
|
1575 | 1598 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1576 | 1599 | i> hello\n |
|
1577 | 1600 | i> between\n |
|
1578 | 1601 | i> pairs 81\n |
|
1579 | 1602 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1580 | 1603 | i> flush() -> None |
|
1581 | 1604 | o> readline() -> 62: |
|
1582 | 1605 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1583 | 1606 | o> readline() -> 4: |
|
1584 | 1607 | o> 383\n |
|
1585 | 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 | 1609 | o> read(1) -> 1: |
|
1587 | 1610 | o> \n |
|
1588 | 1611 | sending unbundle command |
|
1589 | 1612 | i> write(9) -> 9: |
|
1590 | 1613 | i> unbundle\n |
|
1591 | 1614 | i> write(9) -> 9: |
|
1592 | 1615 | i> heads 10\n |
|
1593 | 1616 | i> write(10) -> 10: 666f726365 |
|
1594 | 1617 | i> flush() -> None |
|
1595 | 1618 | o> readline() -> 2: |
|
1596 | 1619 | o> 0\n |
|
1597 | 1620 | i> write(4) -> 4: |
|
1598 | 1621 | i> 426\n |
|
1599 | 1622 | i> write(426) -> 426: |
|
1600 | 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 | 1624 | i> test\n |
|
1602 | 1625 | i> 0 0\n |
|
1603 | 1626 | i> foo\n |
|
1604 | 1627 | i> \n |
|
1605 | 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 | 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 | 1630 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1608 | 1631 | i> write(2) -> 2: |
|
1609 | 1632 | i> 0\n |
|
1610 | 1633 | i> flush() -> None |
|
1611 | 1634 | o> readline() -> 2: |
|
1612 | 1635 | o> 0\n |
|
1613 | 1636 | o> readline() -> 2: |
|
1614 | 1637 | o> 1\n |
|
1615 | 1638 | o> read(1) -> 1: 0 |
|
1616 | 1639 | result: 0 |
|
1617 | 1640 | remote output: |
|
1641 | o> read(-1) -> 0: | |
|
1618 | 1642 | e> read(-1) -> 230: |
|
1619 | 1643 | e> adding changesets\n |
|
1620 | 1644 | e> adding manifests\n |
|
1621 | 1645 | e> adding file changes\n |
|
1622 | 1646 | e> added 1 changesets with 1 changes to 1 files\n |
|
1623 | 1647 | e> stdout 1\n |
|
1624 | 1648 | e> stderr 1\n |
|
1625 | 1649 | e> stdout 2\n |
|
1626 | 1650 | e> stderr 2\n |
|
1627 | 1651 | e> transaction abort!\n |
|
1628 | 1652 | e> rollback completed\n |
|
1629 | 1653 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1630 | 1654 | |
|
1631 | 1655 | Shell and Python hooks writing to stdout and stderr have output captured |
|
1632 | 1656 | |
|
1633 | 1657 | $ cat > $TESTTMP/hook.sh << EOF |
|
1634 | 1658 | > echo 'shell stdout 1' |
|
1635 | 1659 | > echo 'shell stderr 1' 1>&2 |
|
1636 | 1660 | > echo 'shell stdout 2' |
|
1637 | 1661 | > echo 'shell stderr 2' 1>&2 |
|
1638 | 1662 | > exit 0 |
|
1639 | 1663 | > EOF |
|
1640 | 1664 | |
|
1641 | 1665 | $ cat > .hg/hgrc << EOF |
|
1642 | 1666 | > [hooks] |
|
1643 | 1667 | > pretxnchangegroup.a = sh $TESTTMP/hook.sh |
|
1644 | 1668 | > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout |
|
1645 | 1669 | > EOF |
|
1646 | 1670 | |
|
1647 | 1671 | $ debugwireproto << EOF |
|
1648 | 1672 | > command unbundle |
|
1649 | 1673 | > # This is "force" in hex. |
|
1650 | 1674 | > heads 666f726365 |
|
1651 | 1675 | > PUSHFILE ../initial.v1.hg |
|
1652 | 1676 | > readavailable |
|
1653 | 1677 | > EOF |
|
1654 | 1678 | testing ssh1 |
|
1655 | 1679 | creating ssh peer from handshake results |
|
1656 | 1680 | i> write(104) -> 104: |
|
1657 | 1681 | i> hello\n |
|
1658 | 1682 | i> between\n |
|
1659 | 1683 | i> pairs 81\n |
|
1660 | 1684 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1661 | 1685 | i> flush() -> None |
|
1662 | 1686 | o> readline() -> 4: |
|
1663 | 1687 | o> 384\n |
|
1664 | 1688 | o> readline() -> 384: |
|
1665 | 1689 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1666 | 1690 | o> readline() -> 2: |
|
1667 | 1691 | o> 1\n |
|
1668 | 1692 | o> readline() -> 1: |
|
1669 | 1693 | o> \n |
|
1670 | 1694 | sending unbundle command |
|
1671 | 1695 | i> write(9) -> 9: |
|
1672 | 1696 | i> unbundle\n |
|
1673 | 1697 | i> write(9) -> 9: |
|
1674 | 1698 | i> heads 10\n |
|
1675 | 1699 | i> write(10) -> 10: 666f726365 |
|
1676 | 1700 | i> flush() -> None |
|
1677 | 1701 | o> readline() -> 2: |
|
1678 | 1702 | o> 0\n |
|
1679 | 1703 | i> write(4) -> 4: |
|
1680 | 1704 | i> 426\n |
|
1681 | 1705 | i> write(426) -> 426: |
|
1682 | 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 | 1707 | i> test\n |
|
1684 | 1708 | i> 0 0\n |
|
1685 | 1709 | i> foo\n |
|
1686 | 1710 | i> \n |
|
1687 | 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 | 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 | 1713 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1690 | 1714 | i> write(2) -> 2: |
|
1691 | 1715 | i> 0\n |
|
1692 | 1716 | i> flush() -> None |
|
1693 | 1717 | o> readline() -> 2: |
|
1694 | 1718 | o> 0\n |
|
1695 | 1719 | o> readline() -> 2: |
|
1696 | 1720 | o> 1\n |
|
1697 | 1721 | o> read(1) -> 1: 0 |
|
1698 | 1722 | result: 0 |
|
1699 | 1723 | remote output: |
|
1724 | o> read(-1) -> 0: | |
|
1700 | 1725 | e> read(-1) -> 273: |
|
1701 | 1726 | e> adding changesets\n |
|
1702 | 1727 | e> adding manifests\n |
|
1703 | 1728 | e> adding file changes\n |
|
1704 | 1729 | e> added 1 changesets with 1 changes to 1 files\n |
|
1705 | 1730 | e> shell stdout 1\n |
|
1706 | 1731 | e> shell stderr 1\n |
|
1707 | 1732 | e> shell stdout 2\n |
|
1708 | 1733 | e> shell stderr 2\n |
|
1709 | 1734 | e> stderr 1\n |
|
1710 | 1735 | e> stderr 2\n |
|
1711 | 1736 | e> stdout 1\n |
|
1712 | 1737 | e> stdout 2\n |
|
1713 | 1738 | e> transaction abort!\n |
|
1714 | 1739 | e> rollback completed\n |
|
1715 | 1740 | e> abort: pretxnchangegroup.b hook failed\n |
|
1716 | 1741 | |
|
1717 | 1742 | testing ssh2 |
|
1718 | 1743 | creating ssh peer from handshake results |
|
1719 | 1744 | i> write(171) -> 171: |
|
1720 | 1745 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1721 | 1746 | i> hello\n |
|
1722 | 1747 | i> between\n |
|
1723 | 1748 | i> pairs 81\n |
|
1724 | 1749 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1725 | 1750 | i> flush() -> None |
|
1726 | 1751 | o> readline() -> 62: |
|
1727 | 1752 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1728 | 1753 | o> readline() -> 4: |
|
1729 | 1754 | o> 383\n |
|
1730 | 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 | 1756 | o> read(1) -> 1: |
|
1732 | 1757 | o> \n |
|
1733 | 1758 | sending unbundle command |
|
1734 | 1759 | i> write(9) -> 9: |
|
1735 | 1760 | i> unbundle\n |
|
1736 | 1761 | i> write(9) -> 9: |
|
1737 | 1762 | i> heads 10\n |
|
1738 | 1763 | i> write(10) -> 10: 666f726365 |
|
1739 | 1764 | i> flush() -> None |
|
1740 | 1765 | o> readline() -> 2: |
|
1741 | 1766 | o> 0\n |
|
1742 | 1767 | i> write(4) -> 4: |
|
1743 | 1768 | i> 426\n |
|
1744 | 1769 | i> write(426) -> 426: |
|
1745 | 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 | 1771 | i> test\n |
|
1747 | 1772 | i> 0 0\n |
|
1748 | 1773 | i> foo\n |
|
1749 | 1774 | i> \n |
|
1750 | 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 | 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 | 1777 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1753 | 1778 | i> write(2) -> 2: |
|
1754 | 1779 | i> 0\n |
|
1755 | 1780 | i> flush() -> None |
|
1756 | 1781 | o> readline() -> 2: |
|
1757 | 1782 | o> 0\n |
|
1758 | 1783 | o> readline() -> 2: |
|
1759 | 1784 | o> 1\n |
|
1760 | 1785 | o> read(1) -> 1: 0 |
|
1761 | 1786 | result: 0 |
|
1762 | 1787 | remote output: |
|
1788 | o> read(-1) -> 0: | |
|
1763 | 1789 | e> read(-1) -> 273: |
|
1764 | 1790 | e> adding changesets\n |
|
1765 | 1791 | e> adding manifests\n |
|
1766 | 1792 | e> adding file changes\n |
|
1767 | 1793 | e> added 1 changesets with 1 changes to 1 files\n |
|
1768 | 1794 | e> shell stdout 1\n |
|
1769 | 1795 | e> shell stderr 1\n |
|
1770 | 1796 | e> shell stdout 2\n |
|
1771 | 1797 | e> shell stderr 2\n |
|
1772 | 1798 | e> stderr 1\n |
|
1773 | 1799 | e> stderr 2\n |
|
1774 | 1800 | e> stdout 1\n |
|
1775 | 1801 | e> stdout 2\n |
|
1776 | 1802 | e> transaction abort!\n |
|
1777 | 1803 | e> rollback completed\n |
|
1778 | 1804 | e> abort: pretxnchangegroup.b hook failed\n |
|
1779 | 1805 | |
|
1780 | 1806 | $ cd .. |
|
1781 | 1807 | |
|
1782 | 1808 | Pushing a bundle1 with no output |
|
1783 | 1809 | |
|
1784 | 1810 | $ hg init simplerepo |
|
1785 | 1811 | $ cd simplerepo |
|
1786 | 1812 | |
|
1787 | 1813 | $ debugwireproto 1 << EOF |
|
1788 | 1814 | > command unbundle |
|
1789 | 1815 | > # This is "force" in hex. |
|
1790 | 1816 | > heads 666f726365 |
|
1791 | 1817 | > PUSHFILE ../initial.v1.hg |
|
1792 | 1818 | > readavailable |
|
1793 | 1819 | > EOF |
|
1794 | 1820 | testing ssh1 |
|
1795 | 1821 | creating ssh peer from handshake results |
|
1796 | 1822 | i> write(104) -> 104: |
|
1797 | 1823 | i> hello\n |
|
1798 | 1824 | i> between\n |
|
1799 | 1825 | i> pairs 81\n |
|
1800 | 1826 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1801 | 1827 | i> flush() -> None |
|
1802 | 1828 | o> readline() -> 4: |
|
1803 | 1829 | o> 384\n |
|
1804 | 1830 | o> readline() -> 384: |
|
1805 | 1831 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1806 | 1832 | o> readline() -> 2: |
|
1807 | 1833 | o> 1\n |
|
1808 | 1834 | o> readline() -> 1: |
|
1809 | 1835 | o> \n |
|
1810 | 1836 | sending unbundle command |
|
1811 | 1837 | i> write(9) -> 9: |
|
1812 | 1838 | i> unbundle\n |
|
1813 | 1839 | i> write(9) -> 9: |
|
1814 | 1840 | i> heads 10\n |
|
1815 | 1841 | i> write(10) -> 10: 666f726365 |
|
1816 | 1842 | i> flush() -> None |
|
1817 | 1843 | o> readline() -> 2: |
|
1818 | 1844 | o> 0\n |
|
1819 | 1845 | i> write(4) -> 4: |
|
1820 | 1846 | i> 426\n |
|
1821 | 1847 | i> write(426) -> 426: |
|
1822 | 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 | 1849 | i> test\n |
|
1824 | 1850 | i> 0 0\n |
|
1825 | 1851 | i> foo\n |
|
1826 | 1852 | i> \n |
|
1827 | 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 | 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 | 1855 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1830 | 1856 | i> write(2) -> 2: |
|
1831 | 1857 | i> 0\n |
|
1832 | 1858 | i> flush() -> None |
|
1833 | 1859 | o> readline() -> 2: |
|
1834 | 1860 | o> 0\n |
|
1835 | 1861 | o> readline() -> 2: |
|
1836 | 1862 | o> 1\n |
|
1837 | 1863 | o> read(1) -> 1: 1 |
|
1838 | 1864 | result: 1 |
|
1839 | 1865 | remote output: |
|
1866 | o> read(-1) -> 0: | |
|
1840 | 1867 | e> read(-1) -> 100: |
|
1841 | 1868 | e> adding changesets\n |
|
1842 | 1869 | e> adding manifests\n |
|
1843 | 1870 | e> adding file changes\n |
|
1844 | 1871 | e> added 1 changesets with 1 changes to 1 files\n |
|
1845 | 1872 | |
|
1846 | 1873 | testing ssh2 |
|
1847 | 1874 | creating ssh peer from handshake results |
|
1848 | 1875 | i> write(171) -> 171: |
|
1849 | 1876 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1850 | 1877 | i> hello\n |
|
1851 | 1878 | i> between\n |
|
1852 | 1879 | i> pairs 81\n |
|
1853 | 1880 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1854 | 1881 | i> flush() -> None |
|
1855 | 1882 | o> readline() -> 62: |
|
1856 | 1883 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1857 | 1884 | o> readline() -> 4: |
|
1858 | 1885 | o> 383\n |
|
1859 | 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 | 1887 | o> read(1) -> 1: |
|
1861 | 1888 | o> \n |
|
1862 | 1889 | sending unbundle command |
|
1863 | 1890 | i> write(9) -> 9: |
|
1864 | 1891 | i> unbundle\n |
|
1865 | 1892 | i> write(9) -> 9: |
|
1866 | 1893 | i> heads 10\n |
|
1867 | 1894 | i> write(10) -> 10: 666f726365 |
|
1868 | 1895 | i> flush() -> None |
|
1869 | 1896 | o> readline() -> 2: |
|
1870 | 1897 | o> 0\n |
|
1871 | 1898 | i> write(4) -> 4: |
|
1872 | 1899 | i> 426\n |
|
1873 | 1900 | i> write(426) -> 426: |
|
1874 | 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 | 1902 | i> test\n |
|
1876 | 1903 | i> 0 0\n |
|
1877 | 1904 | i> foo\n |
|
1878 | 1905 | i> \n |
|
1879 | 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 | 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 | 1908 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1882 | 1909 | i> write(2) -> 2: |
|
1883 | 1910 | i> 0\n |
|
1884 | 1911 | i> flush() -> None |
|
1885 | 1912 | o> readline() -> 2: |
|
1886 | 1913 | o> 0\n |
|
1887 | 1914 | o> readline() -> 2: |
|
1888 | 1915 | o> 1\n |
|
1889 | 1916 | o> read(1) -> 1: 1 |
|
1890 | 1917 | result: 1 |
|
1891 | 1918 | remote output: |
|
1919 | o> read(-1) -> 0: | |
|
1892 | 1920 | e> read(-1) -> 100: |
|
1893 | 1921 | e> adding changesets\n |
|
1894 | 1922 | e> adding manifests\n |
|
1895 | 1923 | e> adding file changes\n |
|
1896 | 1924 | e> added 1 changesets with 1 changes to 1 files\n |
|
1897 | 1925 | |
|
1898 | 1926 | $ cd .. |
|
1899 | 1927 | |
|
1900 | 1928 | Pushing a bundle1 with ui.write() and ui.write_err() |
|
1901 | 1929 | |
|
1902 | 1930 | $ cat > $TESTTMP/hook << EOF |
|
1903 | 1931 | > def hookuiwrite(ui, repo, **kwargs): |
|
1904 | 1932 | > ui.write(b'ui.write 1\n') |
|
1905 | 1933 | > ui.write_err(b'ui.write_err 1\n') |
|
1906 | 1934 | > ui.write(b'ui.write 2\n') |
|
1907 | 1935 | > ui.write_err(b'ui.write_err 2\n') |
|
1908 | 1936 | > EOF |
|
1909 | 1937 | |
|
1910 | 1938 | $ hg init uiwriterepo |
|
1911 | 1939 | $ cd uiwriterepo |
|
1912 | 1940 | $ cat > .hg/hgrc << EOF |
|
1913 | 1941 | > [hooks] |
|
1914 | 1942 | > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite |
|
1915 | 1943 | > EOF |
|
1916 | 1944 | |
|
1917 | 1945 | $ debugwireproto 1 << EOF |
|
1918 | 1946 | > command unbundle |
|
1919 | 1947 | > # This is "force" in hex. |
|
1920 | 1948 | > heads 666f726365 |
|
1921 | 1949 | > PUSHFILE ../initial.v1.hg |
|
1922 | 1950 | > readavailable |
|
1923 | 1951 | > EOF |
|
1924 | 1952 | testing ssh1 |
|
1925 | 1953 | creating ssh peer from handshake results |
|
1926 | 1954 | i> write(104) -> 104: |
|
1927 | 1955 | i> hello\n |
|
1928 | 1956 | i> between\n |
|
1929 | 1957 | i> pairs 81\n |
|
1930 | 1958 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1931 | 1959 | i> flush() -> None |
|
1932 | 1960 | o> readline() -> 4: |
|
1933 | 1961 | o> 384\n |
|
1934 | 1962 | o> readline() -> 384: |
|
1935 | 1963 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1936 | 1964 | o> readline() -> 2: |
|
1937 | 1965 | o> 1\n |
|
1938 | 1966 | o> readline() -> 1: |
|
1939 | 1967 | o> \n |
|
1940 | 1968 | sending unbundle command |
|
1941 | 1969 | i> write(9) -> 9: |
|
1942 | 1970 | i> unbundle\n |
|
1943 | 1971 | i> write(9) -> 9: |
|
1944 | 1972 | i> heads 10\n |
|
1945 | 1973 | i> write(10) -> 10: 666f726365 |
|
1946 | 1974 | i> flush() -> None |
|
1947 | 1975 | o> readline() -> 2: |
|
1948 | 1976 | o> 0\n |
|
1949 | 1977 | i> write(4) -> 4: |
|
1950 | 1978 | i> 426\n |
|
1951 | 1979 | i> write(426) -> 426: |
|
1952 | 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 | 1981 | i> test\n |
|
1954 | 1982 | i> 0 0\n |
|
1955 | 1983 | i> foo\n |
|
1956 | 1984 | i> \n |
|
1957 | 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 | 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 | 1987 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1960 | 1988 | i> write(2) -> 2: |
|
1961 | 1989 | i> 0\n |
|
1962 | 1990 | i> flush() -> None |
|
1963 | 1991 | o> readline() -> 2: |
|
1964 | 1992 | o> 0\n |
|
1965 | 1993 | o> readline() -> 2: |
|
1966 | 1994 | o> 1\n |
|
1967 | 1995 | o> read(1) -> 1: 1 |
|
1968 | 1996 | result: 1 |
|
1969 | 1997 | remote output: |
|
1998 | o> read(-1) -> 0: | |
|
1970 | 1999 | e> read(-1) -> 152: |
|
1971 | 2000 | e> adding changesets\n |
|
1972 | 2001 | e> adding manifests\n |
|
1973 | 2002 | e> adding file changes\n |
|
1974 | 2003 | e> added 1 changesets with 1 changes to 1 files\n |
|
1975 | 2004 | e> ui.write 1\n |
|
1976 | 2005 | e> ui.write_err 1\n |
|
1977 | 2006 | e> ui.write 2\n |
|
1978 | 2007 | e> ui.write_err 2\n |
|
1979 | 2008 | |
|
1980 | 2009 | testing ssh2 |
|
1981 | 2010 | creating ssh peer from handshake results |
|
1982 | 2011 | i> write(171) -> 171: |
|
1983 | 2012 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1984 | 2013 | i> hello\n |
|
1985 | 2014 | i> between\n |
|
1986 | 2015 | i> pairs 81\n |
|
1987 | 2016 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1988 | 2017 | i> flush() -> None |
|
1989 | 2018 | o> readline() -> 62: |
|
1990 | 2019 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1991 | 2020 | o> readline() -> 4: |
|
1992 | 2021 | o> 383\n |
|
1993 | 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 | 2023 | o> read(1) -> 1: |
|
1995 | 2024 | o> \n |
|
1996 | 2025 | sending unbundle command |
|
1997 | 2026 | i> write(9) -> 9: |
|
1998 | 2027 | i> unbundle\n |
|
1999 | 2028 | i> write(9) -> 9: |
|
2000 | 2029 | i> heads 10\n |
|
2001 | 2030 | i> write(10) -> 10: 666f726365 |
|
2002 | 2031 | i> flush() -> None |
|
2003 | 2032 | o> readline() -> 2: |
|
2004 | 2033 | o> 0\n |
|
2005 | 2034 | i> write(4) -> 4: |
|
2006 | 2035 | i> 426\n |
|
2007 | 2036 | i> write(426) -> 426: |
|
2008 | 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 | 2038 | i> test\n |
|
2010 | 2039 | i> 0 0\n |
|
2011 | 2040 | i> foo\n |
|
2012 | 2041 | i> \n |
|
2013 | 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 | 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 | 2044 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
2016 | 2045 | i> write(2) -> 2: |
|
2017 | 2046 | i> 0\n |
|
2018 | 2047 | i> flush() -> None |
|
2019 | 2048 | o> readline() -> 2: |
|
2020 | 2049 | o> 0\n |
|
2021 | 2050 | o> readline() -> 2: |
|
2022 | 2051 | o> 1\n |
|
2023 | 2052 | o> read(1) -> 1: 1 |
|
2024 | 2053 | result: 1 |
|
2025 | 2054 | remote output: |
|
2055 | o> read(-1) -> 0: | |
|
2026 | 2056 | e> read(-1) -> 152: |
|
2027 | 2057 | e> adding changesets\n |
|
2028 | 2058 | e> adding manifests\n |
|
2029 | 2059 | e> adding file changes\n |
|
2030 | 2060 | e> added 1 changesets with 1 changes to 1 files\n |
|
2031 | 2061 | e> ui.write 1\n |
|
2032 | 2062 | e> ui.write_err 1\n |
|
2033 | 2063 | e> ui.write 2\n |
|
2034 | 2064 | e> ui.write_err 2\n |
@@ -1,2139 +1,2143 b'' | |||
|
1 | 1 | $ cat > hgrc-sshv2 << EOF |
|
2 | 2 | > %include $HGRCPATH |
|
3 | 3 | > [experimental] |
|
4 | 4 | > sshpeer.advertise-v2 = true |
|
5 | 5 | > sshserver.support-v2 = true |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | Helper function to run protocol tests against multiple protocol versions. |
|
9 | 9 | This is easier than using #testcases because managing differences between |
|
10 | 10 | protocols with inline conditional output is hard to read. |
|
11 | 11 | |
|
12 | 12 | $ debugwireproto() { |
|
13 | 13 | > commands=`cat -` |
|
14 | 14 | > echo 'testing ssh1' |
|
15 | 15 | > echo "${commands}" | hg --verbose debugwireproto --localssh |
|
16 | 16 | > echo "" |
|
17 | 17 | > echo 'testing ssh2' |
|
18 | 18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh |
|
19 | 19 | > } |
|
20 | 20 | |
|
21 | 21 | $ cat >> $HGRCPATH << EOF |
|
22 | 22 | > [ui] |
|
23 | 23 | > ssh = $PYTHON "$TESTDIR/dummyssh" |
|
24 | 24 | > [devel] |
|
25 | 25 | > debug.peer-request = true |
|
26 | 26 | > [extensions] |
|
27 | 27 | > sshprotoext = $TESTDIR/sshprotoext.py |
|
28 | 28 | > EOF |
|
29 | 29 | |
|
30 | 30 | $ hg init server |
|
31 | 31 | $ cd server |
|
32 | 32 | $ echo 0 > foo |
|
33 | 33 | $ hg -q add foo |
|
34 | 34 | $ hg commit -m initial |
|
35 | 35 | |
|
36 | 36 | A no-op connection performs a handshake |
|
37 | 37 | |
|
38 | 38 | $ hg debugwireproto --localssh << EOF |
|
39 | 39 | > EOF |
|
40 | 40 | creating ssh peer from handshake results |
|
41 | 41 | |
|
42 | 42 | Raw peers don't perform any activity |
|
43 | 43 | |
|
44 | 44 | $ hg debugwireproto --localssh --peer raw << EOF |
|
45 | 45 | > EOF |
|
46 | 46 | using raw connection to peer |
|
47 | 47 | $ hg debugwireproto --localssh --peer ssh1 << EOF |
|
48 | 48 | > EOF |
|
49 | 49 | creating ssh peer for wire protocol version 1 |
|
50 | 50 | $ hg debugwireproto --localssh --peer ssh2 << EOF |
|
51 | 51 | > EOF |
|
52 | 52 | creating ssh peer for wire protocol version 2 |
|
53 | 53 | |
|
54 | 54 | Test a normal behaving server, for sanity |
|
55 | 55 | |
|
56 | 56 | $ cd .. |
|
57 | 57 | |
|
58 | 58 | $ hg --debug debugpeer ssh://user@dummy/server |
|
59 | 59 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
60 | 60 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
61 | 61 | devel-peer-request: hello |
|
62 | 62 | sending hello command |
|
63 | 63 | devel-peer-request: between |
|
64 | 64 | devel-peer-request: pairs: 81 bytes |
|
65 | 65 | sending between command |
|
66 | 66 | remote: 384 |
|
67 | 67 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
68 | 68 | remote: 1 |
|
69 | 69 | url: ssh://user@dummy/server |
|
70 | 70 | local: no |
|
71 | 71 | pushable: yes |
|
72 | 72 | |
|
73 | 73 | Server should answer the "hello" command in isolation |
|
74 | 74 | |
|
75 | 75 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
76 | 76 | > raw |
|
77 | 77 | > hello\n |
|
78 | 78 | > readline |
|
79 | 79 | > readline |
|
80 | 80 | > EOF |
|
81 | 81 | using raw connection to peer |
|
82 | 82 | i> write(6) -> 6: |
|
83 | 83 | i> hello\n |
|
84 | 84 | o> readline() -> 4: |
|
85 | 85 | o> 384\n |
|
86 | 86 | o> readline() -> 384: |
|
87 | 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 | 89 | `hg debugserve --sshstdio` works |
|
90 | 90 | |
|
91 | 91 | $ cd server |
|
92 | 92 | $ hg debugserve --sshstdio << EOF |
|
93 | 93 | > hello |
|
94 | 94 | > EOF |
|
95 | 95 | 384 |
|
96 | 96 | capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
97 | 97 | |
|
98 | 98 | I/O logging works |
|
99 | 99 | |
|
100 | 100 | $ hg debugserve --sshstdio --logiofd 1 << EOF |
|
101 | 101 | > hello |
|
102 | 102 | > EOF |
|
103 | 103 | o> write(4) -> 4: |
|
104 | 104 | o> 384\n |
|
105 | 105 | o> write(384) -> 384: |
|
106 | 106 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
107 | 107 | 384 |
|
108 | 108 | capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
109 | 109 | o> flush() -> None |
|
110 | 110 | |
|
111 | 111 | $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF |
|
112 | 112 | > hello |
|
113 | 113 | > EOF |
|
114 | 114 | 384 |
|
115 | 115 | capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
116 | 116 | |
|
117 | 117 | $ cat $TESTTMP/io |
|
118 | 118 | o> write(4) -> 4: |
|
119 | 119 | o> 384\n |
|
120 | 120 | o> write(384) -> 384: |
|
121 | 121 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
122 | 122 | o> flush() -> None |
|
123 | 123 | |
|
124 | 124 | $ cd .. |
|
125 | 125 | |
|
126 | 126 | >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. |
|
127 | 127 | Server should reply with capabilities and should send "1\n\n" as a successful |
|
128 | 128 | reply with empty response to the "between". |
|
129 | 129 | |
|
130 | 130 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
131 | 131 | > raw |
|
132 | 132 | > hello\n |
|
133 | 133 | > readline |
|
134 | 134 | > readline |
|
135 | 135 | > raw |
|
136 | 136 | > between\n |
|
137 | 137 | > pairs 81\n |
|
138 | 138 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
139 | 139 | > readline |
|
140 | 140 | > readline |
|
141 | 141 | > EOF |
|
142 | 142 | using raw connection to peer |
|
143 | 143 | i> write(6) -> 6: |
|
144 | 144 | i> hello\n |
|
145 | 145 | o> readline() -> 4: |
|
146 | 146 | o> 384\n |
|
147 | 147 | o> readline() -> 384: |
|
148 | 148 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
149 | 149 | i> write(98) -> 98: |
|
150 | 150 | i> between\n |
|
151 | 151 | i> pairs 81\n |
|
152 | 152 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
153 | 153 | o> readline() -> 2: |
|
154 | 154 | o> 1\n |
|
155 | 155 | o> readline() -> 1: |
|
156 | 156 | o> \n |
|
157 | 157 | |
|
158 | 158 | SSH banner is not printed by default, ignored by clients |
|
159 | 159 | |
|
160 | 160 | $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server |
|
161 | 161 | url: ssh://user@dummy/server |
|
162 | 162 | local: no |
|
163 | 163 | pushable: yes |
|
164 | 164 | |
|
165 | 165 | --debug will print the banner |
|
166 | 166 | |
|
167 | 167 | $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server |
|
168 | 168 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
169 | 169 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
170 | 170 | devel-peer-request: hello |
|
171 | 171 | sending hello command |
|
172 | 172 | devel-peer-request: between |
|
173 | 173 | devel-peer-request: pairs: 81 bytes |
|
174 | 174 | sending between command |
|
175 | 175 | remote: banner: line 0 |
|
176 | 176 | remote: banner: line 1 |
|
177 | 177 | remote: banner: line 2 |
|
178 | 178 | remote: banner: line 3 |
|
179 | 179 | remote: banner: line 4 |
|
180 | 180 | remote: banner: line 5 |
|
181 | 181 | remote: banner: line 6 |
|
182 | 182 | remote: banner: line 7 |
|
183 | 183 | remote: banner: line 8 |
|
184 | 184 | remote: banner: line 9 |
|
185 | 185 | remote: 384 |
|
186 | 186 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
187 | 187 | remote: 1 |
|
188 | 188 | url: ssh://user@dummy/server |
|
189 | 189 | local: no |
|
190 | 190 | pushable: yes |
|
191 | 191 | |
|
192 | 192 | And test the banner with the raw protocol |
|
193 | 193 | |
|
194 | 194 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF |
|
195 | 195 | > raw |
|
196 | 196 | > hello\n |
|
197 | 197 | > readline |
|
198 | 198 | > readline |
|
199 | 199 | > readline |
|
200 | 200 | > readline |
|
201 | 201 | > readline |
|
202 | 202 | > readline |
|
203 | 203 | > readline |
|
204 | 204 | > readline |
|
205 | 205 | > readline |
|
206 | 206 | > readline |
|
207 | 207 | > readline |
|
208 | 208 | > readline |
|
209 | 209 | > raw |
|
210 | 210 | > between\n |
|
211 | 211 | > pairs 81\n |
|
212 | 212 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
213 | 213 | > readline |
|
214 | 214 | > readline |
|
215 | 215 | > EOF |
|
216 | 216 | using raw connection to peer |
|
217 | 217 | i> write(6) -> 6: |
|
218 | 218 | i> hello\n |
|
219 | 219 | o> readline() -> 15: |
|
220 | 220 | o> banner: line 0\n |
|
221 | 221 | o> readline() -> 15: |
|
222 | 222 | o> banner: line 1\n |
|
223 | 223 | o> readline() -> 15: |
|
224 | 224 | o> banner: line 2\n |
|
225 | 225 | o> readline() -> 15: |
|
226 | 226 | o> banner: line 3\n |
|
227 | 227 | o> readline() -> 15: |
|
228 | 228 | o> banner: line 4\n |
|
229 | 229 | o> readline() -> 15: |
|
230 | 230 | o> banner: line 5\n |
|
231 | 231 | o> readline() -> 15: |
|
232 | 232 | o> banner: line 6\n |
|
233 | 233 | o> readline() -> 15: |
|
234 | 234 | o> banner: line 7\n |
|
235 | 235 | o> readline() -> 15: |
|
236 | 236 | o> banner: line 8\n |
|
237 | 237 | o> readline() -> 15: |
|
238 | 238 | o> banner: line 9\n |
|
239 | 239 | o> readline() -> 4: |
|
240 | 240 | o> 384\n |
|
241 | 241 | o> readline() -> 384: |
|
242 | 242 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
243 | 243 | i> write(98) -> 98: |
|
244 | 244 | i> between\n |
|
245 | 245 | i> pairs 81\n |
|
246 | 246 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
247 | 247 | o> readline() -> 2: |
|
248 | 248 | o> 1\n |
|
249 | 249 | o> readline() -> 1: |
|
250 | 250 | o> \n |
|
251 | 251 | |
|
252 | 252 | Connecting to a <0.9.1 server that doesn't support the hello command. |
|
253 | 253 | The client should refuse, as we dropped support for connecting to such |
|
254 | 254 | servers. |
|
255 | 255 | |
|
256 | 256 | $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server |
|
257 | 257 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
258 | 258 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
259 | 259 | devel-peer-request: hello |
|
260 | 260 | sending hello command |
|
261 | 261 | devel-peer-request: between |
|
262 | 262 | devel-peer-request: pairs: 81 bytes |
|
263 | 263 | sending between command |
|
264 | 264 | remote: 0 |
|
265 | 265 | remote: 1 |
|
266 | 266 | abort: no suitable response from remote hg! |
|
267 | 267 | [255] |
|
268 | 268 | |
|
269 | 269 | Sending an unknown command to the server results in an empty response to that command |
|
270 | 270 | |
|
271 | 271 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
272 | 272 | > raw |
|
273 | 273 | > pre-hello\n |
|
274 | 274 | > readline |
|
275 | 275 | > raw |
|
276 | 276 | > hello\n |
|
277 | 277 | > readline |
|
278 | 278 | > raw |
|
279 | 279 | > between\n |
|
280 | 280 | > pairs 81\n |
|
281 | 281 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
282 | 282 | > readline |
|
283 | 283 | > readline |
|
284 | 284 | > EOF |
|
285 | 285 | using raw connection to peer |
|
286 | 286 | i> write(10) -> 10: |
|
287 | 287 | i> pre-hello\n |
|
288 | 288 | o> readline() -> 2: |
|
289 | 289 | o> 0\n |
|
290 | 290 | i> write(6) -> 6: |
|
291 | 291 | i> hello\n |
|
292 | 292 | o> readline() -> 4: |
|
293 | 293 | o> 384\n |
|
294 | 294 | i> write(98) -> 98: |
|
295 | 295 | i> between\n |
|
296 | 296 | i> pairs 81\n |
|
297 | 297 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
298 | 298 | o> readline() -> 384: |
|
299 | 299 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
300 | 300 | o> readline() -> 2: |
|
301 | 301 | o> 1\n |
|
302 | 302 | |
|
303 | 303 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
|
304 | 304 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
305 | 305 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
306 | 306 | sending no-args command |
|
307 | 307 | devel-peer-request: hello |
|
308 | 308 | sending hello command |
|
309 | 309 | devel-peer-request: between |
|
310 | 310 | devel-peer-request: pairs: 81 bytes |
|
311 | 311 | sending between command |
|
312 | 312 | remote: 0 |
|
313 | 313 | remote: 384 |
|
314 | 314 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
315 | 315 | remote: 1 |
|
316 | 316 | url: ssh://user@dummy/server |
|
317 | 317 | local: no |
|
318 | 318 | pushable: yes |
|
319 | 319 | |
|
320 | 320 | Send multiple unknown commands before hello |
|
321 | 321 | |
|
322 | 322 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
323 | 323 | > raw |
|
324 | 324 | > unknown1\n |
|
325 | 325 | > readline |
|
326 | 326 | > raw |
|
327 | 327 | > unknown2\n |
|
328 | 328 | > readline |
|
329 | 329 | > raw |
|
330 | 330 | > unknown3\n |
|
331 | 331 | > readline |
|
332 | 332 | > raw |
|
333 | 333 | > hello\n |
|
334 | 334 | > readline |
|
335 | 335 | > readline |
|
336 | 336 | > raw |
|
337 | 337 | > between\n |
|
338 | 338 | > pairs 81\n |
|
339 | 339 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
340 | 340 | > readline |
|
341 | 341 | > readline |
|
342 | 342 | > EOF |
|
343 | 343 | using raw connection to peer |
|
344 | 344 | i> write(9) -> 9: |
|
345 | 345 | i> unknown1\n |
|
346 | 346 | o> readline() -> 2: |
|
347 | 347 | o> 0\n |
|
348 | 348 | i> write(9) -> 9: |
|
349 | 349 | i> unknown2\n |
|
350 | 350 | o> readline() -> 2: |
|
351 | 351 | o> 0\n |
|
352 | 352 | i> write(9) -> 9: |
|
353 | 353 | i> unknown3\n |
|
354 | 354 | o> readline() -> 2: |
|
355 | 355 | o> 0\n |
|
356 | 356 | i> write(6) -> 6: |
|
357 | 357 | i> hello\n |
|
358 | 358 | o> readline() -> 4: |
|
359 | 359 | o> 384\n |
|
360 | 360 | o> readline() -> 384: |
|
361 | 361 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
362 | 362 | i> write(98) -> 98: |
|
363 | 363 | i> between\n |
|
364 | 364 | i> pairs 81\n |
|
365 | 365 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
366 | 366 | o> readline() -> 2: |
|
367 | 367 | o> 1\n |
|
368 | 368 | o> readline() -> 1: |
|
369 | 369 | o> \n |
|
370 | 370 | |
|
371 | 371 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
|
372 | 372 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
373 | 373 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
374 | 374 | sending unknown1 command |
|
375 | 375 | sending unknown2 command |
|
376 | 376 | sending unknown3 command |
|
377 | 377 | devel-peer-request: hello |
|
378 | 378 | sending hello command |
|
379 | 379 | devel-peer-request: between |
|
380 | 380 | devel-peer-request: pairs: 81 bytes |
|
381 | 381 | sending between command |
|
382 | 382 | remote: 0 |
|
383 | 383 | remote: 0 |
|
384 | 384 | remote: 0 |
|
385 | 385 | remote: 384 |
|
386 | 386 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
387 | 387 | remote: 1 |
|
388 | 388 | url: ssh://user@dummy/server |
|
389 | 389 | local: no |
|
390 | 390 | pushable: yes |
|
391 | 391 | |
|
392 | 392 | Send an unknown command before hello that has arguments |
|
393 | 393 | |
|
394 | 394 | $ cd server |
|
395 | 395 | |
|
396 | 396 | $ hg debugwireproto --localssh --peer raw << EOF |
|
397 | 397 | > raw |
|
398 | 398 | > with-args\n |
|
399 | 399 | > foo 13\n |
|
400 | 400 | > value for foo\n |
|
401 | 401 | > bar 13\n |
|
402 | 402 | > value for bar\n |
|
403 | 403 | > readline |
|
404 | 404 | > readline |
|
405 | 405 | > readline |
|
406 | 406 | > readline |
|
407 | 407 | > readline |
|
408 | 408 | > raw |
|
409 | 409 | > hello\n |
|
410 | 410 | > readline |
|
411 | 411 | > readline |
|
412 | 412 | > raw |
|
413 | 413 | > between\n |
|
414 | 414 | > pairs 81\n |
|
415 | 415 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
416 | 416 | > readline |
|
417 | 417 | > readline |
|
418 | 418 | > EOF |
|
419 | 419 | using raw connection to peer |
|
420 | 420 | i> write(52) -> 52: |
|
421 | 421 | i> with-args\n |
|
422 | 422 | i> foo 13\n |
|
423 | 423 | i> value for foo\n |
|
424 | 424 | i> bar 13\n |
|
425 | 425 | i> value for bar\n |
|
426 | 426 | o> readline() -> 2: |
|
427 | 427 | o> 0\n |
|
428 | 428 | o> readline() -> 2: |
|
429 | 429 | o> 0\n |
|
430 | 430 | o> readline() -> 2: |
|
431 | 431 | o> 0\n |
|
432 | 432 | o> readline() -> 2: |
|
433 | 433 | o> 0\n |
|
434 | 434 | o> readline() -> 2: |
|
435 | 435 | o> 0\n |
|
436 | 436 | i> write(6) -> 6: |
|
437 | 437 | i> hello\n |
|
438 | 438 | o> readline() -> 4: |
|
439 | 439 | o> 384\n |
|
440 | 440 | o> readline() -> 384: |
|
441 | 441 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
442 | 442 | i> write(98) -> 98: |
|
443 | 443 | i> between\n |
|
444 | 444 | i> pairs 81\n |
|
445 | 445 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
446 | 446 | o> readline() -> 2: |
|
447 | 447 | o> 1\n |
|
448 | 448 | o> readline() -> 1: |
|
449 | 449 | o> \n |
|
450 | 450 | |
|
451 | 451 | Send an unknown command having an argument that looks numeric |
|
452 | 452 | |
|
453 | 453 | $ hg debugwireproto --localssh --peer raw << EOF |
|
454 | 454 | > raw |
|
455 | 455 | > unknown\n |
|
456 | 456 | > foo 1\n |
|
457 | 457 | > 0\n |
|
458 | 458 | > readline |
|
459 | 459 | > readline |
|
460 | 460 | > readline |
|
461 | 461 | > raw |
|
462 | 462 | > hello\n |
|
463 | 463 | > readline |
|
464 | 464 | > readline |
|
465 | 465 | > raw |
|
466 | 466 | > between\n |
|
467 | 467 | > pairs 81\n |
|
468 | 468 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
469 | 469 | > readline |
|
470 | 470 | > readline |
|
471 | 471 | > EOF |
|
472 | 472 | using raw connection to peer |
|
473 | 473 | i> write(16) -> 16: |
|
474 | 474 | i> unknown\n |
|
475 | 475 | i> foo 1\n |
|
476 | 476 | i> 0\n |
|
477 | 477 | o> readline() -> 2: |
|
478 | 478 | o> 0\n |
|
479 | 479 | o> readline() -> 2: |
|
480 | 480 | o> 0\n |
|
481 | 481 | o> readline() -> 2: |
|
482 | 482 | o> 0\n |
|
483 | 483 | i> write(6) -> 6: |
|
484 | 484 | i> hello\n |
|
485 | 485 | o> readline() -> 4: |
|
486 | 486 | o> 384\n |
|
487 | 487 | o> readline() -> 384: |
|
488 | 488 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
489 | 489 | i> write(98) -> 98: |
|
490 | 490 | i> between\n |
|
491 | 491 | i> pairs 81\n |
|
492 | 492 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
493 | 493 | o> readline() -> 2: |
|
494 | 494 | o> 1\n |
|
495 | 495 | o> readline() -> 1: |
|
496 | 496 | o> \n |
|
497 | 497 | |
|
498 | 498 | $ hg debugwireproto --localssh --peer raw << EOF |
|
499 | 499 | > raw |
|
500 | 500 | > unknown\n |
|
501 | 501 | > foo 1\n |
|
502 | 502 | > 1\n |
|
503 | 503 | > readline |
|
504 | 504 | > readline |
|
505 | 505 | > readline |
|
506 | 506 | > raw |
|
507 | 507 | > hello\n |
|
508 | 508 | > readline |
|
509 | 509 | > readline |
|
510 | 510 | > raw |
|
511 | 511 | > between\n |
|
512 | 512 | > pairs 81\n |
|
513 | 513 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
514 | 514 | > readline |
|
515 | 515 | > readline |
|
516 | 516 | > EOF |
|
517 | 517 | using raw connection to peer |
|
518 | 518 | i> write(16) -> 16: |
|
519 | 519 | i> unknown\n |
|
520 | 520 | i> foo 1\n |
|
521 | 521 | i> 1\n |
|
522 | 522 | o> readline() -> 2: |
|
523 | 523 | o> 0\n |
|
524 | 524 | o> readline() -> 2: |
|
525 | 525 | o> 0\n |
|
526 | 526 | o> readline() -> 2: |
|
527 | 527 | o> 0\n |
|
528 | 528 | i> write(6) -> 6: |
|
529 | 529 | i> hello\n |
|
530 | 530 | o> readline() -> 4: |
|
531 | 531 | o> 384\n |
|
532 | 532 | o> readline() -> 384: |
|
533 | 533 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
534 | 534 | i> write(98) -> 98: |
|
535 | 535 | i> between\n |
|
536 | 536 | i> pairs 81\n |
|
537 | 537 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
538 | 538 | o> readline() -> 2: |
|
539 | 539 | o> 1\n |
|
540 | 540 | o> readline() -> 1: |
|
541 | 541 | o> \n |
|
542 | 542 | |
|
543 | 543 | When sending a dict argument value, it is serialized to |
|
544 | 544 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
|
545 | 545 | in the dict. |
|
546 | 546 | |
|
547 | 547 | Dictionary value for unknown command |
|
548 | 548 | |
|
549 | 549 | $ hg debugwireproto --localssh --peer raw << EOF |
|
550 | 550 | > raw |
|
551 | 551 | > unknown\n |
|
552 | 552 | > dict 3\n |
|
553 | 553 | > key1 3\n |
|
554 | 554 | > foo\n |
|
555 | 555 | > key2 3\n |
|
556 | 556 | > bar\n |
|
557 | 557 | > key3 3\n |
|
558 | 558 | > baz\n |
|
559 | 559 | > readline |
|
560 | 560 | > readline |
|
561 | 561 | > readline |
|
562 | 562 | > readline |
|
563 | 563 | > readline |
|
564 | 564 | > readline |
|
565 | 565 | > readline |
|
566 | 566 | > readline |
|
567 | 567 | > raw |
|
568 | 568 | > hello\n |
|
569 | 569 | > readline |
|
570 | 570 | > readline |
|
571 | 571 | > EOF |
|
572 | 572 | using raw connection to peer |
|
573 | 573 | i> write(48) -> 48: |
|
574 | 574 | i> unknown\n |
|
575 | 575 | i> dict 3\n |
|
576 | 576 | i> key1 3\n |
|
577 | 577 | i> foo\n |
|
578 | 578 | i> key2 3\n |
|
579 | 579 | i> bar\n |
|
580 | 580 | i> key3 3\n |
|
581 | 581 | i> baz\n |
|
582 | 582 | o> readline() -> 2: |
|
583 | 583 | o> 0\n |
|
584 | 584 | o> readline() -> 2: |
|
585 | 585 | o> 0\n |
|
586 | 586 | o> readline() -> 2: |
|
587 | 587 | o> 0\n |
|
588 | 588 | o> readline() -> 2: |
|
589 | 589 | o> 0\n |
|
590 | 590 | o> readline() -> 2: |
|
591 | 591 | o> 0\n |
|
592 | 592 | o> readline() -> 2: |
|
593 | 593 | o> 0\n |
|
594 | 594 | o> readline() -> 2: |
|
595 | 595 | o> 0\n |
|
596 | 596 | o> readline() -> 2: |
|
597 | 597 | o> 0\n |
|
598 | 598 | i> write(6) -> 6: |
|
599 | 599 | i> hello\n |
|
600 | 600 | o> readline() -> 4: |
|
601 | 601 | o> 384\n |
|
602 | 602 | o> readline() -> 384: |
|
603 | 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 | 605 | Incomplete dictionary send |
|
606 | 606 | |
|
607 | 607 | $ hg debugwireproto --localssh --peer raw << EOF |
|
608 | 608 | > raw |
|
609 | 609 | > unknown\n |
|
610 | 610 | > dict 3\n |
|
611 | 611 | > key1 3\n |
|
612 | 612 | > foo\n |
|
613 | 613 | > readline |
|
614 | 614 | > readline |
|
615 | 615 | > readline |
|
616 | 616 | > readline |
|
617 | 617 | > EOF |
|
618 | 618 | using raw connection to peer |
|
619 | 619 | i> write(26) -> 26: |
|
620 | 620 | i> unknown\n |
|
621 | 621 | i> dict 3\n |
|
622 | 622 | i> key1 3\n |
|
623 | 623 | i> foo\n |
|
624 | 624 | o> readline() -> 2: |
|
625 | 625 | o> 0\n |
|
626 | 626 | o> readline() -> 2: |
|
627 | 627 | o> 0\n |
|
628 | 628 | o> readline() -> 2: |
|
629 | 629 | o> 0\n |
|
630 | 630 | o> readline() -> 2: |
|
631 | 631 | o> 0\n |
|
632 | 632 | |
|
633 | 633 | Incomplete value send |
|
634 | 634 | |
|
635 | 635 | $ hg debugwireproto --localssh --peer raw << EOF |
|
636 | 636 | > raw |
|
637 | 637 | > unknown\n |
|
638 | 638 | > dict 3\n |
|
639 | 639 | > key1 3\n |
|
640 | 640 | > fo |
|
641 | 641 | > readline |
|
642 | 642 | > readline |
|
643 | 643 | > readline |
|
644 | 644 | > EOF |
|
645 | 645 | using raw connection to peer |
|
646 | 646 | i> write(24) -> 24: |
|
647 | 647 | i> unknown\n |
|
648 | 648 | i> dict 3\n |
|
649 | 649 | i> key1 3\n |
|
650 | 650 | i> fo |
|
651 | 651 | o> readline() -> 2: |
|
652 | 652 | o> 0\n |
|
653 | 653 | o> readline() -> 2: |
|
654 | 654 | o> 0\n |
|
655 | 655 | o> readline() -> 2: |
|
656 | 656 | o> 0\n |
|
657 | 657 | |
|
658 | 658 | Send a command line with spaces |
|
659 | 659 | |
|
660 | 660 | $ hg debugwireproto --localssh --peer raw << EOF |
|
661 | 661 | > raw |
|
662 | 662 | > unknown withspace\n |
|
663 | 663 | > readline |
|
664 | 664 | > raw |
|
665 | 665 | > hello\n |
|
666 | 666 | > readline |
|
667 | 667 | > readline |
|
668 | 668 | > raw |
|
669 | 669 | > between\n |
|
670 | 670 | > pairs 81\n |
|
671 | 671 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
672 | 672 | > readline |
|
673 | 673 | > readline |
|
674 | 674 | > EOF |
|
675 | 675 | using raw connection to peer |
|
676 | 676 | i> write(18) -> 18: |
|
677 | 677 | i> unknown withspace\n |
|
678 | 678 | o> readline() -> 2: |
|
679 | 679 | o> 0\n |
|
680 | 680 | i> write(6) -> 6: |
|
681 | 681 | i> hello\n |
|
682 | 682 | o> readline() -> 4: |
|
683 | 683 | o> 384\n |
|
684 | 684 | o> readline() -> 384: |
|
685 | 685 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
686 | 686 | i> write(98) -> 98: |
|
687 | 687 | i> between\n |
|
688 | 688 | i> pairs 81\n |
|
689 | 689 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
690 | 690 | o> readline() -> 2: |
|
691 | 691 | o> 1\n |
|
692 | 692 | o> readline() -> 1: |
|
693 | 693 | o> \n |
|
694 | 694 | |
|
695 | 695 | $ hg debugwireproto --localssh --peer raw << EOF |
|
696 | 696 | > raw |
|
697 | 697 | > unknown with multiple spaces\n |
|
698 | 698 | > readline |
|
699 | 699 | > raw |
|
700 | 700 | > hello\n |
|
701 | 701 | > readline |
|
702 | 702 | > readline |
|
703 | 703 | > raw |
|
704 | 704 | > between\n |
|
705 | 705 | > pairs 81\n |
|
706 | 706 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
707 | 707 | > readline |
|
708 | 708 | > EOF |
|
709 | 709 | using raw connection to peer |
|
710 | 710 | i> write(29) -> 29: |
|
711 | 711 | i> unknown with multiple spaces\n |
|
712 | 712 | o> readline() -> 2: |
|
713 | 713 | o> 0\n |
|
714 | 714 | i> write(6) -> 6: |
|
715 | 715 | i> hello\n |
|
716 | 716 | o> readline() -> 4: |
|
717 | 717 | o> 384\n |
|
718 | 718 | o> readline() -> 384: |
|
719 | 719 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
720 | 720 | i> write(98) -> 98: |
|
721 | 721 | i> between\n |
|
722 | 722 | i> pairs 81\n |
|
723 | 723 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
724 | 724 | o> readline() -> 2: |
|
725 | 725 | o> 1\n |
|
726 | 726 | |
|
727 | 727 | $ hg debugwireproto --localssh --peer raw << EOF |
|
728 | 728 | > raw |
|
729 | 729 | > unknown with spaces\n |
|
730 | 730 | > key 10\n |
|
731 | 731 | > some value\n |
|
732 | 732 | > readline |
|
733 | 733 | > readline |
|
734 | 734 | > readline |
|
735 | 735 | > raw |
|
736 | 736 | > hello\n |
|
737 | 737 | > readline |
|
738 | 738 | > readline |
|
739 | 739 | > raw |
|
740 | 740 | > between\n |
|
741 | 741 | > pairs 81\n |
|
742 | 742 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
743 | 743 | > readline |
|
744 | 744 | > readline |
|
745 | 745 | > EOF |
|
746 | 746 | using raw connection to peer |
|
747 | 747 | i> write(38) -> 38: |
|
748 | 748 | i> unknown with spaces\n |
|
749 | 749 | i> key 10\n |
|
750 | 750 | i> some value\n |
|
751 | 751 | o> readline() -> 2: |
|
752 | 752 | o> 0\n |
|
753 | 753 | o> readline() -> 2: |
|
754 | 754 | o> 0\n |
|
755 | 755 | o> readline() -> 2: |
|
756 | 756 | o> 0\n |
|
757 | 757 | i> write(6) -> 6: |
|
758 | 758 | i> hello\n |
|
759 | 759 | o> readline() -> 4: |
|
760 | 760 | o> 384\n |
|
761 | 761 | o> readline() -> 384: |
|
762 | 762 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
763 | 763 | i> write(98) -> 98: |
|
764 | 764 | i> between\n |
|
765 | 765 | i> pairs 81\n |
|
766 | 766 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
767 | 767 | o> readline() -> 2: |
|
768 | 768 | o> 1\n |
|
769 | 769 | o> readline() -> 1: |
|
770 | 770 | o> \n |
|
771 | 771 | |
|
772 | 772 | Send an unknown command after the "between" |
|
773 | 773 | |
|
774 | 774 | $ hg debugwireproto --localssh --peer raw << EOF |
|
775 | 775 | > raw |
|
776 | 776 | > hello\n |
|
777 | 777 | > readline |
|
778 | 778 | > readline |
|
779 | 779 | > raw |
|
780 | 780 | > between\n |
|
781 | 781 | > pairs 81\n |
|
782 | 782 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
783 | 783 | > readline |
|
784 | 784 | > readline |
|
785 | 785 | > EOF |
|
786 | 786 | using raw connection to peer |
|
787 | 787 | i> write(6) -> 6: |
|
788 | 788 | i> hello\n |
|
789 | 789 | o> readline() -> 4: |
|
790 | 790 | o> 384\n |
|
791 | 791 | o> readline() -> 384: |
|
792 | 792 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
793 | 793 | i> write(105) -> 105: |
|
794 | 794 | i> between\n |
|
795 | 795 | i> pairs 81\n |
|
796 | 796 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
797 | 797 | o> readline() -> 2: |
|
798 | 798 | o> 1\n |
|
799 | 799 | o> readline() -> 1: |
|
800 | 800 | o> \n |
|
801 | 801 | |
|
802 | 802 | And one with arguments |
|
803 | 803 | |
|
804 | 804 | $ hg debugwireproto --localssh --peer raw << EOF |
|
805 | 805 | > raw |
|
806 | 806 | > hello\n |
|
807 | 807 | > between\n |
|
808 | 808 | > pairs 81\n |
|
809 | 809 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
810 | 810 | > readline |
|
811 | 811 | > readline |
|
812 | 812 | > readline |
|
813 | 813 | > readline |
|
814 | 814 | > raw |
|
815 | 815 | > unknown\n |
|
816 | 816 | > foo 5\n |
|
817 | 817 | > \nvalue\n |
|
818 | 818 | > bar 3\n |
|
819 | 819 | > baz\n |
|
820 | 820 | > readline |
|
821 | 821 | > readline |
|
822 | 822 | > readline |
|
823 | 823 | > EOF |
|
824 | 824 | using raw connection to peer |
|
825 | 825 | i> write(104) -> 104: |
|
826 | 826 | i> hello\n |
|
827 | 827 | i> between\n |
|
828 | 828 | i> pairs 81\n |
|
829 | 829 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
830 | 830 | o> readline() -> 4: |
|
831 | 831 | o> 384\n |
|
832 | 832 | o> readline() -> 384: |
|
833 | 833 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
834 | 834 | o> readline() -> 2: |
|
835 | 835 | o> 1\n |
|
836 | 836 | o> readline() -> 1: |
|
837 | 837 | o> \n |
|
838 | 838 | i> write(31) -> 31: |
|
839 | 839 | i> unknown\n |
|
840 | 840 | i> foo 5\n |
|
841 | 841 | i> \n |
|
842 | 842 | i> value\n |
|
843 | 843 | i> bar 3\n |
|
844 | 844 | i> baz\n |
|
845 | 845 | o> readline() -> 2: |
|
846 | 846 | o> 0\n |
|
847 | 847 | o> readline() -> 2: |
|
848 | 848 | o> 0\n |
|
849 | 849 | o> readline() -> 0: |
|
850 | 850 | |
|
851 | 851 | Send a valid command before the handshake |
|
852 | 852 | |
|
853 | 853 | $ hg debugwireproto --localssh --peer raw << EOF |
|
854 | 854 | > raw |
|
855 | 855 | > heads\n |
|
856 | 856 | > readline |
|
857 | 857 | > raw |
|
858 | 858 | > hello\n |
|
859 | 859 | > between\n |
|
860 | 860 | > pairs 81\n |
|
861 | 861 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
862 | 862 | > readline |
|
863 | 863 | > readline |
|
864 | 864 | > readline |
|
865 | 865 | > readline |
|
866 | 866 | > EOF |
|
867 | 867 | using raw connection to peer |
|
868 | 868 | i> write(6) -> 6: |
|
869 | 869 | i> heads\n |
|
870 | 870 | o> readline() -> 3: |
|
871 | 871 | o> 41\n |
|
872 | 872 | i> write(104) -> 104: |
|
873 | 873 | i> hello\n |
|
874 | 874 | i> between\n |
|
875 | 875 | i> pairs 81\n |
|
876 | 876 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
877 | 877 | o> readline() -> 41: |
|
878 | 878 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
879 | 879 | o> readline() -> 4: |
|
880 | 880 | o> 384\n |
|
881 | 881 | o> readline() -> 384: |
|
882 | 882 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
883 | 883 | o> readline() -> 2: |
|
884 | 884 | o> 1\n |
|
885 | 885 | |
|
886 | 886 | And a variation that doesn't send the between command |
|
887 | 887 | |
|
888 | 888 | $ hg debugwireproto --localssh --peer raw << EOF |
|
889 | 889 | > raw |
|
890 | 890 | > heads\n |
|
891 | 891 | > readline |
|
892 | 892 | > raw |
|
893 | 893 | > hello\n |
|
894 | 894 | > readline |
|
895 | 895 | > readline |
|
896 | 896 | > EOF |
|
897 | 897 | using raw connection to peer |
|
898 | 898 | i> write(6) -> 6: |
|
899 | 899 | i> heads\n |
|
900 | 900 | o> readline() -> 3: |
|
901 | 901 | o> 41\n |
|
902 | 902 | i> write(6) -> 6: |
|
903 | 903 | i> hello\n |
|
904 | 904 | o> readline() -> 41: |
|
905 | 905 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
906 | 906 | o> readline() -> 4: |
|
907 | 907 | o> 384\n |
|
908 | 908 | |
|
909 | 909 | Send an upgrade request to a server that doesn't support that command |
|
910 | 910 | |
|
911 | 911 | $ hg debugwireproto --localssh --peer raw << EOF |
|
912 | 912 | > raw |
|
913 | 913 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
914 | 914 | > readline |
|
915 | 915 | > raw |
|
916 | 916 | > hello\n |
|
917 | 917 | > between\n |
|
918 | 918 | > pairs 81\n |
|
919 | 919 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
920 | 920 | > readline |
|
921 | 921 | > readline |
|
922 | 922 | > readline |
|
923 | 923 | > readline |
|
924 | 924 | > EOF |
|
925 | 925 | using raw connection to peer |
|
926 | 926 | i> write(77) -> 77: |
|
927 | 927 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
928 | 928 | o> readline() -> 2: |
|
929 | 929 | o> 0\n |
|
930 | 930 | i> write(104) -> 104: |
|
931 | 931 | i> hello\n |
|
932 | 932 | i> between\n |
|
933 | 933 | i> pairs 81\n |
|
934 | 934 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
935 | 935 | o> readline() -> 4: |
|
936 | 936 | o> 384\n |
|
937 | 937 | o> readline() -> 384: |
|
938 | 938 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
939 | 939 | o> readline() -> 2: |
|
940 | 940 | o> 1\n |
|
941 | 941 | o> readline() -> 1: |
|
942 | 942 | o> \n |
|
943 | 943 | |
|
944 | 944 | $ cd .. |
|
945 | 945 | |
|
946 | 946 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
947 | 947 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
948 | 948 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
949 | 949 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
950 | 950 | devel-peer-request: hello |
|
951 | 951 | sending hello command |
|
952 | 952 | devel-peer-request: between |
|
953 | 953 | devel-peer-request: pairs: 81 bytes |
|
954 | 954 | sending between command |
|
955 | 955 | remote: 0 |
|
956 | 956 | remote: 384 |
|
957 | 957 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
958 | 958 | remote: 1 |
|
959 | 959 | url: ssh://user@dummy/server |
|
960 | 960 | local: no |
|
961 | 961 | pushable: yes |
|
962 | 962 | |
|
963 | 963 | Enable version 2 support on server. We need to do this in hgrc because we can't |
|
964 | 964 | use --config with `hg serve --stdio`. |
|
965 | 965 | |
|
966 | 966 | $ cat >> server/.hg/hgrc << EOF |
|
967 | 967 | > [experimental] |
|
968 | 968 | > sshserver.support-v2 = true |
|
969 | 969 | > EOF |
|
970 | 970 | |
|
971 | 971 | Send an upgrade request to a server that supports upgrade |
|
972 | 972 | |
|
973 | 973 | $ cd server |
|
974 | 974 | |
|
975 | 975 | $ hg debugwireproto --localssh --peer raw << EOF |
|
976 | 976 | > raw |
|
977 | 977 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
978 | 978 | > hello\n |
|
979 | 979 | > between\n |
|
980 | 980 | > pairs 81\n |
|
981 | 981 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
982 | 982 | > readline |
|
983 | 983 | > readline |
|
984 | 984 | > readline |
|
985 | 985 | > EOF |
|
986 | 986 | using raw connection to peer |
|
987 | 987 | i> write(153) -> 153: |
|
988 | 988 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
989 | 989 | i> hello\n |
|
990 | 990 | i> between\n |
|
991 | 991 | i> pairs 81\n |
|
992 | 992 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
993 | 993 | o> readline() -> 44: |
|
994 | 994 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
995 | 995 | o> readline() -> 4: |
|
996 | 996 | o> 383\n |
|
997 | 997 | o> readline() -> 384: |
|
998 | 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 | 1000 | $ cd .. |
|
1001 | 1001 | |
|
1002 | 1002 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
1003 | 1003 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1004 | 1004 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1005 | 1005 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1006 | 1006 | devel-peer-request: hello |
|
1007 | 1007 | sending hello command |
|
1008 | 1008 | devel-peer-request: between |
|
1009 | 1009 | devel-peer-request: pairs: 81 bytes |
|
1010 | 1010 | sending between command |
|
1011 | 1011 | protocol upgraded to exp-ssh-v2-0001 |
|
1012 | 1012 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1013 | 1013 | url: ssh://user@dummy/server |
|
1014 | 1014 | local: no |
|
1015 | 1015 | pushable: yes |
|
1016 | 1016 | |
|
1017 | 1017 | Verify the peer has capabilities |
|
1018 | 1018 | |
|
1019 | 1019 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server |
|
1020 | 1020 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1021 | 1021 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1022 | 1022 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1023 | 1023 | devel-peer-request: hello |
|
1024 | 1024 | sending hello command |
|
1025 | 1025 | devel-peer-request: between |
|
1026 | 1026 | devel-peer-request: pairs: 81 bytes |
|
1027 | 1027 | sending between command |
|
1028 | 1028 | protocol upgraded to exp-ssh-v2-0001 |
|
1029 | 1029 | remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN |
|
1030 | 1030 | Main capabilities: |
|
1031 | 1031 | batch |
|
1032 | 1032 | branchmap |
|
1033 | 1033 | $USUAL_BUNDLE2_CAPS_SERVER$ |
|
1034 | 1034 | changegroupsubset |
|
1035 | 1035 | getbundle |
|
1036 | 1036 | known |
|
1037 | 1037 | lookup |
|
1038 | 1038 | pushkey |
|
1039 | 1039 | streamreqs=generaldelta,revlogv1 |
|
1040 | 1040 | unbundle=HG10GZ,HG10BZ,HG10UN |
|
1041 | 1041 | unbundlehash |
|
1042 | 1042 | Bundle2 capabilities: |
|
1043 | 1043 | HG20 |
|
1044 | 1044 | bookmarks |
|
1045 | 1045 | changegroup |
|
1046 | 1046 | 01 |
|
1047 | 1047 | 02 |
|
1048 | 1048 | digests |
|
1049 | 1049 | md5 |
|
1050 | 1050 | sha1 |
|
1051 | 1051 | sha512 |
|
1052 | 1052 | error |
|
1053 | 1053 | abort |
|
1054 | 1054 | unsupportedcontent |
|
1055 | 1055 | pushraced |
|
1056 | 1056 | pushkey |
|
1057 | 1057 | hgtagsfnodes |
|
1058 | 1058 | listkeys |
|
1059 | 1059 | phases |
|
1060 | 1060 | heads |
|
1061 | 1061 | pushkey |
|
1062 | 1062 | remote-changegroup |
|
1063 | 1063 | http |
|
1064 | 1064 | https |
|
1065 | 1065 | |
|
1066 | 1066 | Command after upgrade to version 2 is processed |
|
1067 | 1067 | |
|
1068 | 1068 | $ cd server |
|
1069 | 1069 | |
|
1070 | 1070 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1071 | 1071 | > raw |
|
1072 | 1072 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1073 | 1073 | > hello\n |
|
1074 | 1074 | > between\n |
|
1075 | 1075 | > pairs 81\n |
|
1076 | 1076 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1077 | 1077 | > readline |
|
1078 | 1078 | > readline |
|
1079 | 1079 | > readline |
|
1080 | 1080 | > raw |
|
1081 | 1081 | > hello\n |
|
1082 | 1082 | > readline |
|
1083 | 1083 | > readline |
|
1084 | 1084 | > EOF |
|
1085 | 1085 | using raw connection to peer |
|
1086 | 1086 | i> write(153) -> 153: |
|
1087 | 1087 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1088 | 1088 | i> hello\n |
|
1089 | 1089 | i> between\n |
|
1090 | 1090 | i> pairs 81\n |
|
1091 | 1091 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1092 | 1092 | o> readline() -> 44: |
|
1093 | 1093 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1094 | 1094 | o> readline() -> 4: |
|
1095 | 1095 | o> 383\n |
|
1096 | 1096 | o> readline() -> 384: |
|
1097 | 1097 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1098 | 1098 | i> write(6) -> 6: |
|
1099 | 1099 | i> hello\n |
|
1100 | 1100 | o> readline() -> 4: |
|
1101 | 1101 | o> 366\n |
|
1102 | 1102 | o> readline() -> 366: |
|
1103 | 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 | 1105 | Multiple upgrades is not allowed |
|
1106 | 1106 | |
|
1107 | 1107 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1108 | 1108 | > raw |
|
1109 | 1109 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1110 | 1110 | > hello\n |
|
1111 | 1111 | > between\n |
|
1112 | 1112 | > pairs 81\n |
|
1113 | 1113 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1114 | 1114 | > readline |
|
1115 | 1115 | > readline |
|
1116 | 1116 | > readline |
|
1117 | 1117 | > raw |
|
1118 | 1118 | > upgrade another-token proto=irrelevant\n |
|
1119 | 1119 | > hello\n |
|
1120 | 1120 | > readline |
|
1121 | 1121 | > readavailable |
|
1122 | 1122 | > EOF |
|
1123 | 1123 | using raw connection to peer |
|
1124 | 1124 | i> write(153) -> 153: |
|
1125 | 1125 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1126 | 1126 | i> hello\n |
|
1127 | 1127 | i> between\n |
|
1128 | 1128 | i> pairs 81\n |
|
1129 | 1129 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1130 | 1130 | o> readline() -> 44: |
|
1131 | 1131 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1132 | 1132 | o> readline() -> 4: |
|
1133 | 1133 | o> 383\n |
|
1134 | 1134 | o> readline() -> 384: |
|
1135 | 1135 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1136 | 1136 | i> write(45) -> 45: |
|
1137 | 1137 | i> upgrade another-token proto=irrelevant\n |
|
1138 | 1138 | i> hello\n |
|
1139 | 1139 | o> readline() -> 1: |
|
1140 | 1140 | o> \n |
|
1141 | o> read(-1) -> 0: | |
|
1141 | 1142 | e> read(-1) -> 42: |
|
1142 | 1143 | e> cannot upgrade protocols multiple times\n |
|
1143 | 1144 | e> -\n |
|
1144 | 1145 | |
|
1145 | 1146 | Malformed upgrade request line (not exactly 3 space delimited tokens) |
|
1146 | 1147 | |
|
1147 | 1148 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1148 | 1149 | > raw |
|
1149 | 1150 | > upgrade\n |
|
1150 | 1151 | > readline |
|
1151 | 1152 | > EOF |
|
1152 | 1153 | using raw connection to peer |
|
1153 | 1154 | i> write(8) -> 8: |
|
1154 | 1155 | i> upgrade\n |
|
1155 | 1156 | o> readline() -> 2: |
|
1156 | 1157 | o> 0\n |
|
1157 | 1158 | |
|
1158 | 1159 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1159 | 1160 | > raw |
|
1160 | 1161 | > upgrade token\n |
|
1161 | 1162 | > readline |
|
1162 | 1163 | > EOF |
|
1163 | 1164 | using raw connection to peer |
|
1164 | 1165 | i> write(14) -> 14: |
|
1165 | 1166 | i> upgrade token\n |
|
1166 | 1167 | o> readline() -> 2: |
|
1167 | 1168 | o> 0\n |
|
1168 | 1169 | |
|
1169 | 1170 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1170 | 1171 | > raw |
|
1171 | 1172 | > upgrade token foo=bar extra-token\n |
|
1172 | 1173 | > readline |
|
1173 | 1174 | > EOF |
|
1174 | 1175 | using raw connection to peer |
|
1175 | 1176 | i> write(34) -> 34: |
|
1176 | 1177 | i> upgrade token foo=bar extra-token\n |
|
1177 | 1178 | o> readline() -> 2: |
|
1178 | 1179 | o> 0\n |
|
1179 | 1180 | |
|
1180 | 1181 | Upgrade request to unsupported protocol is ignored |
|
1181 | 1182 | |
|
1182 | 1183 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1183 | 1184 | > raw |
|
1184 | 1185 | > upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1185 | 1186 | > readline |
|
1186 | 1187 | > raw |
|
1187 | 1188 | > hello\n |
|
1188 | 1189 | > readline |
|
1189 | 1190 | > readline |
|
1190 | 1191 | > raw |
|
1191 | 1192 | > between\n |
|
1192 | 1193 | > pairs 81\n |
|
1193 | 1194 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1194 | 1195 | > readline |
|
1195 | 1196 | > readline |
|
1196 | 1197 | > EOF |
|
1197 | 1198 | using raw connection to peer |
|
1198 | 1199 | i> write(51) -> 51: |
|
1199 | 1200 | i> upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1200 | 1201 | o> readline() -> 2: |
|
1201 | 1202 | o> 0\n |
|
1202 | 1203 | i> write(6) -> 6: |
|
1203 | 1204 | i> hello\n |
|
1204 | 1205 | o> readline() -> 4: |
|
1205 | 1206 | o> 384\n |
|
1206 | 1207 | o> readline() -> 384: |
|
1207 | 1208 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1208 | 1209 | i> write(98) -> 98: |
|
1209 | 1210 | i> between\n |
|
1210 | 1211 | i> pairs 81\n |
|
1211 | 1212 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1212 | 1213 | o> readline() -> 2: |
|
1213 | 1214 | o> 1\n |
|
1214 | 1215 | o> readline() -> 1: |
|
1215 | 1216 | o> \n |
|
1216 | 1217 | |
|
1217 | 1218 | Upgrade request must be followed by hello + between |
|
1218 | 1219 | |
|
1219 | 1220 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1220 | 1221 | > raw |
|
1221 | 1222 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1222 | 1223 | > invalid\n |
|
1223 | 1224 | > readline |
|
1224 | 1225 | > readavailable |
|
1225 | 1226 | > EOF |
|
1226 | 1227 | using raw connection to peer |
|
1227 | 1228 | i> write(44) -> 44: |
|
1228 | 1229 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1229 | 1230 | i> invalid\n |
|
1230 | 1231 | o> readline() -> 1: |
|
1231 | 1232 | o> \n |
|
1233 | o> read(-1) -> 0: | |
|
1232 | 1234 | e> read(-1) -> 46: |
|
1233 | 1235 | e> malformed handshake protocol: missing hello\n |
|
1234 | 1236 | e> -\n |
|
1235 | 1237 | |
|
1236 | 1238 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1237 | 1239 | > raw |
|
1238 | 1240 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1239 | 1241 | > hello\n |
|
1240 | 1242 | > invalid\n |
|
1241 | 1243 | > readline |
|
1242 | 1244 | > readavailable |
|
1243 | 1245 | > EOF |
|
1244 | 1246 | using raw connection to peer |
|
1245 | 1247 | i> write(50) -> 50: |
|
1246 | 1248 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1247 | 1249 | i> hello\n |
|
1248 | 1250 | i> invalid\n |
|
1249 | 1251 | o> readline() -> 1: |
|
1250 | 1252 | o> \n |
|
1253 | o> read(-1) -> 0: | |
|
1251 | 1254 | e> read(-1) -> 48: |
|
1252 | 1255 | e> malformed handshake protocol: missing between\n |
|
1253 | 1256 | e> -\n |
|
1254 | 1257 | |
|
1255 | 1258 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1256 | 1259 | > raw |
|
1257 | 1260 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1258 | 1261 | > hello\n |
|
1259 | 1262 | > between\n |
|
1260 | 1263 | > invalid\n |
|
1261 | 1264 | > readline |
|
1262 | 1265 | > readavailable |
|
1263 | 1266 | > EOF |
|
1264 | 1267 | using raw connection to peer |
|
1265 | 1268 | i> write(58) -> 58: |
|
1266 | 1269 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1267 | 1270 | i> hello\n |
|
1268 | 1271 | i> between\n |
|
1269 | 1272 | i> invalid\n |
|
1270 | 1273 | o> readline() -> 1: |
|
1271 | 1274 | o> \n |
|
1275 | o> read(-1) -> 0: | |
|
1272 | 1276 | e> read(-1) -> 49: |
|
1273 | 1277 | e> malformed handshake protocol: missing pairs 81\n |
|
1274 | 1278 | e> -\n |
|
1275 | 1279 | |
|
1276 | 1280 | Legacy commands are not exposed to version 2 of protocol |
|
1277 | 1281 | |
|
1278 | 1282 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1279 | 1283 | > command branches |
|
1280 | 1284 | > nodes 0000000000000000000000000000000000000000 |
|
1281 | 1285 | > EOF |
|
1282 | 1286 | creating ssh peer from handshake results |
|
1283 | 1287 | sending branches command |
|
1284 | 1288 | response: |
|
1285 | 1289 | |
|
1286 | 1290 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1287 | 1291 | > command changegroup |
|
1288 | 1292 | > roots 0000000000000000000000000000000000000000 |
|
1289 | 1293 | > EOF |
|
1290 | 1294 | creating ssh peer from handshake results |
|
1291 | 1295 | sending changegroup command |
|
1292 | 1296 | response: |
|
1293 | 1297 | |
|
1294 | 1298 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1295 | 1299 | > command changegroupsubset |
|
1296 | 1300 | > bases 0000000000000000000000000000000000000000 |
|
1297 | 1301 | > heads 0000000000000000000000000000000000000000 |
|
1298 | 1302 | > EOF |
|
1299 | 1303 | creating ssh peer from handshake results |
|
1300 | 1304 | sending changegroupsubset command |
|
1301 | 1305 | response: |
|
1302 | 1306 | |
|
1303 | 1307 | $ cd .. |
|
1304 | 1308 | |
|
1305 | 1309 | Test listkeys for listing namespaces |
|
1306 | 1310 | |
|
1307 | 1311 | $ hg init empty |
|
1308 | 1312 | $ cd empty |
|
1309 | 1313 | $ debugwireproto << EOF |
|
1310 | 1314 | > command listkeys |
|
1311 | 1315 | > namespace namespaces |
|
1312 | 1316 | > EOF |
|
1313 | 1317 | testing ssh1 |
|
1314 | 1318 | creating ssh peer from handshake results |
|
1315 | 1319 | i> write(104) -> 104: |
|
1316 | 1320 | i> hello\n |
|
1317 | 1321 | i> between\n |
|
1318 | 1322 | i> pairs 81\n |
|
1319 | 1323 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1320 | 1324 | i> flush() -> None |
|
1321 | 1325 | o> readline() -> 4: |
|
1322 | 1326 | o> 384\n |
|
1323 | 1327 | o> readline() -> 384: |
|
1324 | 1328 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1325 | 1329 | o> readline() -> 2: |
|
1326 | 1330 | o> 1\n |
|
1327 | 1331 | o> readline() -> 1: |
|
1328 | 1332 | o> \n |
|
1329 | 1333 | sending listkeys command |
|
1330 | 1334 | i> write(9) -> 9: |
|
1331 | 1335 | i> listkeys\n |
|
1332 | 1336 | i> write(13) -> 13: |
|
1333 | 1337 | i> namespace 10\n |
|
1334 | 1338 | i> write(10) -> 10: namespaces |
|
1335 | 1339 | i> flush() -> None |
|
1336 | 1340 | o> bufferedreadline() -> 3: |
|
1337 | 1341 | o> 30\n |
|
1338 | 1342 | o> bufferedread(30) -> 30: |
|
1339 | 1343 | o> bookmarks \n |
|
1340 | 1344 | o> namespaces \n |
|
1341 | 1345 | o> phases |
|
1342 | 1346 | response: bookmarks \nnamespaces \nphases |
|
1343 | 1347 | |
|
1344 | 1348 | testing ssh2 |
|
1345 | 1349 | creating ssh peer from handshake results |
|
1346 | 1350 | i> write(171) -> 171: |
|
1347 | 1351 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1348 | 1352 | i> hello\n |
|
1349 | 1353 | i> between\n |
|
1350 | 1354 | i> pairs 81\n |
|
1351 | 1355 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1352 | 1356 | i> flush() -> None |
|
1353 | 1357 | o> readline() -> 62: |
|
1354 | 1358 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1355 | 1359 | o> readline() -> 4: |
|
1356 | 1360 | o> 383\n |
|
1357 | 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 | 1362 | o> read(1) -> 1: |
|
1359 | 1363 | o> \n |
|
1360 | 1364 | sending listkeys command |
|
1361 | 1365 | i> write(9) -> 9: |
|
1362 | 1366 | i> listkeys\n |
|
1363 | 1367 | i> write(13) -> 13: |
|
1364 | 1368 | i> namespace 10\n |
|
1365 | 1369 | i> write(10) -> 10: namespaces |
|
1366 | 1370 | i> flush() -> None |
|
1367 | 1371 | o> bufferedreadline() -> 3: |
|
1368 | 1372 | o> 30\n |
|
1369 | 1373 | o> bufferedread(30) -> 30: |
|
1370 | 1374 | o> bookmarks \n |
|
1371 | 1375 | o> namespaces \n |
|
1372 | 1376 | o> phases |
|
1373 | 1377 | response: bookmarks \nnamespaces \nphases |
|
1374 | 1378 | |
|
1375 | 1379 | $ cd .. |
|
1376 | 1380 | |
|
1377 | 1381 | Test listkeys for bookmarks |
|
1378 | 1382 | |
|
1379 | 1383 | $ hg init bookmarkrepo |
|
1380 | 1384 | $ cd bookmarkrepo |
|
1381 | 1385 | $ echo 0 > foo |
|
1382 | 1386 | $ hg add foo |
|
1383 | 1387 | $ hg -q commit -m initial |
|
1384 | 1388 | $ echo 1 > foo |
|
1385 | 1389 | $ hg commit -m second |
|
1386 | 1390 | |
|
1387 | 1391 | With no bookmarks set |
|
1388 | 1392 | |
|
1389 | 1393 | $ debugwireproto << EOF |
|
1390 | 1394 | > command listkeys |
|
1391 | 1395 | > namespace bookmarks |
|
1392 | 1396 | > EOF |
|
1393 | 1397 | testing ssh1 |
|
1394 | 1398 | creating ssh peer from handshake results |
|
1395 | 1399 | i> write(104) -> 104: |
|
1396 | 1400 | i> hello\n |
|
1397 | 1401 | i> between\n |
|
1398 | 1402 | i> pairs 81\n |
|
1399 | 1403 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1400 | 1404 | i> flush() -> None |
|
1401 | 1405 | o> readline() -> 4: |
|
1402 | 1406 | o> 384\n |
|
1403 | 1407 | o> readline() -> 384: |
|
1404 | 1408 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1405 | 1409 | o> readline() -> 2: |
|
1406 | 1410 | o> 1\n |
|
1407 | 1411 | o> readline() -> 1: |
|
1408 | 1412 | o> \n |
|
1409 | 1413 | sending listkeys command |
|
1410 | 1414 | i> write(9) -> 9: |
|
1411 | 1415 | i> listkeys\n |
|
1412 | 1416 | i> write(12) -> 12: |
|
1413 | 1417 | i> namespace 9\n |
|
1414 | 1418 | i> write(9) -> 9: bookmarks |
|
1415 | 1419 | i> flush() -> None |
|
1416 | 1420 | o> bufferedreadline() -> 2: |
|
1417 | 1421 | o> 0\n |
|
1418 | 1422 | response: |
|
1419 | 1423 | |
|
1420 | 1424 | testing ssh2 |
|
1421 | 1425 | creating ssh peer from handshake results |
|
1422 | 1426 | i> write(171) -> 171: |
|
1423 | 1427 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1424 | 1428 | i> hello\n |
|
1425 | 1429 | i> between\n |
|
1426 | 1430 | i> pairs 81\n |
|
1427 | 1431 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1428 | 1432 | i> flush() -> None |
|
1429 | 1433 | o> readline() -> 62: |
|
1430 | 1434 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1431 | 1435 | o> readline() -> 4: |
|
1432 | 1436 | o> 383\n |
|
1433 | 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 | 1438 | o> read(1) -> 1: |
|
1435 | 1439 | o> \n |
|
1436 | 1440 | sending listkeys command |
|
1437 | 1441 | i> write(9) -> 9: |
|
1438 | 1442 | i> listkeys\n |
|
1439 | 1443 | i> write(12) -> 12: |
|
1440 | 1444 | i> namespace 9\n |
|
1441 | 1445 | i> write(9) -> 9: bookmarks |
|
1442 | 1446 | i> flush() -> None |
|
1443 | 1447 | o> bufferedreadline() -> 2: |
|
1444 | 1448 | o> 0\n |
|
1445 | 1449 | response: |
|
1446 | 1450 | |
|
1447 | 1451 | With a single bookmark set |
|
1448 | 1452 | |
|
1449 | 1453 | $ hg book -r 0 bookA |
|
1450 | 1454 | $ debugwireproto << EOF |
|
1451 | 1455 | > command listkeys |
|
1452 | 1456 | > namespace bookmarks |
|
1453 | 1457 | > EOF |
|
1454 | 1458 | testing ssh1 |
|
1455 | 1459 | creating ssh peer from handshake results |
|
1456 | 1460 | i> write(104) -> 104: |
|
1457 | 1461 | i> hello\n |
|
1458 | 1462 | i> between\n |
|
1459 | 1463 | i> pairs 81\n |
|
1460 | 1464 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1461 | 1465 | i> flush() -> None |
|
1462 | 1466 | o> readline() -> 4: |
|
1463 | 1467 | o> 384\n |
|
1464 | 1468 | o> readline() -> 384: |
|
1465 | 1469 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1466 | 1470 | o> readline() -> 2: |
|
1467 | 1471 | o> 1\n |
|
1468 | 1472 | o> readline() -> 1: |
|
1469 | 1473 | o> \n |
|
1470 | 1474 | sending listkeys command |
|
1471 | 1475 | i> write(9) -> 9: |
|
1472 | 1476 | i> listkeys\n |
|
1473 | 1477 | i> write(12) -> 12: |
|
1474 | 1478 | i> namespace 9\n |
|
1475 | 1479 | i> write(9) -> 9: bookmarks |
|
1476 | 1480 | i> flush() -> None |
|
1477 | 1481 | o> bufferedreadline() -> 3: |
|
1478 | 1482 | o> 46\n |
|
1479 | 1483 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1480 | 1484 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1481 | 1485 | |
|
1482 | 1486 | testing ssh2 |
|
1483 | 1487 | creating ssh peer from handshake results |
|
1484 | 1488 | i> write(171) -> 171: |
|
1485 | 1489 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1486 | 1490 | i> hello\n |
|
1487 | 1491 | i> between\n |
|
1488 | 1492 | i> pairs 81\n |
|
1489 | 1493 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1490 | 1494 | i> flush() -> None |
|
1491 | 1495 | o> readline() -> 62: |
|
1492 | 1496 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1493 | 1497 | o> readline() -> 4: |
|
1494 | 1498 | o> 383\n |
|
1495 | 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 | 1500 | o> read(1) -> 1: |
|
1497 | 1501 | o> \n |
|
1498 | 1502 | sending listkeys command |
|
1499 | 1503 | i> write(9) -> 9: |
|
1500 | 1504 | i> listkeys\n |
|
1501 | 1505 | i> write(12) -> 12: |
|
1502 | 1506 | i> namespace 9\n |
|
1503 | 1507 | i> write(9) -> 9: bookmarks |
|
1504 | 1508 | i> flush() -> None |
|
1505 | 1509 | o> bufferedreadline() -> 3: |
|
1506 | 1510 | o> 46\n |
|
1507 | 1511 | o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1508 | 1512 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f |
|
1509 | 1513 | |
|
1510 | 1514 | With multiple bookmarks set |
|
1511 | 1515 | |
|
1512 | 1516 | $ hg book -r 1 bookB |
|
1513 | 1517 | $ debugwireproto << EOF |
|
1514 | 1518 | > command listkeys |
|
1515 | 1519 | > namespace bookmarks |
|
1516 | 1520 | > EOF |
|
1517 | 1521 | testing ssh1 |
|
1518 | 1522 | creating ssh peer from handshake results |
|
1519 | 1523 | i> write(104) -> 104: |
|
1520 | 1524 | i> hello\n |
|
1521 | 1525 | i> between\n |
|
1522 | 1526 | i> pairs 81\n |
|
1523 | 1527 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1524 | 1528 | i> flush() -> None |
|
1525 | 1529 | o> readline() -> 4: |
|
1526 | 1530 | o> 384\n |
|
1527 | 1531 | o> readline() -> 384: |
|
1528 | 1532 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1529 | 1533 | o> readline() -> 2: |
|
1530 | 1534 | o> 1\n |
|
1531 | 1535 | o> readline() -> 1: |
|
1532 | 1536 | o> \n |
|
1533 | 1537 | sending listkeys command |
|
1534 | 1538 | i> write(9) -> 9: |
|
1535 | 1539 | i> listkeys\n |
|
1536 | 1540 | i> write(12) -> 12: |
|
1537 | 1541 | i> namespace 9\n |
|
1538 | 1542 | i> write(9) -> 9: bookmarks |
|
1539 | 1543 | i> flush() -> None |
|
1540 | 1544 | o> bufferedreadline() -> 3: |
|
1541 | 1545 | o> 93\n |
|
1542 | 1546 | o> bufferedread(93) -> 93: |
|
1543 | 1547 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1544 | 1548 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1545 | 1549 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1546 | 1550 | |
|
1547 | 1551 | testing ssh2 |
|
1548 | 1552 | creating ssh peer from handshake results |
|
1549 | 1553 | i> write(171) -> 171: |
|
1550 | 1554 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1551 | 1555 | i> hello\n |
|
1552 | 1556 | i> between\n |
|
1553 | 1557 | i> pairs 81\n |
|
1554 | 1558 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1555 | 1559 | i> flush() -> None |
|
1556 | 1560 | o> readline() -> 62: |
|
1557 | 1561 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1558 | 1562 | o> readline() -> 4: |
|
1559 | 1563 | o> 383\n |
|
1560 | 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 | 1565 | o> read(1) -> 1: |
|
1562 | 1566 | o> \n |
|
1563 | 1567 | sending listkeys command |
|
1564 | 1568 | i> write(9) -> 9: |
|
1565 | 1569 | i> listkeys\n |
|
1566 | 1570 | i> write(12) -> 12: |
|
1567 | 1571 | i> namespace 9\n |
|
1568 | 1572 | i> write(9) -> 9: bookmarks |
|
1569 | 1573 | i> flush() -> None |
|
1570 | 1574 | o> bufferedreadline() -> 3: |
|
1571 | 1575 | o> 93\n |
|
1572 | 1576 | o> bufferedread(93) -> 93: |
|
1573 | 1577 | o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1574 | 1578 | o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1575 | 1579 | response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1576 | 1580 | |
|
1577 | 1581 | Test pushkey for bookmarks |
|
1578 | 1582 | |
|
1579 | 1583 | $ debugwireproto << EOF |
|
1580 | 1584 | > command pushkey |
|
1581 | 1585 | > namespace bookmarks |
|
1582 | 1586 | > key remote |
|
1583 | 1587 | > old |
|
1584 | 1588 | > new 68986213bd4485ea51533535e3fc9e78007a711f |
|
1585 | 1589 | > EOF |
|
1586 | 1590 | testing ssh1 |
|
1587 | 1591 | creating ssh peer from handshake results |
|
1588 | 1592 | i> write(104) -> 104: |
|
1589 | 1593 | i> hello\n |
|
1590 | 1594 | i> between\n |
|
1591 | 1595 | i> pairs 81\n |
|
1592 | 1596 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1593 | 1597 | i> flush() -> None |
|
1594 | 1598 | o> readline() -> 4: |
|
1595 | 1599 | o> 384\n |
|
1596 | 1600 | o> readline() -> 384: |
|
1597 | 1601 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1598 | 1602 | o> readline() -> 2: |
|
1599 | 1603 | o> 1\n |
|
1600 | 1604 | o> readline() -> 1: |
|
1601 | 1605 | o> \n |
|
1602 | 1606 | sending pushkey command |
|
1603 | 1607 | i> write(8) -> 8: |
|
1604 | 1608 | i> pushkey\n |
|
1605 | 1609 | i> write(6) -> 6: |
|
1606 | 1610 | i> key 6\n |
|
1607 | 1611 | i> write(6) -> 6: remote |
|
1608 | 1612 | i> write(12) -> 12: |
|
1609 | 1613 | i> namespace 9\n |
|
1610 | 1614 | i> write(9) -> 9: bookmarks |
|
1611 | 1615 | i> write(7) -> 7: |
|
1612 | 1616 | i> new 40\n |
|
1613 | 1617 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1614 | 1618 | i> write(6) -> 6: |
|
1615 | 1619 | i> old 0\n |
|
1616 | 1620 | i> flush() -> None |
|
1617 | 1621 | o> bufferedreadline() -> 2: |
|
1618 | 1622 | o> 2\n |
|
1619 | 1623 | o> bufferedread(2) -> 2: |
|
1620 | 1624 | o> 1\n |
|
1621 | 1625 | response: 1\n |
|
1622 | 1626 | |
|
1623 | 1627 | testing ssh2 |
|
1624 | 1628 | creating ssh peer from handshake results |
|
1625 | 1629 | i> write(171) -> 171: |
|
1626 | 1630 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1627 | 1631 | i> hello\n |
|
1628 | 1632 | i> between\n |
|
1629 | 1633 | i> pairs 81\n |
|
1630 | 1634 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1631 | 1635 | i> flush() -> None |
|
1632 | 1636 | o> readline() -> 62: |
|
1633 | 1637 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1634 | 1638 | o> readline() -> 4: |
|
1635 | 1639 | o> 383\n |
|
1636 | 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 | 1641 | o> read(1) -> 1: |
|
1638 | 1642 | o> \n |
|
1639 | 1643 | sending pushkey command |
|
1640 | 1644 | i> write(8) -> 8: |
|
1641 | 1645 | i> pushkey\n |
|
1642 | 1646 | i> write(6) -> 6: |
|
1643 | 1647 | i> key 6\n |
|
1644 | 1648 | i> write(6) -> 6: remote |
|
1645 | 1649 | i> write(12) -> 12: |
|
1646 | 1650 | i> namespace 9\n |
|
1647 | 1651 | i> write(9) -> 9: bookmarks |
|
1648 | 1652 | i> write(7) -> 7: |
|
1649 | 1653 | i> new 40\n |
|
1650 | 1654 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1651 | 1655 | i> write(6) -> 6: |
|
1652 | 1656 | i> old 0\n |
|
1653 | 1657 | i> flush() -> None |
|
1654 | 1658 | o> bufferedreadline() -> 2: |
|
1655 | 1659 | o> 2\n |
|
1656 | 1660 | o> bufferedread(2) -> 2: |
|
1657 | 1661 | o> 1\n |
|
1658 | 1662 | response: 1\n |
|
1659 | 1663 | |
|
1660 | 1664 | $ hg bookmarks |
|
1661 | 1665 | bookA 0:68986213bd44 |
|
1662 | 1666 | bookB 1:1880f3755e2e |
|
1663 | 1667 | remote 0:68986213bd44 |
|
1664 | 1668 | |
|
1665 | 1669 | $ cd .. |
|
1666 | 1670 | |
|
1667 | 1671 | Test listkeys for phases |
|
1668 | 1672 | |
|
1669 | 1673 | $ hg init phasesrepo |
|
1670 | 1674 | $ cd phasesrepo |
|
1671 | 1675 | |
|
1672 | 1676 | Phases on empty repo |
|
1673 | 1677 | |
|
1674 | 1678 | $ debugwireproto << EOF |
|
1675 | 1679 | > command listkeys |
|
1676 | 1680 | > namespace phases |
|
1677 | 1681 | > EOF |
|
1678 | 1682 | testing ssh1 |
|
1679 | 1683 | creating ssh peer from handshake results |
|
1680 | 1684 | i> write(104) -> 104: |
|
1681 | 1685 | i> hello\n |
|
1682 | 1686 | i> between\n |
|
1683 | 1687 | i> pairs 81\n |
|
1684 | 1688 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1685 | 1689 | i> flush() -> None |
|
1686 | 1690 | o> readline() -> 4: |
|
1687 | 1691 | o> 384\n |
|
1688 | 1692 | o> readline() -> 384: |
|
1689 | 1693 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1690 | 1694 | o> readline() -> 2: |
|
1691 | 1695 | o> 1\n |
|
1692 | 1696 | o> readline() -> 1: |
|
1693 | 1697 | o> \n |
|
1694 | 1698 | sending listkeys command |
|
1695 | 1699 | i> write(9) -> 9: |
|
1696 | 1700 | i> listkeys\n |
|
1697 | 1701 | i> write(12) -> 12: |
|
1698 | 1702 | i> namespace 6\n |
|
1699 | 1703 | i> write(6) -> 6: phases |
|
1700 | 1704 | i> flush() -> None |
|
1701 | 1705 | o> bufferedreadline() -> 3: |
|
1702 | 1706 | o> 15\n |
|
1703 | 1707 | o> bufferedread(15) -> 15: publishing True |
|
1704 | 1708 | response: publishing True |
|
1705 | 1709 | |
|
1706 | 1710 | testing ssh2 |
|
1707 | 1711 | creating ssh peer from handshake results |
|
1708 | 1712 | i> write(171) -> 171: |
|
1709 | 1713 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1710 | 1714 | i> hello\n |
|
1711 | 1715 | i> between\n |
|
1712 | 1716 | i> pairs 81\n |
|
1713 | 1717 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1714 | 1718 | i> flush() -> None |
|
1715 | 1719 | o> readline() -> 62: |
|
1716 | 1720 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1717 | 1721 | o> readline() -> 4: |
|
1718 | 1722 | o> 383\n |
|
1719 | 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 | 1724 | o> read(1) -> 1: |
|
1721 | 1725 | o> \n |
|
1722 | 1726 | sending listkeys command |
|
1723 | 1727 | i> write(9) -> 9: |
|
1724 | 1728 | i> listkeys\n |
|
1725 | 1729 | i> write(12) -> 12: |
|
1726 | 1730 | i> namespace 6\n |
|
1727 | 1731 | i> write(6) -> 6: phases |
|
1728 | 1732 | i> flush() -> None |
|
1729 | 1733 | o> bufferedreadline() -> 3: |
|
1730 | 1734 | o> 15\n |
|
1731 | 1735 | o> bufferedread(15) -> 15: publishing True |
|
1732 | 1736 | response: publishing True |
|
1733 | 1737 | |
|
1734 | 1738 | Create some commits |
|
1735 | 1739 | |
|
1736 | 1740 | $ echo 0 > foo |
|
1737 | 1741 | $ hg add foo |
|
1738 | 1742 | $ hg -q commit -m initial |
|
1739 | 1743 | $ hg phase --public |
|
1740 | 1744 | $ echo 1 > foo |
|
1741 | 1745 | $ hg commit -m 'head 1 commit 1' |
|
1742 | 1746 | $ echo 2 > foo |
|
1743 | 1747 | $ hg commit -m 'head 1 commit 2' |
|
1744 | 1748 | $ hg -q up 0 |
|
1745 | 1749 | $ echo 1a > foo |
|
1746 | 1750 | $ hg commit -m 'head 2 commit 1' |
|
1747 | 1751 | created new head |
|
1748 | 1752 | $ echo 2a > foo |
|
1749 | 1753 | $ hg commit -m 'head 2 commit 2' |
|
1750 | 1754 | |
|
1751 | 1755 | Two draft heads |
|
1752 | 1756 | |
|
1753 | 1757 | $ debugwireproto << EOF |
|
1754 | 1758 | > command listkeys |
|
1755 | 1759 | > namespace phases |
|
1756 | 1760 | > EOF |
|
1757 | 1761 | testing ssh1 |
|
1758 | 1762 | creating ssh peer from handshake results |
|
1759 | 1763 | i> write(104) -> 104: |
|
1760 | 1764 | i> hello\n |
|
1761 | 1765 | i> between\n |
|
1762 | 1766 | i> pairs 81\n |
|
1763 | 1767 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1764 | 1768 | i> flush() -> None |
|
1765 | 1769 | o> readline() -> 4: |
|
1766 | 1770 | o> 384\n |
|
1767 | 1771 | o> readline() -> 384: |
|
1768 | 1772 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1769 | 1773 | o> readline() -> 2: |
|
1770 | 1774 | o> 1\n |
|
1771 | 1775 | o> readline() -> 1: |
|
1772 | 1776 | o> \n |
|
1773 | 1777 | sending listkeys command |
|
1774 | 1778 | i> write(9) -> 9: |
|
1775 | 1779 | i> listkeys\n |
|
1776 | 1780 | i> write(12) -> 12: |
|
1777 | 1781 | i> namespace 6\n |
|
1778 | 1782 | i> write(6) -> 6: phases |
|
1779 | 1783 | i> flush() -> None |
|
1780 | 1784 | o> bufferedreadline() -> 4: |
|
1781 | 1785 | o> 101\n |
|
1782 | 1786 | o> bufferedread(101) -> 101: |
|
1783 | 1787 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n |
|
1784 | 1788 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1785 | 1789 | o> publishing True |
|
1786 | 1790 | response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1787 | 1791 | |
|
1788 | 1792 | testing ssh2 |
|
1789 | 1793 | creating ssh peer from handshake results |
|
1790 | 1794 | i> write(171) -> 171: |
|
1791 | 1795 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1792 | 1796 | i> hello\n |
|
1793 | 1797 | i> between\n |
|
1794 | 1798 | i> pairs 81\n |
|
1795 | 1799 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1796 | 1800 | i> flush() -> None |
|
1797 | 1801 | o> readline() -> 62: |
|
1798 | 1802 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1799 | 1803 | o> readline() -> 4: |
|
1800 | 1804 | o> 383\n |
|
1801 | 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 | 1806 | o> read(1) -> 1: |
|
1803 | 1807 | o> \n |
|
1804 | 1808 | sending listkeys command |
|
1805 | 1809 | i> write(9) -> 9: |
|
1806 | 1810 | i> listkeys\n |
|
1807 | 1811 | i> write(12) -> 12: |
|
1808 | 1812 | i> namespace 6\n |
|
1809 | 1813 | i> write(6) -> 6: phases |
|
1810 | 1814 | i> flush() -> None |
|
1811 | 1815 | o> bufferedreadline() -> 4: |
|
1812 | 1816 | o> 101\n |
|
1813 | 1817 | o> bufferedread(101) -> 101: |
|
1814 | 1818 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n |
|
1815 | 1819 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1816 | 1820 | o> publishing True |
|
1817 | 1821 | response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1818 | 1822 | |
|
1819 | 1823 | Single draft head |
|
1820 | 1824 | |
|
1821 | 1825 | $ hg phase --public -r 2 |
|
1822 | 1826 | $ debugwireproto << EOF |
|
1823 | 1827 | > command listkeys |
|
1824 | 1828 | > namespace phases |
|
1825 | 1829 | > EOF |
|
1826 | 1830 | testing ssh1 |
|
1827 | 1831 | creating ssh peer from handshake results |
|
1828 | 1832 | i> write(104) -> 104: |
|
1829 | 1833 | i> hello\n |
|
1830 | 1834 | i> between\n |
|
1831 | 1835 | i> pairs 81\n |
|
1832 | 1836 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1833 | 1837 | i> flush() -> None |
|
1834 | 1838 | o> readline() -> 4: |
|
1835 | 1839 | o> 384\n |
|
1836 | 1840 | o> readline() -> 384: |
|
1837 | 1841 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1838 | 1842 | o> readline() -> 2: |
|
1839 | 1843 | o> 1\n |
|
1840 | 1844 | o> readline() -> 1: |
|
1841 | 1845 | o> \n |
|
1842 | 1846 | sending listkeys command |
|
1843 | 1847 | i> write(9) -> 9: |
|
1844 | 1848 | i> listkeys\n |
|
1845 | 1849 | i> write(12) -> 12: |
|
1846 | 1850 | i> namespace 6\n |
|
1847 | 1851 | i> write(6) -> 6: phases |
|
1848 | 1852 | i> flush() -> None |
|
1849 | 1853 | o> bufferedreadline() -> 3: |
|
1850 | 1854 | o> 58\n |
|
1851 | 1855 | o> bufferedread(58) -> 58: |
|
1852 | 1856 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1853 | 1857 | o> publishing True |
|
1854 | 1858 | response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1855 | 1859 | |
|
1856 | 1860 | testing ssh2 |
|
1857 | 1861 | creating ssh peer from handshake results |
|
1858 | 1862 | i> write(171) -> 171: |
|
1859 | 1863 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1860 | 1864 | i> hello\n |
|
1861 | 1865 | i> between\n |
|
1862 | 1866 | i> pairs 81\n |
|
1863 | 1867 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1864 | 1868 | i> flush() -> None |
|
1865 | 1869 | o> readline() -> 62: |
|
1866 | 1870 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1867 | 1871 | o> readline() -> 4: |
|
1868 | 1872 | o> 383\n |
|
1869 | 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 | 1874 | o> read(1) -> 1: |
|
1871 | 1875 | o> \n |
|
1872 | 1876 | sending listkeys command |
|
1873 | 1877 | i> write(9) -> 9: |
|
1874 | 1878 | i> listkeys\n |
|
1875 | 1879 | i> write(12) -> 12: |
|
1876 | 1880 | i> namespace 6\n |
|
1877 | 1881 | i> write(6) -> 6: phases |
|
1878 | 1882 | i> flush() -> None |
|
1879 | 1883 | o> bufferedreadline() -> 3: |
|
1880 | 1884 | o> 58\n |
|
1881 | 1885 | o> bufferedread(58) -> 58: |
|
1882 | 1886 | o> c4750011d906c18ea2f0527419cbc1a544435150 1\n |
|
1883 | 1887 | o> publishing True |
|
1884 | 1888 | response: c4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True |
|
1885 | 1889 | |
|
1886 | 1890 | All public heads |
|
1887 | 1891 | |
|
1888 | 1892 | $ hg phase --public -r 4 |
|
1889 | 1893 | $ debugwireproto << EOF |
|
1890 | 1894 | > command listkeys |
|
1891 | 1895 | > namespace phases |
|
1892 | 1896 | > EOF |
|
1893 | 1897 | testing ssh1 |
|
1894 | 1898 | creating ssh peer from handshake results |
|
1895 | 1899 | i> write(104) -> 104: |
|
1896 | 1900 | i> hello\n |
|
1897 | 1901 | i> between\n |
|
1898 | 1902 | i> pairs 81\n |
|
1899 | 1903 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1900 | 1904 | i> flush() -> None |
|
1901 | 1905 | o> readline() -> 4: |
|
1902 | 1906 | o> 384\n |
|
1903 | 1907 | o> readline() -> 384: |
|
1904 | 1908 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1905 | 1909 | o> readline() -> 2: |
|
1906 | 1910 | o> 1\n |
|
1907 | 1911 | o> readline() -> 1: |
|
1908 | 1912 | o> \n |
|
1909 | 1913 | sending listkeys command |
|
1910 | 1914 | i> write(9) -> 9: |
|
1911 | 1915 | i> listkeys\n |
|
1912 | 1916 | i> write(12) -> 12: |
|
1913 | 1917 | i> namespace 6\n |
|
1914 | 1918 | i> write(6) -> 6: phases |
|
1915 | 1919 | i> flush() -> None |
|
1916 | 1920 | o> bufferedreadline() -> 3: |
|
1917 | 1921 | o> 15\n |
|
1918 | 1922 | o> bufferedread(15) -> 15: publishing True |
|
1919 | 1923 | response: publishing True |
|
1920 | 1924 | |
|
1921 | 1925 | testing ssh2 |
|
1922 | 1926 | creating ssh peer from handshake results |
|
1923 | 1927 | i> write(171) -> 171: |
|
1924 | 1928 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1925 | 1929 | i> hello\n |
|
1926 | 1930 | i> between\n |
|
1927 | 1931 | i> pairs 81\n |
|
1928 | 1932 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1929 | 1933 | i> flush() -> None |
|
1930 | 1934 | o> readline() -> 62: |
|
1931 | 1935 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1932 | 1936 | o> readline() -> 4: |
|
1933 | 1937 | o> 383\n |
|
1934 | 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 | 1939 | o> read(1) -> 1: |
|
1936 | 1940 | o> \n |
|
1937 | 1941 | sending listkeys command |
|
1938 | 1942 | i> write(9) -> 9: |
|
1939 | 1943 | i> listkeys\n |
|
1940 | 1944 | i> write(12) -> 12: |
|
1941 | 1945 | i> namespace 6\n |
|
1942 | 1946 | i> write(6) -> 6: phases |
|
1943 | 1947 | i> flush() -> None |
|
1944 | 1948 | o> bufferedreadline() -> 3: |
|
1945 | 1949 | o> 15\n |
|
1946 | 1950 | o> bufferedread(15) -> 15: publishing True |
|
1947 | 1951 | response: publishing True |
|
1948 | 1952 | |
|
1949 | 1953 | Setting public phase via pushkey |
|
1950 | 1954 | |
|
1951 | 1955 | $ hg phase --draft --force -r . |
|
1952 | 1956 | |
|
1953 | 1957 | $ debugwireproto << EOF |
|
1954 | 1958 | > command pushkey |
|
1955 | 1959 | > namespace phases |
|
1956 | 1960 | > key 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1957 | 1961 | > old 1 |
|
1958 | 1962 | > new 0 |
|
1959 | 1963 | > EOF |
|
1960 | 1964 | testing ssh1 |
|
1961 | 1965 | creating ssh peer from handshake results |
|
1962 | 1966 | i> write(104) -> 104: |
|
1963 | 1967 | i> hello\n |
|
1964 | 1968 | i> between\n |
|
1965 | 1969 | i> pairs 81\n |
|
1966 | 1970 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1967 | 1971 | i> flush() -> None |
|
1968 | 1972 | o> readline() -> 4: |
|
1969 | 1973 | o> 384\n |
|
1970 | 1974 | o> readline() -> 384: |
|
1971 | 1975 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
1972 | 1976 | o> readline() -> 2: |
|
1973 | 1977 | o> 1\n |
|
1974 | 1978 | o> readline() -> 1: |
|
1975 | 1979 | o> \n |
|
1976 | 1980 | sending pushkey command |
|
1977 | 1981 | i> write(8) -> 8: |
|
1978 | 1982 | i> pushkey\n |
|
1979 | 1983 | i> write(7) -> 7: |
|
1980 | 1984 | i> key 40\n |
|
1981 | 1985 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1982 | 1986 | i> write(12) -> 12: |
|
1983 | 1987 | i> namespace 6\n |
|
1984 | 1988 | i> write(6) -> 6: phases |
|
1985 | 1989 | i> write(6) -> 6: |
|
1986 | 1990 | i> new 1\n |
|
1987 | 1991 | i> write(1) -> 1: 0 |
|
1988 | 1992 | i> write(6) -> 6: |
|
1989 | 1993 | i> old 1\n |
|
1990 | 1994 | i> write(1) -> 1: 1 |
|
1991 | 1995 | i> flush() -> None |
|
1992 | 1996 | o> bufferedreadline() -> 2: |
|
1993 | 1997 | o> 2\n |
|
1994 | 1998 | o> bufferedread(2) -> 2: |
|
1995 | 1999 | o> 1\n |
|
1996 | 2000 | response: 1\n |
|
1997 | 2001 | |
|
1998 | 2002 | testing ssh2 |
|
1999 | 2003 | creating ssh peer from handshake results |
|
2000 | 2004 | i> write(171) -> 171: |
|
2001 | 2005 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2002 | 2006 | i> hello\n |
|
2003 | 2007 | i> between\n |
|
2004 | 2008 | i> pairs 81\n |
|
2005 | 2009 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2006 | 2010 | i> flush() -> None |
|
2007 | 2011 | o> readline() -> 62: |
|
2008 | 2012 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2009 | 2013 | o> readline() -> 4: |
|
2010 | 2014 | o> 383\n |
|
2011 | 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 | 2016 | o> read(1) -> 1: |
|
2013 | 2017 | o> \n |
|
2014 | 2018 | sending pushkey command |
|
2015 | 2019 | i> write(8) -> 8: |
|
2016 | 2020 | i> pushkey\n |
|
2017 | 2021 | i> write(7) -> 7: |
|
2018 | 2022 | i> key 40\n |
|
2019 | 2023 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
2020 | 2024 | i> write(12) -> 12: |
|
2021 | 2025 | i> namespace 6\n |
|
2022 | 2026 | i> write(6) -> 6: phases |
|
2023 | 2027 | i> write(6) -> 6: |
|
2024 | 2028 | i> new 1\n |
|
2025 | 2029 | i> write(1) -> 1: 0 |
|
2026 | 2030 | i> write(6) -> 6: |
|
2027 | 2031 | i> old 1\n |
|
2028 | 2032 | i> write(1) -> 1: 1 |
|
2029 | 2033 | i> flush() -> None |
|
2030 | 2034 | o> bufferedreadline() -> 2: |
|
2031 | 2035 | o> 2\n |
|
2032 | 2036 | o> bufferedread(2) -> 2: |
|
2033 | 2037 | o> 1\n |
|
2034 | 2038 | response: 1\n |
|
2035 | 2039 | |
|
2036 | 2040 | $ hg phase . |
|
2037 | 2041 | 4: public |
|
2038 | 2042 | |
|
2039 | 2043 | $ cd .. |
|
2040 | 2044 | |
|
2041 | 2045 | Test batching of requests |
|
2042 | 2046 | |
|
2043 | 2047 | $ hg init batching |
|
2044 | 2048 | $ cd batching |
|
2045 | 2049 | $ echo 0 > foo |
|
2046 | 2050 | $ hg add foo |
|
2047 | 2051 | $ hg -q commit -m initial |
|
2048 | 2052 | $ hg phase --public |
|
2049 | 2053 | $ echo 1 > foo |
|
2050 | 2054 | $ hg commit -m 'commit 1' |
|
2051 | 2055 | $ hg -q up 0 |
|
2052 | 2056 | $ echo 2 > foo |
|
2053 | 2057 | $ hg commit -m 'commit 2' |
|
2054 | 2058 | created new head |
|
2055 | 2059 | $ hg book -r 1 bookA |
|
2056 | 2060 | $ hg book -r 2 bookB |
|
2057 | 2061 | |
|
2058 | 2062 | $ debugwireproto << EOF |
|
2059 | 2063 | > batchbegin |
|
2060 | 2064 | > command heads |
|
2061 | 2065 | > command listkeys |
|
2062 | 2066 | > namespace bookmarks |
|
2063 | 2067 | > command listkeys |
|
2064 | 2068 | > namespace phases |
|
2065 | 2069 | > batchsubmit |
|
2066 | 2070 | > EOF |
|
2067 | 2071 | testing ssh1 |
|
2068 | 2072 | creating ssh peer from handshake results |
|
2069 | 2073 | i> write(104) -> 104: |
|
2070 | 2074 | i> hello\n |
|
2071 | 2075 | i> between\n |
|
2072 | 2076 | i> pairs 81\n |
|
2073 | 2077 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2074 | 2078 | i> flush() -> None |
|
2075 | 2079 | o> readline() -> 4: |
|
2076 | 2080 | o> 384\n |
|
2077 | 2081 | o> readline() -> 384: |
|
2078 | 2082 | o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n |
|
2079 | 2083 | o> readline() -> 2: |
|
2080 | 2084 | o> 1\n |
|
2081 | 2085 | o> readline() -> 1: |
|
2082 | 2086 | o> \n |
|
2083 | 2087 | sending batch with 3 sub-commands |
|
2084 | 2088 | i> write(6) -> 6: |
|
2085 | 2089 | i> batch\n |
|
2086 | 2090 | i> write(4) -> 4: |
|
2087 | 2091 | i> * 0\n |
|
2088 | 2092 | i> write(8) -> 8: |
|
2089 | 2093 | i> cmds 61\n |
|
2090 | 2094 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2091 | 2095 | i> flush() -> None |
|
2092 | 2096 | o> bufferedreadline() -> 4: |
|
2093 | 2097 | o> 278\n |
|
2094 | 2098 | o> bufferedread(278) -> 278: |
|
2095 | 2099 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2096 | 2100 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2097 | 2101 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n |
|
2098 | 2102 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n |
|
2099 | 2103 | o> publishing True |
|
2100 | 2104 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2101 | 2105 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2102 | 2106 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |
|
2103 | 2107 | |
|
2104 | 2108 | testing ssh2 |
|
2105 | 2109 | creating ssh peer from handshake results |
|
2106 | 2110 | i> write(171) -> 171: |
|
2107 | 2111 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2108 | 2112 | i> hello\n |
|
2109 | 2113 | i> between\n |
|
2110 | 2114 | i> pairs 81\n |
|
2111 | 2115 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2112 | 2116 | i> flush() -> None |
|
2113 | 2117 | o> readline() -> 62: |
|
2114 | 2118 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2115 | 2119 | o> readline() -> 4: |
|
2116 | 2120 | o> 383\n |
|
2117 | 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 | 2122 | o> read(1) -> 1: |
|
2119 | 2123 | o> \n |
|
2120 | 2124 | sending batch with 3 sub-commands |
|
2121 | 2125 | i> write(6) -> 6: |
|
2122 | 2126 | i> batch\n |
|
2123 | 2127 | i> write(4) -> 4: |
|
2124 | 2128 | i> * 0\n |
|
2125 | 2129 | i> write(8) -> 8: |
|
2126 | 2130 | i> cmds 61\n |
|
2127 | 2131 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2128 | 2132 | i> flush() -> None |
|
2129 | 2133 | o> bufferedreadline() -> 4: |
|
2130 | 2134 | o> 278\n |
|
2131 | 2135 | o> bufferedread(278) -> 278: |
|
2132 | 2136 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2133 | 2137 | o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2134 | 2138 | o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n |
|
2135 | 2139 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n |
|
2136 | 2140 | o> publishing True |
|
2137 | 2141 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2138 | 2142 | response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2139 | 2143 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |
General Comments 0
You need to be logged in to leave comments.
Login now