##// END OF EJS Templates
debugcommands: add debugserve command...
Gregory Szorc -
r36544:44dc34b8 default
parent child Browse files
Show More
@@ -1,2499 +1,2531 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 string
20 20 import sys
21 21 import tempfile
22 22 import time
23 23
24 24 from .i18n import _
25 25 from .node import (
26 26 bin,
27 27 hex,
28 28 nullhex,
29 29 nullid,
30 30 nullrev,
31 31 short,
32 32 )
33 33 from . import (
34 34 bundle2,
35 35 changegroup,
36 36 cmdutil,
37 37 color,
38 38 context,
39 39 dagparser,
40 40 dagutil,
41 41 encoding,
42 42 error,
43 43 exchange,
44 44 extensions,
45 45 filemerge,
46 46 fileset,
47 47 formatter,
48 48 hg,
49 49 localrepo,
50 50 lock as lockmod,
51 51 logcmdutil,
52 52 merge as mergemod,
53 53 obsolete,
54 54 obsutil,
55 55 phases,
56 56 policy,
57 57 pvec,
58 58 pycompat,
59 59 registrar,
60 60 repair,
61 61 revlog,
62 62 revset,
63 63 revsetlang,
64 64 scmutil,
65 65 setdiscovery,
66 66 simplemerge,
67 67 smartset,
68 68 sslutil,
69 69 streamclone,
70 70 templater,
71 71 treediscovery,
72 72 upgrade,
73 73 url as urlmod,
74 74 util,
75 75 vfs as vfsmod,
76 wireprotoserver,
76 77 )
77 78
78 79 release = lockmod.release
79 80
80 81 command = registrar.command()
81 82
82 83 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
83 84 def debugancestor(ui, repo, *args):
84 85 """find the ancestor revision of two revisions in a given index"""
85 86 if len(args) == 3:
86 87 index, rev1, rev2 = args
87 88 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
88 89 lookup = r.lookup
89 90 elif len(args) == 2:
90 91 if not repo:
91 92 raise error.Abort(_('there is no Mercurial repository here '
92 93 '(.hg not found)'))
93 94 rev1, rev2 = args
94 95 r = repo.changelog
95 96 lookup = repo.lookup
96 97 else:
97 98 raise error.Abort(_('either two or three arguments required'))
98 99 a = r.ancestor(lookup(rev1), lookup(rev2))
99 100 ui.write('%d:%s\n' % (r.rev(a), hex(a)))
100 101
101 102 @command('debugapplystreamclonebundle', [], 'FILE')
102 103 def debugapplystreamclonebundle(ui, repo, fname):
103 104 """apply a stream clone bundle file"""
104 105 f = hg.openpath(ui, fname)
105 106 gen = exchange.readbundle(ui, f, fname)
106 107 gen.apply(repo)
107 108
108 109 @command('debugbuilddag',
109 110 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
110 111 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
111 112 ('n', 'new-file', None, _('add new file at each rev'))],
112 113 _('[OPTION]... [TEXT]'))
113 114 def debugbuilddag(ui, repo, text=None,
114 115 mergeable_file=False,
115 116 overwritten_file=False,
116 117 new_file=False):
117 118 """builds a repo with a given DAG from scratch in the current empty repo
118 119
119 120 The description of the DAG is read from stdin if not given on the
120 121 command line.
121 122
122 123 Elements:
123 124
124 125 - "+n" is a linear run of n nodes based on the current default parent
125 126 - "." is a single node based on the current default parent
126 127 - "$" resets the default parent to null (implied at the start);
127 128 otherwise the default parent is always the last node created
128 129 - "<p" sets the default parent to the backref p
129 130 - "*p" is a fork at parent p, which is a backref
130 131 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs
131 132 - "/p2" is a merge of the preceding node and p2
132 133 - ":tag" defines a local tag for the preceding node
133 134 - "@branch" sets the named branch for subsequent nodes
134 135 - "#...\\n" is a comment up to the end of the line
135 136
136 137 Whitespace between the above elements is ignored.
137 138
138 139 A backref is either
139 140
140 141 - a number n, which references the node curr-n, where curr is the current
141 142 node, or
142 143 - the name of a local tag you placed earlier using ":tag", or
143 144 - empty to denote the default parent.
144 145
145 146 All string valued-elements are either strictly alphanumeric, or must
146 147 be enclosed in double quotes ("..."), with "\\" as escape character.
147 148 """
148 149
149 150 if text is None:
150 151 ui.status(_("reading DAG from stdin\n"))
151 152 text = ui.fin.read()
152 153
153 154 cl = repo.changelog
154 155 if len(cl) > 0:
155 156 raise error.Abort(_('repository is not empty'))
156 157
157 158 # determine number of revs in DAG
158 159 total = 0
159 160 for type, data in dagparser.parsedag(text):
160 161 if type == 'n':
161 162 total += 1
162 163
163 164 if mergeable_file:
164 165 linesperrev = 2
165 166 # make a file with k lines per rev
166 167 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)]
167 168 initialmergedlines.append("")
168 169
169 170 tags = []
170 171
171 172 wlock = lock = tr = None
172 173 try:
173 174 wlock = repo.wlock()
174 175 lock = repo.lock()
175 176 tr = repo.transaction("builddag")
176 177
177 178 at = -1
178 179 atbranch = 'default'
179 180 nodeids = []
180 181 id = 0
181 182 ui.progress(_('building'), id, unit=_('revisions'), total=total)
182 183 for type, data in dagparser.parsedag(text):
183 184 if type == 'n':
184 185 ui.note(('node %s\n' % pycompat.bytestr(data)))
185 186 id, ps = data
186 187
187 188 files = []
188 189 filecontent = {}
189 190
190 191 p2 = None
191 192 if mergeable_file:
192 193 fn = "mf"
193 194 p1 = repo[ps[0]]
194 195 if len(ps) > 1:
195 196 p2 = repo[ps[1]]
196 197 pa = p1.ancestor(p2)
197 198 base, local, other = [x[fn].data() for x in (pa, p1,
198 199 p2)]
199 200 m3 = simplemerge.Merge3Text(base, local, other)
200 201 ml = [l.strip() for l in m3.merge_lines()]
201 202 ml.append("")
202 203 elif at > 0:
203 204 ml = p1[fn].data().split("\n")
204 205 else:
205 206 ml = initialmergedlines
206 207 ml[id * linesperrev] += " r%i" % id
207 208 mergedtext = "\n".join(ml)
208 209 files.append(fn)
209 210 filecontent[fn] = mergedtext
210 211
211 212 if overwritten_file:
212 213 fn = "of"
213 214 files.append(fn)
214 215 filecontent[fn] = "r%i\n" % id
215 216
216 217 if new_file:
217 218 fn = "nf%i" % id
218 219 files.append(fn)
219 220 filecontent[fn] = "r%i\n" % id
220 221 if len(ps) > 1:
221 222 if not p2:
222 223 p2 = repo[ps[1]]
223 224 for fn in p2:
224 225 if fn.startswith("nf"):
225 226 files.append(fn)
226 227 filecontent[fn] = p2[fn].data()
227 228
228 229 def fctxfn(repo, cx, path):
229 230 if path in filecontent:
230 231 return context.memfilectx(repo, cx, path,
231 232 filecontent[path])
232 233 return None
233 234
234 235 if len(ps) == 0 or ps[0] < 0:
235 236 pars = [None, None]
236 237 elif len(ps) == 1:
237 238 pars = [nodeids[ps[0]], None]
238 239 else:
239 240 pars = [nodeids[p] for p in ps]
240 241 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
241 242 date=(id, 0),
242 243 user="debugbuilddag",
243 244 extra={'branch': atbranch})
244 245 nodeid = repo.commitctx(cx)
245 246 nodeids.append(nodeid)
246 247 at = id
247 248 elif type == 'l':
248 249 id, name = data
249 250 ui.note(('tag %s\n' % name))
250 251 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
251 252 elif type == 'a':
252 253 ui.note(('branch %s\n' % data))
253 254 atbranch = data
254 255 ui.progress(_('building'), id, unit=_('revisions'), total=total)
255 256 tr.close()
256 257
257 258 if tags:
258 259 repo.vfs.write("localtags", "".join(tags))
259 260 finally:
260 261 ui.progress(_('building'), None)
261 262 release(tr, lock, wlock)
262 263
263 264 def _debugchangegroup(ui, gen, all=None, indent=0, **opts):
264 265 indent_string = ' ' * indent
265 266 if all:
266 267 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n")
267 268 % indent_string)
268 269
269 270 def showchunks(named):
270 271 ui.write("\n%s%s\n" % (indent_string, named))
271 272 for deltadata in gen.deltaiter():
272 273 node, p1, p2, cs, deltabase, delta, flags = deltadata
273 274 ui.write("%s%s %s %s %s %s %d\n" %
274 275 (indent_string, hex(node), hex(p1), hex(p2),
275 276 hex(cs), hex(deltabase), len(delta)))
276 277
277 278 chunkdata = gen.changelogheader()
278 279 showchunks("changelog")
279 280 chunkdata = gen.manifestheader()
280 281 showchunks("manifest")
281 282 for chunkdata in iter(gen.filelogheader, {}):
282 283 fname = chunkdata['filename']
283 284 showchunks(fname)
284 285 else:
285 286 if isinstance(gen, bundle2.unbundle20):
286 287 raise error.Abort(_('use debugbundle2 for this file'))
287 288 chunkdata = gen.changelogheader()
288 289 for deltadata in gen.deltaiter():
289 290 node, p1, p2, cs, deltabase, delta, flags = deltadata
290 291 ui.write("%s%s\n" % (indent_string, hex(node)))
291 292
292 293 def _debugobsmarkers(ui, part, indent=0, **opts):
293 294 """display version and markers contained in 'data'"""
294 295 opts = pycompat.byteskwargs(opts)
295 296 data = part.read()
296 297 indent_string = ' ' * indent
297 298 try:
298 299 version, markers = obsolete._readmarkers(data)
299 300 except error.UnknownVersion as exc:
300 301 msg = "%sunsupported version: %s (%d bytes)\n"
301 302 msg %= indent_string, exc.version, len(data)
302 303 ui.write(msg)
303 304 else:
304 305 msg = "%sversion: %d (%d bytes)\n"
305 306 msg %= indent_string, version, len(data)
306 307 ui.write(msg)
307 308 fm = ui.formatter('debugobsolete', opts)
308 309 for rawmarker in sorted(markers):
309 310 m = obsutil.marker(None, rawmarker)
310 311 fm.startitem()
311 312 fm.plain(indent_string)
312 313 cmdutil.showmarker(fm, m)
313 314 fm.end()
314 315
315 316 def _debugphaseheads(ui, data, indent=0):
316 317 """display version and markers contained in 'data'"""
317 318 indent_string = ' ' * indent
318 319 headsbyphase = phases.binarydecode(data)
319 320 for phase in phases.allphases:
320 321 for head in headsbyphase[phase]:
321 322 ui.write(indent_string)
322 323 ui.write('%s %s\n' % (hex(head), phases.phasenames[phase]))
323 324
324 325 def _quasirepr(thing):
325 326 if isinstance(thing, (dict, util.sortdict, collections.OrderedDict)):
326 327 return '{%s}' % (
327 328 b', '.join(b'%s: %s' % (k, thing[k]) for k in sorted(thing)))
328 329 return pycompat.bytestr(repr(thing))
329 330
330 331 def _debugbundle2(ui, gen, all=None, **opts):
331 332 """lists the contents of a bundle2"""
332 333 if not isinstance(gen, bundle2.unbundle20):
333 334 raise error.Abort(_('not a bundle2 file'))
334 335 ui.write(('Stream params: %s\n' % _quasirepr(gen.params)))
335 336 parttypes = opts.get(r'part_type', [])
336 337 for part in gen.iterparts():
337 338 if parttypes and part.type not in parttypes:
338 339 continue
339 340 ui.write('%s -- %s\n' % (part.type, _quasirepr(part.params)))
340 341 if part.type == 'changegroup':
341 342 version = part.params.get('version', '01')
342 343 cg = changegroup.getunbundler(version, part, 'UN')
343 344 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
344 345 if part.type == 'obsmarkers':
345 346 _debugobsmarkers(ui, part, indent=4, **opts)
346 347 if part.type == 'phase-heads':
347 348 _debugphaseheads(ui, part, indent=4)
348 349
349 350 @command('debugbundle',
350 351 [('a', 'all', None, _('show all details')),
351 352 ('', 'part-type', [], _('show only the named part type')),
352 353 ('', 'spec', None, _('print the bundlespec of the bundle'))],
353 354 _('FILE'),
354 355 norepo=True)
355 356 def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
356 357 """lists the contents of a bundle"""
357 358 with hg.openpath(ui, bundlepath) as f:
358 359 if spec:
359 360 spec = exchange.getbundlespec(ui, f)
360 361 ui.write('%s\n' % spec)
361 362 return
362 363
363 364 gen = exchange.readbundle(ui, f, bundlepath)
364 365 if isinstance(gen, bundle2.unbundle20):
365 366 return _debugbundle2(ui, gen, all=all, **opts)
366 367 _debugchangegroup(ui, gen, all=all, **opts)
367 368
368 369 @command('debugcapabilities',
369 370 [], _('PATH'),
370 371 norepo=True)
371 372 def debugcapabilities(ui, path, **opts):
372 373 """lists the capabilities of a remote peer"""
373 374 opts = pycompat.byteskwargs(opts)
374 375 peer = hg.peer(ui, opts, path)
375 376 caps = peer.capabilities()
376 377 ui.write(('Main capabilities:\n'))
377 378 for c in sorted(caps):
378 379 ui.write((' %s\n') % c)
379 380 b2caps = bundle2.bundle2caps(peer)
380 381 if b2caps:
381 382 ui.write(('Bundle2 capabilities:\n'))
382 383 for key, values in sorted(b2caps.iteritems()):
383 384 ui.write((' %s\n') % key)
384 385 for v in values:
385 386 ui.write((' %s\n') % v)
386 387
387 388 @command('debugcheckstate', [], '')
388 389 def debugcheckstate(ui, repo):
389 390 """validate the correctness of the current dirstate"""
390 391 parent1, parent2 = repo.dirstate.parents()
391 392 m1 = repo[parent1].manifest()
392 393 m2 = repo[parent2].manifest()
393 394 errors = 0
394 395 for f in repo.dirstate:
395 396 state = repo.dirstate[f]
396 397 if state in "nr" and f not in m1:
397 398 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
398 399 errors += 1
399 400 if state in "a" and f in m1:
400 401 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
401 402 errors += 1
402 403 if state in "m" and f not in m1 and f not in m2:
403 404 ui.warn(_("%s in state %s, but not in either manifest\n") %
404 405 (f, state))
405 406 errors += 1
406 407 for f in m1:
407 408 state = repo.dirstate[f]
408 409 if state not in "nrm":
409 410 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
410 411 errors += 1
411 412 if errors:
412 413 error = _(".hg/dirstate inconsistent with current parent's manifest")
413 414 raise error.Abort(error)
414 415
415 416 @command('debugcolor',
416 417 [('', 'style', None, _('show all configured styles'))],
417 418 'hg debugcolor')
418 419 def debugcolor(ui, repo, **opts):
419 420 """show available color, effects or style"""
420 421 ui.write(('color mode: %s\n') % ui._colormode)
421 422 if opts.get(r'style'):
422 423 return _debugdisplaystyle(ui)
423 424 else:
424 425 return _debugdisplaycolor(ui)
425 426
426 427 def _debugdisplaycolor(ui):
427 428 ui = ui.copy()
428 429 ui._styles.clear()
429 430 for effect in color._activeeffects(ui).keys():
430 431 ui._styles[effect] = effect
431 432 if ui._terminfoparams:
432 433 for k, v in ui.configitems('color'):
433 434 if k.startswith('color.'):
434 435 ui._styles[k] = k[6:]
435 436 elif k.startswith('terminfo.'):
436 437 ui._styles[k] = k[9:]
437 438 ui.write(_('available colors:\n'))
438 439 # sort label with a '_' after the other to group '_background' entry.
439 440 items = sorted(ui._styles.items(),
440 441 key=lambda i: ('_' in i[0], i[0], i[1]))
441 442 for colorname, label in items:
442 443 ui.write(('%s\n') % colorname, label=label)
443 444
444 445 def _debugdisplaystyle(ui):
445 446 ui.write(_('available style:\n'))
446 447 width = max(len(s) for s in ui._styles)
447 448 for label, effects in sorted(ui._styles.items()):
448 449 ui.write('%s' % label, label=label)
449 450 if effects:
450 451 # 50
451 452 ui.write(': ')
452 453 ui.write(' ' * (max(0, width - len(label))))
453 454 ui.write(', '.join(ui.label(e, e) for e in effects.split()))
454 455 ui.write('\n')
455 456
456 457 @command('debugcreatestreamclonebundle', [], 'FILE')
457 458 def debugcreatestreamclonebundle(ui, repo, fname):
458 459 """create a stream clone bundle file
459 460
460 461 Stream bundles are special bundles that are essentially archives of
461 462 revlog files. They are commonly used for cloning very quickly.
462 463 """
463 464 # TODO we may want to turn this into an abort when this functionality
464 465 # is moved into `hg bundle`.
465 466 if phases.hassecret(repo):
466 467 ui.warn(_('(warning: stream clone bundle will contain secret '
467 468 'revisions)\n'))
468 469
469 470 requirements, gen = streamclone.generatebundlev1(repo)
470 471 changegroup.writechunks(ui, gen, fname)
471 472
472 473 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
473 474
474 475 @command('debugdag',
475 476 [('t', 'tags', None, _('use tags as labels')),
476 477 ('b', 'branches', None, _('annotate with branch names')),
477 478 ('', 'dots', None, _('use dots for runs')),
478 479 ('s', 'spaces', None, _('separate elements by spaces'))],
479 480 _('[OPTION]... [FILE [REV]...]'),
480 481 optionalrepo=True)
481 482 def debugdag(ui, repo, file_=None, *revs, **opts):
482 483 """format the changelog or an index DAG as a concise textual description
483 484
484 485 If you pass a revlog index, the revlog's DAG is emitted. If you list
485 486 revision numbers, they get labeled in the output as rN.
486 487
487 488 Otherwise, the changelog DAG of the current repo is emitted.
488 489 """
489 490 spaces = opts.get(r'spaces')
490 491 dots = opts.get(r'dots')
491 492 if file_:
492 493 rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
493 494 file_)
494 495 revs = set((int(r) for r in revs))
495 496 def events():
496 497 for r in rlog:
497 498 yield 'n', (r, list(p for p in rlog.parentrevs(r)
498 499 if p != -1))
499 500 if r in revs:
500 501 yield 'l', (r, "r%i" % r)
501 502 elif repo:
502 503 cl = repo.changelog
503 504 tags = opts.get(r'tags')
504 505 branches = opts.get(r'branches')
505 506 if tags:
506 507 labels = {}
507 508 for l, n in repo.tags().items():
508 509 labels.setdefault(cl.rev(n), []).append(l)
509 510 def events():
510 511 b = "default"
511 512 for r in cl:
512 513 if branches:
513 514 newb = cl.read(cl.node(r))[5]['branch']
514 515 if newb != b:
515 516 yield 'a', newb
516 517 b = newb
517 518 yield 'n', (r, list(p for p in cl.parentrevs(r)
518 519 if p != -1))
519 520 if tags:
520 521 ls = labels.get(r)
521 522 if ls:
522 523 for l in ls:
523 524 yield 'l', (r, l)
524 525 else:
525 526 raise error.Abort(_('need repo for changelog dag'))
526 527
527 528 for line in dagparser.dagtextlines(events(),
528 529 addspaces=spaces,
529 530 wraplabels=True,
530 531 wrapannotations=True,
531 532 wrapnonlinear=dots,
532 533 usedots=dots,
533 534 maxlinewidth=70):
534 535 ui.write(line)
535 536 ui.write("\n")
536 537
537 538 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
538 539 def debugdata(ui, repo, file_, rev=None, **opts):
539 540 """dump the contents of a data file revision"""
540 541 opts = pycompat.byteskwargs(opts)
541 542 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
542 543 if rev is not None:
543 544 raise error.CommandError('debugdata', _('invalid arguments'))
544 545 file_, rev = None, file_
545 546 elif rev is None:
546 547 raise error.CommandError('debugdata', _('invalid arguments'))
547 548 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
548 549 try:
549 550 ui.write(r.revision(r.lookup(rev), raw=True))
550 551 except KeyError:
551 552 raise error.Abort(_('invalid revision identifier %s') % rev)
552 553
553 554 @command('debugdate',
554 555 [('e', 'extended', None, _('try extended date formats'))],
555 556 _('[-e] DATE [RANGE]'),
556 557 norepo=True, optionalrepo=True)
557 558 def debugdate(ui, date, range=None, **opts):
558 559 """parse and display a date"""
559 560 if opts[r"extended"]:
560 561 d = util.parsedate(date, util.extendeddateformats)
561 562 else:
562 563 d = util.parsedate(date)
563 564 ui.write(("internal: %d %d\n") % d)
564 565 ui.write(("standard: %s\n") % util.datestr(d))
565 566 if range:
566 567 m = util.matchdate(range)
567 568 ui.write(("match: %s\n") % m(d[0]))
568 569
569 570 @command('debugdeltachain',
570 571 cmdutil.debugrevlogopts + cmdutil.formatteropts,
571 572 _('-c|-m|FILE'),
572 573 optionalrepo=True)
573 574 def debugdeltachain(ui, repo, file_=None, **opts):
574 575 """dump information about delta chains in a revlog
575 576
576 577 Output can be templatized. Available template keywords are:
577 578
578 579 :``rev``: revision number
579 580 :``chainid``: delta chain identifier (numbered by unique base)
580 581 :``chainlen``: delta chain length to this revision
581 582 :``prevrev``: previous revision in delta chain
582 583 :``deltatype``: role of delta / how it was computed
583 584 :``compsize``: compressed size of revision
584 585 :``uncompsize``: uncompressed size of revision
585 586 :``chainsize``: total size of compressed revisions in chain
586 587 :``chainratio``: total chain size divided by uncompressed revision size
587 588 (new delta chains typically start at ratio 2.00)
588 589 :``lindist``: linear distance from base revision in delta chain to end
589 590 of this revision
590 591 :``extradist``: total size of revisions not part of this delta chain from
591 592 base of delta chain to end of this revision; a measurement
592 593 of how much extra data we need to read/seek across to read
593 594 the delta chain for this revision
594 595 :``extraratio``: extradist divided by chainsize; another representation of
595 596 how much unrelated data is needed to load this delta chain
596 597
597 598 If the repository is configured to use the sparse read, additional keywords
598 599 are available:
599 600
600 601 :``readsize``: total size of data read from the disk for a revision
601 602 (sum of the sizes of all the blocks)
602 603 :``largestblock``: size of the largest block of data read from the disk
603 604 :``readdensity``: density of useful bytes in the data read from the disk
604 605 :``srchunks``: in how many data hunks the whole revision would be read
605 606
606 607 The sparse read can be enabled with experimental.sparse-read = True
607 608 """
608 609 opts = pycompat.byteskwargs(opts)
609 610 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
610 611 index = r.index
611 612 generaldelta = r.version & revlog.FLAG_GENERALDELTA
612 613 withsparseread = getattr(r, '_withsparseread', False)
613 614
614 615 def revinfo(rev):
615 616 e = index[rev]
616 617 compsize = e[1]
617 618 uncompsize = e[2]
618 619 chainsize = 0
619 620
620 621 if generaldelta:
621 622 if e[3] == e[5]:
622 623 deltatype = 'p1'
623 624 elif e[3] == e[6]:
624 625 deltatype = 'p2'
625 626 elif e[3] == rev - 1:
626 627 deltatype = 'prev'
627 628 elif e[3] == rev:
628 629 deltatype = 'base'
629 630 else:
630 631 deltatype = 'other'
631 632 else:
632 633 if e[3] == rev:
633 634 deltatype = 'base'
634 635 else:
635 636 deltatype = 'prev'
636 637
637 638 chain = r._deltachain(rev)[0]
638 639 for iterrev in chain:
639 640 e = index[iterrev]
640 641 chainsize += e[1]
641 642
642 643 return compsize, uncompsize, deltatype, chain, chainsize
643 644
644 645 fm = ui.formatter('debugdeltachain', opts)
645 646
646 647 fm.plain(' rev chain# chainlen prev delta '
647 648 'size rawsize chainsize ratio lindist extradist '
648 649 'extraratio')
649 650 if withsparseread:
650 651 fm.plain(' readsize largestblk rddensity srchunks')
651 652 fm.plain('\n')
652 653
653 654 chainbases = {}
654 655 for rev in r:
655 656 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
656 657 chainbase = chain[0]
657 658 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
658 659 start = r.start
659 660 length = r.length
660 661 basestart = start(chainbase)
661 662 revstart = start(rev)
662 663 lineardist = revstart + comp - basestart
663 664 extradist = lineardist - chainsize
664 665 try:
665 666 prevrev = chain[-2]
666 667 except IndexError:
667 668 prevrev = -1
668 669
669 670 chainratio = float(chainsize) / float(uncomp)
670 671 extraratio = float(extradist) / float(chainsize)
671 672
672 673 fm.startitem()
673 674 fm.write('rev chainid chainlen prevrev deltatype compsize '
674 675 'uncompsize chainsize chainratio lindist extradist '
675 676 'extraratio',
676 677 '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f',
677 678 rev, chainid, len(chain), prevrev, deltatype, comp,
678 679 uncomp, chainsize, chainratio, lineardist, extradist,
679 680 extraratio,
680 681 rev=rev, chainid=chainid, chainlen=len(chain),
681 682 prevrev=prevrev, deltatype=deltatype, compsize=comp,
682 683 uncompsize=uncomp, chainsize=chainsize,
683 684 chainratio=chainratio, lindist=lineardist,
684 685 extradist=extradist, extraratio=extraratio)
685 686 if withsparseread:
686 687 readsize = 0
687 688 largestblock = 0
688 689 srchunks = 0
689 690
690 691 for revschunk in revlog._slicechunk(r, chain):
691 692 srchunks += 1
692 693 blkend = start(revschunk[-1]) + length(revschunk[-1])
693 694 blksize = blkend - start(revschunk[0])
694 695
695 696 readsize += blksize
696 697 if largestblock < blksize:
697 698 largestblock = blksize
698 699
699 700 readdensity = float(chainsize) / float(readsize)
700 701
701 702 fm.write('readsize largestblock readdensity srchunks',
702 703 ' %10d %10d %9.5f %8d',
703 704 readsize, largestblock, readdensity, srchunks,
704 705 readsize=readsize, largestblock=largestblock,
705 706 readdensity=readdensity, srchunks=srchunks)
706 707
707 708 fm.plain('\n')
708 709
709 710 fm.end()
710 711
711 712 @command('debugdirstate|debugstate',
712 713 [('', 'nodates', None, _('do not display the saved mtime')),
713 714 ('', 'datesort', None, _('sort by saved mtime'))],
714 715 _('[OPTION]...'))
715 716 def debugstate(ui, repo, **opts):
716 717 """show the contents of the current dirstate"""
717 718
718 719 nodates = opts.get(r'nodates')
719 720 datesort = opts.get(r'datesort')
720 721
721 722 timestr = ""
722 723 if datesort:
723 724 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
724 725 else:
725 726 keyfunc = None # sort by filename
726 727 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
727 728 if ent[3] == -1:
728 729 timestr = 'unset '
729 730 elif nodates:
730 731 timestr = 'set '
731 732 else:
732 733 timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
733 734 time.localtime(ent[3]))
734 735 timestr = encoding.strtolocal(timestr)
735 736 if ent[1] & 0o20000:
736 737 mode = 'lnk'
737 738 else:
738 739 mode = '%3o' % (ent[1] & 0o777 & ~util.umask)
739 740 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
740 741 for f in repo.dirstate.copies():
741 742 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
742 743
743 744 @command('debugdiscovery',
744 745 [('', 'old', None, _('use old-style discovery')),
745 746 ('', 'nonheads', None,
746 747 _('use old-style discovery with non-heads included')),
747 748 ('', 'rev', [], 'restrict discovery to this set of revs'),
748 749 ] + cmdutil.remoteopts,
749 750 _('[--rev REV] [OTHER]'))
750 751 def debugdiscovery(ui, repo, remoteurl="default", **opts):
751 752 """runs the changeset discovery protocol in isolation"""
752 753 opts = pycompat.byteskwargs(opts)
753 754 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
754 755 remote = hg.peer(repo, opts, remoteurl)
755 756 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
756 757
757 758 # make sure tests are repeatable
758 759 random.seed(12323)
759 760
760 761 def doit(pushedrevs, remoteheads, remote=remote):
761 762 if opts.get('old'):
762 763 if not util.safehasattr(remote, 'branches'):
763 764 # enable in-client legacy support
764 765 remote = localrepo.locallegacypeer(remote.local())
765 766 common, _in, hds = treediscovery.findcommonincoming(repo, remote,
766 767 force=True)
767 768 common = set(common)
768 769 if not opts.get('nonheads'):
769 770 ui.write(("unpruned common: %s\n") %
770 771 " ".join(sorted(short(n) for n in common)))
771 772 dag = dagutil.revlogdag(repo.changelog)
772 773 all = dag.ancestorset(dag.internalizeall(common))
773 774 common = dag.externalizeall(dag.headsetofconnecteds(all))
774 775 else:
775 776 nodes = None
776 777 if pushedrevs:
777 778 revs = scmutil.revrange(repo, pushedrevs)
778 779 nodes = [repo[r].node() for r in revs]
779 780 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
780 781 ancestorsof=nodes)
781 782 common = set(common)
782 783 rheads = set(hds)
783 784 lheads = set(repo.heads())
784 785 ui.write(("common heads: %s\n") %
785 786 " ".join(sorted(short(n) for n in common)))
786 787 if lheads <= common:
787 788 ui.write(("local is subset\n"))
788 789 elif rheads <= common:
789 790 ui.write(("remote is subset\n"))
790 791
791 792 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
792 793 localrevs = opts['rev']
793 794 doit(localrevs, remoterevs)
794 795
795 796 _chunksize = 4 << 10
796 797
797 798 @command('debugdownload',
798 799 [
799 800 ('o', 'output', '', _('path')),
800 801 ],
801 802 optionalrepo=True)
802 803 def debugdownload(ui, repo, url, output=None, **opts):
803 804 """download a resource using Mercurial logic and config
804 805 """
805 806 fh = urlmod.open(ui, url, output)
806 807
807 808 dest = ui
808 809 if output:
809 810 dest = open(output, "wb", _chunksize)
810 811 try:
811 812 data = fh.read(_chunksize)
812 813 while data:
813 814 dest.write(data)
814 815 data = fh.read(_chunksize)
815 816 finally:
816 817 if output:
817 818 dest.close()
818 819
819 820 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
820 821 def debugextensions(ui, **opts):
821 822 '''show information about active extensions'''
822 823 opts = pycompat.byteskwargs(opts)
823 824 exts = extensions.extensions(ui)
824 825 hgver = util.version()
825 826 fm = ui.formatter('debugextensions', opts)
826 827 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
827 828 isinternal = extensions.ismoduleinternal(extmod)
828 829 extsource = pycompat.fsencode(extmod.__file__)
829 830 if isinternal:
830 831 exttestedwith = [] # never expose magic string to users
831 832 else:
832 833 exttestedwith = getattr(extmod, 'testedwith', '').split()
833 834 extbuglink = getattr(extmod, 'buglink', None)
834 835
835 836 fm.startitem()
836 837
837 838 if ui.quiet or ui.verbose:
838 839 fm.write('name', '%s\n', extname)
839 840 else:
840 841 fm.write('name', '%s', extname)
841 842 if isinternal or hgver in exttestedwith:
842 843 fm.plain('\n')
843 844 elif not exttestedwith:
844 845 fm.plain(_(' (untested!)\n'))
845 846 else:
846 847 lasttestedversion = exttestedwith[-1]
847 848 fm.plain(' (%s!)\n' % lasttestedversion)
848 849
849 850 fm.condwrite(ui.verbose and extsource, 'source',
850 851 _(' location: %s\n'), extsource or "")
851 852
852 853 if ui.verbose:
853 854 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
854 855 fm.data(bundled=isinternal)
855 856
856 857 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
857 858 _(' tested with: %s\n'),
858 859 fm.formatlist(exttestedwith, name='ver'))
859 860
860 861 fm.condwrite(ui.verbose and extbuglink, 'buglink',
861 862 _(' bug reporting: %s\n'), extbuglink or "")
862 863
863 864 fm.end()
864 865
865 866 @command('debugfileset',
866 867 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
867 868 _('[-r REV] FILESPEC'))
868 869 def debugfileset(ui, repo, expr, **opts):
869 870 '''parse and apply a fileset specification'''
870 871 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
871 872 if ui.verbose:
872 873 tree = fileset.parse(expr)
873 874 ui.note(fileset.prettyformat(tree), "\n")
874 875
875 876 for f in ctx.getfileset(expr):
876 877 ui.write("%s\n" % f)
877 878
878 879 @command('debugformat',
879 880 [] + cmdutil.formatteropts,
880 881 _(''))
881 882 def debugformat(ui, repo, **opts):
882 883 """display format information about the current repository
883 884
884 885 Use --verbose to get extra information about current config value and
885 886 Mercurial default."""
886 887 opts = pycompat.byteskwargs(opts)
887 888 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
888 889 maxvariantlength = max(len('format-variant'), maxvariantlength)
889 890
890 891 def makeformatname(name):
891 892 return '%s:' + (' ' * (maxvariantlength - len(name)))
892 893
893 894 fm = ui.formatter('debugformat', opts)
894 895 if fm.isplain():
895 896 def formatvalue(value):
896 897 if util.safehasattr(value, 'startswith'):
897 898 return value
898 899 if value:
899 900 return 'yes'
900 901 else:
901 902 return 'no'
902 903 else:
903 904 formatvalue = pycompat.identity
904 905
905 906 fm.plain('format-variant')
906 907 fm.plain(' ' * (maxvariantlength - len('format-variant')))
907 908 fm.plain(' repo')
908 909 if ui.verbose:
909 910 fm.plain(' config default')
910 911 fm.plain('\n')
911 912 for fv in upgrade.allformatvariant:
912 913 fm.startitem()
913 914 repovalue = fv.fromrepo(repo)
914 915 configvalue = fv.fromconfig(repo)
915 916
916 917 if repovalue != configvalue:
917 918 namelabel = 'formatvariant.name.mismatchconfig'
918 919 repolabel = 'formatvariant.repo.mismatchconfig'
919 920 elif repovalue != fv.default:
920 921 namelabel = 'formatvariant.name.mismatchdefault'
921 922 repolabel = 'formatvariant.repo.mismatchdefault'
922 923 else:
923 924 namelabel = 'formatvariant.name.uptodate'
924 925 repolabel = 'formatvariant.repo.uptodate'
925 926
926 927 fm.write('name', makeformatname(fv.name), fv.name,
927 928 label=namelabel)
928 929 fm.write('repo', ' %3s', formatvalue(repovalue),
929 930 label=repolabel)
930 931 if fv.default != configvalue:
931 932 configlabel = 'formatvariant.config.special'
932 933 else:
933 934 configlabel = 'formatvariant.config.default'
934 935 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
935 936 label=configlabel)
936 937 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
937 938 label='formatvariant.default')
938 939 fm.plain('\n')
939 940 fm.end()
940 941
941 942 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
942 943 def debugfsinfo(ui, path="."):
943 944 """show information detected about current filesystem"""
944 945 ui.write(('path: %s\n') % path)
945 946 ui.write(('mounted on: %s\n') % (util.getfsmountpoint(path) or '(unknown)'))
946 947 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no'))
947 948 ui.write(('fstype: %s\n') % (util.getfstype(path) or '(unknown)'))
948 949 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no'))
949 950 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no'))
950 951 casesensitive = '(unknown)'
951 952 try:
952 953 with tempfile.NamedTemporaryFile(prefix='.debugfsinfo', dir=path) as f:
953 954 casesensitive = util.fscasesensitive(f.name) and 'yes' or 'no'
954 955 except OSError:
955 956 pass
956 957 ui.write(('case-sensitive: %s\n') % casesensitive)
957 958
958 959 @command('debuggetbundle',
959 960 [('H', 'head', [], _('id of head node'), _('ID')),
960 961 ('C', 'common', [], _('id of common node'), _('ID')),
961 962 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
962 963 _('REPO FILE [-H|-C ID]...'),
963 964 norepo=True)
964 965 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
965 966 """retrieves a bundle from a repo
966 967
967 968 Every ID must be a full-length hex node id string. Saves the bundle to the
968 969 given file.
969 970 """
970 971 opts = pycompat.byteskwargs(opts)
971 972 repo = hg.peer(ui, opts, repopath)
972 973 if not repo.capable('getbundle'):
973 974 raise error.Abort("getbundle() not supported by target repository")
974 975 args = {}
975 976 if common:
976 977 args[r'common'] = [bin(s) for s in common]
977 978 if head:
978 979 args[r'heads'] = [bin(s) for s in head]
979 980 # TODO: get desired bundlecaps from command line.
980 981 args[r'bundlecaps'] = None
981 982 bundle = repo.getbundle('debug', **args)
982 983
983 984 bundletype = opts.get('type', 'bzip2').lower()
984 985 btypes = {'none': 'HG10UN',
985 986 'bzip2': 'HG10BZ',
986 987 'gzip': 'HG10GZ',
987 988 'bundle2': 'HG20'}
988 989 bundletype = btypes.get(bundletype)
989 990 if bundletype not in bundle2.bundletypes:
990 991 raise error.Abort(_('unknown bundle type specified with --type'))
991 992 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
992 993
993 994 @command('debugignore', [], '[FILE]')
994 995 def debugignore(ui, repo, *files, **opts):
995 996 """display the combined ignore pattern and information about ignored files
996 997
997 998 With no argument display the combined ignore pattern.
998 999
999 1000 Given space separated file names, shows if the given file is ignored and
1000 1001 if so, show the ignore rule (file and line number) that matched it.
1001 1002 """
1002 1003 ignore = repo.dirstate._ignore
1003 1004 if not files:
1004 1005 # Show all the patterns
1005 1006 ui.write("%s\n" % repr(ignore))
1006 1007 else:
1007 1008 m = scmutil.match(repo[None], pats=files)
1008 1009 for f in m.files():
1009 1010 nf = util.normpath(f)
1010 1011 ignored = None
1011 1012 ignoredata = None
1012 1013 if nf != '.':
1013 1014 if ignore(nf):
1014 1015 ignored = nf
1015 1016 ignoredata = repo.dirstate._ignorefileandline(nf)
1016 1017 else:
1017 1018 for p in util.finddirs(nf):
1018 1019 if ignore(p):
1019 1020 ignored = p
1020 1021 ignoredata = repo.dirstate._ignorefileandline(p)
1021 1022 break
1022 1023 if ignored:
1023 1024 if ignored == nf:
1024 1025 ui.write(_("%s is ignored\n") % m.uipath(f))
1025 1026 else:
1026 1027 ui.write(_("%s is ignored because of "
1027 1028 "containing folder %s\n")
1028 1029 % (m.uipath(f), ignored))
1029 1030 ignorefile, lineno, line = ignoredata
1030 1031 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1031 1032 % (ignorefile, lineno, line))
1032 1033 else:
1033 1034 ui.write(_("%s is not ignored\n") % m.uipath(f))
1034 1035
1035 1036 @command('debugindex', cmdutil.debugrevlogopts +
1036 1037 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1037 1038 _('[-f FORMAT] -c|-m|FILE'),
1038 1039 optionalrepo=True)
1039 1040 def debugindex(ui, repo, file_=None, **opts):
1040 1041 """dump the contents of an index file"""
1041 1042 opts = pycompat.byteskwargs(opts)
1042 1043 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
1043 1044 format = opts.get('format', 0)
1044 1045 if format not in (0, 1):
1045 1046 raise error.Abort(_("unknown format %d") % format)
1046 1047
1047 1048 generaldelta = r.version & revlog.FLAG_GENERALDELTA
1048 1049 if generaldelta:
1049 1050 basehdr = ' delta'
1050 1051 else:
1051 1052 basehdr = ' base'
1052 1053
1053 1054 if ui.debugflag:
1054 1055 shortfn = hex
1055 1056 else:
1056 1057 shortfn = short
1057 1058
1058 1059 # There might not be anything in r, so have a sane default
1059 1060 idlen = 12
1060 1061 for i in r:
1061 1062 idlen = len(shortfn(r.node(i)))
1062 1063 break
1063 1064
1064 1065 if format == 0:
1065 1066 ui.write((" rev offset length " + basehdr + " linkrev"
1066 1067 " %s %s p2\n") % ("nodeid".ljust(idlen), "p1".ljust(idlen)))
1067 1068 elif format == 1:
1068 1069 ui.write((" rev flag offset length"
1069 1070 " size " + basehdr + " link p1 p2"
1070 1071 " %s\n") % "nodeid".rjust(idlen))
1071 1072
1072 1073 for i in r:
1073 1074 node = r.node(i)
1074 1075 if generaldelta:
1075 1076 base = r.deltaparent(i)
1076 1077 else:
1077 1078 base = r.chainbase(i)
1078 1079 if format == 0:
1079 1080 try:
1080 1081 pp = r.parents(node)
1081 1082 except Exception:
1082 1083 pp = [nullid, nullid]
1083 1084 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1084 1085 i, r.start(i), r.length(i), base, r.linkrev(i),
1085 1086 shortfn(node), shortfn(pp[0]), shortfn(pp[1])))
1086 1087 elif format == 1:
1087 1088 pr = r.parentrevs(i)
1088 1089 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1089 1090 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1090 1091 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
1091 1092
1092 1093 @command('debugindexdot', cmdutil.debugrevlogopts,
1093 1094 _('-c|-m|FILE'), optionalrepo=True)
1094 1095 def debugindexdot(ui, repo, file_=None, **opts):
1095 1096 """dump an index DAG as a graphviz dot file"""
1096 1097 opts = pycompat.byteskwargs(opts)
1097 1098 r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
1098 1099 ui.write(("digraph G {\n"))
1099 1100 for i in r:
1100 1101 node = r.node(i)
1101 1102 pp = r.parents(node)
1102 1103 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1103 1104 if pp[1] != nullid:
1104 1105 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1105 1106 ui.write("}\n")
1106 1107
1107 1108 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
1108 1109 def debuginstall(ui, **opts):
1109 1110 '''test Mercurial installation
1110 1111
1111 1112 Returns 0 on success.
1112 1113 '''
1113 1114 opts = pycompat.byteskwargs(opts)
1114 1115
1115 1116 def writetemp(contents):
1116 1117 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1117 1118 f = os.fdopen(fd, pycompat.sysstr("wb"))
1118 1119 f.write(contents)
1119 1120 f.close()
1120 1121 return name
1121 1122
1122 1123 problems = 0
1123 1124
1124 1125 fm = ui.formatter('debuginstall', opts)
1125 1126 fm.startitem()
1126 1127
1127 1128 # encoding
1128 1129 fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding)
1129 1130 err = None
1130 1131 try:
1131 1132 codecs.lookup(pycompat.sysstr(encoding.encoding))
1132 1133 except LookupError as inst:
1133 1134 err = util.forcebytestr(inst)
1134 1135 problems += 1
1135 1136 fm.condwrite(err, 'encodingerror', _(" %s\n"
1136 1137 " (check that your locale is properly set)\n"), err)
1137 1138
1138 1139 # Python
1139 1140 fm.write('pythonexe', _("checking Python executable (%s)\n"),
1140 1141 pycompat.sysexecutable)
1141 1142 fm.write('pythonver', _("checking Python version (%s)\n"),
1142 1143 ("%d.%d.%d" % sys.version_info[:3]))
1143 1144 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
1144 1145 os.path.dirname(pycompat.fsencode(os.__file__)))
1145 1146
1146 1147 security = set(sslutil.supportedprotocols)
1147 1148 if sslutil.hassni:
1148 1149 security.add('sni')
1149 1150
1150 1151 fm.write('pythonsecurity', _("checking Python security support (%s)\n"),
1151 1152 fm.formatlist(sorted(security), name='protocol',
1152 1153 fmt='%s', sep=','))
1153 1154
1154 1155 # These are warnings, not errors. So don't increment problem count. This
1155 1156 # may change in the future.
1156 1157 if 'tls1.2' not in security:
1157 1158 fm.plain(_(' TLS 1.2 not supported by Python install; '
1158 1159 'network connections lack modern security\n'))
1159 1160 if 'sni' not in security:
1160 1161 fm.plain(_(' SNI not supported by Python install; may have '
1161 1162 'connectivity issues with some servers\n'))
1162 1163
1163 1164 # TODO print CA cert info
1164 1165
1165 1166 # hg version
1166 1167 hgver = util.version()
1167 1168 fm.write('hgver', _("checking Mercurial version (%s)\n"),
1168 1169 hgver.split('+')[0])
1169 1170 fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
1170 1171 '+'.join(hgver.split('+')[1:]))
1171 1172
1172 1173 # compiled modules
1173 1174 fm.write('hgmodulepolicy', _("checking module policy (%s)\n"),
1174 1175 policy.policy)
1175 1176 fm.write('hgmodules', _("checking installed modules (%s)...\n"),
1176 1177 os.path.dirname(pycompat.fsencode(__file__)))
1177 1178
1178 1179 if policy.policy in ('c', 'allow'):
1179 1180 err = None
1180 1181 try:
1181 1182 from .cext import (
1182 1183 base85,
1183 1184 bdiff,
1184 1185 mpatch,
1185 1186 osutil,
1186 1187 )
1187 1188 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1188 1189 except Exception as inst:
1189 1190 err = util.forcebytestr(inst)
1190 1191 problems += 1
1191 1192 fm.condwrite(err, 'extensionserror', " %s\n", err)
1192 1193
1193 1194 compengines = util.compengines._engines.values()
1194 1195 fm.write('compengines', _('checking registered compression engines (%s)\n'),
1195 1196 fm.formatlist(sorted(e.name() for e in compengines),
1196 1197 name='compengine', fmt='%s', sep=', '))
1197 1198 fm.write('compenginesavail', _('checking available compression engines '
1198 1199 '(%s)\n'),
1199 1200 fm.formatlist(sorted(e.name() for e in compengines
1200 1201 if e.available()),
1201 1202 name='compengine', fmt='%s', sep=', '))
1202 1203 wirecompengines = util.compengines.supportedwireengines(util.SERVERROLE)
1203 1204 fm.write('compenginesserver', _('checking available compression engines '
1204 1205 'for wire protocol (%s)\n'),
1205 1206 fm.formatlist([e.name() for e in wirecompengines
1206 1207 if e.wireprotosupport()],
1207 1208 name='compengine', fmt='%s', sep=', '))
1208 1209 re2 = 'missing'
1209 1210 if util._re2:
1210 1211 re2 = 'available'
1211 1212 fm.plain(_('checking "re2" regexp engine (%s)\n') % re2)
1212 1213 fm.data(re2=bool(util._re2))
1213 1214
1214 1215 # templates
1215 1216 p = templater.templatepaths()
1216 1217 fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
1217 1218 fm.condwrite(not p, '', _(" no template directories found\n"))
1218 1219 if p:
1219 1220 m = templater.templatepath("map-cmdline.default")
1220 1221 if m:
1221 1222 # template found, check if it is working
1222 1223 err = None
1223 1224 try:
1224 1225 templater.templater.frommapfile(m)
1225 1226 except Exception as inst:
1226 1227 err = util.forcebytestr(inst)
1227 1228 p = None
1228 1229 fm.condwrite(err, 'defaulttemplateerror', " %s\n", err)
1229 1230 else:
1230 1231 p = None
1231 1232 fm.condwrite(p, 'defaulttemplate',
1232 1233 _("checking default template (%s)\n"), m)
1233 1234 fm.condwrite(not m, 'defaulttemplatenotfound',
1234 1235 _(" template '%s' not found\n"), "default")
1235 1236 if not p:
1236 1237 problems += 1
1237 1238 fm.condwrite(not p, '',
1238 1239 _(" (templates seem to have been installed incorrectly)\n"))
1239 1240
1240 1241 # editor
1241 1242 editor = ui.geteditor()
1242 1243 editor = util.expandpath(editor)
1243 1244 editorbin = util.shellsplit(editor)[0]
1244 1245 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1245 1246 cmdpath = util.findexe(editorbin)
1246 1247 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1247 1248 _(" No commit editor set and can't find %s in PATH\n"
1248 1249 " (specify a commit editor in your configuration"
1249 1250 " file)\n"), not cmdpath and editor == 'vi' and editorbin)
1250 1251 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
1251 1252 _(" Can't find editor '%s' in PATH\n"
1252 1253 " (specify a commit editor in your configuration"
1253 1254 " file)\n"), not cmdpath and editorbin)
1254 1255 if not cmdpath and editor != 'vi':
1255 1256 problems += 1
1256 1257
1257 1258 # check username
1258 1259 username = None
1259 1260 err = None
1260 1261 try:
1261 1262 username = ui.username()
1262 1263 except error.Abort as e:
1263 1264 err = util.forcebytestr(e)
1264 1265 problems += 1
1265 1266
1266 1267 fm.condwrite(username, 'username', _("checking username (%s)\n"), username)
1267 1268 fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n"
1268 1269 " (specify a username in your configuration file)\n"), err)
1269 1270
1270 1271 fm.condwrite(not problems, '',
1271 1272 _("no problems detected\n"))
1272 1273 if not problems:
1273 1274 fm.data(problems=problems)
1274 1275 fm.condwrite(problems, 'problems',
1275 1276 _("%d problems detected,"
1276 1277 " please check your install!\n"), problems)
1277 1278 fm.end()
1278 1279
1279 1280 return problems
1280 1281
1281 1282 @command('debugknown', [], _('REPO ID...'), norepo=True)
1282 1283 def debugknown(ui, repopath, *ids, **opts):
1283 1284 """test whether node ids are known to a repo
1284 1285
1285 1286 Every ID must be a full-length hex node id string. Returns a list of 0s
1286 1287 and 1s indicating unknown/known.
1287 1288 """
1288 1289 opts = pycompat.byteskwargs(opts)
1289 1290 repo = hg.peer(ui, opts, repopath)
1290 1291 if not repo.capable('known'):
1291 1292 raise error.Abort("known() not supported by target repository")
1292 1293 flags = repo.known([bin(s) for s in ids])
1293 1294 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1294 1295
1295 1296 @command('debuglabelcomplete', [], _('LABEL...'))
1296 1297 def debuglabelcomplete(ui, repo, *args):
1297 1298 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
1298 1299 debugnamecomplete(ui, repo, *args)
1299 1300
1300 1301 @command('debuglocks',
1301 1302 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
1302 1303 ('W', 'force-wlock', None,
1303 1304 _('free the working state lock (DANGEROUS)')),
1304 1305 ('s', 'set-lock', None, _('set the store lock until stopped')),
1305 1306 ('S', 'set-wlock', None,
1306 1307 _('set the working state lock until stopped'))],
1307 1308 _('[OPTION]...'))
1308 1309 def debuglocks(ui, repo, **opts):
1309 1310 """show or modify state of locks
1310 1311
1311 1312 By default, this command will show which locks are held. This
1312 1313 includes the user and process holding the lock, the amount of time
1313 1314 the lock has been held, and the machine name where the process is
1314 1315 running if it's not local.
1315 1316
1316 1317 Locks protect the integrity of Mercurial's data, so should be
1317 1318 treated with care. System crashes or other interruptions may cause
1318 1319 locks to not be properly released, though Mercurial will usually
1319 1320 detect and remove such stale locks automatically.
1320 1321
1321 1322 However, detecting stale locks may not always be possible (for
1322 1323 instance, on a shared filesystem). Removing locks may also be
1323 1324 blocked by filesystem permissions.
1324 1325
1325 1326 Setting a lock will prevent other commands from changing the data.
1326 1327 The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs.
1327 1328 The set locks are removed when the command exits.
1328 1329
1329 1330 Returns 0 if no locks are held.
1330 1331
1331 1332 """
1332 1333
1333 1334 if opts.get(r'force_lock'):
1334 1335 repo.svfs.unlink('lock')
1335 1336 if opts.get(r'force_wlock'):
1336 1337 repo.vfs.unlink('wlock')
1337 1338 if opts.get(r'force_lock') or opts.get(r'force_wlock'):
1338 1339 return 0
1339 1340
1340 1341 locks = []
1341 1342 try:
1342 1343 if opts.get(r'set_wlock'):
1343 1344 try:
1344 1345 locks.append(repo.wlock(False))
1345 1346 except error.LockHeld:
1346 1347 raise error.Abort(_('wlock is already held'))
1347 1348 if opts.get(r'set_lock'):
1348 1349 try:
1349 1350 locks.append(repo.lock(False))
1350 1351 except error.LockHeld:
1351 1352 raise error.Abort(_('lock is already held'))
1352 1353 if len(locks):
1353 1354 ui.promptchoice(_("ready to release the lock (y)? $$ &Yes"))
1354 1355 return 0
1355 1356 finally:
1356 1357 release(*locks)
1357 1358
1358 1359 now = time.time()
1359 1360 held = 0
1360 1361
1361 1362 def report(vfs, name, method):
1362 1363 # this causes stale locks to get reaped for more accurate reporting
1363 1364 try:
1364 1365 l = method(False)
1365 1366 except error.LockHeld:
1366 1367 l = None
1367 1368
1368 1369 if l:
1369 1370 l.release()
1370 1371 else:
1371 1372 try:
1372 1373 stat = vfs.lstat(name)
1373 1374 age = now - stat.st_mtime
1374 1375 user = util.username(stat.st_uid)
1375 1376 locker = vfs.readlock(name)
1376 1377 if ":" in locker:
1377 1378 host, pid = locker.split(':')
1378 1379 if host == socket.gethostname():
1379 1380 locker = 'user %s, process %s' % (user, pid)
1380 1381 else:
1381 1382 locker = 'user %s, process %s, host %s' \
1382 1383 % (user, pid, host)
1383 1384 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
1384 1385 return 1
1385 1386 except OSError as e:
1386 1387 if e.errno != errno.ENOENT:
1387 1388 raise
1388 1389
1389 1390 ui.write(("%-6s free\n") % (name + ":"))
1390 1391 return 0
1391 1392
1392 1393 held += report(repo.svfs, "lock", repo.lock)
1393 1394 held += report(repo.vfs, "wlock", repo.wlock)
1394 1395
1395 1396 return held
1396 1397
1397 1398 @command('debugmergestate', [], '')
1398 1399 def debugmergestate(ui, repo, *args):
1399 1400 """print merge state
1400 1401
1401 1402 Use --verbose to print out information about whether v1 or v2 merge state
1402 1403 was chosen."""
1403 1404 def _hashornull(h):
1404 1405 if h == nullhex:
1405 1406 return 'null'
1406 1407 else:
1407 1408 return h
1408 1409
1409 1410 def printrecords(version):
1410 1411 ui.write(('* version %d records\n') % version)
1411 1412 if version == 1:
1412 1413 records = v1records
1413 1414 else:
1414 1415 records = v2records
1415 1416
1416 1417 for rtype, record in records:
1417 1418 # pretty print some record types
1418 1419 if rtype == 'L':
1419 1420 ui.write(('local: %s\n') % record)
1420 1421 elif rtype == 'O':
1421 1422 ui.write(('other: %s\n') % record)
1422 1423 elif rtype == 'm':
1423 1424 driver, mdstate = record.split('\0', 1)
1424 1425 ui.write(('merge driver: %s (state "%s")\n')
1425 1426 % (driver, mdstate))
1426 1427 elif rtype in 'FDC':
1427 1428 r = record.split('\0')
1428 1429 f, state, hash, lfile, afile, anode, ofile = r[0:7]
1429 1430 if version == 1:
1430 1431 onode = 'not stored in v1 format'
1431 1432 flags = r[7]
1432 1433 else:
1433 1434 onode, flags = r[7:9]
1434 1435 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
1435 1436 % (f, rtype, state, _hashornull(hash)))
1436 1437 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
1437 1438 ui.write((' ancestor path: %s (node %s)\n')
1438 1439 % (afile, _hashornull(anode)))
1439 1440 ui.write((' other path: %s (node %s)\n')
1440 1441 % (ofile, _hashornull(onode)))
1441 1442 elif rtype == 'f':
1442 1443 filename, rawextras = record.split('\0', 1)
1443 1444 extras = rawextras.split('\0')
1444 1445 i = 0
1445 1446 extrastrings = []
1446 1447 while i < len(extras):
1447 1448 extrastrings.append('%s = %s' % (extras[i], extras[i + 1]))
1448 1449 i += 2
1449 1450
1450 1451 ui.write(('file extras: %s (%s)\n')
1451 1452 % (filename, ', '.join(extrastrings)))
1452 1453 elif rtype == 'l':
1453 1454 labels = record.split('\0', 2)
1454 1455 labels = [l for l in labels if len(l) > 0]
1455 1456 ui.write(('labels:\n'))
1456 1457 ui.write((' local: %s\n' % labels[0]))
1457 1458 ui.write((' other: %s\n' % labels[1]))
1458 1459 if len(labels) > 2:
1459 1460 ui.write((' base: %s\n' % labels[2]))
1460 1461 else:
1461 1462 ui.write(('unrecognized entry: %s\t%s\n')
1462 1463 % (rtype, record.replace('\0', '\t')))
1463 1464
1464 1465 # Avoid mergestate.read() since it may raise an exception for unsupported
1465 1466 # merge state records. We shouldn't be doing this, but this is OK since this
1466 1467 # command is pretty low-level.
1467 1468 ms = mergemod.mergestate(repo)
1468 1469
1469 1470 # sort so that reasonable information is on top
1470 1471 v1records = ms._readrecordsv1()
1471 1472 v2records = ms._readrecordsv2()
1472 1473 order = 'LOml'
1473 1474 def key(r):
1474 1475 idx = order.find(r[0])
1475 1476 if idx == -1:
1476 1477 return (1, r[1])
1477 1478 else:
1478 1479 return (0, idx)
1479 1480 v1records.sort(key=key)
1480 1481 v2records.sort(key=key)
1481 1482
1482 1483 if not v1records and not v2records:
1483 1484 ui.write(('no merge state found\n'))
1484 1485 elif not v2records:
1485 1486 ui.note(('no version 2 merge state\n'))
1486 1487 printrecords(1)
1487 1488 elif ms._v1v2match(v1records, v2records):
1488 1489 ui.note(('v1 and v2 states match: using v2\n'))
1489 1490 printrecords(2)
1490 1491 else:
1491 1492 ui.note(('v1 and v2 states mismatch: using v1\n'))
1492 1493 printrecords(1)
1493 1494 if ui.verbose:
1494 1495 printrecords(2)
1495 1496
1496 1497 @command('debugnamecomplete', [], _('NAME...'))
1497 1498 def debugnamecomplete(ui, repo, *args):
1498 1499 '''complete "names" - tags, open branch names, bookmark names'''
1499 1500
1500 1501 names = set()
1501 1502 # since we previously only listed open branches, we will handle that
1502 1503 # specially (after this for loop)
1503 1504 for name, ns in repo.names.iteritems():
1504 1505 if name != 'branches':
1505 1506 names.update(ns.listnames(repo))
1506 1507 names.update(tag for (tag, heads, tip, closed)
1507 1508 in repo.branchmap().iterbranches() if not closed)
1508 1509 completions = set()
1509 1510 if not args:
1510 1511 args = ['']
1511 1512 for a in args:
1512 1513 completions.update(n for n in names if n.startswith(a))
1513 1514 ui.write('\n'.join(sorted(completions)))
1514 1515 ui.write('\n')
1515 1516
1516 1517 @command('debugobsolete',
1517 1518 [('', 'flags', 0, _('markers flag')),
1518 1519 ('', 'record-parents', False,
1519 1520 _('record parent information for the precursor')),
1520 1521 ('r', 'rev', [], _('display markers relevant to REV')),
1521 1522 ('', 'exclusive', False, _('restrict display to markers only '
1522 1523 'relevant to REV')),
1523 1524 ('', 'index', False, _('display index of the marker')),
1524 1525 ('', 'delete', [], _('delete markers specified by indices')),
1525 1526 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1526 1527 _('[OBSOLETED [REPLACEMENT ...]]'))
1527 1528 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1528 1529 """create arbitrary obsolete marker
1529 1530
1530 1531 With no arguments, displays the list of obsolescence markers."""
1531 1532
1532 1533 opts = pycompat.byteskwargs(opts)
1533 1534
1534 1535 def parsenodeid(s):
1535 1536 try:
1536 1537 # We do not use revsingle/revrange functions here to accept
1537 1538 # arbitrary node identifiers, possibly not present in the
1538 1539 # local repository.
1539 1540 n = bin(s)
1540 1541 if len(n) != len(nullid):
1541 1542 raise TypeError()
1542 1543 return n
1543 1544 except TypeError:
1544 1545 raise error.Abort('changeset references must be full hexadecimal '
1545 1546 'node identifiers')
1546 1547
1547 1548 if opts.get('delete'):
1548 1549 indices = []
1549 1550 for v in opts.get('delete'):
1550 1551 try:
1551 1552 indices.append(int(v))
1552 1553 except ValueError:
1553 1554 raise error.Abort(_('invalid index value: %r') % v,
1554 1555 hint=_('use integers for indices'))
1555 1556
1556 1557 if repo.currenttransaction():
1557 1558 raise error.Abort(_('cannot delete obsmarkers in the middle '
1558 1559 'of transaction.'))
1559 1560
1560 1561 with repo.lock():
1561 1562 n = repair.deleteobsmarkers(repo.obsstore, indices)
1562 1563 ui.write(_('deleted %i obsolescence markers\n') % n)
1563 1564
1564 1565 return
1565 1566
1566 1567 if precursor is not None:
1567 1568 if opts['rev']:
1568 1569 raise error.Abort('cannot select revision when creating marker')
1569 1570 metadata = {}
1570 1571 metadata['user'] = opts['user'] or ui.username()
1571 1572 succs = tuple(parsenodeid(succ) for succ in successors)
1572 1573 l = repo.lock()
1573 1574 try:
1574 1575 tr = repo.transaction('debugobsolete')
1575 1576 try:
1576 1577 date = opts.get('date')
1577 1578 if date:
1578 1579 date = util.parsedate(date)
1579 1580 else:
1580 1581 date = None
1581 1582 prec = parsenodeid(precursor)
1582 1583 parents = None
1583 1584 if opts['record_parents']:
1584 1585 if prec not in repo.unfiltered():
1585 1586 raise error.Abort('cannot used --record-parents on '
1586 1587 'unknown changesets')
1587 1588 parents = repo.unfiltered()[prec].parents()
1588 1589 parents = tuple(p.node() for p in parents)
1589 1590 repo.obsstore.create(tr, prec, succs, opts['flags'],
1590 1591 parents=parents, date=date,
1591 1592 metadata=metadata, ui=ui)
1592 1593 tr.close()
1593 1594 except ValueError as exc:
1594 1595 raise error.Abort(_('bad obsmarker input: %s') %
1595 1596 pycompat.bytestr(exc))
1596 1597 finally:
1597 1598 tr.release()
1598 1599 finally:
1599 1600 l.release()
1600 1601 else:
1601 1602 if opts['rev']:
1602 1603 revs = scmutil.revrange(repo, opts['rev'])
1603 1604 nodes = [repo[r].node() for r in revs]
1604 1605 markers = list(obsutil.getmarkers(repo, nodes=nodes,
1605 1606 exclusive=opts['exclusive']))
1606 1607 markers.sort(key=lambda x: x._data)
1607 1608 else:
1608 1609 markers = obsutil.getmarkers(repo)
1609 1610
1610 1611 markerstoiter = markers
1611 1612 isrelevant = lambda m: True
1612 1613 if opts.get('rev') and opts.get('index'):
1613 1614 markerstoiter = obsutil.getmarkers(repo)
1614 1615 markerset = set(markers)
1615 1616 isrelevant = lambda m: m in markerset
1616 1617
1617 1618 fm = ui.formatter('debugobsolete', opts)
1618 1619 for i, m in enumerate(markerstoiter):
1619 1620 if not isrelevant(m):
1620 1621 # marker can be irrelevant when we're iterating over a set
1621 1622 # of markers (markerstoiter) which is bigger than the set
1622 1623 # of markers we want to display (markers)
1623 1624 # this can happen if both --index and --rev options are
1624 1625 # provided and thus we need to iterate over all of the markers
1625 1626 # to get the correct indices, but only display the ones that
1626 1627 # are relevant to --rev value
1627 1628 continue
1628 1629 fm.startitem()
1629 1630 ind = i if opts.get('index') else None
1630 1631 cmdutil.showmarker(fm, m, index=ind)
1631 1632 fm.end()
1632 1633
1633 1634 @command('debugpathcomplete',
1634 1635 [('f', 'full', None, _('complete an entire path')),
1635 1636 ('n', 'normal', None, _('show only normal files')),
1636 1637 ('a', 'added', None, _('show only added files')),
1637 1638 ('r', 'removed', None, _('show only removed files'))],
1638 1639 _('FILESPEC...'))
1639 1640 def debugpathcomplete(ui, repo, *specs, **opts):
1640 1641 '''complete part or all of a tracked path
1641 1642
1642 1643 This command supports shells that offer path name completion. It
1643 1644 currently completes only files already known to the dirstate.
1644 1645
1645 1646 Completion extends only to the next path segment unless
1646 1647 --full is specified, in which case entire paths are used.'''
1647 1648
1648 1649 def complete(path, acceptable):
1649 1650 dirstate = repo.dirstate
1650 1651 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
1651 1652 rootdir = repo.root + pycompat.ossep
1652 1653 if spec != repo.root and not spec.startswith(rootdir):
1653 1654 return [], []
1654 1655 if os.path.isdir(spec):
1655 1656 spec += '/'
1656 1657 spec = spec[len(rootdir):]
1657 1658 fixpaths = pycompat.ossep != '/'
1658 1659 if fixpaths:
1659 1660 spec = spec.replace(pycompat.ossep, '/')
1660 1661 speclen = len(spec)
1661 1662 fullpaths = opts[r'full']
1662 1663 files, dirs = set(), set()
1663 1664 adddir, addfile = dirs.add, files.add
1664 1665 for f, st in dirstate.iteritems():
1665 1666 if f.startswith(spec) and st[0] in acceptable:
1666 1667 if fixpaths:
1667 1668 f = f.replace('/', pycompat.ossep)
1668 1669 if fullpaths:
1669 1670 addfile(f)
1670 1671 continue
1671 1672 s = f.find(pycompat.ossep, speclen)
1672 1673 if s >= 0:
1673 1674 adddir(f[:s])
1674 1675 else:
1675 1676 addfile(f)
1676 1677 return files, dirs
1677 1678
1678 1679 acceptable = ''
1679 1680 if opts[r'normal']:
1680 1681 acceptable += 'nm'
1681 1682 if opts[r'added']:
1682 1683 acceptable += 'a'
1683 1684 if opts[r'removed']:
1684 1685 acceptable += 'r'
1685 1686 cwd = repo.getcwd()
1686 1687 if not specs:
1687 1688 specs = ['.']
1688 1689
1689 1690 files, dirs = set(), set()
1690 1691 for spec in specs:
1691 1692 f, d = complete(spec, acceptable or 'nmar')
1692 1693 files.update(f)
1693 1694 dirs.update(d)
1694 1695 files.update(dirs)
1695 1696 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1696 1697 ui.write('\n')
1697 1698
1698 1699 @command('debugpeer', [], _('PATH'), norepo=True)
1699 1700 def debugpeer(ui, path):
1700 1701 """establish a connection to a peer repository"""
1701 1702 # Always enable peer request logging. Requires --debug to display
1702 1703 # though.
1703 1704 overrides = {
1704 1705 ('devel', 'debug.peer-request'): True,
1705 1706 }
1706 1707
1707 1708 with ui.configoverride(overrides):
1708 1709 peer = hg.peer(ui, {}, path)
1709 1710
1710 1711 local = peer.local() is not None
1711 1712 canpush = peer.canpush()
1712 1713
1713 1714 ui.write(_('url: %s\n') % peer.url())
1714 1715 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1715 1716 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1716 1717
1717 1718 @command('debugpickmergetool',
1718 1719 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1719 1720 ('', 'changedelete', None, _('emulate merging change and delete')),
1720 1721 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1721 1722 _('[PATTERN]...'),
1722 1723 inferrepo=True)
1723 1724 def debugpickmergetool(ui, repo, *pats, **opts):
1724 1725 """examine which merge tool is chosen for specified file
1725 1726
1726 1727 As described in :hg:`help merge-tools`, Mercurial examines
1727 1728 configurations below in this order to decide which merge tool is
1728 1729 chosen for specified file.
1729 1730
1730 1731 1. ``--tool`` option
1731 1732 2. ``HGMERGE`` environment variable
1732 1733 3. configurations in ``merge-patterns`` section
1733 1734 4. configuration of ``ui.merge``
1734 1735 5. configurations in ``merge-tools`` section
1735 1736 6. ``hgmerge`` tool (for historical reason only)
1736 1737 7. default tool for fallback (``:merge`` or ``:prompt``)
1737 1738
1738 1739 This command writes out examination result in the style below::
1739 1740
1740 1741 FILE = MERGETOOL
1741 1742
1742 1743 By default, all files known in the first parent context of the
1743 1744 working directory are examined. Use file patterns and/or -I/-X
1744 1745 options to limit target files. -r/--rev is also useful to examine
1745 1746 files in another context without actual updating to it.
1746 1747
1747 1748 With --debug, this command shows warning messages while matching
1748 1749 against ``merge-patterns`` and so on, too. It is recommended to
1749 1750 use this option with explicit file patterns and/or -I/-X options,
1750 1751 because this option increases amount of output per file according
1751 1752 to configurations in hgrc.
1752 1753
1753 1754 With -v/--verbose, this command shows configurations below at
1754 1755 first (only if specified).
1755 1756
1756 1757 - ``--tool`` option
1757 1758 - ``HGMERGE`` environment variable
1758 1759 - configuration of ``ui.merge``
1759 1760
1760 1761 If merge tool is chosen before matching against
1761 1762 ``merge-patterns``, this command can't show any helpful
1762 1763 information, even with --debug. In such case, information above is
1763 1764 useful to know why a merge tool is chosen.
1764 1765 """
1765 1766 opts = pycompat.byteskwargs(opts)
1766 1767 overrides = {}
1767 1768 if opts['tool']:
1768 1769 overrides[('ui', 'forcemerge')] = opts['tool']
1769 1770 ui.note(('with --tool %r\n') % (opts['tool']))
1770 1771
1771 1772 with ui.configoverride(overrides, 'debugmergepatterns'):
1772 1773 hgmerge = encoding.environ.get("HGMERGE")
1773 1774 if hgmerge is not None:
1774 1775 ui.note(('with HGMERGE=%r\n') % (hgmerge))
1775 1776 uimerge = ui.config("ui", "merge")
1776 1777 if uimerge:
1777 1778 ui.note(('with ui.merge=%r\n') % (uimerge))
1778 1779
1779 1780 ctx = scmutil.revsingle(repo, opts.get('rev'))
1780 1781 m = scmutil.match(ctx, pats, opts)
1781 1782 changedelete = opts['changedelete']
1782 1783 for path in ctx.walk(m):
1783 1784 fctx = ctx[path]
1784 1785 try:
1785 1786 if not ui.debugflag:
1786 1787 ui.pushbuffer(error=True)
1787 1788 tool, toolpath = filemerge._picktool(repo, ui, path,
1788 1789 fctx.isbinary(),
1789 1790 'l' in fctx.flags(),
1790 1791 changedelete)
1791 1792 finally:
1792 1793 if not ui.debugflag:
1793 1794 ui.popbuffer()
1794 1795 ui.write(('%s = %s\n') % (path, tool))
1795 1796
1796 1797 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1797 1798 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1798 1799 '''access the pushkey key/value protocol
1799 1800
1800 1801 With two args, list the keys in the given namespace.
1801 1802
1802 1803 With five args, set a key to new if it currently is set to old.
1803 1804 Reports success or failure.
1804 1805 '''
1805 1806
1806 1807 target = hg.peer(ui, {}, repopath)
1807 1808 if keyinfo:
1808 1809 key, old, new = keyinfo
1809 1810 r = target.pushkey(namespace, key, old, new)
1810 1811 ui.status(str(r) + '\n')
1811 1812 return not r
1812 1813 else:
1813 1814 for k, v in sorted(target.listkeys(namespace).iteritems()):
1814 1815 ui.write("%s\t%s\n" % (util.escapestr(k),
1815 1816 util.escapestr(v)))
1816 1817
1817 1818 @command('debugpvec', [], _('A B'))
1818 1819 def debugpvec(ui, repo, a, b=None):
1819 1820 ca = scmutil.revsingle(repo, a)
1820 1821 cb = scmutil.revsingle(repo, b)
1821 1822 pa = pvec.ctxpvec(ca)
1822 1823 pb = pvec.ctxpvec(cb)
1823 1824 if pa == pb:
1824 1825 rel = "="
1825 1826 elif pa > pb:
1826 1827 rel = ">"
1827 1828 elif pa < pb:
1828 1829 rel = "<"
1829 1830 elif pa | pb:
1830 1831 rel = "|"
1831 1832 ui.write(_("a: %s\n") % pa)
1832 1833 ui.write(_("b: %s\n") % pb)
1833 1834 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
1834 1835 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
1835 1836 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
1836 1837 pa.distance(pb), rel))
1837 1838
1838 1839 @command('debugrebuilddirstate|debugrebuildstate',
1839 1840 [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
1840 1841 ('', 'minimal', None, _('only rebuild files that are inconsistent with '
1841 1842 'the working copy parent')),
1842 1843 ],
1843 1844 _('[-r REV]'))
1844 1845 def debugrebuilddirstate(ui, repo, rev, **opts):
1845 1846 """rebuild the dirstate as it would look like for the given revision
1846 1847
1847 1848 If no revision is specified the first current parent will be used.
1848 1849
1849 1850 The dirstate will be set to the files of the given revision.
1850 1851 The actual working directory content or existing dirstate
1851 1852 information such as adds or removes is not considered.
1852 1853
1853 1854 ``minimal`` will only rebuild the dirstate status for files that claim to be
1854 1855 tracked but are not in the parent manifest, or that exist in the parent
1855 1856 manifest but are not in the dirstate. It will not change adds, removes, or
1856 1857 modified files that are in the working copy parent.
1857 1858
1858 1859 One use of this command is to make the next :hg:`status` invocation
1859 1860 check the actual file content.
1860 1861 """
1861 1862 ctx = scmutil.revsingle(repo, rev)
1862 1863 with repo.wlock():
1863 1864 dirstate = repo.dirstate
1864 1865 changedfiles = None
1865 1866 # See command doc for what minimal does.
1866 1867 if opts.get(r'minimal'):
1867 1868 manifestfiles = set(ctx.manifest().keys())
1868 1869 dirstatefiles = set(dirstate)
1869 1870 manifestonly = manifestfiles - dirstatefiles
1870 1871 dsonly = dirstatefiles - manifestfiles
1871 1872 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
1872 1873 changedfiles = manifestonly | dsnotadded
1873 1874
1874 1875 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
1875 1876
1876 1877 @command('debugrebuildfncache', [], '')
1877 1878 def debugrebuildfncache(ui, repo):
1878 1879 """rebuild the fncache file"""
1879 1880 repair.rebuildfncache(ui, repo)
1880 1881
1881 1882 @command('debugrename',
1882 1883 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1883 1884 _('[-r REV] FILE'))
1884 1885 def debugrename(ui, repo, file1, *pats, **opts):
1885 1886 """dump rename information"""
1886 1887
1887 1888 opts = pycompat.byteskwargs(opts)
1888 1889 ctx = scmutil.revsingle(repo, opts.get('rev'))
1889 1890 m = scmutil.match(ctx, (file1,) + pats, opts)
1890 1891 for abs in ctx.walk(m):
1891 1892 fctx = ctx[abs]
1892 1893 o = fctx.filelog().renamed(fctx.filenode())
1893 1894 rel = m.rel(abs)
1894 1895 if o:
1895 1896 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
1896 1897 else:
1897 1898 ui.write(_("%s not renamed\n") % rel)
1898 1899
1899 1900 @command('debugrevlog', cmdutil.debugrevlogopts +
1900 1901 [('d', 'dump', False, _('dump index data'))],
1901 1902 _('-c|-m|FILE'),
1902 1903 optionalrepo=True)
1903 1904 def debugrevlog(ui, repo, file_=None, **opts):
1904 1905 """show data and statistics about a revlog"""
1905 1906 opts = pycompat.byteskwargs(opts)
1906 1907 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
1907 1908
1908 1909 if opts.get("dump"):
1909 1910 numrevs = len(r)
1910 1911 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2"
1911 1912 " rawsize totalsize compression heads chainlen\n"))
1912 1913 ts = 0
1913 1914 heads = set()
1914 1915
1915 1916 for rev in xrange(numrevs):
1916 1917 dbase = r.deltaparent(rev)
1917 1918 if dbase == -1:
1918 1919 dbase = rev
1919 1920 cbase = r.chainbase(rev)
1920 1921 clen = r.chainlen(rev)
1921 1922 p1, p2 = r.parentrevs(rev)
1922 1923 rs = r.rawsize(rev)
1923 1924 ts = ts + rs
1924 1925 heads -= set(r.parentrevs(rev))
1925 1926 heads.add(rev)
1926 1927 try:
1927 1928 compression = ts / r.end(rev)
1928 1929 except ZeroDivisionError:
1929 1930 compression = 0
1930 1931 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
1931 1932 "%11d %5d %8d\n" %
1932 1933 (rev, p1, p2, r.start(rev), r.end(rev),
1933 1934 r.start(dbase), r.start(cbase),
1934 1935 r.start(p1), r.start(p2),
1935 1936 rs, ts, compression, len(heads), clen))
1936 1937 return 0
1937 1938
1938 1939 v = r.version
1939 1940 format = v & 0xFFFF
1940 1941 flags = []
1941 1942 gdelta = False
1942 1943 if v & revlog.FLAG_INLINE_DATA:
1943 1944 flags.append('inline')
1944 1945 if v & revlog.FLAG_GENERALDELTA:
1945 1946 gdelta = True
1946 1947 flags.append('generaldelta')
1947 1948 if not flags:
1948 1949 flags = ['(none)']
1949 1950
1950 1951 nummerges = 0
1951 1952 numfull = 0
1952 1953 numprev = 0
1953 1954 nump1 = 0
1954 1955 nump2 = 0
1955 1956 numother = 0
1956 1957 nump1prev = 0
1957 1958 nump2prev = 0
1958 1959 chainlengths = []
1959 1960 chainbases = []
1960 1961 chainspans = []
1961 1962
1962 1963 datasize = [None, 0, 0]
1963 1964 fullsize = [None, 0, 0]
1964 1965 deltasize = [None, 0, 0]
1965 1966 chunktypecounts = {}
1966 1967 chunktypesizes = {}
1967 1968
1968 1969 def addsize(size, l):
1969 1970 if l[0] is None or size < l[0]:
1970 1971 l[0] = size
1971 1972 if size > l[1]:
1972 1973 l[1] = size
1973 1974 l[2] += size
1974 1975
1975 1976 numrevs = len(r)
1976 1977 for rev in xrange(numrevs):
1977 1978 p1, p2 = r.parentrevs(rev)
1978 1979 delta = r.deltaparent(rev)
1979 1980 if format > 0:
1980 1981 addsize(r.rawsize(rev), datasize)
1981 1982 if p2 != nullrev:
1982 1983 nummerges += 1
1983 1984 size = r.length(rev)
1984 1985 if delta == nullrev:
1985 1986 chainlengths.append(0)
1986 1987 chainbases.append(r.start(rev))
1987 1988 chainspans.append(size)
1988 1989 numfull += 1
1989 1990 addsize(size, fullsize)
1990 1991 else:
1991 1992 chainlengths.append(chainlengths[delta] + 1)
1992 1993 baseaddr = chainbases[delta]
1993 1994 revaddr = r.start(rev)
1994 1995 chainbases.append(baseaddr)
1995 1996 chainspans.append((revaddr - baseaddr) + size)
1996 1997 addsize(size, deltasize)
1997 1998 if delta == rev - 1:
1998 1999 numprev += 1
1999 2000 if delta == p1:
2000 2001 nump1prev += 1
2001 2002 elif delta == p2:
2002 2003 nump2prev += 1
2003 2004 elif delta == p1:
2004 2005 nump1 += 1
2005 2006 elif delta == p2:
2006 2007 nump2 += 1
2007 2008 elif delta != nullrev:
2008 2009 numother += 1
2009 2010
2010 2011 # Obtain data on the raw chunks in the revlog.
2011 2012 segment = r._getsegmentforrevs(rev, rev)[1]
2012 2013 if segment:
2013 2014 chunktype = bytes(segment[0:1])
2014 2015 else:
2015 2016 chunktype = 'empty'
2016 2017
2017 2018 if chunktype not in chunktypecounts:
2018 2019 chunktypecounts[chunktype] = 0
2019 2020 chunktypesizes[chunktype] = 0
2020 2021
2021 2022 chunktypecounts[chunktype] += 1
2022 2023 chunktypesizes[chunktype] += size
2023 2024
2024 2025 # Adjust size min value for empty cases
2025 2026 for size in (datasize, fullsize, deltasize):
2026 2027 if size[0] is None:
2027 2028 size[0] = 0
2028 2029
2029 2030 numdeltas = numrevs - numfull
2030 2031 numoprev = numprev - nump1prev - nump2prev
2031 2032 totalrawsize = datasize[2]
2032 2033 datasize[2] /= numrevs
2033 2034 fulltotal = fullsize[2]
2034 2035 fullsize[2] /= numfull
2035 2036 deltatotal = deltasize[2]
2036 2037 if numrevs - numfull > 0:
2037 2038 deltasize[2] /= numrevs - numfull
2038 2039 totalsize = fulltotal + deltatotal
2039 2040 avgchainlen = sum(chainlengths) / numrevs
2040 2041 maxchainlen = max(chainlengths)
2041 2042 maxchainspan = max(chainspans)
2042 2043 compratio = 1
2043 2044 if totalsize:
2044 2045 compratio = totalrawsize / totalsize
2045 2046
2046 2047 basedfmtstr = '%%%dd\n'
2047 2048 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
2048 2049
2049 2050 def dfmtstr(max):
2050 2051 return basedfmtstr % len(str(max))
2051 2052 def pcfmtstr(max, padding=0):
2052 2053 return basepcfmtstr % (len(str(max)), ' ' * padding)
2053 2054
2054 2055 def pcfmt(value, total):
2055 2056 if total:
2056 2057 return (value, 100 * float(value) / total)
2057 2058 else:
2058 2059 return value, 100.0
2059 2060
2060 2061 ui.write(('format : %d\n') % format)
2061 2062 ui.write(('flags : %s\n') % ', '.join(flags))
2062 2063
2063 2064 ui.write('\n')
2064 2065 fmt = pcfmtstr(totalsize)
2065 2066 fmt2 = dfmtstr(totalsize)
2066 2067 ui.write(('revisions : ') + fmt2 % numrevs)
2067 2068 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs))
2068 2069 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs))
2069 2070 ui.write(('revisions : ') + fmt2 % numrevs)
2070 2071 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs))
2071 2072 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs))
2072 2073 ui.write(('revision size : ') + fmt2 % totalsize)
2073 2074 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize))
2074 2075 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize))
2075 2076
2076 2077 def fmtchunktype(chunktype):
2077 2078 if chunktype == 'empty':
2078 2079 return ' %s : ' % chunktype
2079 2080 elif chunktype in pycompat.bytestr(string.ascii_letters):
2080 2081 return ' 0x%s (%s) : ' % (hex(chunktype), chunktype)
2081 2082 else:
2082 2083 return ' 0x%s : ' % hex(chunktype)
2083 2084
2084 2085 ui.write('\n')
2085 2086 ui.write(('chunks : ') + fmt2 % numrevs)
2086 2087 for chunktype in sorted(chunktypecounts):
2087 2088 ui.write(fmtchunktype(chunktype))
2088 2089 ui.write(fmt % pcfmt(chunktypecounts[chunktype], numrevs))
2089 2090 ui.write(('chunks size : ') + fmt2 % totalsize)
2090 2091 for chunktype in sorted(chunktypecounts):
2091 2092 ui.write(fmtchunktype(chunktype))
2092 2093 ui.write(fmt % pcfmt(chunktypesizes[chunktype], totalsize))
2093 2094
2094 2095 ui.write('\n')
2095 2096 fmt = dfmtstr(max(avgchainlen, maxchainlen, maxchainspan, compratio))
2096 2097 ui.write(('avg chain length : ') + fmt % avgchainlen)
2097 2098 ui.write(('max chain length : ') + fmt % maxchainlen)
2098 2099 ui.write(('max chain reach : ') + fmt % maxchainspan)
2099 2100 ui.write(('compression ratio : ') + fmt % compratio)
2100 2101
2101 2102 if format > 0:
2102 2103 ui.write('\n')
2103 2104 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n')
2104 2105 % tuple(datasize))
2105 2106 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n')
2106 2107 % tuple(fullsize))
2107 2108 ui.write(('delta size (min/max/avg) : %d / %d / %d\n')
2108 2109 % tuple(deltasize))
2109 2110
2110 2111 if numdeltas > 0:
2111 2112 ui.write('\n')
2112 2113 fmt = pcfmtstr(numdeltas)
2113 2114 fmt2 = pcfmtstr(numdeltas, 4)
2114 2115 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas))
2115 2116 if numprev > 0:
2116 2117 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev,
2117 2118 numprev))
2118 2119 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev,
2119 2120 numprev))
2120 2121 ui.write((' other : ') + fmt2 % pcfmt(numoprev,
2121 2122 numprev))
2122 2123 if gdelta:
2123 2124 ui.write(('deltas against p1 : ')
2124 2125 + fmt % pcfmt(nump1, numdeltas))
2125 2126 ui.write(('deltas against p2 : ')
2126 2127 + fmt % pcfmt(nump2, numdeltas))
2127 2128 ui.write(('deltas against other : ') + fmt % pcfmt(numother,
2128 2129 numdeltas))
2129 2130
2130 2131 @command('debugrevspec',
2131 2132 [('', 'optimize', None,
2132 2133 _('print parsed tree after optimizing (DEPRECATED)')),
2133 2134 ('', 'show-revs', True, _('print list of result revisions (default)')),
2134 2135 ('s', 'show-set', None, _('print internal representation of result set')),
2135 2136 ('p', 'show-stage', [],
2136 2137 _('print parsed tree at the given stage'), _('NAME')),
2137 2138 ('', 'no-optimized', False, _('evaluate tree without optimization')),
2138 2139 ('', 'verify-optimized', False, _('verify optimized result')),
2139 2140 ],
2140 2141 ('REVSPEC'))
2141 2142 def debugrevspec(ui, repo, expr, **opts):
2142 2143 """parse and apply a revision specification
2143 2144
2144 2145 Use -p/--show-stage option to print the parsed tree at the given stages.
2145 2146 Use -p all to print tree at every stage.
2146 2147
2147 2148 Use --no-show-revs option with -s or -p to print only the set
2148 2149 representation or the parsed tree respectively.
2149 2150
2150 2151 Use --verify-optimized to compare the optimized result with the unoptimized
2151 2152 one. Returns 1 if the optimized result differs.
2152 2153 """
2153 2154 opts = pycompat.byteskwargs(opts)
2154 2155 aliases = ui.configitems('revsetalias')
2155 2156 stages = [
2156 2157 ('parsed', lambda tree: tree),
2157 2158 ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
2158 2159 ui.warn)),
2159 2160 ('concatenated', revsetlang.foldconcat),
2160 2161 ('analyzed', revsetlang.analyze),
2161 2162 ('optimized', revsetlang.optimize),
2162 2163 ]
2163 2164 if opts['no_optimized']:
2164 2165 stages = stages[:-1]
2165 2166 if opts['verify_optimized'] and opts['no_optimized']:
2166 2167 raise error.Abort(_('cannot use --verify-optimized with '
2167 2168 '--no-optimized'))
2168 2169 stagenames = set(n for n, f in stages)
2169 2170
2170 2171 showalways = set()
2171 2172 showchanged = set()
2172 2173 if ui.verbose and not opts['show_stage']:
2173 2174 # show parsed tree by --verbose (deprecated)
2174 2175 showalways.add('parsed')
2175 2176 showchanged.update(['expanded', 'concatenated'])
2176 2177 if opts['optimize']:
2177 2178 showalways.add('optimized')
2178 2179 if opts['show_stage'] and opts['optimize']:
2179 2180 raise error.Abort(_('cannot use --optimize with --show-stage'))
2180 2181 if opts['show_stage'] == ['all']:
2181 2182 showalways.update(stagenames)
2182 2183 else:
2183 2184 for n in opts['show_stage']:
2184 2185 if n not in stagenames:
2185 2186 raise error.Abort(_('invalid stage name: %s') % n)
2186 2187 showalways.update(opts['show_stage'])
2187 2188
2188 2189 treebystage = {}
2189 2190 printedtree = None
2190 2191 tree = revsetlang.parse(expr, lookup=repo.__contains__)
2191 2192 for n, f in stages:
2192 2193 treebystage[n] = tree = f(tree)
2193 2194 if n in showalways or (n in showchanged and tree != printedtree):
2194 2195 if opts['show_stage'] or n != 'parsed':
2195 2196 ui.write(("* %s:\n") % n)
2196 2197 ui.write(revsetlang.prettyformat(tree), "\n")
2197 2198 printedtree = tree
2198 2199
2199 2200 if opts['verify_optimized']:
2200 2201 arevs = revset.makematcher(treebystage['analyzed'])(repo)
2201 2202 brevs = revset.makematcher(treebystage['optimized'])(repo)
2202 2203 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2203 2204 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
2204 2205 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
2205 2206 arevs = list(arevs)
2206 2207 brevs = list(brevs)
2207 2208 if arevs == brevs:
2208 2209 return 0
2209 2210 ui.write(('--- analyzed\n'), label='diff.file_a')
2210 2211 ui.write(('+++ optimized\n'), label='diff.file_b')
2211 2212 sm = difflib.SequenceMatcher(None, arevs, brevs)
2212 2213 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2213 2214 if tag in ('delete', 'replace'):
2214 2215 for c in arevs[alo:ahi]:
2215 2216 ui.write('-%s\n' % c, label='diff.deleted')
2216 2217 if tag in ('insert', 'replace'):
2217 2218 for c in brevs[blo:bhi]:
2218 2219 ui.write('+%s\n' % c, label='diff.inserted')
2219 2220 if tag == 'equal':
2220 2221 for c in arevs[alo:ahi]:
2221 2222 ui.write(' %s\n' % c)
2222 2223 return 1
2223 2224
2224 2225 func = revset.makematcher(tree)
2225 2226 revs = func(repo)
2226 2227 if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
2227 2228 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
2228 2229 if not opts['show_revs']:
2229 2230 return
2230 2231 for c in revs:
2231 2232 ui.write("%d\n" % c)
2232 2233
2234 @command('debugserve', [
2235 ('', 'sshstdio', False, _('run an SSH server bound to process handles')),
2236 ('', 'logiofd', '', _('file descriptor to log server I/O to')),
2237 ('', 'logiofile', '', _('file to log server I/O to')),
2238 ], '')
2239 def debugserve(ui, repo, **opts):
2240 """run a server with advanced settings
2241
2242 This command is similar to :hg:`serve`. It exists partially as a
2243 workaround to the fact that ``hg serve --stdio`` must have specific
2244 arguments for security reasons.
2245 """
2246 opts = pycompat.byteskwargs(opts)
2247
2248 if not opts['sshstdio']:
2249 raise error.Abort(_('only --sshstdio is currently supported'))
2250
2251 logfh = None
2252
2253 if opts['logiofd'] and opts['logiofile']:
2254 raise error.Abort(_('cannot use both --logiofd and --logiofile'))
2255
2256 if opts['logiofd']:
2257 # Line buffered because output is line based.
2258 logfh = os.fdopen(int(opts['logiofd']), 'ab', 1)
2259 elif opts['logiofile']:
2260 logfh = open(opts['logiofile'], 'ab', 1)
2261
2262 s = wireprotoserver.sshserver(ui, repo, logfh=logfh)
2263 s.serve_forever()
2264
2233 2265 @command('debugsetparents', [], _('REV1 [REV2]'))
2234 2266 def debugsetparents(ui, repo, rev1, rev2=None):
2235 2267 """manually set the parents of the current working directory
2236 2268
2237 2269 This is useful for writing repository conversion tools, but should
2238 2270 be used with care. For example, neither the working directory nor the
2239 2271 dirstate is updated, so file status may be incorrect after running this
2240 2272 command.
2241 2273
2242 2274 Returns 0 on success.
2243 2275 """
2244 2276
2245 2277 r1 = scmutil.revsingle(repo, rev1).node()
2246 2278 r2 = scmutil.revsingle(repo, rev2, 'null').node()
2247 2279
2248 2280 with repo.wlock():
2249 2281 repo.setparents(r1, r2)
2250 2282
2251 2283 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2252 2284 def debugssl(ui, repo, source=None, **opts):
2253 2285 '''test a secure connection to a server
2254 2286
2255 2287 This builds the certificate chain for the server on Windows, installing the
2256 2288 missing intermediates and trusted root via Windows Update if necessary. It
2257 2289 does nothing on other platforms.
2258 2290
2259 2291 If SOURCE is omitted, the 'default' path will be used. If a URL is given,
2260 2292 that server is used. See :hg:`help urls` for more information.
2261 2293
2262 2294 If the update succeeds, retry the original operation. Otherwise, the cause
2263 2295 of the SSL error is likely another issue.
2264 2296 '''
2265 2297 if not pycompat.iswindows:
2266 2298 raise error.Abort(_('certificate chain building is only possible on '
2267 2299 'Windows'))
2268 2300
2269 2301 if not source:
2270 2302 if not repo:
2271 2303 raise error.Abort(_("there is no Mercurial repository here, and no "
2272 2304 "server specified"))
2273 2305 source = "default"
2274 2306
2275 2307 source, branches = hg.parseurl(ui.expandpath(source))
2276 2308 url = util.url(source)
2277 2309 addr = None
2278 2310
2279 2311 defaultport = {'https': 443, 'ssh': 22}
2280 2312 if url.scheme in defaultport:
2281 2313 try:
2282 2314 addr = (url.host, int(url.port or defaultport[url.scheme]))
2283 2315 except ValueError:
2284 2316 raise error.Abort(_("malformed port number in URL"))
2285 2317 else:
2286 2318 raise error.Abort(_("only https and ssh connections are supported"))
2287 2319
2288 2320 from . import win32
2289 2321
2290 2322 s = ssl.wrap_socket(socket.socket(), ssl_version=ssl.PROTOCOL_TLS,
2291 2323 cert_reqs=ssl.CERT_NONE, ca_certs=None)
2292 2324
2293 2325 try:
2294 2326 s.connect(addr)
2295 2327 cert = s.getpeercert(True)
2296 2328
2297 2329 ui.status(_('checking the certificate chain for %s\n') % url.host)
2298 2330
2299 2331 complete = win32.checkcertificatechain(cert, build=False)
2300 2332
2301 2333 if not complete:
2302 2334 ui.status(_('certificate chain is incomplete, updating... '))
2303 2335
2304 2336 if not win32.checkcertificatechain(cert):
2305 2337 ui.status(_('failed.\n'))
2306 2338 else:
2307 2339 ui.status(_('done.\n'))
2308 2340 else:
2309 2341 ui.status(_('full certificate chain is available\n'))
2310 2342 finally:
2311 2343 s.close()
2312 2344
2313 2345 @command('debugsub',
2314 2346 [('r', 'rev', '',
2315 2347 _('revision to check'), _('REV'))],
2316 2348 _('[-r REV] [REV]'))
2317 2349 def debugsub(ui, repo, rev=None):
2318 2350 ctx = scmutil.revsingle(repo, rev, None)
2319 2351 for k, v in sorted(ctx.substate.items()):
2320 2352 ui.write(('path %s\n') % k)
2321 2353 ui.write((' source %s\n') % v[0])
2322 2354 ui.write((' revision %s\n') % v[1])
2323 2355
2324 2356 @command('debugsuccessorssets',
2325 2357 [('', 'closest', False, _('return closest successors sets only'))],
2326 2358 _('[REV]'))
2327 2359 def debugsuccessorssets(ui, repo, *revs, **opts):
2328 2360 """show set of successors for revision
2329 2361
2330 2362 A successors set of changeset A is a consistent group of revisions that
2331 2363 succeed A. It contains non-obsolete changesets only unless closests
2332 2364 successors set is set.
2333 2365
2334 2366 In most cases a changeset A has a single successors set containing a single
2335 2367 successor (changeset A replaced by A').
2336 2368
2337 2369 A changeset that is made obsolete with no successors are called "pruned".
2338 2370 Such changesets have no successors sets at all.
2339 2371
2340 2372 A changeset that has been "split" will have a successors set containing
2341 2373 more than one successor.
2342 2374
2343 2375 A changeset that has been rewritten in multiple different ways is called
2344 2376 "divergent". Such changesets have multiple successor sets (each of which
2345 2377 may also be split, i.e. have multiple successors).
2346 2378
2347 2379 Results are displayed as follows::
2348 2380
2349 2381 <rev1>
2350 2382 <successors-1A>
2351 2383 <rev2>
2352 2384 <successors-2A>
2353 2385 <successors-2B1> <successors-2B2> <successors-2B3>
2354 2386
2355 2387 Here rev2 has two possible (i.e. divergent) successors sets. The first
2356 2388 holds one element, whereas the second holds three (i.e. the changeset has
2357 2389 been split).
2358 2390 """
2359 2391 # passed to successorssets caching computation from one call to another
2360 2392 cache = {}
2361 2393 ctx2str = bytes
2362 2394 node2str = short
2363 2395 for rev in scmutil.revrange(repo, revs):
2364 2396 ctx = repo[rev]
2365 2397 ui.write('%s\n'% ctx2str(ctx))
2366 2398 for succsset in obsutil.successorssets(repo, ctx.node(),
2367 2399 closest=opts[r'closest'],
2368 2400 cache=cache):
2369 2401 if succsset:
2370 2402 ui.write(' ')
2371 2403 ui.write(node2str(succsset[0]))
2372 2404 for node in succsset[1:]:
2373 2405 ui.write(' ')
2374 2406 ui.write(node2str(node))
2375 2407 ui.write('\n')
2376 2408
2377 2409 @command('debugtemplate',
2378 2410 [('r', 'rev', [], _('apply template on changesets'), _('REV')),
2379 2411 ('D', 'define', [], _('define template keyword'), _('KEY=VALUE'))],
2380 2412 _('[-r REV]... [-D KEY=VALUE]... TEMPLATE'),
2381 2413 optionalrepo=True)
2382 2414 def debugtemplate(ui, repo, tmpl, **opts):
2383 2415 """parse and apply a template
2384 2416
2385 2417 If -r/--rev is given, the template is processed as a log template and
2386 2418 applied to the given changesets. Otherwise, it is processed as a generic
2387 2419 template.
2388 2420
2389 2421 Use --verbose to print the parsed tree.
2390 2422 """
2391 2423 revs = None
2392 2424 if opts[r'rev']:
2393 2425 if repo is None:
2394 2426 raise error.RepoError(_('there is no Mercurial repository here '
2395 2427 '(.hg not found)'))
2396 2428 revs = scmutil.revrange(repo, opts[r'rev'])
2397 2429
2398 2430 props = {}
2399 2431 for d in opts[r'define']:
2400 2432 try:
2401 2433 k, v = (e.strip() for e in d.split('=', 1))
2402 2434 if not k or k == 'ui':
2403 2435 raise ValueError
2404 2436 props[k] = v
2405 2437 except ValueError:
2406 2438 raise error.Abort(_('malformed keyword definition: %s') % d)
2407 2439
2408 2440 if ui.verbose:
2409 2441 aliases = ui.configitems('templatealias')
2410 2442 tree = templater.parse(tmpl)
2411 2443 ui.note(templater.prettyformat(tree), '\n')
2412 2444 newtree = templater.expandaliases(tree, aliases)
2413 2445 if newtree != tree:
2414 2446 ui.note(("* expanded:\n"), templater.prettyformat(newtree), '\n')
2415 2447
2416 2448 if revs is None:
2417 2449 tres = formatter.templateresources(ui, repo)
2418 2450 t = formatter.maketemplater(ui, tmpl, resources=tres)
2419 2451 ui.write(t.render(props))
2420 2452 else:
2421 2453 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2422 2454 for r in revs:
2423 2455 displayer.show(repo[r], **pycompat.strkwargs(props))
2424 2456 displayer.close()
2425 2457
2426 2458 @command('debugupdatecaches', [])
2427 2459 def debugupdatecaches(ui, repo, *pats, **opts):
2428 2460 """warm all known caches in the repository"""
2429 2461 with repo.wlock(), repo.lock():
2430 2462 repo.updatecaches()
2431 2463
2432 2464 @command('debugupgraderepo', [
2433 2465 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2434 2466 ('', 'run', False, _('performs an upgrade')),
2435 2467 ])
2436 2468 def debugupgraderepo(ui, repo, run=False, optimize=None):
2437 2469 """upgrade a repository to use different features
2438 2470
2439 2471 If no arguments are specified, the repository is evaluated for upgrade
2440 2472 and a list of problems and potential optimizations is printed.
2441 2473
2442 2474 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
2443 2475 can be influenced via additional arguments. More details will be provided
2444 2476 by the command output when run without ``--run``.
2445 2477
2446 2478 During the upgrade, the repository will be locked and no writes will be
2447 2479 allowed.
2448 2480
2449 2481 At the end of the upgrade, the repository may not be readable while new
2450 2482 repository data is swapped in. This window will be as long as it takes to
2451 2483 rename some directories inside the ``.hg`` directory. On most machines, this
2452 2484 should complete almost instantaneously and the chances of a consumer being
2453 2485 unable to access the repository should be low.
2454 2486 """
2455 2487 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2456 2488
2457 2489 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2458 2490 inferrepo=True)
2459 2491 def debugwalk(ui, repo, *pats, **opts):
2460 2492 """show how files match on given patterns"""
2461 2493 opts = pycompat.byteskwargs(opts)
2462 2494 m = scmutil.match(repo[None], pats, opts)
2463 2495 ui.write(('matcher: %r\n' % m))
2464 2496 items = list(repo[None].walk(m))
2465 2497 if not items:
2466 2498 return
2467 2499 f = lambda fn: fn
2468 2500 if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
2469 2501 f = lambda fn: util.normpath(fn)
2470 2502 fmt = 'f %%-%ds %%-%ds %%s' % (
2471 2503 max([len(abs) for abs in items]),
2472 2504 max([len(m.rel(abs)) for abs in items]))
2473 2505 for abs in items:
2474 2506 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2475 2507 ui.write("%s\n" % line.rstrip())
2476 2508
2477 2509 @command('debugwireargs',
2478 2510 [('', 'three', '', 'three'),
2479 2511 ('', 'four', '', 'four'),
2480 2512 ('', 'five', '', 'five'),
2481 2513 ] + cmdutil.remoteopts,
2482 2514 _('REPO [OPTIONS]... [ONE [TWO]]'),
2483 2515 norepo=True)
2484 2516 def debugwireargs(ui, repopath, *vals, **opts):
2485 2517 opts = pycompat.byteskwargs(opts)
2486 2518 repo = hg.peer(ui, opts, repopath)
2487 2519 for opt in cmdutil.remoteopts:
2488 2520 del opts[opt[1]]
2489 2521 args = {}
2490 2522 for k, v in opts.iteritems():
2491 2523 if v:
2492 2524 args[k] = v
2493 2525 args = pycompat.strkwargs(args)
2494 2526 # run twice to check that we don't mess up the stream for the next command
2495 2527 res1 = repo.debugwireargs(*vals, **args)
2496 2528 res2 = repo.debugwireargs(*vals, **args)
2497 2529 ui.write("%s\n" % res1)
2498 2530 if res1 != res2:
2499 2531 ui.warn("%s\n" % res2)
@@ -1,391 +1,393 b''
1 1 Show all commands except debug commands
2 2 $ hg debugcomplete
3 3 add
4 4 addremove
5 5 annotate
6 6 archive
7 7 backout
8 8 bisect
9 9 bookmarks
10 10 branch
11 11 branches
12 12 bundle
13 13 cat
14 14 clone
15 15 commit
16 16 config
17 17 copy
18 18 diff
19 19 export
20 20 files
21 21 forget
22 22 graft
23 23 grep
24 24 heads
25 25 help
26 26 identify
27 27 import
28 28 incoming
29 29 init
30 30 locate
31 31 log
32 32 manifest
33 33 merge
34 34 outgoing
35 35 parents
36 36 paths
37 37 phase
38 38 pull
39 39 push
40 40 recover
41 41 remove
42 42 rename
43 43 resolve
44 44 revert
45 45 rollback
46 46 root
47 47 serve
48 48 status
49 49 summary
50 50 tag
51 51 tags
52 52 tip
53 53 unbundle
54 54 update
55 55 verify
56 56 version
57 57
58 58 Show all commands that start with "a"
59 59 $ hg debugcomplete a
60 60 add
61 61 addremove
62 62 annotate
63 63 archive
64 64
65 65 Do not show debug commands if there are other candidates
66 66 $ hg debugcomplete d
67 67 diff
68 68
69 69 Show debug commands if there are no other candidates
70 70 $ hg debugcomplete debug
71 71 debugancestor
72 72 debugapplystreamclonebundle
73 73 debugbuilddag
74 74 debugbundle
75 75 debugcapabilities
76 76 debugcheckstate
77 77 debugcolor
78 78 debugcommands
79 79 debugcomplete
80 80 debugconfig
81 81 debugcreatestreamclonebundle
82 82 debugdag
83 83 debugdata
84 84 debugdate
85 85 debugdeltachain
86 86 debugdirstate
87 87 debugdiscovery
88 88 debugdownload
89 89 debugextensions
90 90 debugfileset
91 91 debugformat
92 92 debugfsinfo
93 93 debuggetbundle
94 94 debugignore
95 95 debugindex
96 96 debugindexdot
97 97 debuginstall
98 98 debugknown
99 99 debuglabelcomplete
100 100 debuglocks
101 101 debugmergestate
102 102 debugnamecomplete
103 103 debugobsolete
104 104 debugpathcomplete
105 105 debugpeer
106 106 debugpickmergetool
107 107 debugpushkey
108 108 debugpvec
109 109 debugrebuilddirstate
110 110 debugrebuildfncache
111 111 debugrename
112 112 debugrevlog
113 113 debugrevspec
114 debugserve
114 115 debugsetparents
115 116 debugssl
116 117 debugsub
117 118 debugsuccessorssets
118 119 debugtemplate
119 120 debugupdatecaches
120 121 debugupgraderepo
121 122 debugwalk
122 123 debugwireargs
123 124
124 125 Do not show the alias of a debug command if there are other candidates
125 126 (this should hide rawcommit)
126 127 $ hg debugcomplete r
127 128 recover
128 129 remove
129 130 rename
130 131 resolve
131 132 revert
132 133 rollback
133 134 root
134 135 Show the alias of a debug command if there are no other candidates
135 136 $ hg debugcomplete rawc
136 137
137 138
138 139 Show the global options
139 140 $ hg debugcomplete --options | sort
140 141 --color
141 142 --config
142 143 --cwd
143 144 --debug
144 145 --debugger
145 146 --encoding
146 147 --encodingmode
147 148 --help
148 149 --hidden
149 150 --noninteractive
150 151 --pager
151 152 --profile
152 153 --quiet
153 154 --repository
154 155 --time
155 156 --traceback
156 157 --verbose
157 158 --version
158 159 -R
159 160 -h
160 161 -q
161 162 -v
162 163 -y
163 164
164 165 Show the options for the "serve" command
165 166 $ hg debugcomplete --options serve | sort
166 167 --accesslog
167 168 --address
168 169 --certificate
169 170 --cmdserver
170 171 --color
171 172 --config
172 173 --cwd
173 174 --daemon
174 175 --daemon-postexec
175 176 --debug
176 177 --debugger
177 178 --encoding
178 179 --encodingmode
179 180 --errorlog
180 181 --help
181 182 --hidden
182 183 --ipv6
183 184 --name
184 185 --noninteractive
185 186 --pager
186 187 --pid-file
187 188 --port
188 189 --prefix
189 190 --profile
190 191 --quiet
191 192 --repository
192 193 --stdio
193 194 --style
194 195 --subrepos
195 196 --templates
196 197 --time
197 198 --traceback
198 199 --verbose
199 200 --version
200 201 --web-conf
201 202 -6
202 203 -A
203 204 -E
204 205 -R
205 206 -S
206 207 -a
207 208 -d
208 209 -h
209 210 -n
210 211 -p
211 212 -q
212 213 -t
213 214 -v
214 215 -y
215 216
216 217 Show an error if we use --options with an ambiguous abbreviation
217 218 $ hg debugcomplete --options s
218 219 hg: command 's' is ambiguous:
219 220 serve showconfig status summary
220 221 [255]
221 222
222 223 Show all commands + options
223 224 $ hg debugcommands
224 225 add: include, exclude, subrepos, dry-run
225 226 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template
226 227 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
227 228 commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
228 229 diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos
229 230 export: output, switch-parent, rev, text, git, binary, nodates
230 231 forget: include, exclude
231 232 init: ssh, remotecmd, insecure
232 233 log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
233 234 merge: force, rev, preview, abort, tool
234 235 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
235 236 push: force, rev, bookmark, branch, new-branch, pushvars, ssh, remotecmd, insecure
236 237 remove: after, force, subrepos, include, exclude
237 238 serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos
238 239 status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template
239 240 summary: remote
240 241 update: clean, check, merge, date, rev, tool
241 242 addremove: similarity, subrepos, include, exclude, dry-run
242 243 archive: no-decode, prefix, rev, type, subrepos, include, exclude
243 244 backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
244 245 bisect: reset, good, bad, skip, extend, command, noupdate
245 246 bookmarks: force, rev, delete, rename, inactive, template
246 247 branch: force, clean, rev
247 248 branches: active, closed, template
248 249 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
249 250 cat: output, rev, decode, include, exclude, template
250 251 config: untrusted, edit, local, global, template
251 252 copy: after, force, include, exclude, dry-run
252 253 debugancestor:
253 254 debugapplystreamclonebundle:
254 255 debugbuilddag: mergeable-file, overwritten-file, new-file
255 256 debugbundle: all, part-type, spec
256 257 debugcapabilities:
257 258 debugcheckstate:
258 259 debugcolor: style
259 260 debugcommands:
260 261 debugcomplete: options
261 262 debugcreatestreamclonebundle:
262 263 debugdag: tags, branches, dots, spaces
263 264 debugdata: changelog, manifest, dir
264 265 debugdate: extended
265 266 debugdeltachain: changelog, manifest, dir, template
266 267 debugdirstate: nodates, datesort
267 268 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
268 269 debugdownload: output
269 270 debugextensions: template
270 271 debugfileset: rev
271 272 debugformat: template
272 273 debugfsinfo:
273 274 debuggetbundle: head, common, type
274 275 debugignore:
275 276 debugindex: changelog, manifest, dir, format
276 277 debugindexdot: changelog, manifest, dir
277 278 debuginstall: template
278 279 debugknown:
279 280 debuglabelcomplete:
280 281 debuglocks: force-lock, force-wlock, set-lock, set-wlock
281 282 debugmergestate:
282 283 debugnamecomplete:
283 284 debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template
284 285 debugpathcomplete: full, normal, added, removed
285 286 debugpeer:
286 287 debugpickmergetool: rev, changedelete, include, exclude, tool
287 288 debugpushkey:
288 289 debugpvec:
289 290 debugrebuilddirstate: rev, minimal
290 291 debugrebuildfncache:
291 292 debugrename: rev
292 293 debugrevlog: changelog, manifest, dir, dump
293 294 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
295 debugserve: sshstdio, logiofd, logiofile
294 296 debugsetparents:
295 297 debugssl:
296 298 debugsub: rev
297 299 debugsuccessorssets: closest
298 300 debugtemplate: rev, define
299 301 debugupdatecaches:
300 302 debugupgraderepo: optimize, run
301 303 debugwalk: include, exclude
302 304 debugwireargs: three, four, five, ssh, remotecmd, insecure
303 305 files: rev, print0, include, exclude, template, subrepos
304 306 graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
305 307 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
306 308 heads: rev, topo, active, closed, style, template
307 309 help: extension, command, keyword, system
308 310 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
309 311 import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
310 312 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
311 313 locate: rev, print0, fullpath, include, exclude
312 314 manifest: rev, all, template
313 315 outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
314 316 parents: rev, style, template
315 317 paths: template
316 318 phase: public, draft, secret, force, rev
317 319 recover:
318 320 rename: after, force, include, exclude, dry-run
319 321 resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
320 322 revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
321 323 rollback: dry-run, force
322 324 root:
323 325 tag: force, local, rev, remove, edit, message, date, user
324 326 tags: template
325 327 tip: patch, git, style, template
326 328 unbundle: update
327 329 verify:
328 330 version: template
329 331
330 332 $ hg init a
331 333 $ cd a
332 334 $ echo fee > fee
333 335 $ hg ci -q -Amfee
334 336 $ hg tag fee
335 337 $ mkdir fie
336 338 $ echo dead > fie/dead
337 339 $ echo live > fie/live
338 340 $ hg bookmark fo
339 341 $ hg branch -q fie
340 342 $ hg ci -q -Amfie
341 343 $ echo fo > fo
342 344 $ hg branch -qf default
343 345 $ hg ci -q -Amfo
344 346 $ echo Fum > Fum
345 347 $ hg ci -q -AmFum
346 348 $ hg bookmark Fum
347 349
348 350 Test debugpathcomplete
349 351
350 352 $ hg debugpathcomplete f
351 353 fee
352 354 fie
353 355 fo
354 356 $ hg debugpathcomplete -f f
355 357 fee
356 358 fie/dead
357 359 fie/live
358 360 fo
359 361
360 362 $ hg rm Fum
361 363 $ hg debugpathcomplete -r F
362 364 Fum
363 365
364 366 Test debugnamecomplete
365 367
366 368 $ hg debugnamecomplete
367 369 Fum
368 370 default
369 371 fee
370 372 fie
371 373 fo
372 374 tip
373 375 $ hg debugnamecomplete f
374 376 fee
375 377 fie
376 378 fo
377 379
378 380 Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still
379 381 used for completions in some shells.
380 382
381 383 $ hg debuglabelcomplete
382 384 Fum
383 385 default
384 386 fee
385 387 fie
386 388 fo
387 389 tip
388 390 $ hg debuglabelcomplete f
389 391 fee
390 392 fie
391 393 fo
@@ -1,3473 +1,3474 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a bundle file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 files list tracked files
70 70 forget forget the specified files on the next commit
71 71 graft copy changes from other branches onto the current branch
72 72 grep search revision history for a pattern in specified files
73 73 heads show branch heads
74 74 help show help for a given topic or a help overview
75 75 identify identify the working directory or specified revision
76 76 import import an ordered set of patches
77 77 incoming show new changesets found in source
78 78 init create a new repository in the given directory
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge another revision into working directory
82 82 outgoing show changesets not found in the destination
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 root print the root (top) of the current working directory
93 93 serve start stand-alone webserver
94 94 status show changed files in the working directory
95 95 summary summarize working directory state
96 96 tag add one or more tags for the current or given revision
97 97 tags list repository tags
98 98 unbundle apply one or more bundle files
99 99 update update working directory (or switch revisions)
100 100 verify verify the integrity of the repository
101 101 version output version and copyright information
102 102
103 103 additional help topics:
104 104
105 105 bundlespec Bundle File Formats
106 106 color Colorizing Outputs
107 107 config Configuration Files
108 108 dates Date Formats
109 109 diffs Diff Formats
110 110 environment Environment Variables
111 111 extensions Using Additional Features
112 112 filesets Specifying File Sets
113 113 flags Command-line flags
114 114 glossary Glossary
115 115 hgignore Syntax for Mercurial Ignore Files
116 116 hgweb Configuring hgweb
117 117 internals Technical implementation topics
118 118 merge-tools Merge Tools
119 119 pager Pager Support
120 120 patterns File Name Patterns
121 121 phases Working with Phases
122 122 revisions Specifying Revisions
123 123 scripting Using Mercurial from scripts and automation
124 124 subrepos Subrepositories
125 125 templating Template Usage
126 126 urls URL Paths
127 127
128 128 (use 'hg help -v' to show built-in aliases and global options)
129 129
130 130 $ hg -q help
131 131 add add the specified files on the next commit
132 132 addremove add all new files, delete all missing files
133 133 annotate show changeset information by line for each file
134 134 archive create an unversioned archive of a repository revision
135 135 backout reverse effect of earlier changeset
136 136 bisect subdivision search of changesets
137 137 bookmarks create a new bookmark or list existing bookmarks
138 138 branch set or show the current branch name
139 139 branches list repository named branches
140 140 bundle create a bundle file
141 141 cat output the current or given revision of files
142 142 clone make a copy of an existing repository
143 143 commit commit the specified files or all outstanding changes
144 144 config show combined config settings from all hgrc files
145 145 copy mark files as copied for the next commit
146 146 diff diff repository (or selected files)
147 147 export dump the header and diffs for one or more changesets
148 148 files list tracked files
149 149 forget forget the specified files on the next commit
150 150 graft copy changes from other branches onto the current branch
151 151 grep search revision history for a pattern in specified files
152 152 heads show branch heads
153 153 help show help for a given topic or a help overview
154 154 identify identify the working directory or specified revision
155 155 import import an ordered set of patches
156 156 incoming show new changesets found in source
157 157 init create a new repository in the given directory
158 158 log show revision history of entire repository or files
159 159 manifest output the current or given revision of the project manifest
160 160 merge merge another revision into working directory
161 161 outgoing show changesets not found in the destination
162 162 paths show aliases for remote repositories
163 163 phase set or show the current phase name
164 164 pull pull changes from the specified source
165 165 push push changes to the specified destination
166 166 recover roll back an interrupted transaction
167 167 remove remove the specified files on the next commit
168 168 rename rename files; equivalent of copy + remove
169 169 resolve redo merges or set/view the merge status of files
170 170 revert restore files to their checkout state
171 171 root print the root (top) of the current working directory
172 172 serve start stand-alone webserver
173 173 status show changed files in the working directory
174 174 summary summarize working directory state
175 175 tag add one or more tags for the current or given revision
176 176 tags list repository tags
177 177 unbundle apply one or more bundle files
178 178 update update working directory (or switch revisions)
179 179 verify verify the integrity of the repository
180 180 version output version and copyright information
181 181
182 182 additional help topics:
183 183
184 184 bundlespec Bundle File Formats
185 185 color Colorizing Outputs
186 186 config Configuration Files
187 187 dates Date Formats
188 188 diffs Diff Formats
189 189 environment Environment Variables
190 190 extensions Using Additional Features
191 191 filesets Specifying File Sets
192 192 flags Command-line flags
193 193 glossary Glossary
194 194 hgignore Syntax for Mercurial Ignore Files
195 195 hgweb Configuring hgweb
196 196 internals Technical implementation topics
197 197 merge-tools Merge Tools
198 198 pager Pager Support
199 199 patterns File Name Patterns
200 200 phases Working with Phases
201 201 revisions Specifying Revisions
202 202 scripting Using Mercurial from scripts and automation
203 203 subrepos Subrepositories
204 204 templating Template Usage
205 205 urls URL Paths
206 206
207 207 Test extension help:
208 208 $ hg help extensions --config extensions.rebase= --config extensions.children=
209 209 Using Additional Features
210 210 """""""""""""""""""""""""
211 211
212 212 Mercurial has the ability to add new features through the use of
213 213 extensions. Extensions may add new commands, add options to existing
214 214 commands, change the default behavior of commands, or implement hooks.
215 215
216 216 To enable the "foo" extension, either shipped with Mercurial or in the
217 217 Python search path, create an entry for it in your configuration file,
218 218 like this:
219 219
220 220 [extensions]
221 221 foo =
222 222
223 223 You may also specify the full path to an extension:
224 224
225 225 [extensions]
226 226 myfeature = ~/.hgext/myfeature.py
227 227
228 228 See 'hg help config' for more information on configuration files.
229 229
230 230 Extensions are not loaded by default for a variety of reasons: they can
231 231 increase startup overhead; they may be meant for advanced usage only; they
232 232 may provide potentially dangerous abilities (such as letting you destroy
233 233 or modify history); they might not be ready for prime time; or they may
234 234 alter some usual behaviors of stock Mercurial. It is thus up to the user
235 235 to activate extensions as needed.
236 236
237 237 To explicitly disable an extension enabled in a configuration file of
238 238 broader scope, prepend its path with !:
239 239
240 240 [extensions]
241 241 # disabling extension bar residing in /path/to/extension/bar.py
242 242 bar = !/path/to/extension/bar.py
243 243 # ditto, but no path was supplied for extension baz
244 244 baz = !
245 245
246 246 enabled extensions:
247 247
248 248 children command to display child changesets (DEPRECATED)
249 249 rebase command to move sets of revisions to a different ancestor
250 250
251 251 disabled extensions:
252 252
253 253 acl hooks for controlling repository access
254 254 blackbox log repository events to a blackbox for debugging
255 255 bugzilla hooks for integrating with the Bugzilla bug tracker
256 256 censor erase file content at a given revision
257 257 churn command to display statistics about repository history
258 258 clonebundles advertise pre-generated bundles to seed clones
259 259 convert import revisions from foreign VCS repositories into
260 260 Mercurial
261 261 eol automatically manage newlines in repository files
262 262 extdiff command to allow external programs to compare revisions
263 263 factotum http authentication with factotum
264 264 githelp try mapping git commands to Mercurial commands
265 265 gpg commands to sign and verify changesets
266 266 hgk browse the repository in a graphical way
267 267 highlight syntax highlighting for hgweb (requires Pygments)
268 268 histedit interactive history editing
269 269 keyword expand keywords in tracked files
270 270 largefiles track large binary files
271 271 mq manage a stack of patches
272 272 notify hooks for sending email push notifications
273 273 patchbomb command to send changesets as (a series of) patch emails
274 274 purge command to delete untracked files from the working
275 275 directory
276 276 relink recreates hardlinks between repository clones
277 277 remotenames showing remotebookmarks and remotebranches in UI
278 278 schemes extend schemes with shortcuts to repository swarms
279 279 share share a common history between several working directories
280 280 shelve save and restore changes to the working directory
281 281 strip strip changesets and their descendants from history
282 282 transplant command to transplant changesets from another branch
283 283 win32mbcs allow the use of MBCS paths with problematic encodings
284 284 zeroconf discover and advertise repositories on the local network
285 285
286 286 Verify that deprecated extensions are included if --verbose:
287 287
288 288 $ hg -v help extensions | grep children
289 289 children command to display child changesets (DEPRECATED)
290 290
291 291 Verify that extension keywords appear in help templates
292 292
293 293 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
294 294
295 295 Test short command list with verbose option
296 296
297 297 $ hg -v help shortlist
298 298 Mercurial Distributed SCM
299 299
300 300 basic commands:
301 301
302 302 add add the specified files on the next commit
303 303 annotate, blame
304 304 show changeset information by line for each file
305 305 clone make a copy of an existing repository
306 306 commit, ci commit the specified files or all outstanding changes
307 307 diff diff repository (or selected files)
308 308 export dump the header and diffs for one or more changesets
309 309 forget forget the specified files on the next commit
310 310 init create a new repository in the given directory
311 311 log, history show revision history of entire repository or files
312 312 merge merge another revision into working directory
313 313 pull pull changes from the specified source
314 314 push push changes to the specified destination
315 315 remove, rm remove the specified files on the next commit
316 316 serve start stand-alone webserver
317 317 status, st show changed files in the working directory
318 318 summary, sum summarize working directory state
319 319 update, up, checkout, co
320 320 update working directory (or switch revisions)
321 321
322 322 global options ([+] can be repeated):
323 323
324 324 -R --repository REPO repository root directory or name of overlay bundle
325 325 file
326 326 --cwd DIR change working directory
327 327 -y --noninteractive do not prompt, automatically pick the first choice for
328 328 all prompts
329 329 -q --quiet suppress output
330 330 -v --verbose enable additional output
331 331 --color TYPE when to colorize (boolean, always, auto, never, or
332 332 debug)
333 333 --config CONFIG [+] set/override config option (use 'section.name=value')
334 334 --debug enable debugging output
335 335 --debugger start debugger
336 336 --encoding ENCODE set the charset encoding (default: ascii)
337 337 --encodingmode MODE set the charset encoding mode (default: strict)
338 338 --traceback always print a traceback on exception
339 339 --time time how long the command takes
340 340 --profile print command execution profile
341 341 --version output version information and exit
342 342 -h --help display help and exit
343 343 --hidden consider hidden changesets
344 344 --pager TYPE when to paginate (boolean, always, auto, or never)
345 345 (default: auto)
346 346
347 347 (use 'hg help' for the full list of commands)
348 348
349 349 $ hg add -h
350 350 hg add [OPTION]... [FILE]...
351 351
352 352 add the specified files on the next commit
353 353
354 354 Schedule files to be version controlled and added to the repository.
355 355
356 356 The files will be added to the repository at the next commit. To undo an
357 357 add before that, see 'hg forget'.
358 358
359 359 If no names are given, add all files to the repository (except files
360 360 matching ".hgignore").
361 361
362 362 Returns 0 if all files are successfully added.
363 363
364 364 options ([+] can be repeated):
365 365
366 366 -I --include PATTERN [+] include names matching the given patterns
367 367 -X --exclude PATTERN [+] exclude names matching the given patterns
368 368 -S --subrepos recurse into subrepositories
369 369 -n --dry-run do not perform actions, just print output
370 370
371 371 (some details hidden, use --verbose to show complete help)
372 372
373 373 Verbose help for add
374 374
375 375 $ hg add -hv
376 376 hg add [OPTION]... [FILE]...
377 377
378 378 add the specified files on the next commit
379 379
380 380 Schedule files to be version controlled and added to the repository.
381 381
382 382 The files will be added to the repository at the next commit. To undo an
383 383 add before that, see 'hg forget'.
384 384
385 385 If no names are given, add all files to the repository (except files
386 386 matching ".hgignore").
387 387
388 388 Examples:
389 389
390 390 - New (unknown) files are added automatically by 'hg add':
391 391
392 392 $ ls
393 393 foo.c
394 394 $ hg status
395 395 ? foo.c
396 396 $ hg add
397 397 adding foo.c
398 398 $ hg status
399 399 A foo.c
400 400
401 401 - Specific files to be added can be specified:
402 402
403 403 $ ls
404 404 bar.c foo.c
405 405 $ hg status
406 406 ? bar.c
407 407 ? foo.c
408 408 $ hg add bar.c
409 409 $ hg status
410 410 A bar.c
411 411 ? foo.c
412 412
413 413 Returns 0 if all files are successfully added.
414 414
415 415 options ([+] can be repeated):
416 416
417 417 -I --include PATTERN [+] include names matching the given patterns
418 418 -X --exclude PATTERN [+] exclude names matching the given patterns
419 419 -S --subrepos recurse into subrepositories
420 420 -n --dry-run do not perform actions, just print output
421 421
422 422 global options ([+] can be repeated):
423 423
424 424 -R --repository REPO repository root directory or name of overlay bundle
425 425 file
426 426 --cwd DIR change working directory
427 427 -y --noninteractive do not prompt, automatically pick the first choice for
428 428 all prompts
429 429 -q --quiet suppress output
430 430 -v --verbose enable additional output
431 431 --color TYPE when to colorize (boolean, always, auto, never, or
432 432 debug)
433 433 --config CONFIG [+] set/override config option (use 'section.name=value')
434 434 --debug enable debugging output
435 435 --debugger start debugger
436 436 --encoding ENCODE set the charset encoding (default: ascii)
437 437 --encodingmode MODE set the charset encoding mode (default: strict)
438 438 --traceback always print a traceback on exception
439 439 --time time how long the command takes
440 440 --profile print command execution profile
441 441 --version output version information and exit
442 442 -h --help display help and exit
443 443 --hidden consider hidden changesets
444 444 --pager TYPE when to paginate (boolean, always, auto, or never)
445 445 (default: auto)
446 446
447 447 Test the textwidth config option
448 448
449 449 $ hg root -h --config ui.textwidth=50
450 450 hg root
451 451
452 452 print the root (top) of the current working
453 453 directory
454 454
455 455 Print the root directory of the current
456 456 repository.
457 457
458 458 Returns 0 on success.
459 459
460 460 (some details hidden, use --verbose to show
461 461 complete help)
462 462
463 463 Test help option with version option
464 464
465 465 $ hg add -h --version
466 466 Mercurial Distributed SCM (version *) (glob)
467 467 (see https://mercurial-scm.org for more information)
468 468
469 469 Copyright (C) 2005-* Matt Mackall and others (glob)
470 470 This is free software; see the source for copying conditions. There is NO
471 471 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
472 472
473 473 $ hg add --skjdfks
474 474 hg add: option --skjdfks not recognized
475 475 hg add [OPTION]... [FILE]...
476 476
477 477 add the specified files on the next commit
478 478
479 479 options ([+] can be repeated):
480 480
481 481 -I --include PATTERN [+] include names matching the given patterns
482 482 -X --exclude PATTERN [+] exclude names matching the given patterns
483 483 -S --subrepos recurse into subrepositories
484 484 -n --dry-run do not perform actions, just print output
485 485
486 486 (use 'hg add -h' to show more help)
487 487 [255]
488 488
489 489 Test ambiguous command help
490 490
491 491 $ hg help ad
492 492 list of commands:
493 493
494 494 add add the specified files on the next commit
495 495 addremove add all new files, delete all missing files
496 496
497 497 (use 'hg help -v ad' to show built-in aliases and global options)
498 498
499 499 Test command without options
500 500
501 501 $ hg help verify
502 502 hg verify
503 503
504 504 verify the integrity of the repository
505 505
506 506 Verify the integrity of the current repository.
507 507
508 508 This will perform an extensive check of the repository's integrity,
509 509 validating the hashes and checksums of each entry in the changelog,
510 510 manifest, and tracked files, as well as the integrity of their crosslinks
511 511 and indices.
512 512
513 513 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
514 514 information about recovery from corruption of the repository.
515 515
516 516 Returns 0 on success, 1 if errors are encountered.
517 517
518 518 (some details hidden, use --verbose to show complete help)
519 519
520 520 $ hg help diff
521 521 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
522 522
523 523 diff repository (or selected files)
524 524
525 525 Show differences between revisions for the specified files.
526 526
527 527 Differences between files are shown using the unified diff format.
528 528
529 529 Note:
530 530 'hg diff' may generate unexpected results for merges, as it will
531 531 default to comparing against the working directory's first parent
532 532 changeset if no revisions are specified.
533 533
534 534 When two revision arguments are given, then changes are shown between
535 535 those revisions. If only one revision is specified then that revision is
536 536 compared to the working directory, and, when no revisions are specified,
537 537 the working directory files are compared to its first parent.
538 538
539 539 Alternatively you can specify -c/--change with a revision to see the
540 540 changes in that changeset relative to its first parent.
541 541
542 542 Without the -a/--text option, diff will avoid generating diffs of files it
543 543 detects as binary. With -a, diff will generate a diff anyway, probably
544 544 with undesirable results.
545 545
546 546 Use the -g/--git option to generate diffs in the git extended diff format.
547 547 For more information, read 'hg help diffs'.
548 548
549 549 Returns 0 on success.
550 550
551 551 options ([+] can be repeated):
552 552
553 553 -r --rev REV [+] revision
554 554 -c --change REV change made by revision
555 555 -a --text treat all files as text
556 556 -g --git use git extended diff format
557 557 --binary generate binary diffs in git mode (default)
558 558 --nodates omit dates from diff headers
559 559 --noprefix omit a/ and b/ prefixes from filenames
560 560 -p --show-function show which function each change is in
561 561 --reverse produce a diff that undoes the changes
562 562 -w --ignore-all-space ignore white space when comparing lines
563 563 -b --ignore-space-change ignore changes in the amount of white space
564 564 -B --ignore-blank-lines ignore changes whose lines are all blank
565 565 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
566 566 -U --unified NUM number of lines of context to show
567 567 --stat output diffstat-style summary of changes
568 568 --root DIR produce diffs relative to subdirectory
569 569 -I --include PATTERN [+] include names matching the given patterns
570 570 -X --exclude PATTERN [+] exclude names matching the given patterns
571 571 -S --subrepos recurse into subrepositories
572 572
573 573 (some details hidden, use --verbose to show complete help)
574 574
575 575 $ hg help status
576 576 hg status [OPTION]... [FILE]...
577 577
578 578 aliases: st
579 579
580 580 show changed files in the working directory
581 581
582 582 Show status of files in the repository. If names are given, only files
583 583 that match are shown. Files that are clean or ignored or the source of a
584 584 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
585 585 -C/--copies or -A/--all are given. Unless options described with "show
586 586 only ..." are given, the options -mardu are used.
587 587
588 588 Option -q/--quiet hides untracked (unknown and ignored) files unless
589 589 explicitly requested with -u/--unknown or -i/--ignored.
590 590
591 591 Note:
592 592 'hg status' may appear to disagree with diff if permissions have
593 593 changed or a merge has occurred. The standard diff format does not
594 594 report permission changes and diff only reports changes relative to one
595 595 merge parent.
596 596
597 597 If one revision is given, it is used as the base revision. If two
598 598 revisions are given, the differences between them are shown. The --change
599 599 option can also be used as a shortcut to list the changed files of a
600 600 revision from its first parent.
601 601
602 602 The codes used to show the status of files are:
603 603
604 604 M = modified
605 605 A = added
606 606 R = removed
607 607 C = clean
608 608 ! = missing (deleted by non-hg command, but still tracked)
609 609 ? = not tracked
610 610 I = ignored
611 611 = origin of the previous file (with --copies)
612 612
613 613 Returns 0 on success.
614 614
615 615 options ([+] can be repeated):
616 616
617 617 -A --all show status of all files
618 618 -m --modified show only modified files
619 619 -a --added show only added files
620 620 -r --removed show only removed files
621 621 -d --deleted show only deleted (but tracked) files
622 622 -c --clean show only files without changes
623 623 -u --unknown show only unknown (not tracked) files
624 624 -i --ignored show only ignored files
625 625 -n --no-status hide status prefix
626 626 -C --copies show source of copied files
627 627 -0 --print0 end filenames with NUL, for use with xargs
628 628 --rev REV [+] show difference from revision
629 629 --change REV list the changed files of a revision
630 630 -I --include PATTERN [+] include names matching the given patterns
631 631 -X --exclude PATTERN [+] exclude names matching the given patterns
632 632 -S --subrepos recurse into subrepositories
633 633
634 634 (some details hidden, use --verbose to show complete help)
635 635
636 636 $ hg -q help status
637 637 hg status [OPTION]... [FILE]...
638 638
639 639 show changed files in the working directory
640 640
641 641 $ hg help foo
642 642 abort: no such help topic: foo
643 643 (try 'hg help --keyword foo')
644 644 [255]
645 645
646 646 $ hg skjdfks
647 647 hg: unknown command 'skjdfks'
648 648 Mercurial Distributed SCM
649 649
650 650 basic commands:
651 651
652 652 add add the specified files on the next commit
653 653 annotate show changeset information by line for each file
654 654 clone make a copy of an existing repository
655 655 commit commit the specified files or all outstanding changes
656 656 diff diff repository (or selected files)
657 657 export dump the header and diffs for one or more changesets
658 658 forget forget the specified files on the next commit
659 659 init create a new repository in the given directory
660 660 log show revision history of entire repository or files
661 661 merge merge another revision into working directory
662 662 pull pull changes from the specified source
663 663 push push changes to the specified destination
664 664 remove remove the specified files on the next commit
665 665 serve start stand-alone webserver
666 666 status show changed files in the working directory
667 667 summary summarize working directory state
668 668 update update working directory (or switch revisions)
669 669
670 670 (use 'hg help' for the full list of commands or 'hg -v' for details)
671 671 [255]
672 672
673 673 Typoed command gives suggestion
674 674 $ hg puls
675 675 hg: unknown command 'puls'
676 676 (did you mean one of pull, push?)
677 677 [255]
678 678
679 679 Not enabled extension gets suggested
680 680
681 681 $ hg rebase
682 682 hg: unknown command 'rebase'
683 683 'rebase' is provided by the following extension:
684 684
685 685 rebase command to move sets of revisions to a different ancestor
686 686
687 687 (use 'hg help extensions' for information on enabling extensions)
688 688 [255]
689 689
690 690 Disabled extension gets suggested
691 691 $ hg --config extensions.rebase=! rebase
692 692 hg: unknown command 'rebase'
693 693 'rebase' is provided by the following extension:
694 694
695 695 rebase command to move sets of revisions to a different ancestor
696 696
697 697 (use 'hg help extensions' for information on enabling extensions)
698 698 [255]
699 699
700 700 Make sure that we don't run afoul of the help system thinking that
701 701 this is a section and erroring out weirdly.
702 702
703 703 $ hg .log
704 704 hg: unknown command '.log'
705 705 (did you mean log?)
706 706 [255]
707 707
708 708 $ hg log.
709 709 hg: unknown command 'log.'
710 710 (did you mean log?)
711 711 [255]
712 712 $ hg pu.lh
713 713 hg: unknown command 'pu.lh'
714 714 (did you mean one of pull, push?)
715 715 [255]
716 716
717 717 $ cat > helpext.py <<EOF
718 718 > import os
719 719 > from mercurial import commands, registrar
720 720 >
721 721 > cmdtable = {}
722 722 > command = registrar.command(cmdtable)
723 723 >
724 724 > @command(b'nohelp',
725 725 > [(b'', b'longdesc', 3, b'x'*90),
726 726 > (b'n', b'', None, b'normal desc'),
727 727 > (b'', b'newline', b'', b'line1\nline2')],
728 728 > b'hg nohelp',
729 729 > norepo=True)
730 730 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
731 731 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
732 732 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
733 733 > def nohelp(ui, *args, **kwargs):
734 734 > pass
735 735 >
736 736 > def uisetup(ui):
737 737 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
738 738 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
739 739 >
740 740 > EOF
741 741 $ echo '[extensions]' >> $HGRCPATH
742 742 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
743 743
744 744 Test for aliases
745 745
746 746 $ hg help hgalias
747 747 hg hgalias [--remote]
748 748
749 749 alias for: hg summary
750 750
751 751 summarize working directory state
752 752
753 753 This generates a brief summary of the working directory state, including
754 754 parents, branch, commit status, phase and available updates.
755 755
756 756 With the --remote option, this will check the default paths for incoming
757 757 and outgoing changes. This can be time-consuming.
758 758
759 759 Returns 0 on success.
760 760
761 761 defined by: helpext
762 762
763 763 options:
764 764
765 765 --remote check for push and pull
766 766
767 767 (some details hidden, use --verbose to show complete help)
768 768
769 769 $ hg help shellalias
770 770 hg shellalias
771 771
772 772 shell alias for:
773 773
774 774 echo hi
775 775
776 776 defined by: helpext
777 777
778 778 (some details hidden, use --verbose to show complete help)
779 779
780 780 Test command with no help text
781 781
782 782 $ hg help nohelp
783 783 hg nohelp
784 784
785 785 (no help text available)
786 786
787 787 options:
788 788
789 789 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
790 790 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
791 791 -n -- normal desc
792 792 --newline VALUE line1 line2
793 793
794 794 (some details hidden, use --verbose to show complete help)
795 795
796 796 $ hg help -k nohelp
797 797 Commands:
798 798
799 799 nohelp hg nohelp
800 800
801 801 Extension Commands:
802 802
803 803 nohelp (no help text available)
804 804
805 805 Test that default list of commands omits extension commands
806 806
807 807 $ hg help
808 808 Mercurial Distributed SCM
809 809
810 810 list of commands:
811 811
812 812 add add the specified files on the next commit
813 813 addremove add all new files, delete all missing files
814 814 annotate show changeset information by line for each file
815 815 archive create an unversioned archive of a repository revision
816 816 backout reverse effect of earlier changeset
817 817 bisect subdivision search of changesets
818 818 bookmarks create a new bookmark or list existing bookmarks
819 819 branch set or show the current branch name
820 820 branches list repository named branches
821 821 bundle create a bundle file
822 822 cat output the current or given revision of files
823 823 clone make a copy of an existing repository
824 824 commit commit the specified files or all outstanding changes
825 825 config show combined config settings from all hgrc files
826 826 copy mark files as copied for the next commit
827 827 diff diff repository (or selected files)
828 828 export dump the header and diffs for one or more changesets
829 829 files list tracked files
830 830 forget forget the specified files on the next commit
831 831 graft copy changes from other branches onto the current branch
832 832 grep search revision history for a pattern in specified files
833 833 heads show branch heads
834 834 help show help for a given topic or a help overview
835 835 identify identify the working directory or specified revision
836 836 import import an ordered set of patches
837 837 incoming show new changesets found in source
838 838 init create a new repository in the given directory
839 839 log show revision history of entire repository or files
840 840 manifest output the current or given revision of the project manifest
841 841 merge merge another revision into working directory
842 842 outgoing show changesets not found in the destination
843 843 paths show aliases for remote repositories
844 844 phase set or show the current phase name
845 845 pull pull changes from the specified source
846 846 push push changes to the specified destination
847 847 recover roll back an interrupted transaction
848 848 remove remove the specified files on the next commit
849 849 rename rename files; equivalent of copy + remove
850 850 resolve redo merges or set/view the merge status of files
851 851 revert restore files to their checkout state
852 852 root print the root (top) of the current working directory
853 853 serve start stand-alone webserver
854 854 status show changed files in the working directory
855 855 summary summarize working directory state
856 856 tag add one or more tags for the current or given revision
857 857 tags list repository tags
858 858 unbundle apply one or more bundle files
859 859 update update working directory (or switch revisions)
860 860 verify verify the integrity of the repository
861 861 version output version and copyright information
862 862
863 863 enabled extensions:
864 864
865 865 helpext (no help text available)
866 866
867 867 additional help topics:
868 868
869 869 bundlespec Bundle File Formats
870 870 color Colorizing Outputs
871 871 config Configuration Files
872 872 dates Date Formats
873 873 diffs Diff Formats
874 874 environment Environment Variables
875 875 extensions Using Additional Features
876 876 filesets Specifying File Sets
877 877 flags Command-line flags
878 878 glossary Glossary
879 879 hgignore Syntax for Mercurial Ignore Files
880 880 hgweb Configuring hgweb
881 881 internals Technical implementation topics
882 882 merge-tools Merge Tools
883 883 pager Pager Support
884 884 patterns File Name Patterns
885 885 phases Working with Phases
886 886 revisions Specifying Revisions
887 887 scripting Using Mercurial from scripts and automation
888 888 subrepos Subrepositories
889 889 templating Template Usage
890 890 urls URL Paths
891 891
892 892 (use 'hg help -v' to show built-in aliases and global options)
893 893
894 894
895 895 Test list of internal help commands
896 896
897 897 $ hg help debug
898 898 debug commands (internal and unsupported):
899 899
900 900 debugancestor
901 901 find the ancestor revision of two revisions in a given index
902 902 debugapplystreamclonebundle
903 903 apply a stream clone bundle file
904 904 debugbuilddag
905 905 builds a repo with a given DAG from scratch in the current
906 906 empty repo
907 907 debugbundle lists the contents of a bundle
908 908 debugcapabilities
909 909 lists the capabilities of a remote peer
910 910 debugcheckstate
911 911 validate the correctness of the current dirstate
912 912 debugcolor show available color, effects or style
913 913 debugcommands
914 914 list all available commands and options
915 915 debugcomplete
916 916 returns the completion list associated with the given command
917 917 debugcreatestreamclonebundle
918 918 create a stream clone bundle file
919 919 debugdag format the changelog or an index DAG as a concise textual
920 920 description
921 921 debugdata dump the contents of a data file revision
922 922 debugdate parse and display a date
923 923 debugdeltachain
924 924 dump information about delta chains in a revlog
925 925 debugdirstate
926 926 show the contents of the current dirstate
927 927 debugdiscovery
928 928 runs the changeset discovery protocol in isolation
929 929 debugdownload
930 930 download a resource using Mercurial logic and config
931 931 debugextensions
932 932 show information about active extensions
933 933 debugfileset parse and apply a fileset specification
934 934 debugformat display format information about the current repository
935 935 debugfsinfo show information detected about current filesystem
936 936 debuggetbundle
937 937 retrieves a bundle from a repo
938 938 debugignore display the combined ignore pattern and information about
939 939 ignored files
940 940 debugindex dump the contents of an index file
941 941 debugindexdot
942 942 dump an index DAG as a graphviz dot file
943 943 debuginstall test Mercurial installation
944 944 debugknown test whether node ids are known to a repo
945 945 debuglocks show or modify state of locks
946 946 debugmergestate
947 947 print merge state
948 948 debugnamecomplete
949 949 complete "names" - tags, open branch names, bookmark names
950 950 debugobsolete
951 951 create arbitrary obsolete marker
952 952 debugoptADV (no help text available)
953 953 debugoptDEP (no help text available)
954 954 debugoptEXP (no help text available)
955 955 debugpathcomplete
956 956 complete part or all of a tracked path
957 957 debugpeer establish a connection to a peer repository
958 958 debugpickmergetool
959 959 examine which merge tool is chosen for specified file
960 960 debugpushkey access the pushkey key/value protocol
961 961 debugpvec (no help text available)
962 962 debugrebuilddirstate
963 963 rebuild the dirstate as it would look like for the given
964 964 revision
965 965 debugrebuildfncache
966 966 rebuild the fncache file
967 967 debugrename dump rename information
968 968 debugrevlog show data and statistics about a revlog
969 969 debugrevspec parse and apply a revision specification
970 debugserve run a server with advanced settings
970 971 debugsetparents
971 972 manually set the parents of the current working directory
972 973 debugssl test a secure connection to a server
973 974 debugsub (no help text available)
974 975 debugsuccessorssets
975 976 show set of successors for revision
976 977 debugtemplate
977 978 parse and apply a template
978 979 debugupdatecaches
979 980 warm all known caches in the repository
980 981 debugupgraderepo
981 982 upgrade a repository to use different features
982 983 debugwalk show how files match on given patterns
983 984 debugwireargs
984 985 (no help text available)
985 986
986 987 (use 'hg help -v debug' to show built-in aliases and global options)
987 988
988 989 internals topic renders index of available sub-topics
989 990
990 991 $ hg help internals
991 992 Technical implementation topics
992 993 """""""""""""""""""""""""""""""
993 994
994 995 To access a subtopic, use "hg help internals.{subtopic-name}"
995 996
996 997 bundle2 Bundle2
997 998 bundles Bundles
998 999 censor Censor
999 1000 changegroups Changegroups
1000 1001 config Config Registrar
1001 1002 requirements Repository Requirements
1002 1003 revlogs Revision Logs
1003 1004 wireprotocol Wire Protocol
1004 1005
1005 1006 sub-topics can be accessed
1006 1007
1007 1008 $ hg help internals.changegroups
1008 1009 Changegroups
1009 1010 """"""""""""
1010 1011
1011 1012 Changegroups are representations of repository revlog data, specifically
1012 1013 the changelog data, root/flat manifest data, treemanifest data, and
1013 1014 filelogs.
1014 1015
1015 1016 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1016 1017 level, versions "1" and "2" are almost exactly the same, with the only
1017 1018 difference being an additional item in the *delta header*. Version "3"
1018 1019 adds support for revlog flags in the *delta header* and optionally
1019 1020 exchanging treemanifests (enabled by setting an option on the
1020 1021 "changegroup" part in the bundle2).
1021 1022
1022 1023 Changegroups when not exchanging treemanifests consist of 3 logical
1023 1024 segments:
1024 1025
1025 1026 +---------------------------------+
1026 1027 | | | |
1027 1028 | changeset | manifest | filelogs |
1028 1029 | | | |
1029 1030 | | | |
1030 1031 +---------------------------------+
1031 1032
1032 1033 When exchanging treemanifests, there are 4 logical segments:
1033 1034
1034 1035 +-------------------------------------------------+
1035 1036 | | | | |
1036 1037 | changeset | root | treemanifests | filelogs |
1037 1038 | | manifest | | |
1038 1039 | | | | |
1039 1040 +-------------------------------------------------+
1040 1041
1041 1042 The principle building block of each segment is a *chunk*. A *chunk* is a
1042 1043 framed piece of data:
1043 1044
1044 1045 +---------------------------------------+
1045 1046 | | |
1046 1047 | length | data |
1047 1048 | (4 bytes) | (<length - 4> bytes) |
1048 1049 | | |
1049 1050 +---------------------------------------+
1050 1051
1051 1052 All integers are big-endian signed integers. Each chunk starts with a
1052 1053 32-bit integer indicating the length of the entire chunk (including the
1053 1054 length field itself).
1054 1055
1055 1056 There is a special case chunk that has a value of 0 for the length
1056 1057 ("0x00000000"). We call this an *empty chunk*.
1057 1058
1058 1059 Delta Groups
1059 1060 ============
1060 1061
1061 1062 A *delta group* expresses the content of a revlog as a series of deltas,
1062 1063 or patches against previous revisions.
1063 1064
1064 1065 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1065 1066 to signal the end of the delta group:
1066 1067
1067 1068 +------------------------------------------------------------------------+
1068 1069 | | | | | |
1069 1070 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1070 1071 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1071 1072 | | | | | |
1072 1073 +------------------------------------------------------------------------+
1073 1074
1074 1075 Each *chunk*'s data consists of the following:
1075 1076
1076 1077 +---------------------------------------+
1077 1078 | | |
1078 1079 | delta header | delta data |
1079 1080 | (various by version) | (various) |
1080 1081 | | |
1081 1082 +---------------------------------------+
1082 1083
1083 1084 The *delta data* is a series of *delta*s that describe a diff from an
1084 1085 existing entry (either that the recipient already has, or previously
1085 1086 specified in the bundle/changegroup).
1086 1087
1087 1088 The *delta header* is different between versions "1", "2", and "3" of the
1088 1089 changegroup format.
1089 1090
1090 1091 Version 1 (headerlen=80):
1091 1092
1092 1093 +------------------------------------------------------+
1093 1094 | | | | |
1094 1095 | node | p1 node | p2 node | link node |
1095 1096 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1096 1097 | | | | |
1097 1098 +------------------------------------------------------+
1098 1099
1099 1100 Version 2 (headerlen=100):
1100 1101
1101 1102 +------------------------------------------------------------------+
1102 1103 | | | | | |
1103 1104 | node | p1 node | p2 node | base node | link node |
1104 1105 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1105 1106 | | | | | |
1106 1107 +------------------------------------------------------------------+
1107 1108
1108 1109 Version 3 (headerlen=102):
1109 1110
1110 1111 +------------------------------------------------------------------------------+
1111 1112 | | | | | | |
1112 1113 | node | p1 node | p2 node | base node | link node | flags |
1113 1114 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1114 1115 | | | | | | |
1115 1116 +------------------------------------------------------------------------------+
1116 1117
1117 1118 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1118 1119 contain a series of *delta*s, densely packed (no separators). These deltas
1119 1120 describe a diff from an existing entry (either that the recipient already
1120 1121 has, or previously specified in the bundle/changegroup). The format is
1121 1122 described more fully in "hg help internals.bdiff", but briefly:
1122 1123
1123 1124 +---------------------------------------------------------------+
1124 1125 | | | | |
1125 1126 | start offset | end offset | new length | content |
1126 1127 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1127 1128 | | | | |
1128 1129 +---------------------------------------------------------------+
1129 1130
1130 1131 Please note that the length field in the delta data does *not* include
1131 1132 itself.
1132 1133
1133 1134 In version 1, the delta is always applied against the previous node from
1134 1135 the changegroup or the first parent if this is the first entry in the
1135 1136 changegroup.
1136 1137
1137 1138 In version 2 and up, the delta base node is encoded in the entry in the
1138 1139 changegroup. This allows the delta to be expressed against any parent,
1139 1140 which can result in smaller deltas and more efficient encoding of data.
1140 1141
1141 1142 Changeset Segment
1142 1143 =================
1143 1144
1144 1145 The *changeset segment* consists of a single *delta group* holding
1145 1146 changelog data. The *empty chunk* at the end of the *delta group* denotes
1146 1147 the boundary to the *manifest segment*.
1147 1148
1148 1149 Manifest Segment
1149 1150 ================
1150 1151
1151 1152 The *manifest segment* consists of a single *delta group* holding manifest
1152 1153 data. If treemanifests are in use, it contains only the manifest for the
1153 1154 root directory of the repository. Otherwise, it contains the entire
1154 1155 manifest data. The *empty chunk* at the end of the *delta group* denotes
1155 1156 the boundary to the next segment (either the *treemanifests segment* or
1156 1157 the *filelogs segment*, depending on version and the request options).
1157 1158
1158 1159 Treemanifests Segment
1159 1160 ---------------------
1160 1161
1161 1162 The *treemanifests segment* only exists in changegroup version "3", and
1162 1163 only if the 'treemanifest' param is part of the bundle2 changegroup part
1163 1164 (it is not possible to use changegroup version 3 outside of bundle2).
1164 1165 Aside from the filenames in the *treemanifests segment* containing a
1165 1166 trailing "/" character, it behaves identically to the *filelogs segment*
1166 1167 (see below). The final sub-segment is followed by an *empty chunk*
1167 1168 (logically, a sub-segment with filename size 0). This denotes the boundary
1168 1169 to the *filelogs segment*.
1169 1170
1170 1171 Filelogs Segment
1171 1172 ================
1172 1173
1173 1174 The *filelogs segment* consists of multiple sub-segments, each
1174 1175 corresponding to an individual file whose data is being described:
1175 1176
1176 1177 +--------------------------------------------------+
1177 1178 | | | | | |
1178 1179 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1179 1180 | | | | | (4 bytes) |
1180 1181 | | | | | |
1181 1182 +--------------------------------------------------+
1182 1183
1183 1184 The final filelog sub-segment is followed by an *empty chunk* (logically,
1184 1185 a sub-segment with filename size 0). This denotes the end of the segment
1185 1186 and of the overall changegroup.
1186 1187
1187 1188 Each filelog sub-segment consists of the following:
1188 1189
1189 1190 +------------------------------------------------------+
1190 1191 | | | |
1191 1192 | filename length | filename | delta group |
1192 1193 | (4 bytes) | (<length - 4> bytes) | (various) |
1193 1194 | | | |
1194 1195 +------------------------------------------------------+
1195 1196
1196 1197 That is, a *chunk* consisting of the filename (not terminated or padded)
1197 1198 followed by N chunks constituting the *delta group* for this file. The
1198 1199 *empty chunk* at the end of each *delta group* denotes the boundary to the
1199 1200 next filelog sub-segment.
1200 1201
1201 1202 Test list of commands with command with no help text
1202 1203
1203 1204 $ hg help helpext
1204 1205 helpext extension - no help text available
1205 1206
1206 1207 list of commands:
1207 1208
1208 1209 nohelp (no help text available)
1209 1210
1210 1211 (use 'hg help -v helpext' to show built-in aliases and global options)
1211 1212
1212 1213
1213 1214 test advanced, deprecated and experimental options are hidden in command help
1214 1215 $ hg help debugoptADV
1215 1216 hg debugoptADV
1216 1217
1217 1218 (no help text available)
1218 1219
1219 1220 options:
1220 1221
1221 1222 (some details hidden, use --verbose to show complete help)
1222 1223 $ hg help debugoptDEP
1223 1224 hg debugoptDEP
1224 1225
1225 1226 (no help text available)
1226 1227
1227 1228 options:
1228 1229
1229 1230 (some details hidden, use --verbose to show complete help)
1230 1231
1231 1232 $ hg help debugoptEXP
1232 1233 hg debugoptEXP
1233 1234
1234 1235 (no help text available)
1235 1236
1236 1237 options:
1237 1238
1238 1239 (some details hidden, use --verbose to show complete help)
1239 1240
1240 1241 test advanced, deprecated and experimental options are shown with -v
1241 1242 $ hg help -v debugoptADV | grep aopt
1242 1243 --aopt option is (ADVANCED)
1243 1244 $ hg help -v debugoptDEP | grep dopt
1244 1245 --dopt option is (DEPRECATED)
1245 1246 $ hg help -v debugoptEXP | grep eopt
1246 1247 --eopt option is (EXPERIMENTAL)
1247 1248
1248 1249 #if gettext
1249 1250 test deprecated option is hidden with translation with untranslated description
1250 1251 (use many globy for not failing on changed transaction)
1251 1252 $ LANGUAGE=sv hg help debugoptDEP
1252 1253 hg debugoptDEP
1253 1254
1254 1255 (*) (glob)
1255 1256
1256 1257 options:
1257 1258
1258 1259 (some details hidden, use --verbose to show complete help)
1259 1260 #endif
1260 1261
1261 1262 Test commands that collide with topics (issue4240)
1262 1263
1263 1264 $ hg config -hq
1264 1265 hg config [-u] [NAME]...
1265 1266
1266 1267 show combined config settings from all hgrc files
1267 1268 $ hg showconfig -hq
1268 1269 hg config [-u] [NAME]...
1269 1270
1270 1271 show combined config settings from all hgrc files
1271 1272
1272 1273 Test a help topic
1273 1274
1274 1275 $ hg help dates
1275 1276 Date Formats
1276 1277 """"""""""""
1277 1278
1278 1279 Some commands allow the user to specify a date, e.g.:
1279 1280
1280 1281 - backout, commit, import, tag: Specify the commit date.
1281 1282 - log, revert, update: Select revision(s) by date.
1282 1283
1283 1284 Many date formats are valid. Here are some examples:
1284 1285
1285 1286 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1286 1287 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1287 1288 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1288 1289 - "Dec 6" (midnight)
1289 1290 - "13:18" (today assumed)
1290 1291 - "3:39" (3:39AM assumed)
1291 1292 - "3:39pm" (15:39)
1292 1293 - "2006-12-06 13:18:29" (ISO 8601 format)
1293 1294 - "2006-12-6 13:18"
1294 1295 - "2006-12-6"
1295 1296 - "12-6"
1296 1297 - "12/6"
1297 1298 - "12/6/6" (Dec 6 2006)
1298 1299 - "today" (midnight)
1299 1300 - "yesterday" (midnight)
1300 1301 - "now" - right now
1301 1302
1302 1303 Lastly, there is Mercurial's internal format:
1303 1304
1304 1305 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1305 1306
1306 1307 This is the internal representation format for dates. The first number is
1307 1308 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1308 1309 is the offset of the local timezone, in seconds west of UTC (negative if
1309 1310 the timezone is east of UTC).
1310 1311
1311 1312 The log command also accepts date ranges:
1312 1313
1313 1314 - "<DATE" - at or before a given date/time
1314 1315 - ">DATE" - on or after a given date/time
1315 1316 - "DATE to DATE" - a date range, inclusive
1316 1317 - "-DAYS" - within a given number of days of today
1317 1318
1318 1319 Test repeated config section name
1319 1320
1320 1321 $ hg help config.host
1321 1322 "http_proxy.host"
1322 1323 Host name and (optional) port of the proxy server, for example
1323 1324 "myproxy:8000".
1324 1325
1325 1326 "smtp.host"
1326 1327 Host name of mail server, e.g. "mail.example.com".
1327 1328
1328 1329 Unrelated trailing paragraphs shouldn't be included
1329 1330
1330 1331 $ hg help config.extramsg | grep '^$'
1331 1332
1332 1333
1333 1334 Test capitalized section name
1334 1335
1335 1336 $ hg help scripting.HGPLAIN > /dev/null
1336 1337
1337 1338 Help subsection:
1338 1339
1339 1340 $ hg help config.charsets |grep "Email example:" > /dev/null
1340 1341 [1]
1341 1342
1342 1343 Show nested definitions
1343 1344 ("profiling.type"[break]"ls"[break]"stat"[break])
1344 1345
1345 1346 $ hg help config.type | egrep '^$'|wc -l
1346 1347 \s*3 (re)
1347 1348
1348 1349 Separate sections from subsections
1349 1350
1350 1351 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1351 1352 "format"
1352 1353 --------
1353 1354
1354 1355 "usegeneraldelta"
1355 1356
1356 1357 "dotencode"
1357 1358
1358 1359 "usefncache"
1359 1360
1360 1361 "usestore"
1361 1362
1362 1363 "profiling"
1363 1364 -----------
1364 1365
1365 1366 "format"
1366 1367
1367 1368 "progress"
1368 1369 ----------
1369 1370
1370 1371 "format"
1371 1372
1372 1373
1373 1374 Last item in help config.*:
1374 1375
1375 1376 $ hg help config.`hg help config|grep '^ "'| \
1376 1377 > tail -1|sed 's![ "]*!!g'`| \
1377 1378 > grep 'hg help -c config' > /dev/null
1378 1379 [1]
1379 1380
1380 1381 note to use help -c for general hg help config:
1381 1382
1382 1383 $ hg help config |grep 'hg help -c config' > /dev/null
1383 1384
1384 1385 Test templating help
1385 1386
1386 1387 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1387 1388 desc String. The text of the changeset description.
1388 1389 diffstat String. Statistics of changes with the following format:
1389 1390 firstline Any text. Returns the first line of text.
1390 1391 nonempty Any text. Returns '(none)' if the string is empty.
1391 1392
1392 1393 Test deprecated items
1393 1394
1394 1395 $ hg help -v templating | grep currentbookmark
1395 1396 currentbookmark
1396 1397 $ hg help templating | (grep currentbookmark || true)
1397 1398
1398 1399 Test help hooks
1399 1400
1400 1401 $ cat > helphook1.py <<EOF
1401 1402 > from mercurial import help
1402 1403 >
1403 1404 > def rewrite(ui, topic, doc):
1404 1405 > return doc + '\nhelphook1\n'
1405 1406 >
1406 1407 > def extsetup(ui):
1407 1408 > help.addtopichook('revisions', rewrite)
1408 1409 > EOF
1409 1410 $ cat > helphook2.py <<EOF
1410 1411 > from mercurial import help
1411 1412 >
1412 1413 > def rewrite(ui, topic, doc):
1413 1414 > return doc + '\nhelphook2\n'
1414 1415 >
1415 1416 > def extsetup(ui):
1416 1417 > help.addtopichook('revisions', rewrite)
1417 1418 > EOF
1418 1419 $ echo '[extensions]' >> $HGRCPATH
1419 1420 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1420 1421 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1421 1422 $ hg help revsets | grep helphook
1422 1423 helphook1
1423 1424 helphook2
1424 1425
1425 1426 help -c should only show debug --debug
1426 1427
1427 1428 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1428 1429 [1]
1429 1430
1430 1431 help -c should only show deprecated for -v
1431 1432
1432 1433 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1433 1434 [1]
1434 1435
1435 1436 Test -s / --system
1436 1437
1437 1438 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1438 1439 > wc -l | sed -e 's/ //g'
1439 1440 0
1440 1441 $ hg help config.files --system unix | grep 'USER' | \
1441 1442 > wc -l | sed -e 's/ //g'
1442 1443 0
1443 1444
1444 1445 Test -e / -c / -k combinations
1445 1446
1446 1447 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1447 1448 Commands:
1448 1449 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1449 1450 Extensions:
1450 1451 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1451 1452 Topics:
1452 1453 Commands:
1453 1454 Extensions:
1454 1455 Extension Commands:
1455 1456 $ hg help -c schemes
1456 1457 abort: no such help topic: schemes
1457 1458 (try 'hg help --keyword schemes')
1458 1459 [255]
1459 1460 $ hg help -e schemes |head -1
1460 1461 schemes extension - extend schemes with shortcuts to repository swarms
1461 1462 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1462 1463 Commands:
1463 1464 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1464 1465 Extensions:
1465 1466 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1466 1467 Extensions:
1467 1468 Commands:
1468 1469 $ hg help -c commit > /dev/null
1469 1470 $ hg help -e -c commit > /dev/null
1470 1471 $ hg help -e commit > /dev/null
1471 1472 abort: no such help topic: commit
1472 1473 (try 'hg help --keyword commit')
1473 1474 [255]
1474 1475
1475 1476 Test keyword search help
1476 1477
1477 1478 $ cat > prefixedname.py <<EOF
1478 1479 > '''matched against word "clone"
1479 1480 > '''
1480 1481 > EOF
1481 1482 $ echo '[extensions]' >> $HGRCPATH
1482 1483 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1483 1484 $ hg help -k clone
1484 1485 Topics:
1485 1486
1486 1487 config Configuration Files
1487 1488 extensions Using Additional Features
1488 1489 glossary Glossary
1489 1490 phases Working with Phases
1490 1491 subrepos Subrepositories
1491 1492 urls URL Paths
1492 1493
1493 1494 Commands:
1494 1495
1495 1496 bookmarks create a new bookmark or list existing bookmarks
1496 1497 clone make a copy of an existing repository
1497 1498 paths show aliases for remote repositories
1498 1499 update update working directory (or switch revisions)
1499 1500
1500 1501 Extensions:
1501 1502
1502 1503 clonebundles advertise pre-generated bundles to seed clones
1503 1504 narrow create clones which fetch history data for subset of files
1504 1505 (EXPERIMENTAL)
1505 1506 prefixedname matched against word "clone"
1506 1507 relink recreates hardlinks between repository clones
1507 1508
1508 1509 Extension Commands:
1509 1510
1510 1511 qclone clone main and patch repository at same time
1511 1512
1512 1513 Test unfound topic
1513 1514
1514 1515 $ hg help nonexistingtopicthatwillneverexisteverever
1515 1516 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1516 1517 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1517 1518 [255]
1518 1519
1519 1520 Test unfound keyword
1520 1521
1521 1522 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1522 1523 abort: no matches
1523 1524 (try 'hg help' for a list of topics)
1524 1525 [255]
1525 1526
1526 1527 Test omit indicating for help
1527 1528
1528 1529 $ cat > addverboseitems.py <<EOF
1529 1530 > '''extension to test omit indicating.
1530 1531 >
1531 1532 > This paragraph is never omitted (for extension)
1532 1533 >
1533 1534 > .. container:: verbose
1534 1535 >
1535 1536 > This paragraph is omitted,
1536 1537 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1537 1538 >
1538 1539 > This paragraph is never omitted, too (for extension)
1539 1540 > '''
1540 1541 > from __future__ import absolute_import
1541 1542 > from mercurial import commands, help
1542 1543 > testtopic = """This paragraph is never omitted (for topic).
1543 1544 >
1544 1545 > .. container:: verbose
1545 1546 >
1546 1547 > This paragraph is omitted,
1547 1548 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1548 1549 >
1549 1550 > This paragraph is never omitted, too (for topic)
1550 1551 > """
1551 1552 > def extsetup(ui):
1552 1553 > help.helptable.append((["topic-containing-verbose"],
1553 1554 > "This is the topic to test omit indicating.",
1554 1555 > lambda ui: testtopic))
1555 1556 > EOF
1556 1557 $ echo '[extensions]' >> $HGRCPATH
1557 1558 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1558 1559 $ hg help addverboseitems
1559 1560 addverboseitems extension - extension to test omit indicating.
1560 1561
1561 1562 This paragraph is never omitted (for extension)
1562 1563
1563 1564 This paragraph is never omitted, too (for extension)
1564 1565
1565 1566 (some details hidden, use --verbose to show complete help)
1566 1567
1567 1568 no commands defined
1568 1569 $ hg help -v addverboseitems
1569 1570 addverboseitems extension - extension to test omit indicating.
1570 1571
1571 1572 This paragraph is never omitted (for extension)
1572 1573
1573 1574 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1574 1575 extension)
1575 1576
1576 1577 This paragraph is never omitted, too (for extension)
1577 1578
1578 1579 no commands defined
1579 1580 $ hg help topic-containing-verbose
1580 1581 This is the topic to test omit indicating.
1581 1582 """"""""""""""""""""""""""""""""""""""""""
1582 1583
1583 1584 This paragraph is never omitted (for topic).
1584 1585
1585 1586 This paragraph is never omitted, too (for topic)
1586 1587
1587 1588 (some details hidden, use --verbose to show complete help)
1588 1589 $ hg help -v topic-containing-verbose
1589 1590 This is the topic to test omit indicating.
1590 1591 """"""""""""""""""""""""""""""""""""""""""
1591 1592
1592 1593 This paragraph is never omitted (for topic).
1593 1594
1594 1595 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1595 1596 topic)
1596 1597
1597 1598 This paragraph is never omitted, too (for topic)
1598 1599
1599 1600 Test section lookup
1600 1601
1601 1602 $ hg help revset.merge
1602 1603 "merge()"
1603 1604 Changeset is a merge changeset.
1604 1605
1605 1606 $ hg help glossary.dag
1606 1607 DAG
1607 1608 The repository of changesets of a distributed version control system
1608 1609 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1609 1610 of nodes and edges, where nodes correspond to changesets and edges
1610 1611 imply a parent -> child relation. This graph can be visualized by
1611 1612 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1612 1613 limited by the requirement for children to have at most two parents.
1613 1614
1614 1615
1615 1616 $ hg help hgrc.paths
1616 1617 "paths"
1617 1618 -------
1618 1619
1619 1620 Assigns symbolic names and behavior to repositories.
1620 1621
1621 1622 Options are symbolic names defining the URL or directory that is the
1622 1623 location of the repository. Example:
1623 1624
1624 1625 [paths]
1625 1626 my_server = https://example.com/my_repo
1626 1627 local_path = /home/me/repo
1627 1628
1628 1629 These symbolic names can be used from the command line. To pull from
1629 1630 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1630 1631 local_path'.
1631 1632
1632 1633 Options containing colons (":") denote sub-options that can influence
1633 1634 behavior for that specific path. Example:
1634 1635
1635 1636 [paths]
1636 1637 my_server = https://example.com/my_path
1637 1638 my_server:pushurl = ssh://example.com/my_path
1638 1639
1639 1640 The following sub-options can be defined:
1640 1641
1641 1642 "pushurl"
1642 1643 The URL to use for push operations. If not defined, the location
1643 1644 defined by the path's main entry is used.
1644 1645
1645 1646 "pushrev"
1646 1647 A revset defining which revisions to push by default.
1647 1648
1648 1649 When 'hg push' is executed without a "-r" argument, the revset defined
1649 1650 by this sub-option is evaluated to determine what to push.
1650 1651
1651 1652 For example, a value of "." will push the working directory's revision
1652 1653 by default.
1653 1654
1654 1655 Revsets specifying bookmarks will not result in the bookmark being
1655 1656 pushed.
1656 1657
1657 1658 The following special named paths exist:
1658 1659
1659 1660 "default"
1660 1661 The URL or directory to use when no source or remote is specified.
1661 1662
1662 1663 'hg clone' will automatically define this path to the location the
1663 1664 repository was cloned from.
1664 1665
1665 1666 "default-push"
1666 1667 (deprecated) The URL or directory for the default 'hg push' location.
1667 1668 "default:pushurl" should be used instead.
1668 1669
1669 1670 $ hg help glossary.mcguffin
1670 1671 abort: help section not found: glossary.mcguffin
1671 1672 [255]
1672 1673
1673 1674 $ hg help glossary.mc.guffin
1674 1675 abort: help section not found: glossary.mc.guffin
1675 1676 [255]
1676 1677
1677 1678 $ hg help template.files
1678 1679 files List of strings. All files modified, added, or removed by
1679 1680 this changeset.
1680 1681 files(pattern)
1681 1682 All files of the current changeset matching the pattern. See
1682 1683 'hg help patterns'.
1683 1684
1684 1685 Test section lookup by translated message
1685 1686
1686 1687 str.lower() instead of encoding.lower(str) on translated message might
1687 1688 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1688 1689 as the second or later byte of multi-byte character.
1689 1690
1690 1691 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1691 1692 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1692 1693 replacement makes message meaningless.
1693 1694
1694 1695 This tests that section lookup by translated string isn't broken by
1695 1696 such str.lower().
1696 1697
1697 1698 $ $PYTHON <<EOF
1698 1699 > def escape(s):
1699 1700 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1700 1701 > # translation of "record" in ja_JP.cp932
1701 1702 > upper = "\x8bL\x98^"
1702 1703 > # str.lower()-ed section name should be treated as different one
1703 1704 > lower = "\x8bl\x98^"
1704 1705 > with open('ambiguous.py', 'w') as fp:
1705 1706 > fp.write("""# ambiguous section names in ja_JP.cp932
1706 1707 > u'''summary of extension
1707 1708 >
1708 1709 > %s
1709 1710 > ----
1710 1711 >
1711 1712 > Upper name should show only this message
1712 1713 >
1713 1714 > %s
1714 1715 > ----
1715 1716 >
1716 1717 > Lower name should show only this message
1717 1718 >
1718 1719 > subsequent section
1719 1720 > ------------------
1720 1721 >
1721 1722 > This should be hidden at 'hg help ambiguous' with section name.
1722 1723 > '''
1723 1724 > """ % (escape(upper), escape(lower)))
1724 1725 > EOF
1725 1726
1726 1727 $ cat >> $HGRCPATH <<EOF
1727 1728 > [extensions]
1728 1729 > ambiguous = ./ambiguous.py
1729 1730 > EOF
1730 1731
1731 1732 $ $PYTHON <<EOF | sh
1732 1733 > upper = "\x8bL\x98^"
1733 1734 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1734 1735 > EOF
1735 1736 \x8bL\x98^ (esc)
1736 1737 ----
1737 1738
1738 1739 Upper name should show only this message
1739 1740
1740 1741
1741 1742 $ $PYTHON <<EOF | sh
1742 1743 > lower = "\x8bl\x98^"
1743 1744 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1744 1745 > EOF
1745 1746 \x8bl\x98^ (esc)
1746 1747 ----
1747 1748
1748 1749 Lower name should show only this message
1749 1750
1750 1751
1751 1752 $ cat >> $HGRCPATH <<EOF
1752 1753 > [extensions]
1753 1754 > ambiguous = !
1754 1755 > EOF
1755 1756
1756 1757 Show help content of disabled extensions
1757 1758
1758 1759 $ cat >> $HGRCPATH <<EOF
1759 1760 > [extensions]
1760 1761 > ambiguous = !./ambiguous.py
1761 1762 > EOF
1762 1763 $ hg help -e ambiguous
1763 1764 ambiguous extension - (no help text available)
1764 1765
1765 1766 (use 'hg help extensions' for information on enabling extensions)
1766 1767
1767 1768 Test dynamic list of merge tools only shows up once
1768 1769 $ hg help merge-tools
1769 1770 Merge Tools
1770 1771 """""""""""
1771 1772
1772 1773 To merge files Mercurial uses merge tools.
1773 1774
1774 1775 A merge tool combines two different versions of a file into a merged file.
1775 1776 Merge tools are given the two files and the greatest common ancestor of
1776 1777 the two file versions, so they can determine the changes made on both
1777 1778 branches.
1778 1779
1779 1780 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1780 1781 backout' and in several extensions.
1781 1782
1782 1783 Usually, the merge tool tries to automatically reconcile the files by
1783 1784 combining all non-overlapping changes that occurred separately in the two
1784 1785 different evolutions of the same initial base file. Furthermore, some
1785 1786 interactive merge programs make it easier to manually resolve conflicting
1786 1787 merges, either in a graphical way, or by inserting some conflict markers.
1787 1788 Mercurial does not include any interactive merge programs but relies on
1788 1789 external tools for that.
1789 1790
1790 1791 Available merge tools
1791 1792 =====================
1792 1793
1793 1794 External merge tools and their properties are configured in the merge-
1794 1795 tools configuration section - see hgrc(5) - but they can often just be
1795 1796 named by their executable.
1796 1797
1797 1798 A merge tool is generally usable if its executable can be found on the
1798 1799 system and if it can handle the merge. The executable is found if it is an
1799 1800 absolute or relative executable path or the name of an application in the
1800 1801 executable search path. The tool is assumed to be able to handle the merge
1801 1802 if it can handle symlinks if the file is a symlink, if it can handle
1802 1803 binary files if the file is binary, and if a GUI is available if the tool
1803 1804 requires a GUI.
1804 1805
1805 1806 There are some internal merge tools which can be used. The internal merge
1806 1807 tools are:
1807 1808
1808 1809 ":dump"
1809 1810 Creates three versions of the files to merge, containing the contents of
1810 1811 local, other and base. These files can then be used to perform a merge
1811 1812 manually. If the file to be merged is named "a.txt", these files will
1812 1813 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1813 1814 they will be placed in the same directory as "a.txt".
1814 1815
1815 1816 This implies premerge. Therefore, files aren't dumped, if premerge runs
1816 1817 successfully. Use :forcedump to forcibly write files out.
1817 1818
1818 1819 ":fail"
1819 1820 Rather than attempting to merge files that were modified on both
1820 1821 branches, it marks them as unresolved. The resolve command must be used
1821 1822 to resolve these conflicts.
1822 1823
1823 1824 ":forcedump"
1824 1825 Creates three versions of the files as same as :dump, but omits
1825 1826 premerge.
1826 1827
1827 1828 ":local"
1828 1829 Uses the local 'p1()' version of files as the merged version.
1829 1830
1830 1831 ":merge"
1831 1832 Uses the internal non-interactive simple merge algorithm for merging
1832 1833 files. It will fail if there are any conflicts and leave markers in the
1833 1834 partially merged file. Markers will have two sections, one for each side
1834 1835 of merge.
1835 1836
1836 1837 ":merge-local"
1837 1838 Like :merge, but resolve all conflicts non-interactively in favor of the
1838 1839 local 'p1()' changes.
1839 1840
1840 1841 ":merge-other"
1841 1842 Like :merge, but resolve all conflicts non-interactively in favor of the
1842 1843 other 'p2()' changes.
1843 1844
1844 1845 ":merge3"
1845 1846 Uses the internal non-interactive simple merge algorithm for merging
1846 1847 files. It will fail if there are any conflicts and leave markers in the
1847 1848 partially merged file. Marker will have three sections, one from each
1848 1849 side of the merge and one for the base content.
1849 1850
1850 1851 ":other"
1851 1852 Uses the other 'p2()' version of files as the merged version.
1852 1853
1853 1854 ":prompt"
1854 1855 Asks the user which of the local 'p1()' or the other 'p2()' version to
1855 1856 keep as the merged version.
1856 1857
1857 1858 ":tagmerge"
1858 1859 Uses the internal tag merge algorithm (experimental).
1859 1860
1860 1861 ":union"
1861 1862 Uses the internal non-interactive simple merge algorithm for merging
1862 1863 files. It will use both left and right sides for conflict regions. No
1863 1864 markers are inserted.
1864 1865
1865 1866 Internal tools are always available and do not require a GUI but will by
1866 1867 default not handle symlinks or binary files.
1867 1868
1868 1869 Choosing a merge tool
1869 1870 =====================
1870 1871
1871 1872 Mercurial uses these rules when deciding which merge tool to use:
1872 1873
1873 1874 1. If a tool has been specified with the --tool option to merge or
1874 1875 resolve, it is used. If it is the name of a tool in the merge-tools
1875 1876 configuration, its configuration is used. Otherwise the specified tool
1876 1877 must be executable by the shell.
1877 1878 2. If the "HGMERGE" environment variable is present, its value is used and
1878 1879 must be executable by the shell.
1879 1880 3. If the filename of the file to be merged matches any of the patterns in
1880 1881 the merge-patterns configuration section, the first usable merge tool
1881 1882 corresponding to a matching pattern is used. Here, binary capabilities
1882 1883 of the merge tool are not considered.
1883 1884 4. If ui.merge is set it will be considered next. If the value is not the
1884 1885 name of a configured tool, the specified value is used and must be
1885 1886 executable by the shell. Otherwise the named tool is used if it is
1886 1887 usable.
1887 1888 5. If any usable merge tools are present in the merge-tools configuration
1888 1889 section, the one with the highest priority is used.
1889 1890 6. If a program named "hgmerge" can be found on the system, it is used -
1890 1891 but it will by default not be used for symlinks and binary files.
1891 1892 7. If the file to be merged is not binary and is not a symlink, then
1892 1893 internal ":merge" is used.
1893 1894 8. Otherwise, ":prompt" is used.
1894 1895
1895 1896 Note:
1896 1897 After selecting a merge program, Mercurial will by default attempt to
1897 1898 merge the files using a simple merge algorithm first. Only if it
1898 1899 doesn't succeed because of conflicting changes will Mercurial actually
1899 1900 execute the merge program. Whether to use the simple merge algorithm
1900 1901 first can be controlled by the premerge setting of the merge tool.
1901 1902 Premerge is enabled by default unless the file is binary or a symlink.
1902 1903
1903 1904 See the merge-tools and ui sections of hgrc(5) for details on the
1904 1905 configuration of merge tools.
1905 1906
1906 1907 Compression engines listed in `hg help bundlespec`
1907 1908
1908 1909 $ hg help bundlespec | grep gzip
1909 1910 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1910 1911 An algorithm that produces smaller bundles than "gzip".
1911 1912 This engine will likely produce smaller bundles than "gzip" but will be
1912 1913 "gzip"
1913 1914 better compression than "gzip". It also frequently yields better (?)
1914 1915
1915 1916 Test usage of section marks in help documents
1916 1917
1917 1918 $ cd "$TESTDIR"/../doc
1918 1919 $ $PYTHON check-seclevel.py
1919 1920 $ cd $TESTTMP
1920 1921
1921 1922 #if serve
1922 1923
1923 1924 Test the help pages in hgweb.
1924 1925
1925 1926 Dish up an empty repo; serve it cold.
1926 1927
1927 1928 $ hg init "$TESTTMP/test"
1928 1929 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1929 1930 $ cat hg.pid >> $DAEMON_PIDS
1930 1931
1931 1932 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1932 1933 200 Script output follows
1933 1934
1934 1935 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1935 1936 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1936 1937 <head>
1937 1938 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1938 1939 <meta name="robots" content="index, nofollow" />
1939 1940 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1940 1941 <script type="text/javascript" src="/static/mercurial.js"></script>
1941 1942
1942 1943 <title>Help: Index</title>
1943 1944 </head>
1944 1945 <body>
1945 1946
1946 1947 <div class="container">
1947 1948 <div class="menu">
1948 1949 <div class="logo">
1949 1950 <a href="https://mercurial-scm.org/">
1950 1951 <img src="/static/hglogo.png" alt="mercurial" /></a>
1951 1952 </div>
1952 1953 <ul>
1953 1954 <li><a href="/shortlog">log</a></li>
1954 1955 <li><a href="/graph">graph</a></li>
1955 1956 <li><a href="/tags">tags</a></li>
1956 1957 <li><a href="/bookmarks">bookmarks</a></li>
1957 1958 <li><a href="/branches">branches</a></li>
1958 1959 </ul>
1959 1960 <ul>
1960 1961 <li class="active">help</li>
1961 1962 </ul>
1962 1963 </div>
1963 1964
1964 1965 <div class="main">
1965 1966 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1966 1967
1967 1968 <form class="search" action="/log">
1968 1969
1969 1970 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1970 1971 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1971 1972 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1972 1973 </form>
1973 1974 <table class="bigtable">
1974 1975 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1975 1976
1976 1977 <tr><td>
1977 1978 <a href="/help/bundlespec">
1978 1979 bundlespec
1979 1980 </a>
1980 1981 </td><td>
1981 1982 Bundle File Formats
1982 1983 </td></tr>
1983 1984 <tr><td>
1984 1985 <a href="/help/color">
1985 1986 color
1986 1987 </a>
1987 1988 </td><td>
1988 1989 Colorizing Outputs
1989 1990 </td></tr>
1990 1991 <tr><td>
1991 1992 <a href="/help/config">
1992 1993 config
1993 1994 </a>
1994 1995 </td><td>
1995 1996 Configuration Files
1996 1997 </td></tr>
1997 1998 <tr><td>
1998 1999 <a href="/help/dates">
1999 2000 dates
2000 2001 </a>
2001 2002 </td><td>
2002 2003 Date Formats
2003 2004 </td></tr>
2004 2005 <tr><td>
2005 2006 <a href="/help/diffs">
2006 2007 diffs
2007 2008 </a>
2008 2009 </td><td>
2009 2010 Diff Formats
2010 2011 </td></tr>
2011 2012 <tr><td>
2012 2013 <a href="/help/environment">
2013 2014 environment
2014 2015 </a>
2015 2016 </td><td>
2016 2017 Environment Variables
2017 2018 </td></tr>
2018 2019 <tr><td>
2019 2020 <a href="/help/extensions">
2020 2021 extensions
2021 2022 </a>
2022 2023 </td><td>
2023 2024 Using Additional Features
2024 2025 </td></tr>
2025 2026 <tr><td>
2026 2027 <a href="/help/filesets">
2027 2028 filesets
2028 2029 </a>
2029 2030 </td><td>
2030 2031 Specifying File Sets
2031 2032 </td></tr>
2032 2033 <tr><td>
2033 2034 <a href="/help/flags">
2034 2035 flags
2035 2036 </a>
2036 2037 </td><td>
2037 2038 Command-line flags
2038 2039 </td></tr>
2039 2040 <tr><td>
2040 2041 <a href="/help/glossary">
2041 2042 glossary
2042 2043 </a>
2043 2044 </td><td>
2044 2045 Glossary
2045 2046 </td></tr>
2046 2047 <tr><td>
2047 2048 <a href="/help/hgignore">
2048 2049 hgignore
2049 2050 </a>
2050 2051 </td><td>
2051 2052 Syntax for Mercurial Ignore Files
2052 2053 </td></tr>
2053 2054 <tr><td>
2054 2055 <a href="/help/hgweb">
2055 2056 hgweb
2056 2057 </a>
2057 2058 </td><td>
2058 2059 Configuring hgweb
2059 2060 </td></tr>
2060 2061 <tr><td>
2061 2062 <a href="/help/internals">
2062 2063 internals
2063 2064 </a>
2064 2065 </td><td>
2065 2066 Technical implementation topics
2066 2067 </td></tr>
2067 2068 <tr><td>
2068 2069 <a href="/help/merge-tools">
2069 2070 merge-tools
2070 2071 </a>
2071 2072 </td><td>
2072 2073 Merge Tools
2073 2074 </td></tr>
2074 2075 <tr><td>
2075 2076 <a href="/help/pager">
2076 2077 pager
2077 2078 </a>
2078 2079 </td><td>
2079 2080 Pager Support
2080 2081 </td></tr>
2081 2082 <tr><td>
2082 2083 <a href="/help/patterns">
2083 2084 patterns
2084 2085 </a>
2085 2086 </td><td>
2086 2087 File Name Patterns
2087 2088 </td></tr>
2088 2089 <tr><td>
2089 2090 <a href="/help/phases">
2090 2091 phases
2091 2092 </a>
2092 2093 </td><td>
2093 2094 Working with Phases
2094 2095 </td></tr>
2095 2096 <tr><td>
2096 2097 <a href="/help/revisions">
2097 2098 revisions
2098 2099 </a>
2099 2100 </td><td>
2100 2101 Specifying Revisions
2101 2102 </td></tr>
2102 2103 <tr><td>
2103 2104 <a href="/help/scripting">
2104 2105 scripting
2105 2106 </a>
2106 2107 </td><td>
2107 2108 Using Mercurial from scripts and automation
2108 2109 </td></tr>
2109 2110 <tr><td>
2110 2111 <a href="/help/subrepos">
2111 2112 subrepos
2112 2113 </a>
2113 2114 </td><td>
2114 2115 Subrepositories
2115 2116 </td></tr>
2116 2117 <tr><td>
2117 2118 <a href="/help/templating">
2118 2119 templating
2119 2120 </a>
2120 2121 </td><td>
2121 2122 Template Usage
2122 2123 </td></tr>
2123 2124 <tr><td>
2124 2125 <a href="/help/urls">
2125 2126 urls
2126 2127 </a>
2127 2128 </td><td>
2128 2129 URL Paths
2129 2130 </td></tr>
2130 2131 <tr><td>
2131 2132 <a href="/help/topic-containing-verbose">
2132 2133 topic-containing-verbose
2133 2134 </a>
2134 2135 </td><td>
2135 2136 This is the topic to test omit indicating.
2136 2137 </td></tr>
2137 2138
2138 2139
2139 2140 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2140 2141
2141 2142 <tr><td>
2142 2143 <a href="/help/add">
2143 2144 add
2144 2145 </a>
2145 2146 </td><td>
2146 2147 add the specified files on the next commit
2147 2148 </td></tr>
2148 2149 <tr><td>
2149 2150 <a href="/help/annotate">
2150 2151 annotate
2151 2152 </a>
2152 2153 </td><td>
2153 2154 show changeset information by line for each file
2154 2155 </td></tr>
2155 2156 <tr><td>
2156 2157 <a href="/help/clone">
2157 2158 clone
2158 2159 </a>
2159 2160 </td><td>
2160 2161 make a copy of an existing repository
2161 2162 </td></tr>
2162 2163 <tr><td>
2163 2164 <a href="/help/commit">
2164 2165 commit
2165 2166 </a>
2166 2167 </td><td>
2167 2168 commit the specified files or all outstanding changes
2168 2169 </td></tr>
2169 2170 <tr><td>
2170 2171 <a href="/help/diff">
2171 2172 diff
2172 2173 </a>
2173 2174 </td><td>
2174 2175 diff repository (or selected files)
2175 2176 </td></tr>
2176 2177 <tr><td>
2177 2178 <a href="/help/export">
2178 2179 export
2179 2180 </a>
2180 2181 </td><td>
2181 2182 dump the header and diffs for one or more changesets
2182 2183 </td></tr>
2183 2184 <tr><td>
2184 2185 <a href="/help/forget">
2185 2186 forget
2186 2187 </a>
2187 2188 </td><td>
2188 2189 forget the specified files on the next commit
2189 2190 </td></tr>
2190 2191 <tr><td>
2191 2192 <a href="/help/init">
2192 2193 init
2193 2194 </a>
2194 2195 </td><td>
2195 2196 create a new repository in the given directory
2196 2197 </td></tr>
2197 2198 <tr><td>
2198 2199 <a href="/help/log">
2199 2200 log
2200 2201 </a>
2201 2202 </td><td>
2202 2203 show revision history of entire repository or files
2203 2204 </td></tr>
2204 2205 <tr><td>
2205 2206 <a href="/help/merge">
2206 2207 merge
2207 2208 </a>
2208 2209 </td><td>
2209 2210 merge another revision into working directory
2210 2211 </td></tr>
2211 2212 <tr><td>
2212 2213 <a href="/help/pull">
2213 2214 pull
2214 2215 </a>
2215 2216 </td><td>
2216 2217 pull changes from the specified source
2217 2218 </td></tr>
2218 2219 <tr><td>
2219 2220 <a href="/help/push">
2220 2221 push
2221 2222 </a>
2222 2223 </td><td>
2223 2224 push changes to the specified destination
2224 2225 </td></tr>
2225 2226 <tr><td>
2226 2227 <a href="/help/remove">
2227 2228 remove
2228 2229 </a>
2229 2230 </td><td>
2230 2231 remove the specified files on the next commit
2231 2232 </td></tr>
2232 2233 <tr><td>
2233 2234 <a href="/help/serve">
2234 2235 serve
2235 2236 </a>
2236 2237 </td><td>
2237 2238 start stand-alone webserver
2238 2239 </td></tr>
2239 2240 <tr><td>
2240 2241 <a href="/help/status">
2241 2242 status
2242 2243 </a>
2243 2244 </td><td>
2244 2245 show changed files in the working directory
2245 2246 </td></tr>
2246 2247 <tr><td>
2247 2248 <a href="/help/summary">
2248 2249 summary
2249 2250 </a>
2250 2251 </td><td>
2251 2252 summarize working directory state
2252 2253 </td></tr>
2253 2254 <tr><td>
2254 2255 <a href="/help/update">
2255 2256 update
2256 2257 </a>
2257 2258 </td><td>
2258 2259 update working directory (or switch revisions)
2259 2260 </td></tr>
2260 2261
2261 2262
2262 2263
2263 2264 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2264 2265
2265 2266 <tr><td>
2266 2267 <a href="/help/addremove">
2267 2268 addremove
2268 2269 </a>
2269 2270 </td><td>
2270 2271 add all new files, delete all missing files
2271 2272 </td></tr>
2272 2273 <tr><td>
2273 2274 <a href="/help/archive">
2274 2275 archive
2275 2276 </a>
2276 2277 </td><td>
2277 2278 create an unversioned archive of a repository revision
2278 2279 </td></tr>
2279 2280 <tr><td>
2280 2281 <a href="/help/backout">
2281 2282 backout
2282 2283 </a>
2283 2284 </td><td>
2284 2285 reverse effect of earlier changeset
2285 2286 </td></tr>
2286 2287 <tr><td>
2287 2288 <a href="/help/bisect">
2288 2289 bisect
2289 2290 </a>
2290 2291 </td><td>
2291 2292 subdivision search of changesets
2292 2293 </td></tr>
2293 2294 <tr><td>
2294 2295 <a href="/help/bookmarks">
2295 2296 bookmarks
2296 2297 </a>
2297 2298 </td><td>
2298 2299 create a new bookmark or list existing bookmarks
2299 2300 </td></tr>
2300 2301 <tr><td>
2301 2302 <a href="/help/branch">
2302 2303 branch
2303 2304 </a>
2304 2305 </td><td>
2305 2306 set or show the current branch name
2306 2307 </td></tr>
2307 2308 <tr><td>
2308 2309 <a href="/help/branches">
2309 2310 branches
2310 2311 </a>
2311 2312 </td><td>
2312 2313 list repository named branches
2313 2314 </td></tr>
2314 2315 <tr><td>
2315 2316 <a href="/help/bundle">
2316 2317 bundle
2317 2318 </a>
2318 2319 </td><td>
2319 2320 create a bundle file
2320 2321 </td></tr>
2321 2322 <tr><td>
2322 2323 <a href="/help/cat">
2323 2324 cat
2324 2325 </a>
2325 2326 </td><td>
2326 2327 output the current or given revision of files
2327 2328 </td></tr>
2328 2329 <tr><td>
2329 2330 <a href="/help/config">
2330 2331 config
2331 2332 </a>
2332 2333 </td><td>
2333 2334 show combined config settings from all hgrc files
2334 2335 </td></tr>
2335 2336 <tr><td>
2336 2337 <a href="/help/copy">
2337 2338 copy
2338 2339 </a>
2339 2340 </td><td>
2340 2341 mark files as copied for the next commit
2341 2342 </td></tr>
2342 2343 <tr><td>
2343 2344 <a href="/help/files">
2344 2345 files
2345 2346 </a>
2346 2347 </td><td>
2347 2348 list tracked files
2348 2349 </td></tr>
2349 2350 <tr><td>
2350 2351 <a href="/help/graft">
2351 2352 graft
2352 2353 </a>
2353 2354 </td><td>
2354 2355 copy changes from other branches onto the current branch
2355 2356 </td></tr>
2356 2357 <tr><td>
2357 2358 <a href="/help/grep">
2358 2359 grep
2359 2360 </a>
2360 2361 </td><td>
2361 2362 search revision history for a pattern in specified files
2362 2363 </td></tr>
2363 2364 <tr><td>
2364 2365 <a href="/help/heads">
2365 2366 heads
2366 2367 </a>
2367 2368 </td><td>
2368 2369 show branch heads
2369 2370 </td></tr>
2370 2371 <tr><td>
2371 2372 <a href="/help/help">
2372 2373 help
2373 2374 </a>
2374 2375 </td><td>
2375 2376 show help for a given topic or a help overview
2376 2377 </td></tr>
2377 2378 <tr><td>
2378 2379 <a href="/help/hgalias">
2379 2380 hgalias
2380 2381 </a>
2381 2382 </td><td>
2382 2383 summarize working directory state
2383 2384 </td></tr>
2384 2385 <tr><td>
2385 2386 <a href="/help/identify">
2386 2387 identify
2387 2388 </a>
2388 2389 </td><td>
2389 2390 identify the working directory or specified revision
2390 2391 </td></tr>
2391 2392 <tr><td>
2392 2393 <a href="/help/import">
2393 2394 import
2394 2395 </a>
2395 2396 </td><td>
2396 2397 import an ordered set of patches
2397 2398 </td></tr>
2398 2399 <tr><td>
2399 2400 <a href="/help/incoming">
2400 2401 incoming
2401 2402 </a>
2402 2403 </td><td>
2403 2404 show new changesets found in source
2404 2405 </td></tr>
2405 2406 <tr><td>
2406 2407 <a href="/help/manifest">
2407 2408 manifest
2408 2409 </a>
2409 2410 </td><td>
2410 2411 output the current or given revision of the project manifest
2411 2412 </td></tr>
2412 2413 <tr><td>
2413 2414 <a href="/help/nohelp">
2414 2415 nohelp
2415 2416 </a>
2416 2417 </td><td>
2417 2418 (no help text available)
2418 2419 </td></tr>
2419 2420 <tr><td>
2420 2421 <a href="/help/outgoing">
2421 2422 outgoing
2422 2423 </a>
2423 2424 </td><td>
2424 2425 show changesets not found in the destination
2425 2426 </td></tr>
2426 2427 <tr><td>
2427 2428 <a href="/help/paths">
2428 2429 paths
2429 2430 </a>
2430 2431 </td><td>
2431 2432 show aliases for remote repositories
2432 2433 </td></tr>
2433 2434 <tr><td>
2434 2435 <a href="/help/phase">
2435 2436 phase
2436 2437 </a>
2437 2438 </td><td>
2438 2439 set or show the current phase name
2439 2440 </td></tr>
2440 2441 <tr><td>
2441 2442 <a href="/help/recover">
2442 2443 recover
2443 2444 </a>
2444 2445 </td><td>
2445 2446 roll back an interrupted transaction
2446 2447 </td></tr>
2447 2448 <tr><td>
2448 2449 <a href="/help/rename">
2449 2450 rename
2450 2451 </a>
2451 2452 </td><td>
2452 2453 rename files; equivalent of copy + remove
2453 2454 </td></tr>
2454 2455 <tr><td>
2455 2456 <a href="/help/resolve">
2456 2457 resolve
2457 2458 </a>
2458 2459 </td><td>
2459 2460 redo merges or set/view the merge status of files
2460 2461 </td></tr>
2461 2462 <tr><td>
2462 2463 <a href="/help/revert">
2463 2464 revert
2464 2465 </a>
2465 2466 </td><td>
2466 2467 restore files to their checkout state
2467 2468 </td></tr>
2468 2469 <tr><td>
2469 2470 <a href="/help/root">
2470 2471 root
2471 2472 </a>
2472 2473 </td><td>
2473 2474 print the root (top) of the current working directory
2474 2475 </td></tr>
2475 2476 <tr><td>
2476 2477 <a href="/help/shellalias">
2477 2478 shellalias
2478 2479 </a>
2479 2480 </td><td>
2480 2481 (no help text available)
2481 2482 </td></tr>
2482 2483 <tr><td>
2483 2484 <a href="/help/tag">
2484 2485 tag
2485 2486 </a>
2486 2487 </td><td>
2487 2488 add one or more tags for the current or given revision
2488 2489 </td></tr>
2489 2490 <tr><td>
2490 2491 <a href="/help/tags">
2491 2492 tags
2492 2493 </a>
2493 2494 </td><td>
2494 2495 list repository tags
2495 2496 </td></tr>
2496 2497 <tr><td>
2497 2498 <a href="/help/unbundle">
2498 2499 unbundle
2499 2500 </a>
2500 2501 </td><td>
2501 2502 apply one or more bundle files
2502 2503 </td></tr>
2503 2504 <tr><td>
2504 2505 <a href="/help/verify">
2505 2506 verify
2506 2507 </a>
2507 2508 </td><td>
2508 2509 verify the integrity of the repository
2509 2510 </td></tr>
2510 2511 <tr><td>
2511 2512 <a href="/help/version">
2512 2513 version
2513 2514 </a>
2514 2515 </td><td>
2515 2516 output version and copyright information
2516 2517 </td></tr>
2517 2518
2518 2519
2519 2520 </table>
2520 2521 </div>
2521 2522 </div>
2522 2523
2523 2524
2524 2525
2525 2526 </body>
2526 2527 </html>
2527 2528
2528 2529
2529 2530 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2530 2531 200 Script output follows
2531 2532
2532 2533 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2533 2534 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2534 2535 <head>
2535 2536 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2536 2537 <meta name="robots" content="index, nofollow" />
2537 2538 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2538 2539 <script type="text/javascript" src="/static/mercurial.js"></script>
2539 2540
2540 2541 <title>Help: add</title>
2541 2542 </head>
2542 2543 <body>
2543 2544
2544 2545 <div class="container">
2545 2546 <div class="menu">
2546 2547 <div class="logo">
2547 2548 <a href="https://mercurial-scm.org/">
2548 2549 <img src="/static/hglogo.png" alt="mercurial" /></a>
2549 2550 </div>
2550 2551 <ul>
2551 2552 <li><a href="/shortlog">log</a></li>
2552 2553 <li><a href="/graph">graph</a></li>
2553 2554 <li><a href="/tags">tags</a></li>
2554 2555 <li><a href="/bookmarks">bookmarks</a></li>
2555 2556 <li><a href="/branches">branches</a></li>
2556 2557 </ul>
2557 2558 <ul>
2558 2559 <li class="active"><a href="/help">help</a></li>
2559 2560 </ul>
2560 2561 </div>
2561 2562
2562 2563 <div class="main">
2563 2564 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2564 2565 <h3>Help: add</h3>
2565 2566
2566 2567 <form class="search" action="/log">
2567 2568
2568 2569 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2569 2570 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2570 2571 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2571 2572 </form>
2572 2573 <div id="doc">
2573 2574 <p>
2574 2575 hg add [OPTION]... [FILE]...
2575 2576 </p>
2576 2577 <p>
2577 2578 add the specified files on the next commit
2578 2579 </p>
2579 2580 <p>
2580 2581 Schedule files to be version controlled and added to the
2581 2582 repository.
2582 2583 </p>
2583 2584 <p>
2584 2585 The files will be added to the repository at the next commit. To
2585 2586 undo an add before that, see 'hg forget'.
2586 2587 </p>
2587 2588 <p>
2588 2589 If no names are given, add all files to the repository (except
2589 2590 files matching &quot;.hgignore&quot;).
2590 2591 </p>
2591 2592 <p>
2592 2593 Examples:
2593 2594 </p>
2594 2595 <ul>
2595 2596 <li> New (unknown) files are added automatically by 'hg add':
2596 2597 <pre>
2597 2598 \$ ls (re)
2598 2599 foo.c
2599 2600 \$ hg status (re)
2600 2601 ? foo.c
2601 2602 \$ hg add (re)
2602 2603 adding foo.c
2603 2604 \$ hg status (re)
2604 2605 A foo.c
2605 2606 </pre>
2606 2607 <li> Specific files to be added can be specified:
2607 2608 <pre>
2608 2609 \$ ls (re)
2609 2610 bar.c foo.c
2610 2611 \$ hg status (re)
2611 2612 ? bar.c
2612 2613 ? foo.c
2613 2614 \$ hg add bar.c (re)
2614 2615 \$ hg status (re)
2615 2616 A bar.c
2616 2617 ? foo.c
2617 2618 </pre>
2618 2619 </ul>
2619 2620 <p>
2620 2621 Returns 0 if all files are successfully added.
2621 2622 </p>
2622 2623 <p>
2623 2624 options ([+] can be repeated):
2624 2625 </p>
2625 2626 <table>
2626 2627 <tr><td>-I</td>
2627 2628 <td>--include PATTERN [+]</td>
2628 2629 <td>include names matching the given patterns</td></tr>
2629 2630 <tr><td>-X</td>
2630 2631 <td>--exclude PATTERN [+]</td>
2631 2632 <td>exclude names matching the given patterns</td></tr>
2632 2633 <tr><td>-S</td>
2633 2634 <td>--subrepos</td>
2634 2635 <td>recurse into subrepositories</td></tr>
2635 2636 <tr><td>-n</td>
2636 2637 <td>--dry-run</td>
2637 2638 <td>do not perform actions, just print output</td></tr>
2638 2639 </table>
2639 2640 <p>
2640 2641 global options ([+] can be repeated):
2641 2642 </p>
2642 2643 <table>
2643 2644 <tr><td>-R</td>
2644 2645 <td>--repository REPO</td>
2645 2646 <td>repository root directory or name of overlay bundle file</td></tr>
2646 2647 <tr><td></td>
2647 2648 <td>--cwd DIR</td>
2648 2649 <td>change working directory</td></tr>
2649 2650 <tr><td>-y</td>
2650 2651 <td>--noninteractive</td>
2651 2652 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2652 2653 <tr><td>-q</td>
2653 2654 <td>--quiet</td>
2654 2655 <td>suppress output</td></tr>
2655 2656 <tr><td>-v</td>
2656 2657 <td>--verbose</td>
2657 2658 <td>enable additional output</td></tr>
2658 2659 <tr><td></td>
2659 2660 <td>--color TYPE</td>
2660 2661 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2661 2662 <tr><td></td>
2662 2663 <td>--config CONFIG [+]</td>
2663 2664 <td>set/override config option (use 'section.name=value')</td></tr>
2664 2665 <tr><td></td>
2665 2666 <td>--debug</td>
2666 2667 <td>enable debugging output</td></tr>
2667 2668 <tr><td></td>
2668 2669 <td>--debugger</td>
2669 2670 <td>start debugger</td></tr>
2670 2671 <tr><td></td>
2671 2672 <td>--encoding ENCODE</td>
2672 2673 <td>set the charset encoding (default: ascii)</td></tr>
2673 2674 <tr><td></td>
2674 2675 <td>--encodingmode MODE</td>
2675 2676 <td>set the charset encoding mode (default: strict)</td></tr>
2676 2677 <tr><td></td>
2677 2678 <td>--traceback</td>
2678 2679 <td>always print a traceback on exception</td></tr>
2679 2680 <tr><td></td>
2680 2681 <td>--time</td>
2681 2682 <td>time how long the command takes</td></tr>
2682 2683 <tr><td></td>
2683 2684 <td>--profile</td>
2684 2685 <td>print command execution profile</td></tr>
2685 2686 <tr><td></td>
2686 2687 <td>--version</td>
2687 2688 <td>output version information and exit</td></tr>
2688 2689 <tr><td>-h</td>
2689 2690 <td>--help</td>
2690 2691 <td>display help and exit</td></tr>
2691 2692 <tr><td></td>
2692 2693 <td>--hidden</td>
2693 2694 <td>consider hidden changesets</td></tr>
2694 2695 <tr><td></td>
2695 2696 <td>--pager TYPE</td>
2696 2697 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2697 2698 </table>
2698 2699
2699 2700 </div>
2700 2701 </div>
2701 2702 </div>
2702 2703
2703 2704
2704 2705
2705 2706 </body>
2706 2707 </html>
2707 2708
2708 2709
2709 2710 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2710 2711 200 Script output follows
2711 2712
2712 2713 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2713 2714 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2714 2715 <head>
2715 2716 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2716 2717 <meta name="robots" content="index, nofollow" />
2717 2718 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2718 2719 <script type="text/javascript" src="/static/mercurial.js"></script>
2719 2720
2720 2721 <title>Help: remove</title>
2721 2722 </head>
2722 2723 <body>
2723 2724
2724 2725 <div class="container">
2725 2726 <div class="menu">
2726 2727 <div class="logo">
2727 2728 <a href="https://mercurial-scm.org/">
2728 2729 <img src="/static/hglogo.png" alt="mercurial" /></a>
2729 2730 </div>
2730 2731 <ul>
2731 2732 <li><a href="/shortlog">log</a></li>
2732 2733 <li><a href="/graph">graph</a></li>
2733 2734 <li><a href="/tags">tags</a></li>
2734 2735 <li><a href="/bookmarks">bookmarks</a></li>
2735 2736 <li><a href="/branches">branches</a></li>
2736 2737 </ul>
2737 2738 <ul>
2738 2739 <li class="active"><a href="/help">help</a></li>
2739 2740 </ul>
2740 2741 </div>
2741 2742
2742 2743 <div class="main">
2743 2744 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2744 2745 <h3>Help: remove</h3>
2745 2746
2746 2747 <form class="search" action="/log">
2747 2748
2748 2749 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2749 2750 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2750 2751 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2751 2752 </form>
2752 2753 <div id="doc">
2753 2754 <p>
2754 2755 hg remove [OPTION]... FILE...
2755 2756 </p>
2756 2757 <p>
2757 2758 aliases: rm
2758 2759 </p>
2759 2760 <p>
2760 2761 remove the specified files on the next commit
2761 2762 </p>
2762 2763 <p>
2763 2764 Schedule the indicated files for removal from the current branch.
2764 2765 </p>
2765 2766 <p>
2766 2767 This command schedules the files to be removed at the next commit.
2767 2768 To undo a remove before that, see 'hg revert'. To undo added
2768 2769 files, see 'hg forget'.
2769 2770 </p>
2770 2771 <p>
2771 2772 -A/--after can be used to remove only files that have already
2772 2773 been deleted, -f/--force can be used to force deletion, and -Af
2773 2774 can be used to remove files from the next revision without
2774 2775 deleting them from the working directory.
2775 2776 </p>
2776 2777 <p>
2777 2778 The following table details the behavior of remove for different
2778 2779 file states (columns) and option combinations (rows). The file
2779 2780 states are Added [A], Clean [C], Modified [M] and Missing [!]
2780 2781 (as reported by 'hg status'). The actions are Warn, Remove
2781 2782 (from branch) and Delete (from disk):
2782 2783 </p>
2783 2784 <table>
2784 2785 <tr><td>opt/state</td>
2785 2786 <td>A</td>
2786 2787 <td>C</td>
2787 2788 <td>M</td>
2788 2789 <td>!</td></tr>
2789 2790 <tr><td>none</td>
2790 2791 <td>W</td>
2791 2792 <td>RD</td>
2792 2793 <td>W</td>
2793 2794 <td>R</td></tr>
2794 2795 <tr><td>-f</td>
2795 2796 <td>R</td>
2796 2797 <td>RD</td>
2797 2798 <td>RD</td>
2798 2799 <td>R</td></tr>
2799 2800 <tr><td>-A</td>
2800 2801 <td>W</td>
2801 2802 <td>W</td>
2802 2803 <td>W</td>
2803 2804 <td>R</td></tr>
2804 2805 <tr><td>-Af</td>
2805 2806 <td>R</td>
2806 2807 <td>R</td>
2807 2808 <td>R</td>
2808 2809 <td>R</td></tr>
2809 2810 </table>
2810 2811 <p>
2811 2812 <b>Note:</b>
2812 2813 </p>
2813 2814 <p>
2814 2815 'hg remove' never deletes files in Added [A] state from the
2815 2816 working directory, not even if &quot;--force&quot; is specified.
2816 2817 </p>
2817 2818 <p>
2818 2819 Returns 0 on success, 1 if any warnings encountered.
2819 2820 </p>
2820 2821 <p>
2821 2822 options ([+] can be repeated):
2822 2823 </p>
2823 2824 <table>
2824 2825 <tr><td>-A</td>
2825 2826 <td>--after</td>
2826 2827 <td>record delete for missing files</td></tr>
2827 2828 <tr><td>-f</td>
2828 2829 <td>--force</td>
2829 2830 <td>forget added files, delete modified files</td></tr>
2830 2831 <tr><td>-S</td>
2831 2832 <td>--subrepos</td>
2832 2833 <td>recurse into subrepositories</td></tr>
2833 2834 <tr><td>-I</td>
2834 2835 <td>--include PATTERN [+]</td>
2835 2836 <td>include names matching the given patterns</td></tr>
2836 2837 <tr><td>-X</td>
2837 2838 <td>--exclude PATTERN [+]</td>
2838 2839 <td>exclude names matching the given patterns</td></tr>
2839 2840 </table>
2840 2841 <p>
2841 2842 global options ([+] can be repeated):
2842 2843 </p>
2843 2844 <table>
2844 2845 <tr><td>-R</td>
2845 2846 <td>--repository REPO</td>
2846 2847 <td>repository root directory or name of overlay bundle file</td></tr>
2847 2848 <tr><td></td>
2848 2849 <td>--cwd DIR</td>
2849 2850 <td>change working directory</td></tr>
2850 2851 <tr><td>-y</td>
2851 2852 <td>--noninteractive</td>
2852 2853 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2853 2854 <tr><td>-q</td>
2854 2855 <td>--quiet</td>
2855 2856 <td>suppress output</td></tr>
2856 2857 <tr><td>-v</td>
2857 2858 <td>--verbose</td>
2858 2859 <td>enable additional output</td></tr>
2859 2860 <tr><td></td>
2860 2861 <td>--color TYPE</td>
2861 2862 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2862 2863 <tr><td></td>
2863 2864 <td>--config CONFIG [+]</td>
2864 2865 <td>set/override config option (use 'section.name=value')</td></tr>
2865 2866 <tr><td></td>
2866 2867 <td>--debug</td>
2867 2868 <td>enable debugging output</td></tr>
2868 2869 <tr><td></td>
2869 2870 <td>--debugger</td>
2870 2871 <td>start debugger</td></tr>
2871 2872 <tr><td></td>
2872 2873 <td>--encoding ENCODE</td>
2873 2874 <td>set the charset encoding (default: ascii)</td></tr>
2874 2875 <tr><td></td>
2875 2876 <td>--encodingmode MODE</td>
2876 2877 <td>set the charset encoding mode (default: strict)</td></tr>
2877 2878 <tr><td></td>
2878 2879 <td>--traceback</td>
2879 2880 <td>always print a traceback on exception</td></tr>
2880 2881 <tr><td></td>
2881 2882 <td>--time</td>
2882 2883 <td>time how long the command takes</td></tr>
2883 2884 <tr><td></td>
2884 2885 <td>--profile</td>
2885 2886 <td>print command execution profile</td></tr>
2886 2887 <tr><td></td>
2887 2888 <td>--version</td>
2888 2889 <td>output version information and exit</td></tr>
2889 2890 <tr><td>-h</td>
2890 2891 <td>--help</td>
2891 2892 <td>display help and exit</td></tr>
2892 2893 <tr><td></td>
2893 2894 <td>--hidden</td>
2894 2895 <td>consider hidden changesets</td></tr>
2895 2896 <tr><td></td>
2896 2897 <td>--pager TYPE</td>
2897 2898 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2898 2899 </table>
2899 2900
2900 2901 </div>
2901 2902 </div>
2902 2903 </div>
2903 2904
2904 2905
2905 2906
2906 2907 </body>
2907 2908 </html>
2908 2909
2909 2910
2910 2911 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2911 2912 200 Script output follows
2912 2913
2913 2914 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2914 2915 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2915 2916 <head>
2916 2917 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2917 2918 <meta name="robots" content="index, nofollow" />
2918 2919 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2919 2920 <script type="text/javascript" src="/static/mercurial.js"></script>
2920 2921
2921 2922 <title>Help: dates</title>
2922 2923 </head>
2923 2924 <body>
2924 2925
2925 2926 <div class="container">
2926 2927 <div class="menu">
2927 2928 <div class="logo">
2928 2929 <a href="https://mercurial-scm.org/">
2929 2930 <img src="/static/hglogo.png" alt="mercurial" /></a>
2930 2931 </div>
2931 2932 <ul>
2932 2933 <li><a href="/shortlog">log</a></li>
2933 2934 <li><a href="/graph">graph</a></li>
2934 2935 <li><a href="/tags">tags</a></li>
2935 2936 <li><a href="/bookmarks">bookmarks</a></li>
2936 2937 <li><a href="/branches">branches</a></li>
2937 2938 </ul>
2938 2939 <ul>
2939 2940 <li class="active"><a href="/help">help</a></li>
2940 2941 </ul>
2941 2942 </div>
2942 2943
2943 2944 <div class="main">
2944 2945 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2945 2946 <h3>Help: dates</h3>
2946 2947
2947 2948 <form class="search" action="/log">
2948 2949
2949 2950 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2950 2951 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2951 2952 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2952 2953 </form>
2953 2954 <div id="doc">
2954 2955 <h1>Date Formats</h1>
2955 2956 <p>
2956 2957 Some commands allow the user to specify a date, e.g.:
2957 2958 </p>
2958 2959 <ul>
2959 2960 <li> backout, commit, import, tag: Specify the commit date.
2960 2961 <li> log, revert, update: Select revision(s) by date.
2961 2962 </ul>
2962 2963 <p>
2963 2964 Many date formats are valid. Here are some examples:
2964 2965 </p>
2965 2966 <ul>
2966 2967 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2967 2968 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2968 2969 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2969 2970 <li> &quot;Dec 6&quot; (midnight)
2970 2971 <li> &quot;13:18&quot; (today assumed)
2971 2972 <li> &quot;3:39&quot; (3:39AM assumed)
2972 2973 <li> &quot;3:39pm&quot; (15:39)
2973 2974 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2974 2975 <li> &quot;2006-12-6 13:18&quot;
2975 2976 <li> &quot;2006-12-6&quot;
2976 2977 <li> &quot;12-6&quot;
2977 2978 <li> &quot;12/6&quot;
2978 2979 <li> &quot;12/6/6&quot; (Dec 6 2006)
2979 2980 <li> &quot;today&quot; (midnight)
2980 2981 <li> &quot;yesterday&quot; (midnight)
2981 2982 <li> &quot;now&quot; - right now
2982 2983 </ul>
2983 2984 <p>
2984 2985 Lastly, there is Mercurial's internal format:
2985 2986 </p>
2986 2987 <ul>
2987 2988 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2988 2989 </ul>
2989 2990 <p>
2990 2991 This is the internal representation format for dates. The first number
2991 2992 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2992 2993 second is the offset of the local timezone, in seconds west of UTC
2993 2994 (negative if the timezone is east of UTC).
2994 2995 </p>
2995 2996 <p>
2996 2997 The log command also accepts date ranges:
2997 2998 </p>
2998 2999 <ul>
2999 3000 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3000 3001 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3001 3002 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3002 3003 <li> &quot;-DAYS&quot; - within a given number of days of today
3003 3004 </ul>
3004 3005
3005 3006 </div>
3006 3007 </div>
3007 3008 </div>
3008 3009
3009 3010
3010 3011
3011 3012 </body>
3012 3013 </html>
3013 3014
3014 3015
3015 3016 Sub-topic indexes rendered properly
3016 3017
3017 3018 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3018 3019 200 Script output follows
3019 3020
3020 3021 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3021 3022 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3022 3023 <head>
3023 3024 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3024 3025 <meta name="robots" content="index, nofollow" />
3025 3026 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3026 3027 <script type="text/javascript" src="/static/mercurial.js"></script>
3027 3028
3028 3029 <title>Help: internals</title>
3029 3030 </head>
3030 3031 <body>
3031 3032
3032 3033 <div class="container">
3033 3034 <div class="menu">
3034 3035 <div class="logo">
3035 3036 <a href="https://mercurial-scm.org/">
3036 3037 <img src="/static/hglogo.png" alt="mercurial" /></a>
3037 3038 </div>
3038 3039 <ul>
3039 3040 <li><a href="/shortlog">log</a></li>
3040 3041 <li><a href="/graph">graph</a></li>
3041 3042 <li><a href="/tags">tags</a></li>
3042 3043 <li><a href="/bookmarks">bookmarks</a></li>
3043 3044 <li><a href="/branches">branches</a></li>
3044 3045 </ul>
3045 3046 <ul>
3046 3047 <li><a href="/help">help</a></li>
3047 3048 </ul>
3048 3049 </div>
3049 3050
3050 3051 <div class="main">
3051 3052 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3052 3053
3053 3054 <form class="search" action="/log">
3054 3055
3055 3056 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3056 3057 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3057 3058 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3058 3059 </form>
3059 3060 <table class="bigtable">
3060 3061 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3061 3062
3062 3063 <tr><td>
3063 3064 <a href="/help/internals.bundle2">
3064 3065 bundle2
3065 3066 </a>
3066 3067 </td><td>
3067 3068 Bundle2
3068 3069 </td></tr>
3069 3070 <tr><td>
3070 3071 <a href="/help/internals.bundles">
3071 3072 bundles
3072 3073 </a>
3073 3074 </td><td>
3074 3075 Bundles
3075 3076 </td></tr>
3076 3077 <tr><td>
3077 3078 <a href="/help/internals.censor">
3078 3079 censor
3079 3080 </a>
3080 3081 </td><td>
3081 3082 Censor
3082 3083 </td></tr>
3083 3084 <tr><td>
3084 3085 <a href="/help/internals.changegroups">
3085 3086 changegroups
3086 3087 </a>
3087 3088 </td><td>
3088 3089 Changegroups
3089 3090 </td></tr>
3090 3091 <tr><td>
3091 3092 <a href="/help/internals.config">
3092 3093 config
3093 3094 </a>
3094 3095 </td><td>
3095 3096 Config Registrar
3096 3097 </td></tr>
3097 3098 <tr><td>
3098 3099 <a href="/help/internals.requirements">
3099 3100 requirements
3100 3101 </a>
3101 3102 </td><td>
3102 3103 Repository Requirements
3103 3104 </td></tr>
3104 3105 <tr><td>
3105 3106 <a href="/help/internals.revlogs">
3106 3107 revlogs
3107 3108 </a>
3108 3109 </td><td>
3109 3110 Revision Logs
3110 3111 </td></tr>
3111 3112 <tr><td>
3112 3113 <a href="/help/internals.wireprotocol">
3113 3114 wireprotocol
3114 3115 </a>
3115 3116 </td><td>
3116 3117 Wire Protocol
3117 3118 </td></tr>
3118 3119
3119 3120
3120 3121
3121 3122
3122 3123
3123 3124 </table>
3124 3125 </div>
3125 3126 </div>
3126 3127
3127 3128
3128 3129
3129 3130 </body>
3130 3131 </html>
3131 3132
3132 3133
3133 3134 Sub-topic topics rendered properly
3134 3135
3135 3136 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3136 3137 200 Script output follows
3137 3138
3138 3139 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3139 3140 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3140 3141 <head>
3141 3142 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3142 3143 <meta name="robots" content="index, nofollow" />
3143 3144 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3144 3145 <script type="text/javascript" src="/static/mercurial.js"></script>
3145 3146
3146 3147 <title>Help: internals.changegroups</title>
3147 3148 </head>
3148 3149 <body>
3149 3150
3150 3151 <div class="container">
3151 3152 <div class="menu">
3152 3153 <div class="logo">
3153 3154 <a href="https://mercurial-scm.org/">
3154 3155 <img src="/static/hglogo.png" alt="mercurial" /></a>
3155 3156 </div>
3156 3157 <ul>
3157 3158 <li><a href="/shortlog">log</a></li>
3158 3159 <li><a href="/graph">graph</a></li>
3159 3160 <li><a href="/tags">tags</a></li>
3160 3161 <li><a href="/bookmarks">bookmarks</a></li>
3161 3162 <li><a href="/branches">branches</a></li>
3162 3163 </ul>
3163 3164 <ul>
3164 3165 <li class="active"><a href="/help">help</a></li>
3165 3166 </ul>
3166 3167 </div>
3167 3168
3168 3169 <div class="main">
3169 3170 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3170 3171 <h3>Help: internals.changegroups</h3>
3171 3172
3172 3173 <form class="search" action="/log">
3173 3174
3174 3175 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3175 3176 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3176 3177 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3177 3178 </form>
3178 3179 <div id="doc">
3179 3180 <h1>Changegroups</h1>
3180 3181 <p>
3181 3182 Changegroups are representations of repository revlog data, specifically
3182 3183 the changelog data, root/flat manifest data, treemanifest data, and
3183 3184 filelogs.
3184 3185 </p>
3185 3186 <p>
3186 3187 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3187 3188 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3188 3189 only difference being an additional item in the *delta header*. Version
3189 3190 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3190 3191 exchanging treemanifests (enabled by setting an option on the
3191 3192 &quot;changegroup&quot; part in the bundle2).
3192 3193 </p>
3193 3194 <p>
3194 3195 Changegroups when not exchanging treemanifests consist of 3 logical
3195 3196 segments:
3196 3197 </p>
3197 3198 <pre>
3198 3199 +---------------------------------+
3199 3200 | | | |
3200 3201 | changeset | manifest | filelogs |
3201 3202 | | | |
3202 3203 | | | |
3203 3204 +---------------------------------+
3204 3205 </pre>
3205 3206 <p>
3206 3207 When exchanging treemanifests, there are 4 logical segments:
3207 3208 </p>
3208 3209 <pre>
3209 3210 +-------------------------------------------------+
3210 3211 | | | | |
3211 3212 | changeset | root | treemanifests | filelogs |
3212 3213 | | manifest | | |
3213 3214 | | | | |
3214 3215 +-------------------------------------------------+
3215 3216 </pre>
3216 3217 <p>
3217 3218 The principle building block of each segment is a *chunk*. A *chunk*
3218 3219 is a framed piece of data:
3219 3220 </p>
3220 3221 <pre>
3221 3222 +---------------------------------------+
3222 3223 | | |
3223 3224 | length | data |
3224 3225 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3225 3226 | | |
3226 3227 +---------------------------------------+
3227 3228 </pre>
3228 3229 <p>
3229 3230 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3230 3231 integer indicating the length of the entire chunk (including the length field
3231 3232 itself).
3232 3233 </p>
3233 3234 <p>
3234 3235 There is a special case chunk that has a value of 0 for the length
3235 3236 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3236 3237 </p>
3237 3238 <h2>Delta Groups</h2>
3238 3239 <p>
3239 3240 A *delta group* expresses the content of a revlog as a series of deltas,
3240 3241 or patches against previous revisions.
3241 3242 </p>
3242 3243 <p>
3243 3244 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3244 3245 to signal the end of the delta group:
3245 3246 </p>
3246 3247 <pre>
3247 3248 +------------------------------------------------------------------------+
3248 3249 | | | | | |
3249 3250 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3250 3251 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3251 3252 | | | | | |
3252 3253 +------------------------------------------------------------------------+
3253 3254 </pre>
3254 3255 <p>
3255 3256 Each *chunk*'s data consists of the following:
3256 3257 </p>
3257 3258 <pre>
3258 3259 +---------------------------------------+
3259 3260 | | |
3260 3261 | delta header | delta data |
3261 3262 | (various by version) | (various) |
3262 3263 | | |
3263 3264 +---------------------------------------+
3264 3265 </pre>
3265 3266 <p>
3266 3267 The *delta data* is a series of *delta*s that describe a diff from an existing
3267 3268 entry (either that the recipient already has, or previously specified in the
3268 3269 bundle/changegroup).
3269 3270 </p>
3270 3271 <p>
3271 3272 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3272 3273 &quot;3&quot; of the changegroup format.
3273 3274 </p>
3274 3275 <p>
3275 3276 Version 1 (headerlen=80):
3276 3277 </p>
3277 3278 <pre>
3278 3279 +------------------------------------------------------+
3279 3280 | | | | |
3280 3281 | node | p1 node | p2 node | link node |
3281 3282 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3282 3283 | | | | |
3283 3284 +------------------------------------------------------+
3284 3285 </pre>
3285 3286 <p>
3286 3287 Version 2 (headerlen=100):
3287 3288 </p>
3288 3289 <pre>
3289 3290 +------------------------------------------------------------------+
3290 3291 | | | | | |
3291 3292 | node | p1 node | p2 node | base node | link node |
3292 3293 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3293 3294 | | | | | |
3294 3295 +------------------------------------------------------------------+
3295 3296 </pre>
3296 3297 <p>
3297 3298 Version 3 (headerlen=102):
3298 3299 </p>
3299 3300 <pre>
3300 3301 +------------------------------------------------------------------------------+
3301 3302 | | | | | | |
3302 3303 | node | p1 node | p2 node | base node | link node | flags |
3303 3304 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3304 3305 | | | | | | |
3305 3306 +------------------------------------------------------------------------------+
3306 3307 </pre>
3307 3308 <p>
3308 3309 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3309 3310 series of *delta*s, densely packed (no separators). These deltas describe a diff
3310 3311 from an existing entry (either that the recipient already has, or previously
3311 3312 specified in the bundle/changegroup). The format is described more fully in
3312 3313 &quot;hg help internals.bdiff&quot;, but briefly:
3313 3314 </p>
3314 3315 <pre>
3315 3316 +---------------------------------------------------------------+
3316 3317 | | | | |
3317 3318 | start offset | end offset | new length | content |
3318 3319 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3319 3320 | | | | |
3320 3321 +---------------------------------------------------------------+
3321 3322 </pre>
3322 3323 <p>
3323 3324 Please note that the length field in the delta data does *not* include itself.
3324 3325 </p>
3325 3326 <p>
3326 3327 In version 1, the delta is always applied against the previous node from
3327 3328 the changegroup or the first parent if this is the first entry in the
3328 3329 changegroup.
3329 3330 </p>
3330 3331 <p>
3331 3332 In version 2 and up, the delta base node is encoded in the entry in the
3332 3333 changegroup. This allows the delta to be expressed against any parent,
3333 3334 which can result in smaller deltas and more efficient encoding of data.
3334 3335 </p>
3335 3336 <h2>Changeset Segment</h2>
3336 3337 <p>
3337 3338 The *changeset segment* consists of a single *delta group* holding
3338 3339 changelog data. The *empty chunk* at the end of the *delta group* denotes
3339 3340 the boundary to the *manifest segment*.
3340 3341 </p>
3341 3342 <h2>Manifest Segment</h2>
3342 3343 <p>
3343 3344 The *manifest segment* consists of a single *delta group* holding manifest
3344 3345 data. If treemanifests are in use, it contains only the manifest for the
3345 3346 root directory of the repository. Otherwise, it contains the entire
3346 3347 manifest data. The *empty chunk* at the end of the *delta group* denotes
3347 3348 the boundary to the next segment (either the *treemanifests segment* or the
3348 3349 *filelogs segment*, depending on version and the request options).
3349 3350 </p>
3350 3351 <h3>Treemanifests Segment</h3>
3351 3352 <p>
3352 3353 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3353 3354 only if the 'treemanifest' param is part of the bundle2 changegroup part
3354 3355 (it is not possible to use changegroup version 3 outside of bundle2).
3355 3356 Aside from the filenames in the *treemanifests segment* containing a
3356 3357 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3357 3358 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3358 3359 a sub-segment with filename size 0). This denotes the boundary to the
3359 3360 *filelogs segment*.
3360 3361 </p>
3361 3362 <h2>Filelogs Segment</h2>
3362 3363 <p>
3363 3364 The *filelogs segment* consists of multiple sub-segments, each
3364 3365 corresponding to an individual file whose data is being described:
3365 3366 </p>
3366 3367 <pre>
3367 3368 +--------------------------------------------------+
3368 3369 | | | | | |
3369 3370 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3370 3371 | | | | | (4 bytes) |
3371 3372 | | | | | |
3372 3373 +--------------------------------------------------+
3373 3374 </pre>
3374 3375 <p>
3375 3376 The final filelog sub-segment is followed by an *empty chunk* (logically,
3376 3377 a sub-segment with filename size 0). This denotes the end of the segment
3377 3378 and of the overall changegroup.
3378 3379 </p>
3379 3380 <p>
3380 3381 Each filelog sub-segment consists of the following:
3381 3382 </p>
3382 3383 <pre>
3383 3384 +------------------------------------------------------+
3384 3385 | | | |
3385 3386 | filename length | filename | delta group |
3386 3387 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3387 3388 | | | |
3388 3389 +------------------------------------------------------+
3389 3390 </pre>
3390 3391 <p>
3391 3392 That is, a *chunk* consisting of the filename (not terminated or padded)
3392 3393 followed by N chunks constituting the *delta group* for this file. The
3393 3394 *empty chunk* at the end of each *delta group* denotes the boundary to the
3394 3395 next filelog sub-segment.
3395 3396 </p>
3396 3397
3397 3398 </div>
3398 3399 </div>
3399 3400 </div>
3400 3401
3401 3402
3402 3403
3403 3404 </body>
3404 3405 </html>
3405 3406
3406 3407
3407 3408 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3408 3409 404 Not Found
3409 3410
3410 3411 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3411 3412 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3412 3413 <head>
3413 3414 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3414 3415 <meta name="robots" content="index, nofollow" />
3415 3416 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3416 3417 <script type="text/javascript" src="/static/mercurial.js"></script>
3417 3418
3418 3419 <title>test: error</title>
3419 3420 </head>
3420 3421 <body>
3421 3422
3422 3423 <div class="container">
3423 3424 <div class="menu">
3424 3425 <div class="logo">
3425 3426 <a href="https://mercurial-scm.org/">
3426 3427 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3427 3428 </div>
3428 3429 <ul>
3429 3430 <li><a href="/shortlog">log</a></li>
3430 3431 <li><a href="/graph">graph</a></li>
3431 3432 <li><a href="/tags">tags</a></li>
3432 3433 <li><a href="/bookmarks">bookmarks</a></li>
3433 3434 <li><a href="/branches">branches</a></li>
3434 3435 </ul>
3435 3436 <ul>
3436 3437 <li><a href="/help">help</a></li>
3437 3438 </ul>
3438 3439 </div>
3439 3440
3440 3441 <div class="main">
3441 3442
3442 3443 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3443 3444 <h3>error</h3>
3444 3445
3445 3446
3446 3447 <form class="search" action="/log">
3447 3448
3448 3449 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3449 3450 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3450 3451 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3451 3452 </form>
3452 3453
3453 3454 <div class="description">
3454 3455 <p>
3455 3456 An error occurred while processing your request:
3456 3457 </p>
3457 3458 <p>
3458 3459 Not Found
3459 3460 </p>
3460 3461 </div>
3461 3462 </div>
3462 3463 </div>
3463 3464
3464 3465
3465 3466
3466 3467 </body>
3467 3468 </html>
3468 3469
3469 3470 [1]
3470 3471
3471 3472 $ killdaemons.py
3472 3473
3473 3474 #endif
@@ -1,635 +1,672 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [ui]
3 3 > ssh = $PYTHON "$TESTDIR/dummyssh"
4 4 > [devel]
5 5 > debug.peer-request = true
6 6 > [extensions]
7 7 > sshprotoext = $TESTDIR/sshprotoext.py
8 8 > EOF
9 9
10 10 $ hg init server
11 11 $ cd server
12 12 $ echo 0 > foo
13 13 $ hg -q add foo
14 14 $ hg commit -m initial
15 15 $ cd ..
16 16
17 17 Test a normal behaving server, for sanity
18 18
19 19 $ hg --debug debugpeer ssh://user@dummy/server
20 20 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
21 21 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
22 22 devel-peer-request: hello
23 23 sending hello command
24 24 devel-peer-request: between
25 25 devel-peer-request: pairs: 81 bytes
26 26 sending between command
27 27 remote: 384
28 28 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
29 29 remote: 1
30 30 url: ssh://user@dummy/server
31 31 local: no
32 32 pushable: yes
33 33
34 34 Server should answer the "hello" command in isolation
35 35
36 36 $ hg -R server serve --stdio << EOF
37 37 > hello
38 38 > EOF
39 39 384
40 40 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
41 41
42 `hg debugserve --sshstdio` works
43
44 $ cd server
45 $ hg debugserve --sshstdio << EOF
46 > hello
47 > EOF
48 384
49 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
50
51 I/O logging works
52
53 $ hg debugserve --sshstdio --logiofd 1 << EOF
54 > hello
55 > EOF
56 o> write(4) -> None:
57 o> 384\n
58 o> write(384) -> None:
59 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
60 384
61 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
62 o> flush() -> None
63
64 $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF
65 > hello
66 > EOF
67 384
68 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
69
70 $ cat $TESTTMP/io
71 o> write(4) -> None:
72 o> 384\n
73 o> write(384) -> None:
74 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n
75 o> flush() -> None
76
77 $ cd ..
78
42 79 >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake.
43 80 Server should reply with capabilities and should send "1\n\n" as a successful
44 81 reply with empty response to the "between".
45 82
46 83 $ hg -R server serve --stdio << EOF
47 84 > hello
48 85 > between
49 86 > pairs 81
50 87 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
51 88 > EOF
52 89 384
53 90 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
54 91 1
55 92
56 93
57 94 SSH banner is not printed by default, ignored by clients
58 95
59 96 $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server
60 97 url: ssh://user@dummy/server
61 98 local: no
62 99 pushable: yes
63 100
64 101 --debug will print the banner
65 102
66 103 $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
67 104 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
68 105 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
69 106 devel-peer-request: hello
70 107 sending hello command
71 108 devel-peer-request: between
72 109 devel-peer-request: pairs: 81 bytes
73 110 sending between command
74 111 remote: banner: line 0
75 112 remote: banner: line 1
76 113 remote: banner: line 2
77 114 remote: banner: line 3
78 115 remote: banner: line 4
79 116 remote: banner: line 5
80 117 remote: banner: line 6
81 118 remote: banner: line 7
82 119 remote: banner: line 8
83 120 remote: banner: line 9
84 121 remote: 384
85 122 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
86 123 remote: 1
87 124 url: ssh://user@dummy/server
88 125 local: no
89 126 pushable: yes
90 127
91 128 And test the banner with the raw protocol
92 129
93 130 $ SSHSERVERMODE=banner hg -R server serve --stdio << EOF
94 131 > hello
95 132 > between
96 133 > pairs 81
97 134 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
98 135 > EOF
99 136 banner: line 0
100 137 banner: line 1
101 138 banner: line 2
102 139 banner: line 3
103 140 banner: line 4
104 141 banner: line 5
105 142 banner: line 6
106 143 banner: line 7
107 144 banner: line 8
108 145 banner: line 9
109 146 384
110 147 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
111 148 1
112 149
113 150
114 151 Connecting to a <0.9.1 server that doesn't support the hello command.
115 152 The client should refuse, as we dropped support for connecting to such
116 153 servers.
117 154
118 155 $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
119 156 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
120 157 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
121 158 devel-peer-request: hello
122 159 sending hello command
123 160 devel-peer-request: between
124 161 devel-peer-request: pairs: 81 bytes
125 162 sending between command
126 163 remote: 0
127 164 remote: 1
128 165 abort: no suitable response from remote hg!
129 166 [255]
130 167
131 168 Sending an unknown command to the server results in an empty response to that command
132 169
133 170 $ hg -R server serve --stdio << EOF
134 171 > pre-hello
135 172 > hello
136 173 > between
137 174 > pairs 81
138 175 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
139 176 > EOF
140 177 0
141 178 384
142 179 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
143 180 1
144 181
145 182
146 183 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server
147 184 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
148 185 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
149 186 sending no-args command
150 187 devel-peer-request: hello
151 188 sending hello command
152 189 devel-peer-request: between
153 190 devel-peer-request: pairs: 81 bytes
154 191 sending between command
155 192 remote: 0
156 193 remote: 384
157 194 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
158 195 remote: 1
159 196 url: ssh://user@dummy/server
160 197 local: no
161 198 pushable: yes
162 199
163 200 Send multiple unknown commands before hello
164 201
165 202 $ hg -R server serve --stdio << EOF
166 203 > unknown1
167 204 > unknown2
168 205 > unknown3
169 206 > hello
170 207 > between
171 208 > pairs 81
172 209 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
173 210 > EOF
174 211 0
175 212 0
176 213 0
177 214 384
178 215 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
179 216 1
180 217
181 218
182 219 $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server
183 220 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
184 221 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
185 222 sending unknown1 command
186 223 sending unknown2 command
187 224 sending unknown3 command
188 225 devel-peer-request: hello
189 226 sending hello command
190 227 devel-peer-request: between
191 228 devel-peer-request: pairs: 81 bytes
192 229 sending between command
193 230 remote: 0
194 231 remote: 0
195 232 remote: 0
196 233 remote: 384
197 234 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
198 235 remote: 1
199 236 url: ssh://user@dummy/server
200 237 local: no
201 238 pushable: yes
202 239
203 240 Send an unknown command before hello that has arguments
204 241
205 242 $ hg -R server serve --stdio << EOF
206 243 > with-args
207 244 > foo 13
208 245 > value for foo
209 246 > bar 13
210 247 > value for bar
211 248 > hello
212 249 > between
213 250 > pairs 81
214 251 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
215 252 > EOF
216 253 0
217 254 0
218 255 0
219 256 0
220 257 0
221 258 384
222 259 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
223 260 1
224 261
225 262
226 263 Send an unknown command having an argument that looks numeric
227 264
228 265 $ hg -R server serve --stdio << EOF
229 266 > unknown
230 267 > foo 1
231 268 > 0
232 269 > hello
233 270 > between
234 271 > pairs 81
235 272 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
236 273 > EOF
237 274 0
238 275 0
239 276 0
240 277 384
241 278 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
242 279 1
243 280
244 281
245 282 $ hg -R server serve --stdio << EOF
246 283 > unknown
247 284 > foo 1
248 285 > 1
249 286 > hello
250 287 > between
251 288 > pairs 81
252 289 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
253 290 > EOF
254 291 0
255 292 0
256 293 0
257 294 384
258 295 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
259 296 1
260 297
261 298
262 299 When sending a dict argument value, it is serialized to
263 300 "<arg> <item count>" followed by "<key> <len>\n<value>" for each item
264 301 in the dict.
265 302
266 303 Dictionary value for unknown command
267 304
268 305 $ hg -R server serve --stdio << EOF
269 306 > unknown
270 307 > dict 3
271 308 > key1 3
272 309 > foo
273 310 > key2 3
274 311 > bar
275 312 > key3 3
276 313 > baz
277 314 > hello
278 315 > EOF
279 316 0
280 317 0
281 318 0
282 319 0
283 320 0
284 321 0
285 322 0
286 323 0
287 324 384
288 325 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
289 326
290 327 Incomplete dictionary send
291 328
292 329 $ hg -R server serve --stdio << EOF
293 330 > unknown
294 331 > dict 3
295 332 > key1 3
296 333 > foo
297 334 > EOF
298 335 0
299 336 0
300 337 0
301 338 0
302 339
303 340 Incomplete value send
304 341
305 342 $ hg -R server serve --stdio << EOF
306 343 > unknown
307 344 > dict 3
308 345 > key1 3
309 346 > fo
310 347 > EOF
311 348 0
312 349 0
313 350 0
314 351 0
315 352
316 353 Send a command line with spaces
317 354
318 355 $ hg -R server serve --stdio << EOF
319 356 > unknown withspace
320 357 > hello
321 358 > between
322 359 > pairs 81
323 360 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
324 361 > EOF
325 362 0
326 363 384
327 364 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
328 365 1
329 366
330 367
331 368 $ hg -R server serve --stdio << EOF
332 369 > unknown with multiple spaces
333 370 > hello
334 371 > between
335 372 > pairs 81
336 373 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
337 374 > EOF
338 375 0
339 376 384
340 377 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
341 378 1
342 379
343 380
344 381 $ hg -R server serve --stdio << EOF
345 382 > unknown with spaces
346 383 > key 10
347 384 > some value
348 385 > hello
349 386 > between
350 387 > pairs 81
351 388 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
352 389 > EOF
353 390 0
354 391 0
355 392 0
356 393 384
357 394 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
358 395 1
359 396
360 397
361 398 Send an unknown command after the "between"
362 399
363 400 $ hg -R server serve --stdio << EOF
364 401 > hello
365 402 > between
366 403 > pairs 81
367 404 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
368 405 > EOF
369 406 384
370 407 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
371 408 1
372 409
373 410 0
374 411
375 412 And one with arguments
376 413
377 414 $ hg -R server serve --stdio << EOF
378 415 > hello
379 416 > between
380 417 > pairs 81
381 418 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown
382 419 > foo 5
383 420 > value
384 421 > bar 3
385 422 > baz
386 423 > EOF
387 424 384
388 425 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
389 426 1
390 427
391 428 0
392 429 0
393 430 0
394 431 0
395 432 0
396 433
397 434 Send a valid command before the handshake
398 435
399 436 $ hg -R server serve --stdio << EOF
400 437 > heads
401 438 > hello
402 439 > between
403 440 > pairs 81
404 441 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
405 442 > EOF
406 443 41
407 444 68986213bd4485ea51533535e3fc9e78007a711f
408 445 384
409 446 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
410 447 1
411 448
412 449
413 450 And a variation that doesn't send the between command
414 451
415 452 $ hg -R server serve --stdio << EOF
416 453 > heads
417 454 > hello
418 455 > EOF
419 456 41
420 457 68986213bd4485ea51533535e3fc9e78007a711f
421 458 384
422 459 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
423 460
424 461 Send an upgrade request to a server that doesn't support that command
425 462
426 463 $ hg -R server serve --stdio << EOF
427 464 > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2
428 465 > hello
429 466 > between
430 467 > pairs 81
431 468 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
432 469 > EOF
433 470 0
434 471 384
435 472 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
436 473 1
437 474
438 475
439 476 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
440 477 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
441 478 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
442 479 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
443 480 devel-peer-request: hello
444 481 sending hello command
445 482 devel-peer-request: between
446 483 devel-peer-request: pairs: 81 bytes
447 484 sending between command
448 485 remote: 0
449 486 remote: 384
450 487 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
451 488 remote: 1
452 489 url: ssh://user@dummy/server
453 490 local: no
454 491 pushable: yes
455 492
456 493 Enable version 2 support on server. We need to do this in hgrc because we can't
457 494 use --config with `hg serve --stdio`.
458 495
459 496 $ cat >> server/.hg/hgrc << EOF
460 497 > [experimental]
461 498 > sshserver.support-v2 = true
462 499 > EOF
463 500
464 501 Send an upgrade request to a server that supports upgrade
465 502
466 503 >>> with open('payload', 'wb') as fh:
467 504 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
468 505 ... fh.write(b'hello\n')
469 506 ... fh.write(b'between\n')
470 507 ... fh.write(b'pairs 81\n')
471 508 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
472 509
473 510 $ hg -R server serve --stdio < payload
474 511 upgraded this-is-some-token exp-ssh-v2-0001
475 512 383
476 513 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
477 514
478 515 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server
479 516 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
480 517 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
481 518 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
482 519 devel-peer-request: hello
483 520 sending hello command
484 521 devel-peer-request: between
485 522 devel-peer-request: pairs: 81 bytes
486 523 sending between command
487 524 protocol upgraded to exp-ssh-v2-0001
488 525 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
489 526 url: ssh://user@dummy/server
490 527 local: no
491 528 pushable: yes
492 529
493 530 Verify the peer has capabilities
494 531
495 532 $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server
496 533 running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
497 534 running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
498 535 sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
499 536 devel-peer-request: hello
500 537 sending hello command
501 538 devel-peer-request: between
502 539 devel-peer-request: pairs: 81 bytes
503 540 sending between command
504 541 protocol upgraded to exp-ssh-v2-0001
505 542 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
506 543 Main capabilities:
507 544 batch
508 545 branchmap
509 546 $USUAL_BUNDLE2_CAPS_SERVER$
510 547 changegroupsubset
511 548 getbundle
512 549 known
513 550 lookup
514 551 pushkey
515 552 streamreqs=generaldelta,revlogv1
516 553 unbundle=HG10GZ,HG10BZ,HG10UN
517 554 unbundlehash
518 555 Bundle2 capabilities:
519 556 HG20
520 557 bookmarks
521 558 changegroup
522 559 01
523 560 02
524 561 digests
525 562 md5
526 563 sha1
527 564 sha512
528 565 error
529 566 abort
530 567 unsupportedcontent
531 568 pushraced
532 569 pushkey
533 570 hgtagsfnodes
534 571 listkeys
535 572 phases
536 573 heads
537 574 pushkey
538 575 remote-changegroup
539 576 http
540 577 https
541 578
542 579 Command after upgrade to version 2 is processed
543 580
544 581 >>> with open('payload', 'wb') as fh:
545 582 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
546 583 ... fh.write(b'hello\n')
547 584 ... fh.write(b'between\n')
548 585 ... fh.write(b'pairs 81\n')
549 586 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
550 587 ... fh.write(b'hello\n')
551 588 $ hg -R server serve --stdio < payload
552 589 upgraded this-is-some-token exp-ssh-v2-0001
553 590 383
554 591 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
555 592 384
556 593 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
557 594
558 595 Multiple upgrades is not allowed
559 596
560 597 >>> with open('payload', 'wb') as fh:
561 598 ... fh.write(b'upgrade this-is-some-token proto=exp-ssh-v2-0001\n')
562 599 ... fh.write(b'hello\n')
563 600 ... fh.write(b'between\n')
564 601 ... fh.write(b'pairs 81\n')
565 602 ... fh.write(b'0000000000000000000000000000000000000000-0000000000000000000000000000000000000000')
566 603 ... fh.write(b'upgrade another-token proto=irrelevant\n')
567 604 ... fh.write(b'hello\n')
568 605 $ hg -R server serve --stdio < payload
569 606 upgraded this-is-some-token exp-ssh-v2-0001
570 607 383
571 608 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
572 609 cannot upgrade protocols multiple times
573 610 -
574 611
575 612
576 613 Malformed upgrade request line (not exactly 3 space delimited tokens)
577 614
578 615 $ hg -R server serve --stdio << EOF
579 616 > upgrade
580 617 > EOF
581 618 0
582 619
583 620 $ hg -R server serve --stdio << EOF
584 621 > upgrade token
585 622 > EOF
586 623 0
587 624
588 625 $ hg -R server serve --stdio << EOF
589 626 > upgrade token foo=bar extra-token
590 627 > EOF
591 628 0
592 629
593 630 Upgrade request to unsupported protocol is ignored
594 631
595 632 $ hg -R server serve --stdio << EOF
596 633 > upgrade this-is-some-token proto=unknown1,unknown2
597 634 > hello
598 635 > between
599 636 > pairs 81
600 637 > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000
601 638 > EOF
602 639 0
603 640 384
604 641 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
605 642 1
606 643
607 644
608 645 Upgrade request must be followed by hello + between
609 646
610 647 $ hg -R server serve --stdio << EOF
611 648 > upgrade token proto=exp-ssh-v2-0001
612 649 > invalid
613 650 > EOF
614 651 malformed handshake protocol: missing hello
615 652 -
616 653
617 654
618 655 $ hg -R server serve --stdio << EOF
619 656 > upgrade token proto=exp-ssh-v2-0001
620 657 > hello
621 658 > invalid
622 659 > EOF
623 660 malformed handshake protocol: missing between
624 661 -
625 662
626 663
627 664 $ hg -R server serve --stdio << EOF
628 665 > upgrade token proto=exp-ssh-v2-0001
629 666 > hello
630 667 > between
631 668 > invalid
632 669 > EOF
633 670 malformed handshake protocol: missing pairs 81
634 671 -
635 672
General Comments 0
You need to be logged in to leave comments. Login now