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