##// END OF EJS Templates
help: update help.internalstable for new censor docs
Augie Fackler -
r31293:2cdb1239 default
parent child Browse files
Show More
@@ -1,658 +1,660 b''
1 1 # help.py - help data for mercurial
2 2 #
3 3 # Copyright 2006 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 itertools
11 11 import os
12 12 import textwrap
13 13
14 14 from .i18n import (
15 15 _,
16 16 gettext,
17 17 )
18 18 from . import (
19 19 cmdutil,
20 20 encoding,
21 21 error,
22 22 extensions,
23 23 filemerge,
24 24 fileset,
25 25 minirst,
26 26 revset,
27 27 templatefilters,
28 28 templatekw,
29 29 templater,
30 30 util,
31 31 )
32 32 from .hgweb import (
33 33 webcommands,
34 34 )
35 35
36 36 _exclkeywords = set([
37 37 "(ADVANCED)",
38 38 "(DEPRECATED)",
39 39 "(EXPERIMENTAL)",
40 40 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
41 41 _("(ADVANCED)"),
42 42 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
43 43 _("(DEPRECATED)"),
44 44 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
45 45 _("(EXPERIMENTAL)"),
46 46 ])
47 47
48 48 def listexts(header, exts, indent=1, showdeprecated=False):
49 49 '''return a text listing of the given extensions'''
50 50 rst = []
51 51 if exts:
52 52 for name, desc in sorted(exts.iteritems()):
53 53 if not showdeprecated and any(w in desc for w in _exclkeywords):
54 54 continue
55 55 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
56 56 if rst:
57 57 rst.insert(0, '\n%s\n\n' % header)
58 58 return rst
59 59
60 60 def extshelp(ui):
61 61 rst = loaddoc('extensions')(ui).splitlines(True)
62 62 rst.extend(listexts(
63 63 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
64 64 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
65 65 doc = ''.join(rst)
66 66 return doc
67 67
68 68 def optrst(header, options, verbose):
69 69 data = []
70 70 multioccur = False
71 71 for option in options:
72 72 if len(option) == 5:
73 73 shortopt, longopt, default, desc, optlabel = option
74 74 else:
75 75 shortopt, longopt, default, desc = option
76 76 optlabel = _("VALUE") # default label
77 77
78 78 if not verbose and any(w in desc for w in _exclkeywords):
79 79 continue
80 80
81 81 so = ''
82 82 if shortopt:
83 83 so = '-' + shortopt
84 84 lo = '--' + longopt
85 85 if default:
86 86 desc += _(" (default: %s)") % default
87 87
88 88 if isinstance(default, list):
89 89 lo += " %s [+]" % optlabel
90 90 multioccur = True
91 91 elif (default is not None) and not isinstance(default, bool):
92 92 lo += " %s" % optlabel
93 93
94 94 data.append((so, lo, desc))
95 95
96 96 if multioccur:
97 97 header += (_(" ([+] can be repeated)"))
98 98
99 99 rst = ['\n%s:\n\n' % header]
100 100 rst.extend(minirst.maketable(data, 1))
101 101
102 102 return ''.join(rst)
103 103
104 104 def indicateomitted(rst, omitted, notomitted=None):
105 105 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
106 106 if notomitted:
107 107 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
108 108
109 109 def filtercmd(ui, cmd, kw, doc):
110 110 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
111 111 return True
112 112 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
113 113 return True
114 114 return False
115 115
116 116 def topicmatch(ui, kw):
117 117 """Return help topics matching kw.
118 118
119 119 Returns {'section': [(name, summary), ...], ...} where section is
120 120 one of topics, commands, extensions, or extensioncommands.
121 121 """
122 122 kw = encoding.lower(kw)
123 123 def lowercontains(container):
124 124 return kw in encoding.lower(container) # translated in helptable
125 125 results = {'topics': [],
126 126 'commands': [],
127 127 'extensions': [],
128 128 'extensioncommands': [],
129 129 }
130 130 for names, header, doc in helptable:
131 131 # Old extensions may use a str as doc.
132 132 if (sum(map(lowercontains, names))
133 133 or lowercontains(header)
134 134 or (callable(doc) and lowercontains(doc(ui)))):
135 135 results['topics'].append((names[0], header))
136 136 from . import commands # avoid cycle
137 137 for cmd, entry in commands.table.iteritems():
138 138 if len(entry) == 3:
139 139 summary = entry[2]
140 140 else:
141 141 summary = ''
142 142 # translate docs *before* searching there
143 143 docs = _(getattr(entry[0], '__doc__', None)) or ''
144 144 if kw in cmd or lowercontains(summary) or lowercontains(docs):
145 145 doclines = docs.splitlines()
146 146 if doclines:
147 147 summary = doclines[0]
148 148 cmdname = cmd.partition('|')[0].lstrip('^')
149 149 if filtercmd(ui, cmdname, kw, docs):
150 150 continue
151 151 results['commands'].append((cmdname, summary))
152 152 for name, docs in itertools.chain(
153 153 extensions.enabled(False).iteritems(),
154 154 extensions.disabled().iteritems()):
155 155 if not docs:
156 156 continue
157 157 mod = extensions.load(ui, name, '')
158 158 name = name.rpartition('.')[-1]
159 159 if lowercontains(name) or lowercontains(docs):
160 160 # extension docs are already translated
161 161 results['extensions'].append((name, docs.splitlines()[0]))
162 162 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
163 163 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
164 164 cmdname = cmd.partition('|')[0].lstrip('^')
165 165 if entry[0].__doc__:
166 166 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
167 167 else:
168 168 cmddoc = _('(no help text available)')
169 169 if filtercmd(ui, cmdname, kw, cmddoc):
170 170 continue
171 171 results['extensioncommands'].append((cmdname, cmddoc))
172 172 return results
173 173
174 174 def loaddoc(topic, subdir=None):
175 175 """Return a delayed loader for help/topic.txt."""
176 176
177 177 def loader(ui):
178 178 docdir = os.path.join(util.datapath, 'help')
179 179 if subdir:
180 180 docdir = os.path.join(docdir, subdir)
181 181 path = os.path.join(docdir, topic + ".txt")
182 182 doc = gettext(util.readfile(path))
183 183 for rewriter in helphooks.get(topic, []):
184 184 doc = rewriter(ui, topic, doc)
185 185 return doc
186 186
187 187 return loader
188 188
189 189 internalstable = sorted([
190 190 (['bundles'], _('Bundles'),
191 191 loaddoc('bundles', subdir='internals')),
192 (['censor'], _('Censor'),
193 loaddoc('censor', subdir='internals')),
192 194 (['changegroups'], _('Changegroups'),
193 195 loaddoc('changegroups', subdir='internals')),
194 196 (['requirements'], _('Repository Requirements'),
195 197 loaddoc('requirements', subdir='internals')),
196 198 (['revlogs'], _('Revision Logs'),
197 199 loaddoc('revlogs', subdir='internals')),
198 200 (['wireprotocol'], _('Wire Protocol'),
199 201 loaddoc('wireprotocol', subdir='internals')),
200 202 ])
201 203
202 204 def internalshelp(ui):
203 205 """Generate the index for the "internals" topic."""
204 206 lines = []
205 207 for names, header, doc in internalstable:
206 208 lines.append(' :%s: %s\n' % (names[0], header))
207 209
208 210 return ''.join(lines)
209 211
210 212 helptable = sorted([
211 213 (['color'], _("Colorizing Outputs"), loaddoc('color')),
212 214 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
213 215 (["dates"], _("Date Formats"), loaddoc('dates')),
214 216 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
215 217 (['environment', 'env'], _('Environment Variables'),
216 218 loaddoc('environment')),
217 219 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
218 220 _('Specifying Revisions'), loaddoc('revisions')),
219 221 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
220 222 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
221 223 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
222 224 loaddoc('merge-tools')),
223 225 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
224 226 loaddoc('templates')),
225 227 (['urls'], _('URL Paths'), loaddoc('urls')),
226 228 (["extensions"], _("Using Additional Features"), extshelp),
227 229 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
228 230 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
229 231 (["glossary"], _("Glossary"), loaddoc('glossary')),
230 232 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
231 233 loaddoc('hgignore')),
232 234 (["phases"], _("Working with Phases"), loaddoc('phases')),
233 235 (['scripting'], _('Using Mercurial from scripts and automation'),
234 236 loaddoc('scripting')),
235 237 (['internals'], _("Technical implementation topics"),
236 238 internalshelp),
237 239 (['pager'], _("Pager Support"), loaddoc('pager')),
238 240 ])
239 241
240 242 # Maps topics with sub-topics to a list of their sub-topics.
241 243 subtopics = {
242 244 'internals': internalstable,
243 245 }
244 246
245 247 # Map topics to lists of callable taking the current topic help and
246 248 # returning the updated version
247 249 helphooks = {}
248 250
249 251 def addtopichook(topic, rewriter):
250 252 helphooks.setdefault(topic, []).append(rewriter)
251 253
252 254 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
253 255 """Extract docstring from the items key to function mapping, build a
254 256 single documentation block and use it to overwrite the marker in doc.
255 257 """
256 258 entries = []
257 259 for name in sorted(items):
258 260 text = (items[name].__doc__ or '').rstrip()
259 261 if (not text
260 262 or not ui.verbose and any(w in text for w in _exclkeywords)):
261 263 continue
262 264 text = gettext(text)
263 265 if dedent:
264 266 text = textwrap.dedent(text)
265 267 lines = text.splitlines()
266 268 doclines = [(lines[0])]
267 269 for l in lines[1:]:
268 270 # Stop once we find some Python doctest
269 271 if l.strip().startswith('>>>'):
270 272 break
271 273 if dedent:
272 274 doclines.append(l.rstrip())
273 275 else:
274 276 doclines.append(' ' + l.strip())
275 277 entries.append('\n'.join(doclines))
276 278 entries = '\n\n'.join(entries)
277 279 return doc.replace(marker, entries)
278 280
279 281 def addtopicsymbols(topic, marker, symbols, dedent=False):
280 282 def add(ui, topic, doc):
281 283 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
282 284 addtopichook(topic, add)
283 285
284 286 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
285 287 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
286 288 filemerge.internalsdoc)
287 289 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
288 290 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
289 291 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
290 292 addtopicsymbols('templates', '.. functionsmarker', templater.funcs)
291 293 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
292 294 dedent=True)
293 295
294 296 def help_(ui, name, unknowncmd=False, full=True, subtopic=None, **opts):
295 297 '''
296 298 Generate the help for 'name' as unformatted restructured text. If
297 299 'name' is None, describe the commands available.
298 300 '''
299 301
300 302 from . import commands # avoid cycle
301 303
302 304 def helpcmd(name, subtopic=None):
303 305 try:
304 306 aliases, entry = cmdutil.findcmd(name, commands.table,
305 307 strict=unknowncmd)
306 308 except error.AmbiguousCommand as inst:
307 309 # py3k fix: except vars can't be used outside the scope of the
308 310 # except block, nor can be used inside a lambda. python issue4617
309 311 prefix = inst.args[0]
310 312 select = lambda c: c.lstrip('^').startswith(prefix)
311 313 rst = helplist(select)
312 314 return rst
313 315
314 316 rst = []
315 317
316 318 # check if it's an invalid alias and display its error if it is
317 319 if getattr(entry[0], 'badalias', None):
318 320 rst.append(entry[0].badalias + '\n')
319 321 if entry[0].unknowncmd:
320 322 try:
321 323 rst.extend(helpextcmd(entry[0].cmdname))
322 324 except error.UnknownCommand:
323 325 pass
324 326 return rst
325 327
326 328 # synopsis
327 329 if len(entry) > 2:
328 330 if entry[2].startswith('hg'):
329 331 rst.append("%s\n" % entry[2])
330 332 else:
331 333 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
332 334 else:
333 335 rst.append('hg %s\n' % aliases[0])
334 336 # aliases
335 337 if full and not ui.quiet and len(aliases) > 1:
336 338 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
337 339 rst.append('\n')
338 340
339 341 # description
340 342 doc = gettext(entry[0].__doc__)
341 343 if not doc:
342 344 doc = _("(no help text available)")
343 345 if util.safehasattr(entry[0], 'definition'): # aliased command
344 346 source = entry[0].source
345 347 if entry[0].definition.startswith('!'): # shell alias
346 348 doc = (_('shell alias for::\n\n %s\n\ndefined by: %s\n') %
347 349 (entry[0].definition[1:], source))
348 350 else:
349 351 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
350 352 (entry[0].definition, doc, source))
351 353 doc = doc.splitlines(True)
352 354 if ui.quiet or not full:
353 355 rst.append(doc[0])
354 356 else:
355 357 rst.extend(doc)
356 358 rst.append('\n')
357 359
358 360 # check if this command shadows a non-trivial (multi-line)
359 361 # extension help text
360 362 try:
361 363 mod = extensions.find(name)
362 364 doc = gettext(mod.__doc__) or ''
363 365 if '\n' in doc.strip():
364 366 msg = _("(use 'hg help -e %s' to show help for "
365 367 "the %s extension)") % (name, name)
366 368 rst.append('\n%s\n' % msg)
367 369 except KeyError:
368 370 pass
369 371
370 372 # options
371 373 if not ui.quiet and entry[1]:
372 374 rst.append(optrst(_("options"), entry[1], ui.verbose))
373 375
374 376 if ui.verbose:
375 377 rst.append(optrst(_("global options"),
376 378 commands.globalopts, ui.verbose))
377 379
378 380 if not ui.verbose:
379 381 if not full:
380 382 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
381 383 % name)
382 384 elif not ui.quiet:
383 385 rst.append(_('\n(some details hidden, use --verbose '
384 386 'to show complete help)'))
385 387
386 388 return rst
387 389
388 390
389 391 def helplist(select=None, **opts):
390 392 # list of commands
391 393 if name == "shortlist":
392 394 header = _('basic commands:\n\n')
393 395 elif name == "debug":
394 396 header = _('debug commands (internal and unsupported):\n\n')
395 397 else:
396 398 header = _('list of commands:\n\n')
397 399
398 400 h = {}
399 401 cmds = {}
400 402 for c, e in commands.table.iteritems():
401 403 f = c.partition("|")[0]
402 404 if select and not select(f):
403 405 continue
404 406 if (not select and name != 'shortlist' and
405 407 e[0].__module__ != commands.__name__):
406 408 continue
407 409 if name == "shortlist" and not f.startswith("^"):
408 410 continue
409 411 f = f.lstrip("^")
410 412 doc = e[0].__doc__
411 413 if filtercmd(ui, f, name, doc):
412 414 continue
413 415 doc = gettext(doc)
414 416 if not doc:
415 417 doc = _("(no help text available)")
416 418 h[f] = doc.splitlines()[0].rstrip()
417 419 cmds[f] = c.lstrip("^")
418 420
419 421 rst = []
420 422 if not h:
421 423 if not ui.quiet:
422 424 rst.append(_('no commands defined\n'))
423 425 return rst
424 426
425 427 if not ui.quiet:
426 428 rst.append(header)
427 429 fns = sorted(h)
428 430 for f in fns:
429 431 if ui.verbose:
430 432 commacmds = cmds[f].replace("|",", ")
431 433 rst.append(" :%s: %s\n" % (commacmds, h[f]))
432 434 else:
433 435 rst.append(' :%s: %s\n' % (f, h[f]))
434 436
435 437 ex = opts.get
436 438 anyopts = (ex('keyword') or not (ex('command') or ex('extension')))
437 439 if not name and anyopts:
438 440 exts = listexts(_('enabled extensions:'), extensions.enabled())
439 441 if exts:
440 442 rst.append('\n')
441 443 rst.extend(exts)
442 444
443 445 rst.append(_("\nadditional help topics:\n\n"))
444 446 topics = []
445 447 for names, header, doc in helptable:
446 448 topics.append((names[0], header))
447 449 for t, desc in topics:
448 450 rst.append(" :%s: %s\n" % (t, desc))
449 451
450 452 if ui.quiet:
451 453 pass
452 454 elif ui.verbose:
453 455 rst.append('\n%s\n' % optrst(_("global options"),
454 456 commands.globalopts, ui.verbose))
455 457 if name == 'shortlist':
456 458 rst.append(_("\n(use 'hg help' for the full list "
457 459 "of commands)\n"))
458 460 else:
459 461 if name == 'shortlist':
460 462 rst.append(_("\n(use 'hg help' for the full list of commands "
461 463 "or 'hg -v' for details)\n"))
462 464 elif name and not full:
463 465 rst.append(_("\n(use 'hg help %s' to show the full help "
464 466 "text)\n") % name)
465 467 elif name and cmds and name in cmds.keys():
466 468 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
467 469 "aliases and global options)\n") % name)
468 470 else:
469 471 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
470 472 "and global options)\n")
471 473 % (name and " " + name or ""))
472 474 return rst
473 475
474 476 def helptopic(name, subtopic=None):
475 477 # Look for sub-topic entry first.
476 478 header, doc = None, None
477 479 if subtopic and name in subtopics:
478 480 for names, header, doc in subtopics[name]:
479 481 if subtopic in names:
480 482 break
481 483
482 484 if not header:
483 485 for names, header, doc in helptable:
484 486 if name in names:
485 487 break
486 488 else:
487 489 raise error.UnknownCommand(name)
488 490
489 491 rst = [minirst.section(header)]
490 492
491 493 # description
492 494 if not doc:
493 495 rst.append(" %s\n" % _("(no help text available)"))
494 496 if callable(doc):
495 497 rst += [" %s\n" % l for l in doc(ui).splitlines()]
496 498
497 499 if not ui.verbose:
498 500 omitted = _('(some details hidden, use --verbose'
499 501 ' to show complete help)')
500 502 indicateomitted(rst, omitted)
501 503
502 504 try:
503 505 cmdutil.findcmd(name, commands.table)
504 506 rst.append(_("\nuse 'hg help -c %s' to see help for "
505 507 "the %s command\n") % (name, name))
506 508 except error.UnknownCommand:
507 509 pass
508 510 return rst
509 511
510 512 def helpext(name, subtopic=None):
511 513 try:
512 514 mod = extensions.find(name)
513 515 doc = gettext(mod.__doc__) or _('no help text available')
514 516 except KeyError:
515 517 mod = None
516 518 doc = extensions.disabledext(name)
517 519 if not doc:
518 520 raise error.UnknownCommand(name)
519 521
520 522 if '\n' not in doc:
521 523 head, tail = doc, ""
522 524 else:
523 525 head, tail = doc.split('\n', 1)
524 526 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
525 527 if tail:
526 528 rst.extend(tail.splitlines(True))
527 529 rst.append('\n')
528 530
529 531 if not ui.verbose:
530 532 omitted = _('(some details hidden, use --verbose'
531 533 ' to show complete help)')
532 534 indicateomitted(rst, omitted)
533 535
534 536 if mod:
535 537 try:
536 538 ct = mod.cmdtable
537 539 except AttributeError:
538 540 ct = {}
539 541 modcmds = set([c.partition('|')[0] for c in ct])
540 542 rst.extend(helplist(modcmds.__contains__))
541 543 else:
542 544 rst.append(_("(use 'hg help extensions' for information on enabling"
543 545 " extensions)\n"))
544 546 return rst
545 547
546 548 def helpextcmd(name, subtopic=None):
547 549 cmd, ext, mod = extensions.disabledcmd(ui, name,
548 550 ui.configbool('ui', 'strict'))
549 551 doc = gettext(mod.__doc__).splitlines()[0]
550 552
551 553 rst = listexts(_("'%s' is provided by the following "
552 554 "extension:") % cmd, {ext: doc}, indent=4,
553 555 showdeprecated=True)
554 556 rst.append('\n')
555 557 rst.append(_("(use 'hg help extensions' for information on enabling "
556 558 "extensions)\n"))
557 559 return rst
558 560
559 561
560 562 rst = []
561 563 kw = opts.get('keyword')
562 564 if kw or name is None and any(opts[o] for o in opts):
563 565 matches = topicmatch(ui, name or '')
564 566 helpareas = []
565 567 if opts.get('extension'):
566 568 helpareas += [('extensions', _('Extensions'))]
567 569 if opts.get('command'):
568 570 helpareas += [('commands', _('Commands'))]
569 571 if not helpareas:
570 572 helpareas = [('topics', _('Topics')),
571 573 ('commands', _('Commands')),
572 574 ('extensions', _('Extensions')),
573 575 ('extensioncommands', _('Extension Commands'))]
574 576 for t, title in helpareas:
575 577 if matches[t]:
576 578 rst.append('%s:\n\n' % title)
577 579 rst.extend(minirst.maketable(sorted(matches[t]), 1))
578 580 rst.append('\n')
579 581 if not rst:
580 582 msg = _('no matches')
581 583 hint = _("try 'hg help' for a list of topics")
582 584 raise error.Abort(msg, hint=hint)
583 585 elif name and name != 'shortlist':
584 586 queries = []
585 587 if unknowncmd:
586 588 queries += [helpextcmd]
587 589 if opts.get('extension'):
588 590 queries += [helpext]
589 591 if opts.get('command'):
590 592 queries += [helpcmd]
591 593 if not queries:
592 594 queries = (helptopic, helpcmd, helpext, helpextcmd)
593 595 for f in queries:
594 596 try:
595 597 rst = f(name, subtopic)
596 598 break
597 599 except error.UnknownCommand:
598 600 pass
599 601 else:
600 602 if unknowncmd:
601 603 raise error.UnknownCommand(name)
602 604 else:
603 605 msg = _('no such help topic: %s') % name
604 606 hint = _("try 'hg help --keyword %s'") % name
605 607 raise error.Abort(msg, hint=hint)
606 608 else:
607 609 # program name
608 610 if not ui.quiet:
609 611 rst = [_("Mercurial Distributed SCM\n"), '\n']
610 612 rst.extend(helplist(None, **opts))
611 613
612 614 return ''.join(rst)
613 615
614 616 def formattedhelp(ui, name, keep=None, unknowncmd=False, full=True, **opts):
615 617 """get help for a given topic (as a dotted name) as rendered rst
616 618
617 619 Either returns the rendered help text or raises an exception.
618 620 """
619 621 if keep is None:
620 622 keep = []
621 623 else:
622 624 keep = list(keep) # make a copy so we can mutate this later
623 625 fullname = name
624 626 section = None
625 627 subtopic = None
626 628 if name and '.' in name:
627 629 name, remaining = name.split('.', 1)
628 630 remaining = encoding.lower(remaining)
629 631 if '.' in remaining:
630 632 subtopic, section = remaining.split('.', 1)
631 633 else:
632 634 if name in subtopics:
633 635 subtopic = remaining
634 636 else:
635 637 section = remaining
636 638 textwidth = ui.configint('ui', 'textwidth', 78)
637 639 termwidth = ui.termwidth() - 2
638 640 if textwidth <= 0 or termwidth < textwidth:
639 641 textwidth = termwidth
640 642 text = help_(ui, name,
641 643 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
642 644
643 645 formatted, pruned = minirst.format(text, textwidth, keep=keep,
644 646 section=section)
645 647
646 648 # We could have been given a weird ".foo" section without a name
647 649 # to look for, or we could have simply failed to found "foo.bar"
648 650 # because bar isn't a section of foo
649 651 if section and not (formatted and name):
650 652 raise error.Abort(_("help section not found: %s") % fullname)
651 653
652 654 if 'verbose' in pruned:
653 655 keep.append('omitted')
654 656 else:
655 657 keep.append('notomitted')
656 658 formatted, pruned = minirst.format(text, textwidth, keep=keep,
657 659 section=section)
658 660 return formatted
@@ -1,3297 +1,3305 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 changegroup 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 changegroup 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 color Colorizing Outputs
106 106 config Configuration Files
107 107 dates Date Formats
108 108 diffs Diff Formats
109 109 environment Environment Variables
110 110 extensions Using Additional Features
111 111 filesets Specifying File Sets
112 112 glossary Glossary
113 113 hgignore Syntax for Mercurial Ignore Files
114 114 hgweb Configuring hgweb
115 115 internals Technical implementation topics
116 116 merge-tools Merge Tools
117 117 pager Pager Support
118 118 patterns File Name Patterns
119 119 phases Working with Phases
120 120 revisions Specifying Revisions
121 121 scripting Using Mercurial from scripts and automation
122 122 subrepos Subrepositories
123 123 templating Template Usage
124 124 urls URL Paths
125 125
126 126 (use 'hg help -v' to show built-in aliases and global options)
127 127
128 128 $ hg -q help
129 129 add add the specified files on the next commit
130 130 addremove add all new files, delete all missing files
131 131 annotate show changeset information by line for each file
132 132 archive create an unversioned archive of a repository revision
133 133 backout reverse effect of earlier changeset
134 134 bisect subdivision search of changesets
135 135 bookmarks create a new bookmark or list existing bookmarks
136 136 branch set or show the current branch name
137 137 branches list repository named branches
138 138 bundle create a changegroup file
139 139 cat output the current or given revision of files
140 140 clone make a copy of an existing repository
141 141 commit commit the specified files or all outstanding changes
142 142 config show combined config settings from all hgrc files
143 143 copy mark files as copied for the next commit
144 144 diff diff repository (or selected files)
145 145 export dump the header and diffs for one or more changesets
146 146 files list tracked files
147 147 forget forget the specified files on the next commit
148 148 graft copy changes from other branches onto the current branch
149 149 grep search revision history for a pattern in specified files
150 150 heads show branch heads
151 151 help show help for a given topic or a help overview
152 152 identify identify the working directory or specified revision
153 153 import import an ordered set of patches
154 154 incoming show new changesets found in source
155 155 init create a new repository in the given directory
156 156 log show revision history of entire repository or files
157 157 manifest output the current or given revision of the project manifest
158 158 merge merge another revision into working directory
159 159 outgoing show changesets not found in the destination
160 160 paths show aliases for remote repositories
161 161 phase set or show the current phase name
162 162 pull pull changes from the specified source
163 163 push push changes to the specified destination
164 164 recover roll back an interrupted transaction
165 165 remove remove the specified files on the next commit
166 166 rename rename files; equivalent of copy + remove
167 167 resolve redo merges or set/view the merge status of files
168 168 revert restore files to their checkout state
169 169 root print the root (top) of the current working directory
170 170 serve start stand-alone webserver
171 171 status show changed files in the working directory
172 172 summary summarize working directory state
173 173 tag add one or more tags for the current or given revision
174 174 tags list repository tags
175 175 unbundle apply one or more changegroup files
176 176 update update working directory (or switch revisions)
177 177 verify verify the integrity of the repository
178 178 version output version and copyright information
179 179
180 180 additional help topics:
181 181
182 182 color Colorizing Outputs
183 183 config Configuration Files
184 184 dates Date Formats
185 185 diffs Diff Formats
186 186 environment Environment Variables
187 187 extensions Using Additional Features
188 188 filesets Specifying File Sets
189 189 glossary Glossary
190 190 hgignore Syntax for Mercurial Ignore Files
191 191 hgweb Configuring hgweb
192 192 internals Technical implementation topics
193 193 merge-tools Merge Tools
194 194 pager Pager Support
195 195 patterns File Name Patterns
196 196 phases Working with Phases
197 197 revisions Specifying Revisions
198 198 scripting Using Mercurial from scripts and automation
199 199 subrepos Subrepositories
200 200 templating Template Usage
201 201 urls URL Paths
202 202
203 203 Test extension help:
204 204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 205 Using Additional Features
206 206 """""""""""""""""""""""""
207 207
208 208 Mercurial has the ability to add new features through the use of
209 209 extensions. Extensions may add new commands, add options to existing
210 210 commands, change the default behavior of commands, or implement hooks.
211 211
212 212 To enable the "foo" extension, either shipped with Mercurial or in the
213 213 Python search path, create an entry for it in your configuration file,
214 214 like this:
215 215
216 216 [extensions]
217 217 foo =
218 218
219 219 You may also specify the full path to an extension:
220 220
221 221 [extensions]
222 222 myfeature = ~/.hgext/myfeature.py
223 223
224 224 See 'hg help config' for more information on configuration files.
225 225
226 226 Extensions are not loaded by default for a variety of reasons: they can
227 227 increase startup overhead; they may be meant for advanced usage only; they
228 228 may provide potentially dangerous abilities (such as letting you destroy
229 229 or modify history); they might not be ready for prime time; or they may
230 230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 231 to activate extensions as needed.
232 232
233 233 To explicitly disable an extension enabled in a configuration file of
234 234 broader scope, prepend its path with !:
235 235
236 236 [extensions]
237 237 # disabling extension bar residing in /path/to/extension/bar.py
238 238 bar = !/path/to/extension/bar.py
239 239 # ditto, but no path was supplied for extension baz
240 240 baz = !
241 241
242 242 enabled extensions:
243 243
244 244 children command to display child changesets (DEPRECATED)
245 245 rebase command to move sets of revisions to a different ancestor
246 246
247 247 disabled extensions:
248 248
249 249 acl hooks for controlling repository access
250 250 blackbox log repository events to a blackbox for debugging
251 251 bugzilla hooks for integrating with the Bugzilla bug tracker
252 252 censor erase file content at a given revision
253 253 churn command to display statistics about repository history
254 254 clonebundles advertise pre-generated bundles to seed clones
255 255 convert import revisions from foreign VCS repositories into
256 256 Mercurial
257 257 eol automatically manage newlines in repository files
258 258 extdiff command to allow external programs to compare revisions
259 259 factotum http authentication with factotum
260 260 gpg commands to sign and verify changesets
261 261 hgk browse the repository in a graphical way
262 262 highlight syntax highlighting for hgweb (requires Pygments)
263 263 histedit interactive history editing
264 264 keyword expand keywords in tracked files
265 265 largefiles track large binary files
266 266 mq manage a stack of patches
267 267 notify hooks for sending email push notifications
268 268 patchbomb command to send changesets as (a series of) patch emails
269 269 purge command to delete untracked files from the working
270 270 directory
271 271 relink recreates hardlinks between repository clones
272 272 schemes extend schemes with shortcuts to repository swarms
273 273 share share a common history between several working directories
274 274 shelve save and restore changes to the working directory
275 275 strip strip changesets and their descendants from history
276 276 transplant command to transplant changesets from another branch
277 277 win32mbcs allow the use of MBCS paths with problematic encodings
278 278 zeroconf discover and advertise repositories on the local network
279 279
280 280 Verify that extension keywords appear in help templates
281 281
282 282 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
283 283
284 284 Test short command list with verbose option
285 285
286 286 $ hg -v help shortlist
287 287 Mercurial Distributed SCM
288 288
289 289 basic commands:
290 290
291 291 add add the specified files on the next commit
292 292 annotate, blame
293 293 show changeset information by line for each file
294 294 clone make a copy of an existing repository
295 295 commit, ci commit the specified files or all outstanding changes
296 296 diff diff repository (or selected files)
297 297 export dump the header and diffs for one or more changesets
298 298 forget forget the specified files on the next commit
299 299 init create a new repository in the given directory
300 300 log, history show revision history of entire repository or files
301 301 merge merge another revision into working directory
302 302 pull pull changes from the specified source
303 303 push push changes to the specified destination
304 304 remove, rm remove the specified files on the next commit
305 305 serve start stand-alone webserver
306 306 status, st show changed files in the working directory
307 307 summary, sum summarize working directory state
308 308 update, up, checkout, co
309 309 update working directory (or switch revisions)
310 310
311 311 global options ([+] can be repeated):
312 312
313 313 -R --repository REPO repository root directory or name of overlay bundle
314 314 file
315 315 --cwd DIR change working directory
316 316 -y --noninteractive do not prompt, automatically pick the first choice for
317 317 all prompts
318 318 -q --quiet suppress output
319 319 -v --verbose enable additional output
320 320 --color TYPE when to colorize (boolean, always, auto, never, or
321 321 debug)
322 322 --config CONFIG [+] set/override config option (use 'section.name=value')
323 323 --debug enable debugging output
324 324 --debugger start debugger
325 325 --encoding ENCODE set the charset encoding (default: ascii)
326 326 --encodingmode MODE set the charset encoding mode (default: strict)
327 327 --traceback always print a traceback on exception
328 328 --time time how long the command takes
329 329 --profile print command execution profile
330 330 --version output version information and exit
331 331 -h --help display help and exit
332 332 --hidden consider hidden changesets
333 333 --pager TYPE when to paginate (boolean, always, auto, or never)
334 334 (default: auto)
335 335
336 336 (use 'hg help' for the full list of commands)
337 337
338 338 $ hg add -h
339 339 hg add [OPTION]... [FILE]...
340 340
341 341 add the specified files on the next commit
342 342
343 343 Schedule files to be version controlled and added to the repository.
344 344
345 345 The files will be added to the repository at the next commit. To undo an
346 346 add before that, see 'hg forget'.
347 347
348 348 If no names are given, add all files to the repository (except files
349 349 matching ".hgignore").
350 350
351 351 Returns 0 if all files are successfully added.
352 352
353 353 options ([+] can be repeated):
354 354
355 355 -I --include PATTERN [+] include names matching the given patterns
356 356 -X --exclude PATTERN [+] exclude names matching the given patterns
357 357 -S --subrepos recurse into subrepositories
358 358 -n --dry-run do not perform actions, just print output
359 359
360 360 (some details hidden, use --verbose to show complete help)
361 361
362 362 Verbose help for add
363 363
364 364 $ hg add -hv
365 365 hg add [OPTION]... [FILE]...
366 366
367 367 add the specified files on the next commit
368 368
369 369 Schedule files to be version controlled and added to the repository.
370 370
371 371 The files will be added to the repository at the next commit. To undo an
372 372 add before that, see 'hg forget'.
373 373
374 374 If no names are given, add all files to the repository (except files
375 375 matching ".hgignore").
376 376
377 377 Examples:
378 378
379 379 - New (unknown) files are added automatically by 'hg add':
380 380
381 381 $ ls
382 382 foo.c
383 383 $ hg status
384 384 ? foo.c
385 385 $ hg add
386 386 adding foo.c
387 387 $ hg status
388 388 A foo.c
389 389
390 390 - Specific files to be added can be specified:
391 391
392 392 $ ls
393 393 bar.c foo.c
394 394 $ hg status
395 395 ? bar.c
396 396 ? foo.c
397 397 $ hg add bar.c
398 398 $ hg status
399 399 A bar.c
400 400 ? foo.c
401 401
402 402 Returns 0 if all files are successfully added.
403 403
404 404 options ([+] can be repeated):
405 405
406 406 -I --include PATTERN [+] include names matching the given patterns
407 407 -X --exclude PATTERN [+] exclude names matching the given patterns
408 408 -S --subrepos recurse into subrepositories
409 409 -n --dry-run do not perform actions, just print output
410 410
411 411 global options ([+] can be repeated):
412 412
413 413 -R --repository REPO repository root directory or name of overlay bundle
414 414 file
415 415 --cwd DIR change working directory
416 416 -y --noninteractive do not prompt, automatically pick the first choice for
417 417 all prompts
418 418 -q --quiet suppress output
419 419 -v --verbose enable additional output
420 420 --color TYPE when to colorize (boolean, always, auto, never, or
421 421 debug)
422 422 --config CONFIG [+] set/override config option (use 'section.name=value')
423 423 --debug enable debugging output
424 424 --debugger start debugger
425 425 --encoding ENCODE set the charset encoding (default: ascii)
426 426 --encodingmode MODE set the charset encoding mode (default: strict)
427 427 --traceback always print a traceback on exception
428 428 --time time how long the command takes
429 429 --profile print command execution profile
430 430 --version output version information and exit
431 431 -h --help display help and exit
432 432 --hidden consider hidden changesets
433 433 --pager TYPE when to paginate (boolean, always, auto, or never)
434 434 (default: auto)
435 435
436 436 Test the textwidth config option
437 437
438 438 $ hg root -h --config ui.textwidth=50
439 439 hg root
440 440
441 441 print the root (top) of the current working
442 442 directory
443 443
444 444 Print the root directory of the current
445 445 repository.
446 446
447 447 Returns 0 on success.
448 448
449 449 (some details hidden, use --verbose to show
450 450 complete help)
451 451
452 452 Test help option with version option
453 453
454 454 $ hg add -h --version
455 455 Mercurial Distributed SCM (version *) (glob)
456 456 (see https://mercurial-scm.org for more information)
457 457
458 458 Copyright (C) 2005-* Matt Mackall and others (glob)
459 459 This is free software; see the source for copying conditions. There is NO
460 460 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
461 461
462 462 $ hg add --skjdfks
463 463 hg add: option --skjdfks not recognized
464 464 hg add [OPTION]... [FILE]...
465 465
466 466 add the specified files on the next commit
467 467
468 468 options ([+] can be repeated):
469 469
470 470 -I --include PATTERN [+] include names matching the given patterns
471 471 -X --exclude PATTERN [+] exclude names matching the given patterns
472 472 -S --subrepos recurse into subrepositories
473 473 -n --dry-run do not perform actions, just print output
474 474
475 475 (use 'hg add -h' to show more help)
476 476 [255]
477 477
478 478 Test ambiguous command help
479 479
480 480 $ hg help ad
481 481 list of commands:
482 482
483 483 add add the specified files on the next commit
484 484 addremove add all new files, delete all missing files
485 485
486 486 (use 'hg help -v ad' to show built-in aliases and global options)
487 487
488 488 Test command without options
489 489
490 490 $ hg help verify
491 491 hg verify
492 492
493 493 verify the integrity of the repository
494 494
495 495 Verify the integrity of the current repository.
496 496
497 497 This will perform an extensive check of the repository's integrity,
498 498 validating the hashes and checksums of each entry in the changelog,
499 499 manifest, and tracked files, as well as the integrity of their crosslinks
500 500 and indices.
501 501
502 502 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
503 503 information about recovery from corruption of the repository.
504 504
505 505 Returns 0 on success, 1 if errors are encountered.
506 506
507 507 (some details hidden, use --verbose to show complete help)
508 508
509 509 $ hg help diff
510 510 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
511 511
512 512 diff repository (or selected files)
513 513
514 514 Show differences between revisions for the specified files.
515 515
516 516 Differences between files are shown using the unified diff format.
517 517
518 518 Note:
519 519 'hg diff' may generate unexpected results for merges, as it will
520 520 default to comparing against the working directory's first parent
521 521 changeset if no revisions are specified.
522 522
523 523 When two revision arguments are given, then changes are shown between
524 524 those revisions. If only one revision is specified then that revision is
525 525 compared to the working directory, and, when no revisions are specified,
526 526 the working directory files are compared to its first parent.
527 527
528 528 Alternatively you can specify -c/--change with a revision to see the
529 529 changes in that changeset relative to its first parent.
530 530
531 531 Without the -a/--text option, diff will avoid generating diffs of files it
532 532 detects as binary. With -a, diff will generate a diff anyway, probably
533 533 with undesirable results.
534 534
535 535 Use the -g/--git option to generate diffs in the git extended diff format.
536 536 For more information, read 'hg help diffs'.
537 537
538 538 Returns 0 on success.
539 539
540 540 options ([+] can be repeated):
541 541
542 542 -r --rev REV [+] revision
543 543 -c --change REV change made by revision
544 544 -a --text treat all files as text
545 545 -g --git use git extended diff format
546 546 --nodates omit dates from diff headers
547 547 --noprefix omit a/ and b/ prefixes from filenames
548 548 -p --show-function show which function each change is in
549 549 --reverse produce a diff that undoes the changes
550 550 -w --ignore-all-space ignore white space when comparing lines
551 551 -b --ignore-space-change ignore changes in the amount of white space
552 552 -B --ignore-blank-lines ignore changes whose lines are all blank
553 553 -U --unified NUM number of lines of context to show
554 554 --stat output diffstat-style summary of changes
555 555 --root DIR produce diffs relative to subdirectory
556 556 -I --include PATTERN [+] include names matching the given patterns
557 557 -X --exclude PATTERN [+] exclude names matching the given patterns
558 558 -S --subrepos recurse into subrepositories
559 559
560 560 (some details hidden, use --verbose to show complete help)
561 561
562 562 $ hg help status
563 563 hg status [OPTION]... [FILE]...
564 564
565 565 aliases: st
566 566
567 567 show changed files in the working directory
568 568
569 569 Show status of files in the repository. If names are given, only files
570 570 that match are shown. Files that are clean or ignored or the source of a
571 571 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
572 572 -C/--copies or -A/--all are given. Unless options described with "show
573 573 only ..." are given, the options -mardu are used.
574 574
575 575 Option -q/--quiet hides untracked (unknown and ignored) files unless
576 576 explicitly requested with -u/--unknown or -i/--ignored.
577 577
578 578 Note:
579 579 'hg status' may appear to disagree with diff if permissions have
580 580 changed or a merge has occurred. The standard diff format does not
581 581 report permission changes and diff only reports changes relative to one
582 582 merge parent.
583 583
584 584 If one revision is given, it is used as the base revision. If two
585 585 revisions are given, the differences between them are shown. The --change
586 586 option can also be used as a shortcut to list the changed files of a
587 587 revision from its first parent.
588 588
589 589 The codes used to show the status of files are:
590 590
591 591 M = modified
592 592 A = added
593 593 R = removed
594 594 C = clean
595 595 ! = missing (deleted by non-hg command, but still tracked)
596 596 ? = not tracked
597 597 I = ignored
598 598 = origin of the previous file (with --copies)
599 599
600 600 Returns 0 on success.
601 601
602 602 options ([+] can be repeated):
603 603
604 604 -A --all show status of all files
605 605 -m --modified show only modified files
606 606 -a --added show only added files
607 607 -r --removed show only removed files
608 608 -d --deleted show only deleted (but tracked) files
609 609 -c --clean show only files without changes
610 610 -u --unknown show only unknown (not tracked) files
611 611 -i --ignored show only ignored files
612 612 -n --no-status hide status prefix
613 613 -C --copies show source of copied files
614 614 -0 --print0 end filenames with NUL, for use with xargs
615 615 --rev REV [+] show difference from revision
616 616 --change REV list the changed files of a revision
617 617 -I --include PATTERN [+] include names matching the given patterns
618 618 -X --exclude PATTERN [+] exclude names matching the given patterns
619 619 -S --subrepos recurse into subrepositories
620 620
621 621 (some details hidden, use --verbose to show complete help)
622 622
623 623 $ hg -q help status
624 624 hg status [OPTION]... [FILE]...
625 625
626 626 show changed files in the working directory
627 627
628 628 $ hg help foo
629 629 abort: no such help topic: foo
630 630 (try 'hg help --keyword foo')
631 631 [255]
632 632
633 633 $ hg skjdfks
634 634 hg: unknown command 'skjdfks'
635 635 Mercurial Distributed SCM
636 636
637 637 basic commands:
638 638
639 639 add add the specified files on the next commit
640 640 annotate show changeset information by line for each file
641 641 clone make a copy of an existing repository
642 642 commit commit the specified files or all outstanding changes
643 643 diff diff repository (or selected files)
644 644 export dump the header and diffs for one or more changesets
645 645 forget forget the specified files on the next commit
646 646 init create a new repository in the given directory
647 647 log show revision history of entire repository or files
648 648 merge merge another revision into working directory
649 649 pull pull changes from the specified source
650 650 push push changes to the specified destination
651 651 remove remove the specified files on the next commit
652 652 serve start stand-alone webserver
653 653 status show changed files in the working directory
654 654 summary summarize working directory state
655 655 update update working directory (or switch revisions)
656 656
657 657 (use 'hg help' for the full list of commands or 'hg -v' for details)
658 658 [255]
659 659
660 660
661 661 Make sure that we don't run afoul of the help system thinking that
662 662 this is a section and erroring out weirdly.
663 663
664 664 $ hg .log
665 665 hg: unknown command '.log'
666 666 (did you mean log?)
667 667 [255]
668 668
669 669 $ hg log.
670 670 hg: unknown command 'log.'
671 671 (did you mean log?)
672 672 [255]
673 673 $ hg pu.lh
674 674 hg: unknown command 'pu.lh'
675 675 (did you mean one of pull, push?)
676 676 [255]
677 677
678 678 $ cat > helpext.py <<EOF
679 679 > import os
680 680 > from mercurial import cmdutil, commands
681 681 >
682 682 > cmdtable = {}
683 683 > command = cmdutil.command(cmdtable)
684 684 >
685 685 > @command('nohelp',
686 686 > [('', 'longdesc', 3, 'x'*90),
687 687 > ('n', '', None, 'normal desc'),
688 688 > ('', 'newline', '', 'line1\nline2')],
689 689 > 'hg nohelp',
690 690 > norepo=True)
691 691 > @command('debugoptADV', [('', 'aopt', None, 'option is (ADVANCED)')])
692 692 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
693 693 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
694 694 > def nohelp(ui, *args, **kwargs):
695 695 > pass
696 696 >
697 697 > def uisetup(ui):
698 698 > ui.setconfig('alias', 'shellalias', '!echo hi', 'helpext')
699 699 > ui.setconfig('alias', 'hgalias', 'summary', 'helpext')
700 700 >
701 701 > EOF
702 702 $ echo '[extensions]' >> $HGRCPATH
703 703 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
704 704
705 705 Test for aliases
706 706
707 707 $ hg help hgalias
708 708 hg hgalias [--remote]
709 709
710 710 alias for: hg summary
711 711
712 712 summarize working directory state
713 713
714 714 This generates a brief summary of the working directory state, including
715 715 parents, branch, commit status, phase and available updates.
716 716
717 717 With the --remote option, this will check the default paths for incoming
718 718 and outgoing changes. This can be time-consuming.
719 719
720 720 Returns 0 on success.
721 721
722 722 defined by: helpext
723 723
724 724 options:
725 725
726 726 --remote check for push and pull
727 727
728 728 (some details hidden, use --verbose to show complete help)
729 729
730 730 $ hg help shellalias
731 731 hg shellalias
732 732
733 733 shell alias for:
734 734
735 735 echo hi
736 736
737 737 defined by: helpext
738 738
739 739 (some details hidden, use --verbose to show complete help)
740 740
741 741 Test command with no help text
742 742
743 743 $ hg help nohelp
744 744 hg nohelp
745 745
746 746 (no help text available)
747 747
748 748 options:
749 749
750 750 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
751 751 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
752 752 -n -- normal desc
753 753 --newline VALUE line1 line2
754 754
755 755 (some details hidden, use --verbose to show complete help)
756 756
757 757 $ hg help -k nohelp
758 758 Commands:
759 759
760 760 nohelp hg nohelp
761 761
762 762 Extension Commands:
763 763
764 764 nohelp (no help text available)
765 765
766 766 Test that default list of commands omits extension commands
767 767
768 768 $ hg help
769 769 Mercurial Distributed SCM
770 770
771 771 list of commands:
772 772
773 773 add add the specified files on the next commit
774 774 addremove add all new files, delete all missing files
775 775 annotate show changeset information by line for each file
776 776 archive create an unversioned archive of a repository revision
777 777 backout reverse effect of earlier changeset
778 778 bisect subdivision search of changesets
779 779 bookmarks create a new bookmark or list existing bookmarks
780 780 branch set or show the current branch name
781 781 branches list repository named branches
782 782 bundle create a changegroup file
783 783 cat output the current or given revision of files
784 784 clone make a copy of an existing repository
785 785 commit commit the specified files or all outstanding changes
786 786 config show combined config settings from all hgrc files
787 787 copy mark files as copied for the next commit
788 788 diff diff repository (or selected files)
789 789 export dump the header and diffs for one or more changesets
790 790 files list tracked files
791 791 forget forget the specified files on the next commit
792 792 graft copy changes from other branches onto the current branch
793 793 grep search revision history for a pattern in specified files
794 794 heads show branch heads
795 795 help show help for a given topic or a help overview
796 796 identify identify the working directory or specified revision
797 797 import import an ordered set of patches
798 798 incoming show new changesets found in source
799 799 init create a new repository in the given directory
800 800 log show revision history of entire repository or files
801 801 manifest output the current or given revision of the project manifest
802 802 merge merge another revision into working directory
803 803 outgoing show changesets not found in the destination
804 804 paths show aliases for remote repositories
805 805 phase set or show the current phase name
806 806 pull pull changes from the specified source
807 807 push push changes to the specified destination
808 808 recover roll back an interrupted transaction
809 809 remove remove the specified files on the next commit
810 810 rename rename files; equivalent of copy + remove
811 811 resolve redo merges or set/view the merge status of files
812 812 revert restore files to their checkout state
813 813 root print the root (top) of the current working directory
814 814 serve start stand-alone webserver
815 815 status show changed files in the working directory
816 816 summary summarize working directory state
817 817 tag add one or more tags for the current or given revision
818 818 tags list repository tags
819 819 unbundle apply one or more changegroup files
820 820 update update working directory (or switch revisions)
821 821 verify verify the integrity of the repository
822 822 version output version and copyright information
823 823
824 824 enabled extensions:
825 825
826 826 helpext (no help text available)
827 827
828 828 additional help topics:
829 829
830 830 color Colorizing Outputs
831 831 config Configuration Files
832 832 dates Date Formats
833 833 diffs Diff Formats
834 834 environment Environment Variables
835 835 extensions Using Additional Features
836 836 filesets Specifying File Sets
837 837 glossary Glossary
838 838 hgignore Syntax for Mercurial Ignore Files
839 839 hgweb Configuring hgweb
840 840 internals Technical implementation topics
841 841 merge-tools Merge Tools
842 842 pager Pager Support
843 843 patterns File Name Patterns
844 844 phases Working with Phases
845 845 revisions Specifying Revisions
846 846 scripting Using Mercurial from scripts and automation
847 847 subrepos Subrepositories
848 848 templating Template Usage
849 849 urls URL Paths
850 850
851 851 (use 'hg help -v' to show built-in aliases and global options)
852 852
853 853
854 854 Test list of internal help commands
855 855
856 856 $ hg help debug
857 857 debug commands (internal and unsupported):
858 858
859 859 debugancestor
860 860 find the ancestor revision of two revisions in a given index
861 861 debugapplystreamclonebundle
862 862 apply a stream clone bundle file
863 863 debugbuilddag
864 864 builds a repo with a given DAG from scratch in the current
865 865 empty repo
866 866 debugbundle lists the contents of a bundle
867 867 debugcheckstate
868 868 validate the correctness of the current dirstate
869 869 debugcolor show available color, effects or style
870 870 debugcommands
871 871 list all available commands and options
872 872 debugcomplete
873 873 returns the completion list associated with the given command
874 874 debugcreatestreamclonebundle
875 875 create a stream clone bundle file
876 876 debugdag format the changelog or an index DAG as a concise textual
877 877 description
878 878 debugdata dump the contents of a data file revision
879 879 debugdate parse and display a date
880 880 debugdeltachain
881 881 dump information about delta chains in a revlog
882 882 debugdirstate
883 883 show the contents of the current dirstate
884 884 debugdiscovery
885 885 runs the changeset discovery protocol in isolation
886 886 debugextensions
887 887 show information about active extensions
888 888 debugfileset parse and apply a fileset specification
889 889 debugfsinfo show information detected about current filesystem
890 890 debuggetbundle
891 891 retrieves a bundle from a repo
892 892 debugignore display the combined ignore pattern and information about
893 893 ignored files
894 894 debugindex dump the contents of an index file
895 895 debugindexdot
896 896 dump an index DAG as a graphviz dot file
897 897 debuginstall test Mercurial installation
898 898 debugknown test whether node ids are known to a repo
899 899 debuglocks show or modify state of locks
900 900 debugmergestate
901 901 print merge state
902 902 debugnamecomplete
903 903 complete "names" - tags, open branch names, bookmark names
904 904 debugobsolete
905 905 create arbitrary obsolete marker
906 906 debugoptADV (no help text available)
907 907 debugoptDEP (no help text available)
908 908 debugoptEXP (no help text available)
909 909 debugpathcomplete
910 910 complete part or all of a tracked path
911 911 debugpushkey access the pushkey key/value protocol
912 912 debugpvec (no help text available)
913 913 debugrebuilddirstate
914 914 rebuild the dirstate as it would look like for the given
915 915 revision
916 916 debugrebuildfncache
917 917 rebuild the fncache file
918 918 debugrename dump rename information
919 919 debugrevlog show data and statistics about a revlog
920 920 debugrevspec parse and apply a revision specification
921 921 debugsetparents
922 922 manually set the parents of the current working directory
923 923 debugsub (no help text available)
924 924 debugsuccessorssets
925 925 show set of successors for revision
926 926 debugtemplate
927 927 parse and apply a template
928 928 debugupgraderepo
929 929 upgrade a repository to use different features
930 930 debugwalk show how files match on given patterns
931 931 debugwireargs
932 932 (no help text available)
933 933
934 934 (use 'hg help -v debug' to show built-in aliases and global options)
935 935
936 936 internals topic renders index of available sub-topics
937 937
938 938 $ hg help internals
939 939 Technical implementation topics
940 940 """""""""""""""""""""""""""""""
941 941
942 942 bundles Bundles
943 censor Censor
943 944 changegroups Changegroups
944 945 requirements Repository Requirements
945 946 revlogs Revision Logs
946 947 wireprotocol Wire Protocol
947 948
948 949 sub-topics can be accessed
949 950
950 951 $ hg help internals.changegroups
951 952 Changegroups
952 953 """"""""""""
953 954
954 955 Changegroups are representations of repository revlog data, specifically
955 956 the changelog data, root/flat manifest data, treemanifest data, and
956 957 filelogs.
957 958
958 959 There are 3 versions of changegroups: "1", "2", and "3". From a high-
959 960 level, versions "1" and "2" are almost exactly the same, with the only
960 961 difference being an additional item in the *delta header*. Version "3"
961 962 adds support for revlog flags in the *delta header* and optionally
962 963 exchanging treemanifests (enabled by setting an option on the
963 964 "changegroup" part in the bundle2).
964 965
965 966 Changegroups when not exchanging treemanifests consist of 3 logical
966 967 segments:
967 968
968 969 +---------------------------------+
969 970 | | | |
970 971 | changeset | manifest | filelogs |
971 972 | | | |
972 973 | | | |
973 974 +---------------------------------+
974 975
975 976 When exchanging treemanifests, there are 4 logical segments:
976 977
977 978 +-------------------------------------------------+
978 979 | | | | |
979 980 | changeset | root | treemanifests | filelogs |
980 981 | | manifest | | |
981 982 | | | | |
982 983 +-------------------------------------------------+
983 984
984 985 The principle building block of each segment is a *chunk*. A *chunk* is a
985 986 framed piece of data:
986 987
987 988 +---------------------------------------+
988 989 | | |
989 990 | length | data |
990 991 | (4 bytes) | (<length - 4> bytes) |
991 992 | | |
992 993 +---------------------------------------+
993 994
994 995 All integers are big-endian signed integers. Each chunk starts with a
995 996 32-bit integer indicating the length of the entire chunk (including the
996 997 length field itself).
997 998
998 999 There is a special case chunk that has a value of 0 for the length
999 1000 ("0x00000000"). We call this an *empty chunk*.
1000 1001
1001 1002 Delta Groups
1002 1003 ============
1003 1004
1004 1005 A *delta group* expresses the content of a revlog as a series of deltas,
1005 1006 or patches against previous revisions.
1006 1007
1007 1008 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1008 1009 to signal the end of the delta group:
1009 1010
1010 1011 +------------------------------------------------------------------------+
1011 1012 | | | | | |
1012 1013 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1013 1014 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1014 1015 | | | | | |
1015 1016 +------------------------------------------------------------------------+
1016 1017
1017 1018 Each *chunk*'s data consists of the following:
1018 1019
1019 1020 +---------------------------------------+
1020 1021 | | |
1021 1022 | delta header | delta data |
1022 1023 | (various by version) | (various) |
1023 1024 | | |
1024 1025 +---------------------------------------+
1025 1026
1026 1027 The *delta data* is a series of *delta*s that describe a diff from an
1027 1028 existing entry (either that the recipient already has, or previously
1028 1029 specified in the bundlei/changegroup).
1029 1030
1030 1031 The *delta header* is different between versions "1", "2", and "3" of the
1031 1032 changegroup format.
1032 1033
1033 1034 Version 1 (headerlen=80):
1034 1035
1035 1036 +------------------------------------------------------+
1036 1037 | | | | |
1037 1038 | node | p1 node | p2 node | link node |
1038 1039 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1039 1040 | | | | |
1040 1041 +------------------------------------------------------+
1041 1042
1042 1043 Version 2 (headerlen=100):
1043 1044
1044 1045 +------------------------------------------------------------------+
1045 1046 | | | | | |
1046 1047 | node | p1 node | p2 node | base node | link node |
1047 1048 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1048 1049 | | | | | |
1049 1050 +------------------------------------------------------------------+
1050 1051
1051 1052 Version 3 (headerlen=102):
1052 1053
1053 1054 +------------------------------------------------------------------------------+
1054 1055 | | | | | | |
1055 1056 | node | p1 node | p2 node | base node | link node | flags |
1056 1057 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1057 1058 | | | | | | |
1058 1059 +------------------------------------------------------------------------------+
1059 1060
1060 1061 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1061 1062 contain a series of *delta*s, densely packed (no separators). These deltas
1062 1063 describe a diff from an existing entry (either that the recipient already
1063 1064 has, or previously specified in the bundle/changegroup). The format is
1064 1065 described more fully in "hg help internals.bdiff", but briefly:
1065 1066
1066 1067 +---------------------------------------------------------------+
1067 1068 | | | | |
1068 1069 | start offset | end offset | new length | content |
1069 1070 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1070 1071 | | | | |
1071 1072 +---------------------------------------------------------------+
1072 1073
1073 1074 Please note that the length field in the delta data does *not* include
1074 1075 itself.
1075 1076
1076 1077 In version 1, the delta is always applied against the previous node from
1077 1078 the changegroup or the first parent if this is the first entry in the
1078 1079 changegroup.
1079 1080
1080 1081 In version 2 and up, the delta base node is encoded in the entry in the
1081 1082 changegroup. This allows the delta to be expressed against any parent,
1082 1083 which can result in smaller deltas and more efficient encoding of data.
1083 1084
1084 1085 Changeset Segment
1085 1086 =================
1086 1087
1087 1088 The *changeset segment* consists of a single *delta group* holding
1088 1089 changelog data. The *empty chunk* at the end of the *delta group* denotes
1089 1090 the boundary to the *manifest segment*.
1090 1091
1091 1092 Manifest Segment
1092 1093 ================
1093 1094
1094 1095 The *manifest segment* consists of a single *delta group* holding manifest
1095 1096 data. If treemanifests are in use, it contains only the manifest for the
1096 1097 root directory of the repository. Otherwise, it contains the entire
1097 1098 manifest data. The *empty chunk* at the end of the *delta group* denotes
1098 1099 the boundary to the next segment (either the *treemanifests segment* or
1099 1100 the *filelogs segment*, depending on version and the request options).
1100 1101
1101 1102 Treemanifests Segment
1102 1103 ---------------------
1103 1104
1104 1105 The *treemanifests segment* only exists in changegroup version "3", and
1105 1106 only if the 'treemanifest' param is part of the bundle2 changegroup part
1106 1107 (it is not possible to use changegroup version 3 outside of bundle2).
1107 1108 Aside from the filenames in the *treemanifests segment* containing a
1108 1109 trailing "/" character, it behaves identically to the *filelogs segment*
1109 1110 (see below). The final sub-segment is followed by an *empty chunk*
1110 1111 (logically, a sub-segment with filename size 0). This denotes the boundary
1111 1112 to the *filelogs segment*.
1112 1113
1113 1114 Filelogs Segment
1114 1115 ================
1115 1116
1116 1117 The *filelogs segment* consists of multiple sub-segments, each
1117 1118 corresponding to an individual file whose data is being described:
1118 1119
1119 1120 +--------------------------------------------------+
1120 1121 | | | | | |
1121 1122 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1122 1123 | | | | | (4 bytes) |
1123 1124 | | | | | |
1124 1125 +--------------------------------------------------+
1125 1126
1126 1127 The final filelog sub-segment is followed by an *empty chunk* (logically,
1127 1128 a sub-segment with filename size 0). This denotes the end of the segment
1128 1129 and of the overall changegroup.
1129 1130
1130 1131 Each filelog sub-segment consists of the following:
1131 1132
1132 1133 +------------------------------------------------------+
1133 1134 | | | |
1134 1135 | filename length | filename | delta group |
1135 1136 | (4 bytes) | (<length - 4> bytes) | (various) |
1136 1137 | | | |
1137 1138 +------------------------------------------------------+
1138 1139
1139 1140 That is, a *chunk* consisting of the filename (not terminated or padded)
1140 1141 followed by N chunks constituting the *delta group* for this file. The
1141 1142 *empty chunk* at the end of each *delta group* denotes the boundary to the
1142 1143 next filelog sub-segment.
1143 1144
1144 1145 Test list of commands with command with no help text
1145 1146
1146 1147 $ hg help helpext
1147 1148 helpext extension - no help text available
1148 1149
1149 1150 list of commands:
1150 1151
1151 1152 nohelp (no help text available)
1152 1153
1153 1154 (use 'hg help -v helpext' to show built-in aliases and global options)
1154 1155
1155 1156
1156 1157 test advanced, deprecated and experimental options are hidden in command help
1157 1158 $ hg help debugoptADV
1158 1159 hg debugoptADV
1159 1160
1160 1161 (no help text available)
1161 1162
1162 1163 options:
1163 1164
1164 1165 (some details hidden, use --verbose to show complete help)
1165 1166 $ hg help debugoptDEP
1166 1167 hg debugoptDEP
1167 1168
1168 1169 (no help text available)
1169 1170
1170 1171 options:
1171 1172
1172 1173 (some details hidden, use --verbose to show complete help)
1173 1174
1174 1175 $ hg help debugoptEXP
1175 1176 hg debugoptEXP
1176 1177
1177 1178 (no help text available)
1178 1179
1179 1180 options:
1180 1181
1181 1182 (some details hidden, use --verbose to show complete help)
1182 1183
1183 1184 test advanced, deprecated and experimental options are shown with -v
1184 1185 $ hg help -v debugoptADV | grep aopt
1185 1186 --aopt option is (ADVANCED)
1186 1187 $ hg help -v debugoptDEP | grep dopt
1187 1188 --dopt option is (DEPRECATED)
1188 1189 $ hg help -v debugoptEXP | grep eopt
1189 1190 --eopt option is (EXPERIMENTAL)
1190 1191
1191 1192 #if gettext
1192 1193 test deprecated option is hidden with translation with untranslated description
1193 1194 (use many globy for not failing on changed transaction)
1194 1195 $ LANGUAGE=sv hg help debugoptDEP
1195 1196 hg debugoptDEP
1196 1197
1197 1198 (*) (glob)
1198 1199
1199 1200 options:
1200 1201
1201 1202 (some details hidden, use --verbose to show complete help)
1202 1203 #endif
1203 1204
1204 1205 Test commands that collide with topics (issue4240)
1205 1206
1206 1207 $ hg config -hq
1207 1208 hg config [-u] [NAME]...
1208 1209
1209 1210 show combined config settings from all hgrc files
1210 1211 $ hg showconfig -hq
1211 1212 hg config [-u] [NAME]...
1212 1213
1213 1214 show combined config settings from all hgrc files
1214 1215
1215 1216 Test a help topic
1216 1217
1217 1218 $ hg help dates
1218 1219 Date Formats
1219 1220 """"""""""""
1220 1221
1221 1222 Some commands allow the user to specify a date, e.g.:
1222 1223
1223 1224 - backout, commit, import, tag: Specify the commit date.
1224 1225 - log, revert, update: Select revision(s) by date.
1225 1226
1226 1227 Many date formats are valid. Here are some examples:
1227 1228
1228 1229 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1229 1230 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1230 1231 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1231 1232 - "Dec 6" (midnight)
1232 1233 - "13:18" (today assumed)
1233 1234 - "3:39" (3:39AM assumed)
1234 1235 - "3:39pm" (15:39)
1235 1236 - "2006-12-06 13:18:29" (ISO 8601 format)
1236 1237 - "2006-12-6 13:18"
1237 1238 - "2006-12-6"
1238 1239 - "12-6"
1239 1240 - "12/6"
1240 1241 - "12/6/6" (Dec 6 2006)
1241 1242 - "today" (midnight)
1242 1243 - "yesterday" (midnight)
1243 1244 - "now" - right now
1244 1245
1245 1246 Lastly, there is Mercurial's internal format:
1246 1247
1247 1248 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1248 1249
1249 1250 This is the internal representation format for dates. The first number is
1250 1251 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1251 1252 is the offset of the local timezone, in seconds west of UTC (negative if
1252 1253 the timezone is east of UTC).
1253 1254
1254 1255 The log command also accepts date ranges:
1255 1256
1256 1257 - "<DATE" - at or before a given date/time
1257 1258 - ">DATE" - on or after a given date/time
1258 1259 - "DATE to DATE" - a date range, inclusive
1259 1260 - "-DAYS" - within a given number of days of today
1260 1261
1261 1262 Test repeated config section name
1262 1263
1263 1264 $ hg help config.host
1264 1265 "http_proxy.host"
1265 1266 Host name and (optional) port of the proxy server, for example
1266 1267 "myproxy:8000".
1267 1268
1268 1269 "smtp.host"
1269 1270 Host name of mail server, e.g. "mail.example.com".
1270 1271
1271 1272 Unrelated trailing paragraphs shouldn't be included
1272 1273
1273 1274 $ hg help config.extramsg | grep '^$'
1274 1275
1275 1276
1276 1277 Test capitalized section name
1277 1278
1278 1279 $ hg help scripting.HGPLAIN > /dev/null
1279 1280
1280 1281 Help subsection:
1281 1282
1282 1283 $ hg help config.charsets |grep "Email example:" > /dev/null
1283 1284 [1]
1284 1285
1285 1286 Show nested definitions
1286 1287 ("profiling.type"[break]"ls"[break]"stat"[break])
1287 1288
1288 1289 $ hg help config.type | egrep '^$'|wc -l
1289 1290 \s*3 (re)
1290 1291
1291 1292 Separate sections from subsections
1292 1293
1293 1294 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1294 1295 "format"
1295 1296 --------
1296 1297
1297 1298 "usegeneraldelta"
1298 1299
1299 1300 "dotencode"
1300 1301
1301 1302 "usefncache"
1302 1303
1303 1304 "usestore"
1304 1305
1305 1306 "profiling"
1306 1307 -----------
1307 1308
1308 1309 "format"
1309 1310
1310 1311 "progress"
1311 1312 ----------
1312 1313
1313 1314 "format"
1314 1315
1315 1316
1316 1317 Last item in help config.*:
1317 1318
1318 1319 $ hg help config.`hg help config|grep '^ "'| \
1319 1320 > tail -1|sed 's![ "]*!!g'`| \
1320 1321 > grep 'hg help -c config' > /dev/null
1321 1322 [1]
1322 1323
1323 1324 note to use help -c for general hg help config:
1324 1325
1325 1326 $ hg help config |grep 'hg help -c config' > /dev/null
1326 1327
1327 1328 Test templating help
1328 1329
1329 1330 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1330 1331 desc String. The text of the changeset description.
1331 1332 diffstat String. Statistics of changes with the following format:
1332 1333 firstline Any text. Returns the first line of text.
1333 1334 nonempty Any text. Returns '(none)' if the string is empty.
1334 1335
1335 1336 Test deprecated items
1336 1337
1337 1338 $ hg help -v templating | grep currentbookmark
1338 1339 currentbookmark
1339 1340 $ hg help templating | (grep currentbookmark || true)
1340 1341
1341 1342 Test help hooks
1342 1343
1343 1344 $ cat > helphook1.py <<EOF
1344 1345 > from mercurial import help
1345 1346 >
1346 1347 > def rewrite(ui, topic, doc):
1347 1348 > return doc + '\nhelphook1\n'
1348 1349 >
1349 1350 > def extsetup(ui):
1350 1351 > help.addtopichook('revisions', rewrite)
1351 1352 > EOF
1352 1353 $ cat > helphook2.py <<EOF
1353 1354 > from mercurial import help
1354 1355 >
1355 1356 > def rewrite(ui, topic, doc):
1356 1357 > return doc + '\nhelphook2\n'
1357 1358 >
1358 1359 > def extsetup(ui):
1359 1360 > help.addtopichook('revisions', rewrite)
1360 1361 > EOF
1361 1362 $ echo '[extensions]' >> $HGRCPATH
1362 1363 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1363 1364 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1364 1365 $ hg help revsets | grep helphook
1365 1366 helphook1
1366 1367 helphook2
1367 1368
1368 1369 help -c should only show debug --debug
1369 1370
1370 1371 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1371 1372 [1]
1372 1373
1373 1374 help -c should only show deprecated for -v
1374 1375
1375 1376 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1376 1377 [1]
1377 1378
1378 1379 Test -s / --system
1379 1380
1380 1381 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1381 1382 > wc -l | sed -e 's/ //g'
1382 1383 0
1383 1384 $ hg help config.files --system unix | grep 'USER' | \
1384 1385 > wc -l | sed -e 's/ //g'
1385 1386 0
1386 1387
1387 1388 Test -e / -c / -k combinations
1388 1389
1389 1390 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1390 1391 Commands:
1391 1392 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1392 1393 Extensions:
1393 1394 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1394 1395 Topics:
1395 1396 Commands:
1396 1397 Extensions:
1397 1398 Extension Commands:
1398 1399 $ hg help -c schemes
1399 1400 abort: no such help topic: schemes
1400 1401 (try 'hg help --keyword schemes')
1401 1402 [255]
1402 1403 $ hg help -e schemes |head -1
1403 1404 schemes extension - extend schemes with shortcuts to repository swarms
1404 1405 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1405 1406 Commands:
1406 1407 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1407 1408 Extensions:
1408 1409 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1409 1410 Extensions:
1410 1411 Commands:
1411 1412 $ hg help -c commit > /dev/null
1412 1413 $ hg help -e -c commit > /dev/null
1413 1414 $ hg help -e commit > /dev/null
1414 1415 abort: no such help topic: commit
1415 1416 (try 'hg help --keyword commit')
1416 1417 [255]
1417 1418
1418 1419 Test keyword search help
1419 1420
1420 1421 $ cat > prefixedname.py <<EOF
1421 1422 > '''matched against word "clone"
1422 1423 > '''
1423 1424 > EOF
1424 1425 $ echo '[extensions]' >> $HGRCPATH
1425 1426 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1426 1427 $ hg help -k clone
1427 1428 Topics:
1428 1429
1429 1430 config Configuration Files
1430 1431 extensions Using Additional Features
1431 1432 glossary Glossary
1432 1433 phases Working with Phases
1433 1434 subrepos Subrepositories
1434 1435 urls URL Paths
1435 1436
1436 1437 Commands:
1437 1438
1438 1439 bookmarks create a new bookmark or list existing bookmarks
1439 1440 clone make a copy of an existing repository
1440 1441 paths show aliases for remote repositories
1441 1442 update update working directory (or switch revisions)
1442 1443
1443 1444 Extensions:
1444 1445
1445 1446 clonebundles advertise pre-generated bundles to seed clones
1446 1447 prefixedname matched against word "clone"
1447 1448 relink recreates hardlinks between repository clones
1448 1449
1449 1450 Extension Commands:
1450 1451
1451 1452 qclone clone main and patch repository at same time
1452 1453
1453 1454 Test unfound topic
1454 1455
1455 1456 $ hg help nonexistingtopicthatwillneverexisteverever
1456 1457 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1457 1458 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1458 1459 [255]
1459 1460
1460 1461 Test unfound keyword
1461 1462
1462 1463 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1463 1464 abort: no matches
1464 1465 (try 'hg help' for a list of topics)
1465 1466 [255]
1466 1467
1467 1468 Test omit indicating for help
1468 1469
1469 1470 $ cat > addverboseitems.py <<EOF
1470 1471 > '''extension to test omit indicating.
1471 1472 >
1472 1473 > This paragraph is never omitted (for extension)
1473 1474 >
1474 1475 > .. container:: verbose
1475 1476 >
1476 1477 > This paragraph is omitted,
1477 1478 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1478 1479 >
1479 1480 > This paragraph is never omitted, too (for extension)
1480 1481 > '''
1481 1482 >
1482 1483 > from mercurial import help, commands
1483 1484 > testtopic = """This paragraph is never omitted (for topic).
1484 1485 >
1485 1486 > .. container:: verbose
1486 1487 >
1487 1488 > This paragraph is omitted,
1488 1489 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1489 1490 >
1490 1491 > This paragraph is never omitted, too (for topic)
1491 1492 > """
1492 1493 > def extsetup(ui):
1493 1494 > help.helptable.append((["topic-containing-verbose"],
1494 1495 > "This is the topic to test omit indicating.",
1495 1496 > lambda ui: testtopic))
1496 1497 > EOF
1497 1498 $ echo '[extensions]' >> $HGRCPATH
1498 1499 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1499 1500 $ hg help addverboseitems
1500 1501 addverboseitems extension - extension to test omit indicating.
1501 1502
1502 1503 This paragraph is never omitted (for extension)
1503 1504
1504 1505 This paragraph is never omitted, too (for extension)
1505 1506
1506 1507 (some details hidden, use --verbose to show complete help)
1507 1508
1508 1509 no commands defined
1509 1510 $ hg help -v addverboseitems
1510 1511 addverboseitems extension - extension to test omit indicating.
1511 1512
1512 1513 This paragraph is never omitted (for extension)
1513 1514
1514 1515 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1515 1516 extension)
1516 1517
1517 1518 This paragraph is never omitted, too (for extension)
1518 1519
1519 1520 no commands defined
1520 1521 $ hg help topic-containing-verbose
1521 1522 This is the topic to test omit indicating.
1522 1523 """"""""""""""""""""""""""""""""""""""""""
1523 1524
1524 1525 This paragraph is never omitted (for topic).
1525 1526
1526 1527 This paragraph is never omitted, too (for topic)
1527 1528
1528 1529 (some details hidden, use --verbose to show complete help)
1529 1530 $ hg help -v topic-containing-verbose
1530 1531 This is the topic to test omit indicating.
1531 1532 """"""""""""""""""""""""""""""""""""""""""
1532 1533
1533 1534 This paragraph is never omitted (for topic).
1534 1535
1535 1536 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1536 1537 topic)
1537 1538
1538 1539 This paragraph is never omitted, too (for topic)
1539 1540
1540 1541 Test section lookup
1541 1542
1542 1543 $ hg help revset.merge
1543 1544 "merge()"
1544 1545 Changeset is a merge changeset.
1545 1546
1546 1547 $ hg help glossary.dag
1547 1548 DAG
1548 1549 The repository of changesets of a distributed version control system
1549 1550 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1550 1551 of nodes and edges, where nodes correspond to changesets and edges
1551 1552 imply a parent -> child relation. This graph can be visualized by
1552 1553 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1553 1554 limited by the requirement for children to have at most two parents.
1554 1555
1555 1556
1556 1557 $ hg help hgrc.paths
1557 1558 "paths"
1558 1559 -------
1559 1560
1560 1561 Assigns symbolic names and behavior to repositories.
1561 1562
1562 1563 Options are symbolic names defining the URL or directory that is the
1563 1564 location of the repository. Example:
1564 1565
1565 1566 [paths]
1566 1567 my_server = https://example.com/my_repo
1567 1568 local_path = /home/me/repo
1568 1569
1569 1570 These symbolic names can be used from the command line. To pull from
1570 1571 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1571 1572 local_path'.
1572 1573
1573 1574 Options containing colons (":") denote sub-options that can influence
1574 1575 behavior for that specific path. Example:
1575 1576
1576 1577 [paths]
1577 1578 my_server = https://example.com/my_path
1578 1579 my_server:pushurl = ssh://example.com/my_path
1579 1580
1580 1581 The following sub-options can be defined:
1581 1582
1582 1583 "pushurl"
1583 1584 The URL to use for push operations. If not defined, the location
1584 1585 defined by the path's main entry is used.
1585 1586
1586 1587 "pushrev"
1587 1588 A revset defining which revisions to push by default.
1588 1589
1589 1590 When 'hg push' is executed without a "-r" argument, the revset defined
1590 1591 by this sub-option is evaluated to determine what to push.
1591 1592
1592 1593 For example, a value of "." will push the working directory's revision
1593 1594 by default.
1594 1595
1595 1596 Revsets specifying bookmarks will not result in the bookmark being
1596 1597 pushed.
1597 1598
1598 1599 The following special named paths exist:
1599 1600
1600 1601 "default"
1601 1602 The URL or directory to use when no source or remote is specified.
1602 1603
1603 1604 'hg clone' will automatically define this path to the location the
1604 1605 repository was cloned from.
1605 1606
1606 1607 "default-push"
1607 1608 (deprecated) The URL or directory for the default 'hg push' location.
1608 1609 "default:pushurl" should be used instead.
1609 1610
1610 1611 $ hg help glossary.mcguffin
1611 1612 abort: help section not found: glossary.mcguffin
1612 1613 [255]
1613 1614
1614 1615 $ hg help glossary.mc.guffin
1615 1616 abort: help section not found: glossary.mc.guffin
1616 1617 [255]
1617 1618
1618 1619 $ hg help template.files
1619 1620 files List of strings. All files modified, added, or removed by
1620 1621 this changeset.
1621 1622 files(pattern)
1622 1623 All files of the current changeset matching the pattern. See
1623 1624 'hg help patterns'.
1624 1625
1625 1626 Test section lookup by translated message
1626 1627
1627 1628 str.lower() instead of encoding.lower(str) on translated message might
1628 1629 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1629 1630 as the second or later byte of multi-byte character.
1630 1631
1631 1632 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1632 1633 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1633 1634 replacement makes message meaningless.
1634 1635
1635 1636 This tests that section lookup by translated string isn't broken by
1636 1637 such str.lower().
1637 1638
1638 1639 $ python <<EOF
1639 1640 > def escape(s):
1640 1641 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1641 1642 > # translation of "record" in ja_JP.cp932
1642 1643 > upper = "\x8bL\x98^"
1643 1644 > # str.lower()-ed section name should be treated as different one
1644 1645 > lower = "\x8bl\x98^"
1645 1646 > with open('ambiguous.py', 'w') as fp:
1646 1647 > fp.write("""# ambiguous section names in ja_JP.cp932
1647 1648 > u'''summary of extension
1648 1649 >
1649 1650 > %s
1650 1651 > ----
1651 1652 >
1652 1653 > Upper name should show only this message
1653 1654 >
1654 1655 > %s
1655 1656 > ----
1656 1657 >
1657 1658 > Lower name should show only this message
1658 1659 >
1659 1660 > subsequent section
1660 1661 > ------------------
1661 1662 >
1662 1663 > This should be hidden at 'hg help ambiguous' with section name.
1663 1664 > '''
1664 1665 > """ % (escape(upper), escape(lower)))
1665 1666 > EOF
1666 1667
1667 1668 $ cat >> $HGRCPATH <<EOF
1668 1669 > [extensions]
1669 1670 > ambiguous = ./ambiguous.py
1670 1671 > EOF
1671 1672
1672 1673 $ python <<EOF | sh
1673 1674 > upper = "\x8bL\x98^"
1674 1675 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1675 1676 > EOF
1676 1677 \x8bL\x98^ (esc)
1677 1678 ----
1678 1679
1679 1680 Upper name should show only this message
1680 1681
1681 1682
1682 1683 $ python <<EOF | sh
1683 1684 > lower = "\x8bl\x98^"
1684 1685 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1685 1686 > EOF
1686 1687 \x8bl\x98^ (esc)
1687 1688 ----
1688 1689
1689 1690 Lower name should show only this message
1690 1691
1691 1692
1692 1693 $ cat >> $HGRCPATH <<EOF
1693 1694 > [extensions]
1694 1695 > ambiguous = !
1695 1696 > EOF
1696 1697
1697 1698 Show help content of disabled extensions
1698 1699
1699 1700 $ cat >> $HGRCPATH <<EOF
1700 1701 > [extensions]
1701 1702 > ambiguous = !./ambiguous.py
1702 1703 > EOF
1703 1704 $ hg help -e ambiguous
1704 1705 ambiguous extension - (no help text available)
1705 1706
1706 1707 (use 'hg help extensions' for information on enabling extensions)
1707 1708
1708 1709 Test dynamic list of merge tools only shows up once
1709 1710 $ hg help merge-tools
1710 1711 Merge Tools
1711 1712 """""""""""
1712 1713
1713 1714 To merge files Mercurial uses merge tools.
1714 1715
1715 1716 A merge tool combines two different versions of a file into a merged file.
1716 1717 Merge tools are given the two files and the greatest common ancestor of
1717 1718 the two file versions, so they can determine the changes made on both
1718 1719 branches.
1719 1720
1720 1721 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1721 1722 backout' and in several extensions.
1722 1723
1723 1724 Usually, the merge tool tries to automatically reconcile the files by
1724 1725 combining all non-overlapping changes that occurred separately in the two
1725 1726 different evolutions of the same initial base file. Furthermore, some
1726 1727 interactive merge programs make it easier to manually resolve conflicting
1727 1728 merges, either in a graphical way, or by inserting some conflict markers.
1728 1729 Mercurial does not include any interactive merge programs but relies on
1729 1730 external tools for that.
1730 1731
1731 1732 Available merge tools
1732 1733 =====================
1733 1734
1734 1735 External merge tools and their properties are configured in the merge-
1735 1736 tools configuration section - see hgrc(5) - but they can often just be
1736 1737 named by their executable.
1737 1738
1738 1739 A merge tool is generally usable if its executable can be found on the
1739 1740 system and if it can handle the merge. The executable is found if it is an
1740 1741 absolute or relative executable path or the name of an application in the
1741 1742 executable search path. The tool is assumed to be able to handle the merge
1742 1743 if it can handle symlinks if the file is a symlink, if it can handle
1743 1744 binary files if the file is binary, and if a GUI is available if the tool
1744 1745 requires a GUI.
1745 1746
1746 1747 There are some internal merge tools which can be used. The internal merge
1747 1748 tools are:
1748 1749
1749 1750 ":dump"
1750 1751 Creates three versions of the files to merge, containing the contents of
1751 1752 local, other and base. These files can then be used to perform a merge
1752 1753 manually. If the file to be merged is named "a.txt", these files will
1753 1754 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1754 1755 they will be placed in the same directory as "a.txt".
1755 1756
1756 1757 ":fail"
1757 1758 Rather than attempting to merge files that were modified on both
1758 1759 branches, it marks them as unresolved. The resolve command must be used
1759 1760 to resolve these conflicts.
1760 1761
1761 1762 ":local"
1762 1763 Uses the local 'p1()' version of files as the merged version.
1763 1764
1764 1765 ":merge"
1765 1766 Uses the internal non-interactive simple merge algorithm for merging
1766 1767 files. It will fail if there are any conflicts and leave markers in the
1767 1768 partially merged file. Markers will have two sections, one for each side
1768 1769 of merge.
1769 1770
1770 1771 ":merge-local"
1771 1772 Like :merge, but resolve all conflicts non-interactively in favor of the
1772 1773 local 'p1()' changes.
1773 1774
1774 1775 ":merge-other"
1775 1776 Like :merge, but resolve all conflicts non-interactively in favor of the
1776 1777 other 'p2()' changes.
1777 1778
1778 1779 ":merge3"
1779 1780 Uses the internal non-interactive simple merge algorithm for merging
1780 1781 files. It will fail if there are any conflicts and leave markers in the
1781 1782 partially merged file. Marker will have three sections, one from each
1782 1783 side of the merge and one for the base content.
1783 1784
1784 1785 ":other"
1785 1786 Uses the other 'p2()' version of files as the merged version.
1786 1787
1787 1788 ":prompt"
1788 1789 Asks the user which of the local 'p1()' or the other 'p2()' version to
1789 1790 keep as the merged version.
1790 1791
1791 1792 ":tagmerge"
1792 1793 Uses the internal tag merge algorithm (experimental).
1793 1794
1794 1795 ":union"
1795 1796 Uses the internal non-interactive simple merge algorithm for merging
1796 1797 files. It will use both left and right sides for conflict regions. No
1797 1798 markers are inserted.
1798 1799
1799 1800 Internal tools are always available and do not require a GUI but will by
1800 1801 default not handle symlinks or binary files.
1801 1802
1802 1803 Choosing a merge tool
1803 1804 =====================
1804 1805
1805 1806 Mercurial uses these rules when deciding which merge tool to use:
1806 1807
1807 1808 1. If a tool has been specified with the --tool option to merge or
1808 1809 resolve, it is used. If it is the name of a tool in the merge-tools
1809 1810 configuration, its configuration is used. Otherwise the specified tool
1810 1811 must be executable by the shell.
1811 1812 2. If the "HGMERGE" environment variable is present, its value is used and
1812 1813 must be executable by the shell.
1813 1814 3. If the filename of the file to be merged matches any of the patterns in
1814 1815 the merge-patterns configuration section, the first usable merge tool
1815 1816 corresponding to a matching pattern is used. Here, binary capabilities
1816 1817 of the merge tool are not considered.
1817 1818 4. If ui.merge is set it will be considered next. If the value is not the
1818 1819 name of a configured tool, the specified value is used and must be
1819 1820 executable by the shell. Otherwise the named tool is used if it is
1820 1821 usable.
1821 1822 5. If any usable merge tools are present in the merge-tools configuration
1822 1823 section, the one with the highest priority is used.
1823 1824 6. If a program named "hgmerge" can be found on the system, it is used -
1824 1825 but it will by default not be used for symlinks and binary files.
1825 1826 7. If the file to be merged is not binary and is not a symlink, then
1826 1827 internal ":merge" is used.
1827 1828 8. The merge of the file fails and must be resolved before commit.
1828 1829
1829 1830 Note:
1830 1831 After selecting a merge program, Mercurial will by default attempt to
1831 1832 merge the files using a simple merge algorithm first. Only if it
1832 1833 doesn't succeed because of conflicting changes Mercurial will actually
1833 1834 execute the merge program. Whether to use the simple merge algorithm
1834 1835 first can be controlled by the premerge setting of the merge tool.
1835 1836 Premerge is enabled by default unless the file is binary or a symlink.
1836 1837
1837 1838 See the merge-tools and ui sections of hgrc(5) for details on the
1838 1839 configuration of merge tools.
1839 1840
1840 1841 Test usage of section marks in help documents
1841 1842
1842 1843 $ cd "$TESTDIR"/../doc
1843 1844 $ python check-seclevel.py
1844 1845 $ cd $TESTTMP
1845 1846
1846 1847 #if serve
1847 1848
1848 1849 Test the help pages in hgweb.
1849 1850
1850 1851 Dish up an empty repo; serve it cold.
1851 1852
1852 1853 $ hg init "$TESTTMP/test"
1853 1854 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1854 1855 $ cat hg.pid >> $DAEMON_PIDS
1855 1856
1856 1857 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1857 1858 200 Script output follows
1858 1859
1859 1860 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1860 1861 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1861 1862 <head>
1862 1863 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1863 1864 <meta name="robots" content="index, nofollow" />
1864 1865 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1865 1866 <script type="text/javascript" src="/static/mercurial.js"></script>
1866 1867
1867 1868 <title>Help: Index</title>
1868 1869 </head>
1869 1870 <body>
1870 1871
1871 1872 <div class="container">
1872 1873 <div class="menu">
1873 1874 <div class="logo">
1874 1875 <a href="https://mercurial-scm.org/">
1875 1876 <img src="/static/hglogo.png" alt="mercurial" /></a>
1876 1877 </div>
1877 1878 <ul>
1878 1879 <li><a href="/shortlog">log</a></li>
1879 1880 <li><a href="/graph">graph</a></li>
1880 1881 <li><a href="/tags">tags</a></li>
1881 1882 <li><a href="/bookmarks">bookmarks</a></li>
1882 1883 <li><a href="/branches">branches</a></li>
1883 1884 </ul>
1884 1885 <ul>
1885 1886 <li class="active">help</li>
1886 1887 </ul>
1887 1888 </div>
1888 1889
1889 1890 <div class="main">
1890 1891 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1891 1892 <form class="search" action="/log">
1892 1893
1893 1894 <p><input name="rev" id="search1" type="text" size="30" /></p>
1894 1895 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1895 1896 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1896 1897 </form>
1897 1898 <table class="bigtable">
1898 1899 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1899 1900
1900 1901 <tr><td>
1901 1902 <a href="/help/color">
1902 1903 color
1903 1904 </a>
1904 1905 </td><td>
1905 1906 Colorizing Outputs
1906 1907 </td></tr>
1907 1908 <tr><td>
1908 1909 <a href="/help/config">
1909 1910 config
1910 1911 </a>
1911 1912 </td><td>
1912 1913 Configuration Files
1913 1914 </td></tr>
1914 1915 <tr><td>
1915 1916 <a href="/help/dates">
1916 1917 dates
1917 1918 </a>
1918 1919 </td><td>
1919 1920 Date Formats
1920 1921 </td></tr>
1921 1922 <tr><td>
1922 1923 <a href="/help/diffs">
1923 1924 diffs
1924 1925 </a>
1925 1926 </td><td>
1926 1927 Diff Formats
1927 1928 </td></tr>
1928 1929 <tr><td>
1929 1930 <a href="/help/environment">
1930 1931 environment
1931 1932 </a>
1932 1933 </td><td>
1933 1934 Environment Variables
1934 1935 </td></tr>
1935 1936 <tr><td>
1936 1937 <a href="/help/extensions">
1937 1938 extensions
1938 1939 </a>
1939 1940 </td><td>
1940 1941 Using Additional Features
1941 1942 </td></tr>
1942 1943 <tr><td>
1943 1944 <a href="/help/filesets">
1944 1945 filesets
1945 1946 </a>
1946 1947 </td><td>
1947 1948 Specifying File Sets
1948 1949 </td></tr>
1949 1950 <tr><td>
1950 1951 <a href="/help/glossary">
1951 1952 glossary
1952 1953 </a>
1953 1954 </td><td>
1954 1955 Glossary
1955 1956 </td></tr>
1956 1957 <tr><td>
1957 1958 <a href="/help/hgignore">
1958 1959 hgignore
1959 1960 </a>
1960 1961 </td><td>
1961 1962 Syntax for Mercurial Ignore Files
1962 1963 </td></tr>
1963 1964 <tr><td>
1964 1965 <a href="/help/hgweb">
1965 1966 hgweb
1966 1967 </a>
1967 1968 </td><td>
1968 1969 Configuring hgweb
1969 1970 </td></tr>
1970 1971 <tr><td>
1971 1972 <a href="/help/internals">
1972 1973 internals
1973 1974 </a>
1974 1975 </td><td>
1975 1976 Technical implementation topics
1976 1977 </td></tr>
1977 1978 <tr><td>
1978 1979 <a href="/help/merge-tools">
1979 1980 merge-tools
1980 1981 </a>
1981 1982 </td><td>
1982 1983 Merge Tools
1983 1984 </td></tr>
1984 1985 <tr><td>
1985 1986 <a href="/help/pager">
1986 1987 pager
1987 1988 </a>
1988 1989 </td><td>
1989 1990 Pager Support
1990 1991 </td></tr>
1991 1992 <tr><td>
1992 1993 <a href="/help/patterns">
1993 1994 patterns
1994 1995 </a>
1995 1996 </td><td>
1996 1997 File Name Patterns
1997 1998 </td></tr>
1998 1999 <tr><td>
1999 2000 <a href="/help/phases">
2000 2001 phases
2001 2002 </a>
2002 2003 </td><td>
2003 2004 Working with Phases
2004 2005 </td></tr>
2005 2006 <tr><td>
2006 2007 <a href="/help/revisions">
2007 2008 revisions
2008 2009 </a>
2009 2010 </td><td>
2010 2011 Specifying Revisions
2011 2012 </td></tr>
2012 2013 <tr><td>
2013 2014 <a href="/help/scripting">
2014 2015 scripting
2015 2016 </a>
2016 2017 </td><td>
2017 2018 Using Mercurial from scripts and automation
2018 2019 </td></tr>
2019 2020 <tr><td>
2020 2021 <a href="/help/subrepos">
2021 2022 subrepos
2022 2023 </a>
2023 2024 </td><td>
2024 2025 Subrepositories
2025 2026 </td></tr>
2026 2027 <tr><td>
2027 2028 <a href="/help/templating">
2028 2029 templating
2029 2030 </a>
2030 2031 </td><td>
2031 2032 Template Usage
2032 2033 </td></tr>
2033 2034 <tr><td>
2034 2035 <a href="/help/urls">
2035 2036 urls
2036 2037 </a>
2037 2038 </td><td>
2038 2039 URL Paths
2039 2040 </td></tr>
2040 2041 <tr><td>
2041 2042 <a href="/help/topic-containing-verbose">
2042 2043 topic-containing-verbose
2043 2044 </a>
2044 2045 </td><td>
2045 2046 This is the topic to test omit indicating.
2046 2047 </td></tr>
2047 2048
2048 2049
2049 2050 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2050 2051
2051 2052 <tr><td>
2052 2053 <a href="/help/add">
2053 2054 add
2054 2055 </a>
2055 2056 </td><td>
2056 2057 add the specified files on the next commit
2057 2058 </td></tr>
2058 2059 <tr><td>
2059 2060 <a href="/help/annotate">
2060 2061 annotate
2061 2062 </a>
2062 2063 </td><td>
2063 2064 show changeset information by line for each file
2064 2065 </td></tr>
2065 2066 <tr><td>
2066 2067 <a href="/help/clone">
2067 2068 clone
2068 2069 </a>
2069 2070 </td><td>
2070 2071 make a copy of an existing repository
2071 2072 </td></tr>
2072 2073 <tr><td>
2073 2074 <a href="/help/commit">
2074 2075 commit
2075 2076 </a>
2076 2077 </td><td>
2077 2078 commit the specified files or all outstanding changes
2078 2079 </td></tr>
2079 2080 <tr><td>
2080 2081 <a href="/help/diff">
2081 2082 diff
2082 2083 </a>
2083 2084 </td><td>
2084 2085 diff repository (or selected files)
2085 2086 </td></tr>
2086 2087 <tr><td>
2087 2088 <a href="/help/export">
2088 2089 export
2089 2090 </a>
2090 2091 </td><td>
2091 2092 dump the header and diffs for one or more changesets
2092 2093 </td></tr>
2093 2094 <tr><td>
2094 2095 <a href="/help/forget">
2095 2096 forget
2096 2097 </a>
2097 2098 </td><td>
2098 2099 forget the specified files on the next commit
2099 2100 </td></tr>
2100 2101 <tr><td>
2101 2102 <a href="/help/init">
2102 2103 init
2103 2104 </a>
2104 2105 </td><td>
2105 2106 create a new repository in the given directory
2106 2107 </td></tr>
2107 2108 <tr><td>
2108 2109 <a href="/help/log">
2109 2110 log
2110 2111 </a>
2111 2112 </td><td>
2112 2113 show revision history of entire repository or files
2113 2114 </td></tr>
2114 2115 <tr><td>
2115 2116 <a href="/help/merge">
2116 2117 merge
2117 2118 </a>
2118 2119 </td><td>
2119 2120 merge another revision into working directory
2120 2121 </td></tr>
2121 2122 <tr><td>
2122 2123 <a href="/help/pull">
2123 2124 pull
2124 2125 </a>
2125 2126 </td><td>
2126 2127 pull changes from the specified source
2127 2128 </td></tr>
2128 2129 <tr><td>
2129 2130 <a href="/help/push">
2130 2131 push
2131 2132 </a>
2132 2133 </td><td>
2133 2134 push changes to the specified destination
2134 2135 </td></tr>
2135 2136 <tr><td>
2136 2137 <a href="/help/remove">
2137 2138 remove
2138 2139 </a>
2139 2140 </td><td>
2140 2141 remove the specified files on the next commit
2141 2142 </td></tr>
2142 2143 <tr><td>
2143 2144 <a href="/help/serve">
2144 2145 serve
2145 2146 </a>
2146 2147 </td><td>
2147 2148 start stand-alone webserver
2148 2149 </td></tr>
2149 2150 <tr><td>
2150 2151 <a href="/help/status">
2151 2152 status
2152 2153 </a>
2153 2154 </td><td>
2154 2155 show changed files in the working directory
2155 2156 </td></tr>
2156 2157 <tr><td>
2157 2158 <a href="/help/summary">
2158 2159 summary
2159 2160 </a>
2160 2161 </td><td>
2161 2162 summarize working directory state
2162 2163 </td></tr>
2163 2164 <tr><td>
2164 2165 <a href="/help/update">
2165 2166 update
2166 2167 </a>
2167 2168 </td><td>
2168 2169 update working directory (or switch revisions)
2169 2170 </td></tr>
2170 2171
2171 2172
2172 2173
2173 2174 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2174 2175
2175 2176 <tr><td>
2176 2177 <a href="/help/addremove">
2177 2178 addremove
2178 2179 </a>
2179 2180 </td><td>
2180 2181 add all new files, delete all missing files
2181 2182 </td></tr>
2182 2183 <tr><td>
2183 2184 <a href="/help/archive">
2184 2185 archive
2185 2186 </a>
2186 2187 </td><td>
2187 2188 create an unversioned archive of a repository revision
2188 2189 </td></tr>
2189 2190 <tr><td>
2190 2191 <a href="/help/backout">
2191 2192 backout
2192 2193 </a>
2193 2194 </td><td>
2194 2195 reverse effect of earlier changeset
2195 2196 </td></tr>
2196 2197 <tr><td>
2197 2198 <a href="/help/bisect">
2198 2199 bisect
2199 2200 </a>
2200 2201 </td><td>
2201 2202 subdivision search of changesets
2202 2203 </td></tr>
2203 2204 <tr><td>
2204 2205 <a href="/help/bookmarks">
2205 2206 bookmarks
2206 2207 </a>
2207 2208 </td><td>
2208 2209 create a new bookmark or list existing bookmarks
2209 2210 </td></tr>
2210 2211 <tr><td>
2211 2212 <a href="/help/branch">
2212 2213 branch
2213 2214 </a>
2214 2215 </td><td>
2215 2216 set or show the current branch name
2216 2217 </td></tr>
2217 2218 <tr><td>
2218 2219 <a href="/help/branches">
2219 2220 branches
2220 2221 </a>
2221 2222 </td><td>
2222 2223 list repository named branches
2223 2224 </td></tr>
2224 2225 <tr><td>
2225 2226 <a href="/help/bundle">
2226 2227 bundle
2227 2228 </a>
2228 2229 </td><td>
2229 2230 create a changegroup file
2230 2231 </td></tr>
2231 2232 <tr><td>
2232 2233 <a href="/help/cat">
2233 2234 cat
2234 2235 </a>
2235 2236 </td><td>
2236 2237 output the current or given revision of files
2237 2238 </td></tr>
2238 2239 <tr><td>
2239 2240 <a href="/help/config">
2240 2241 config
2241 2242 </a>
2242 2243 </td><td>
2243 2244 show combined config settings from all hgrc files
2244 2245 </td></tr>
2245 2246 <tr><td>
2246 2247 <a href="/help/copy">
2247 2248 copy
2248 2249 </a>
2249 2250 </td><td>
2250 2251 mark files as copied for the next commit
2251 2252 </td></tr>
2252 2253 <tr><td>
2253 2254 <a href="/help/files">
2254 2255 files
2255 2256 </a>
2256 2257 </td><td>
2257 2258 list tracked files
2258 2259 </td></tr>
2259 2260 <tr><td>
2260 2261 <a href="/help/graft">
2261 2262 graft
2262 2263 </a>
2263 2264 </td><td>
2264 2265 copy changes from other branches onto the current branch
2265 2266 </td></tr>
2266 2267 <tr><td>
2267 2268 <a href="/help/grep">
2268 2269 grep
2269 2270 </a>
2270 2271 </td><td>
2271 2272 search revision history for a pattern in specified files
2272 2273 </td></tr>
2273 2274 <tr><td>
2274 2275 <a href="/help/heads">
2275 2276 heads
2276 2277 </a>
2277 2278 </td><td>
2278 2279 show branch heads
2279 2280 </td></tr>
2280 2281 <tr><td>
2281 2282 <a href="/help/help">
2282 2283 help
2283 2284 </a>
2284 2285 </td><td>
2285 2286 show help for a given topic or a help overview
2286 2287 </td></tr>
2287 2288 <tr><td>
2288 2289 <a href="/help/hgalias">
2289 2290 hgalias
2290 2291 </a>
2291 2292 </td><td>
2292 2293 summarize working directory state
2293 2294 </td></tr>
2294 2295 <tr><td>
2295 2296 <a href="/help/identify">
2296 2297 identify
2297 2298 </a>
2298 2299 </td><td>
2299 2300 identify the working directory or specified revision
2300 2301 </td></tr>
2301 2302 <tr><td>
2302 2303 <a href="/help/import">
2303 2304 import
2304 2305 </a>
2305 2306 </td><td>
2306 2307 import an ordered set of patches
2307 2308 </td></tr>
2308 2309 <tr><td>
2309 2310 <a href="/help/incoming">
2310 2311 incoming
2311 2312 </a>
2312 2313 </td><td>
2313 2314 show new changesets found in source
2314 2315 </td></tr>
2315 2316 <tr><td>
2316 2317 <a href="/help/manifest">
2317 2318 manifest
2318 2319 </a>
2319 2320 </td><td>
2320 2321 output the current or given revision of the project manifest
2321 2322 </td></tr>
2322 2323 <tr><td>
2323 2324 <a href="/help/nohelp">
2324 2325 nohelp
2325 2326 </a>
2326 2327 </td><td>
2327 2328 (no help text available)
2328 2329 </td></tr>
2329 2330 <tr><td>
2330 2331 <a href="/help/outgoing">
2331 2332 outgoing
2332 2333 </a>
2333 2334 </td><td>
2334 2335 show changesets not found in the destination
2335 2336 </td></tr>
2336 2337 <tr><td>
2337 2338 <a href="/help/paths">
2338 2339 paths
2339 2340 </a>
2340 2341 </td><td>
2341 2342 show aliases for remote repositories
2342 2343 </td></tr>
2343 2344 <tr><td>
2344 2345 <a href="/help/phase">
2345 2346 phase
2346 2347 </a>
2347 2348 </td><td>
2348 2349 set or show the current phase name
2349 2350 </td></tr>
2350 2351 <tr><td>
2351 2352 <a href="/help/recover">
2352 2353 recover
2353 2354 </a>
2354 2355 </td><td>
2355 2356 roll back an interrupted transaction
2356 2357 </td></tr>
2357 2358 <tr><td>
2358 2359 <a href="/help/rename">
2359 2360 rename
2360 2361 </a>
2361 2362 </td><td>
2362 2363 rename files; equivalent of copy + remove
2363 2364 </td></tr>
2364 2365 <tr><td>
2365 2366 <a href="/help/resolve">
2366 2367 resolve
2367 2368 </a>
2368 2369 </td><td>
2369 2370 redo merges or set/view the merge status of files
2370 2371 </td></tr>
2371 2372 <tr><td>
2372 2373 <a href="/help/revert">
2373 2374 revert
2374 2375 </a>
2375 2376 </td><td>
2376 2377 restore files to their checkout state
2377 2378 </td></tr>
2378 2379 <tr><td>
2379 2380 <a href="/help/root">
2380 2381 root
2381 2382 </a>
2382 2383 </td><td>
2383 2384 print the root (top) of the current working directory
2384 2385 </td></tr>
2385 2386 <tr><td>
2386 2387 <a href="/help/shellalias">
2387 2388 shellalias
2388 2389 </a>
2389 2390 </td><td>
2390 2391 (no help text available)
2391 2392 </td></tr>
2392 2393 <tr><td>
2393 2394 <a href="/help/tag">
2394 2395 tag
2395 2396 </a>
2396 2397 </td><td>
2397 2398 add one or more tags for the current or given revision
2398 2399 </td></tr>
2399 2400 <tr><td>
2400 2401 <a href="/help/tags">
2401 2402 tags
2402 2403 </a>
2403 2404 </td><td>
2404 2405 list repository tags
2405 2406 </td></tr>
2406 2407 <tr><td>
2407 2408 <a href="/help/unbundle">
2408 2409 unbundle
2409 2410 </a>
2410 2411 </td><td>
2411 2412 apply one or more changegroup files
2412 2413 </td></tr>
2413 2414 <tr><td>
2414 2415 <a href="/help/verify">
2415 2416 verify
2416 2417 </a>
2417 2418 </td><td>
2418 2419 verify the integrity of the repository
2419 2420 </td></tr>
2420 2421 <tr><td>
2421 2422 <a href="/help/version">
2422 2423 version
2423 2424 </a>
2424 2425 </td><td>
2425 2426 output version and copyright information
2426 2427 </td></tr>
2427 2428
2428 2429
2429 2430 </table>
2430 2431 </div>
2431 2432 </div>
2432 2433
2433 2434
2434 2435
2435 2436 </body>
2436 2437 </html>
2437 2438
2438 2439
2439 2440 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2440 2441 200 Script output follows
2441 2442
2442 2443 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2443 2444 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2444 2445 <head>
2445 2446 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2446 2447 <meta name="robots" content="index, nofollow" />
2447 2448 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2448 2449 <script type="text/javascript" src="/static/mercurial.js"></script>
2449 2450
2450 2451 <title>Help: add</title>
2451 2452 </head>
2452 2453 <body>
2453 2454
2454 2455 <div class="container">
2455 2456 <div class="menu">
2456 2457 <div class="logo">
2457 2458 <a href="https://mercurial-scm.org/">
2458 2459 <img src="/static/hglogo.png" alt="mercurial" /></a>
2459 2460 </div>
2460 2461 <ul>
2461 2462 <li><a href="/shortlog">log</a></li>
2462 2463 <li><a href="/graph">graph</a></li>
2463 2464 <li><a href="/tags">tags</a></li>
2464 2465 <li><a href="/bookmarks">bookmarks</a></li>
2465 2466 <li><a href="/branches">branches</a></li>
2466 2467 </ul>
2467 2468 <ul>
2468 2469 <li class="active"><a href="/help">help</a></li>
2469 2470 </ul>
2470 2471 </div>
2471 2472
2472 2473 <div class="main">
2473 2474 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2474 2475 <h3>Help: add</h3>
2475 2476
2476 2477 <form class="search" action="/log">
2477 2478
2478 2479 <p><input name="rev" id="search1" type="text" size="30" /></p>
2479 2480 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2480 2481 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2481 2482 </form>
2482 2483 <div id="doc">
2483 2484 <p>
2484 2485 hg add [OPTION]... [FILE]...
2485 2486 </p>
2486 2487 <p>
2487 2488 add the specified files on the next commit
2488 2489 </p>
2489 2490 <p>
2490 2491 Schedule files to be version controlled and added to the
2491 2492 repository.
2492 2493 </p>
2493 2494 <p>
2494 2495 The files will be added to the repository at the next commit. To
2495 2496 undo an add before that, see 'hg forget'.
2496 2497 </p>
2497 2498 <p>
2498 2499 If no names are given, add all files to the repository (except
2499 2500 files matching &quot;.hgignore&quot;).
2500 2501 </p>
2501 2502 <p>
2502 2503 Examples:
2503 2504 </p>
2504 2505 <ul>
2505 2506 <li> New (unknown) files are added automatically by 'hg add':
2506 2507 <pre>
2507 2508 \$ ls (re)
2508 2509 foo.c
2509 2510 \$ hg status (re)
2510 2511 ? foo.c
2511 2512 \$ hg add (re)
2512 2513 adding foo.c
2513 2514 \$ hg status (re)
2514 2515 A foo.c
2515 2516 </pre>
2516 2517 <li> Specific files to be added can be specified:
2517 2518 <pre>
2518 2519 \$ ls (re)
2519 2520 bar.c foo.c
2520 2521 \$ hg status (re)
2521 2522 ? bar.c
2522 2523 ? foo.c
2523 2524 \$ hg add bar.c (re)
2524 2525 \$ hg status (re)
2525 2526 A bar.c
2526 2527 ? foo.c
2527 2528 </pre>
2528 2529 </ul>
2529 2530 <p>
2530 2531 Returns 0 if all files are successfully added.
2531 2532 </p>
2532 2533 <p>
2533 2534 options ([+] can be repeated):
2534 2535 </p>
2535 2536 <table>
2536 2537 <tr><td>-I</td>
2537 2538 <td>--include PATTERN [+]</td>
2538 2539 <td>include names matching the given patterns</td></tr>
2539 2540 <tr><td>-X</td>
2540 2541 <td>--exclude PATTERN [+]</td>
2541 2542 <td>exclude names matching the given patterns</td></tr>
2542 2543 <tr><td>-S</td>
2543 2544 <td>--subrepos</td>
2544 2545 <td>recurse into subrepositories</td></tr>
2545 2546 <tr><td>-n</td>
2546 2547 <td>--dry-run</td>
2547 2548 <td>do not perform actions, just print output</td></tr>
2548 2549 </table>
2549 2550 <p>
2550 2551 global options ([+] can be repeated):
2551 2552 </p>
2552 2553 <table>
2553 2554 <tr><td>-R</td>
2554 2555 <td>--repository REPO</td>
2555 2556 <td>repository root directory or name of overlay bundle file</td></tr>
2556 2557 <tr><td></td>
2557 2558 <td>--cwd DIR</td>
2558 2559 <td>change working directory</td></tr>
2559 2560 <tr><td>-y</td>
2560 2561 <td>--noninteractive</td>
2561 2562 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2562 2563 <tr><td>-q</td>
2563 2564 <td>--quiet</td>
2564 2565 <td>suppress output</td></tr>
2565 2566 <tr><td>-v</td>
2566 2567 <td>--verbose</td>
2567 2568 <td>enable additional output</td></tr>
2568 2569 <tr><td></td>
2569 2570 <td>--color TYPE</td>
2570 2571 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2571 2572 <tr><td></td>
2572 2573 <td>--config CONFIG [+]</td>
2573 2574 <td>set/override config option (use 'section.name=value')</td></tr>
2574 2575 <tr><td></td>
2575 2576 <td>--debug</td>
2576 2577 <td>enable debugging output</td></tr>
2577 2578 <tr><td></td>
2578 2579 <td>--debugger</td>
2579 2580 <td>start debugger</td></tr>
2580 2581 <tr><td></td>
2581 2582 <td>--encoding ENCODE</td>
2582 2583 <td>set the charset encoding (default: ascii)</td></tr>
2583 2584 <tr><td></td>
2584 2585 <td>--encodingmode MODE</td>
2585 2586 <td>set the charset encoding mode (default: strict)</td></tr>
2586 2587 <tr><td></td>
2587 2588 <td>--traceback</td>
2588 2589 <td>always print a traceback on exception</td></tr>
2589 2590 <tr><td></td>
2590 2591 <td>--time</td>
2591 2592 <td>time how long the command takes</td></tr>
2592 2593 <tr><td></td>
2593 2594 <td>--profile</td>
2594 2595 <td>print command execution profile</td></tr>
2595 2596 <tr><td></td>
2596 2597 <td>--version</td>
2597 2598 <td>output version information and exit</td></tr>
2598 2599 <tr><td>-h</td>
2599 2600 <td>--help</td>
2600 2601 <td>display help and exit</td></tr>
2601 2602 <tr><td></td>
2602 2603 <td>--hidden</td>
2603 2604 <td>consider hidden changesets</td></tr>
2604 2605 <tr><td></td>
2605 2606 <td>--pager TYPE</td>
2606 2607 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2607 2608 </table>
2608 2609
2609 2610 </div>
2610 2611 </div>
2611 2612 </div>
2612 2613
2613 2614
2614 2615
2615 2616 </body>
2616 2617 </html>
2617 2618
2618 2619
2619 2620 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2620 2621 200 Script output follows
2621 2622
2622 2623 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2623 2624 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2624 2625 <head>
2625 2626 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2626 2627 <meta name="robots" content="index, nofollow" />
2627 2628 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2628 2629 <script type="text/javascript" src="/static/mercurial.js"></script>
2629 2630
2630 2631 <title>Help: remove</title>
2631 2632 </head>
2632 2633 <body>
2633 2634
2634 2635 <div class="container">
2635 2636 <div class="menu">
2636 2637 <div class="logo">
2637 2638 <a href="https://mercurial-scm.org/">
2638 2639 <img src="/static/hglogo.png" alt="mercurial" /></a>
2639 2640 </div>
2640 2641 <ul>
2641 2642 <li><a href="/shortlog">log</a></li>
2642 2643 <li><a href="/graph">graph</a></li>
2643 2644 <li><a href="/tags">tags</a></li>
2644 2645 <li><a href="/bookmarks">bookmarks</a></li>
2645 2646 <li><a href="/branches">branches</a></li>
2646 2647 </ul>
2647 2648 <ul>
2648 2649 <li class="active"><a href="/help">help</a></li>
2649 2650 </ul>
2650 2651 </div>
2651 2652
2652 2653 <div class="main">
2653 2654 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2654 2655 <h3>Help: remove</h3>
2655 2656
2656 2657 <form class="search" action="/log">
2657 2658
2658 2659 <p><input name="rev" id="search1" type="text" size="30" /></p>
2659 2660 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2660 2661 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2661 2662 </form>
2662 2663 <div id="doc">
2663 2664 <p>
2664 2665 hg remove [OPTION]... FILE...
2665 2666 </p>
2666 2667 <p>
2667 2668 aliases: rm
2668 2669 </p>
2669 2670 <p>
2670 2671 remove the specified files on the next commit
2671 2672 </p>
2672 2673 <p>
2673 2674 Schedule the indicated files for removal from the current branch.
2674 2675 </p>
2675 2676 <p>
2676 2677 This command schedules the files to be removed at the next commit.
2677 2678 To undo a remove before that, see 'hg revert'. To undo added
2678 2679 files, see 'hg forget'.
2679 2680 </p>
2680 2681 <p>
2681 2682 -A/--after can be used to remove only files that have already
2682 2683 been deleted, -f/--force can be used to force deletion, and -Af
2683 2684 can be used to remove files from the next revision without
2684 2685 deleting them from the working directory.
2685 2686 </p>
2686 2687 <p>
2687 2688 The following table details the behavior of remove for different
2688 2689 file states (columns) and option combinations (rows). The file
2689 2690 states are Added [A], Clean [C], Modified [M] and Missing [!]
2690 2691 (as reported by 'hg status'). The actions are Warn, Remove
2691 2692 (from branch) and Delete (from disk):
2692 2693 </p>
2693 2694 <table>
2694 2695 <tr><td>opt/state</td>
2695 2696 <td>A</td>
2696 2697 <td>C</td>
2697 2698 <td>M</td>
2698 2699 <td>!</td></tr>
2699 2700 <tr><td>none</td>
2700 2701 <td>W</td>
2701 2702 <td>RD</td>
2702 2703 <td>W</td>
2703 2704 <td>R</td></tr>
2704 2705 <tr><td>-f</td>
2705 2706 <td>R</td>
2706 2707 <td>RD</td>
2707 2708 <td>RD</td>
2708 2709 <td>R</td></tr>
2709 2710 <tr><td>-A</td>
2710 2711 <td>W</td>
2711 2712 <td>W</td>
2712 2713 <td>W</td>
2713 2714 <td>R</td></tr>
2714 2715 <tr><td>-Af</td>
2715 2716 <td>R</td>
2716 2717 <td>R</td>
2717 2718 <td>R</td>
2718 2719 <td>R</td></tr>
2719 2720 </table>
2720 2721 <p>
2721 2722 <b>Note:</b>
2722 2723 </p>
2723 2724 <p>
2724 2725 'hg remove' never deletes files in Added [A] state from the
2725 2726 working directory, not even if &quot;--force&quot; is specified.
2726 2727 </p>
2727 2728 <p>
2728 2729 Returns 0 on success, 1 if any warnings encountered.
2729 2730 </p>
2730 2731 <p>
2731 2732 options ([+] can be repeated):
2732 2733 </p>
2733 2734 <table>
2734 2735 <tr><td>-A</td>
2735 2736 <td>--after</td>
2736 2737 <td>record delete for missing files</td></tr>
2737 2738 <tr><td>-f</td>
2738 2739 <td>--force</td>
2739 2740 <td>forget added files, delete modified files</td></tr>
2740 2741 <tr><td>-S</td>
2741 2742 <td>--subrepos</td>
2742 2743 <td>recurse into subrepositories</td></tr>
2743 2744 <tr><td>-I</td>
2744 2745 <td>--include PATTERN [+]</td>
2745 2746 <td>include names matching the given patterns</td></tr>
2746 2747 <tr><td>-X</td>
2747 2748 <td>--exclude PATTERN [+]</td>
2748 2749 <td>exclude names matching the given patterns</td></tr>
2749 2750 </table>
2750 2751 <p>
2751 2752 global options ([+] can be repeated):
2752 2753 </p>
2753 2754 <table>
2754 2755 <tr><td>-R</td>
2755 2756 <td>--repository REPO</td>
2756 2757 <td>repository root directory or name of overlay bundle file</td></tr>
2757 2758 <tr><td></td>
2758 2759 <td>--cwd DIR</td>
2759 2760 <td>change working directory</td></tr>
2760 2761 <tr><td>-y</td>
2761 2762 <td>--noninteractive</td>
2762 2763 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2763 2764 <tr><td>-q</td>
2764 2765 <td>--quiet</td>
2765 2766 <td>suppress output</td></tr>
2766 2767 <tr><td>-v</td>
2767 2768 <td>--verbose</td>
2768 2769 <td>enable additional output</td></tr>
2769 2770 <tr><td></td>
2770 2771 <td>--color TYPE</td>
2771 2772 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2772 2773 <tr><td></td>
2773 2774 <td>--config CONFIG [+]</td>
2774 2775 <td>set/override config option (use 'section.name=value')</td></tr>
2775 2776 <tr><td></td>
2776 2777 <td>--debug</td>
2777 2778 <td>enable debugging output</td></tr>
2778 2779 <tr><td></td>
2779 2780 <td>--debugger</td>
2780 2781 <td>start debugger</td></tr>
2781 2782 <tr><td></td>
2782 2783 <td>--encoding ENCODE</td>
2783 2784 <td>set the charset encoding (default: ascii)</td></tr>
2784 2785 <tr><td></td>
2785 2786 <td>--encodingmode MODE</td>
2786 2787 <td>set the charset encoding mode (default: strict)</td></tr>
2787 2788 <tr><td></td>
2788 2789 <td>--traceback</td>
2789 2790 <td>always print a traceback on exception</td></tr>
2790 2791 <tr><td></td>
2791 2792 <td>--time</td>
2792 2793 <td>time how long the command takes</td></tr>
2793 2794 <tr><td></td>
2794 2795 <td>--profile</td>
2795 2796 <td>print command execution profile</td></tr>
2796 2797 <tr><td></td>
2797 2798 <td>--version</td>
2798 2799 <td>output version information and exit</td></tr>
2799 2800 <tr><td>-h</td>
2800 2801 <td>--help</td>
2801 2802 <td>display help and exit</td></tr>
2802 2803 <tr><td></td>
2803 2804 <td>--hidden</td>
2804 2805 <td>consider hidden changesets</td></tr>
2805 2806 <tr><td></td>
2806 2807 <td>--pager TYPE</td>
2807 2808 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2808 2809 </table>
2809 2810
2810 2811 </div>
2811 2812 </div>
2812 2813 </div>
2813 2814
2814 2815
2815 2816
2816 2817 </body>
2817 2818 </html>
2818 2819
2819 2820
2820 2821 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2821 2822 200 Script output follows
2822 2823
2823 2824 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2824 2825 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2825 2826 <head>
2826 2827 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2827 2828 <meta name="robots" content="index, nofollow" />
2828 2829 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2829 2830 <script type="text/javascript" src="/static/mercurial.js"></script>
2830 2831
2831 2832 <title>Help: dates</title>
2832 2833 </head>
2833 2834 <body>
2834 2835
2835 2836 <div class="container">
2836 2837 <div class="menu">
2837 2838 <div class="logo">
2838 2839 <a href="https://mercurial-scm.org/">
2839 2840 <img src="/static/hglogo.png" alt="mercurial" /></a>
2840 2841 </div>
2841 2842 <ul>
2842 2843 <li><a href="/shortlog">log</a></li>
2843 2844 <li><a href="/graph">graph</a></li>
2844 2845 <li><a href="/tags">tags</a></li>
2845 2846 <li><a href="/bookmarks">bookmarks</a></li>
2846 2847 <li><a href="/branches">branches</a></li>
2847 2848 </ul>
2848 2849 <ul>
2849 2850 <li class="active"><a href="/help">help</a></li>
2850 2851 </ul>
2851 2852 </div>
2852 2853
2853 2854 <div class="main">
2854 2855 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2855 2856 <h3>Help: dates</h3>
2856 2857
2857 2858 <form class="search" action="/log">
2858 2859
2859 2860 <p><input name="rev" id="search1" type="text" size="30" /></p>
2860 2861 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2861 2862 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2862 2863 </form>
2863 2864 <div id="doc">
2864 2865 <h1>Date Formats</h1>
2865 2866 <p>
2866 2867 Some commands allow the user to specify a date, e.g.:
2867 2868 </p>
2868 2869 <ul>
2869 2870 <li> backout, commit, import, tag: Specify the commit date.
2870 2871 <li> log, revert, update: Select revision(s) by date.
2871 2872 </ul>
2872 2873 <p>
2873 2874 Many date formats are valid. Here are some examples:
2874 2875 </p>
2875 2876 <ul>
2876 2877 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2877 2878 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2878 2879 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2879 2880 <li> &quot;Dec 6&quot; (midnight)
2880 2881 <li> &quot;13:18&quot; (today assumed)
2881 2882 <li> &quot;3:39&quot; (3:39AM assumed)
2882 2883 <li> &quot;3:39pm&quot; (15:39)
2883 2884 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2884 2885 <li> &quot;2006-12-6 13:18&quot;
2885 2886 <li> &quot;2006-12-6&quot;
2886 2887 <li> &quot;12-6&quot;
2887 2888 <li> &quot;12/6&quot;
2888 2889 <li> &quot;12/6/6&quot; (Dec 6 2006)
2889 2890 <li> &quot;today&quot; (midnight)
2890 2891 <li> &quot;yesterday&quot; (midnight)
2891 2892 <li> &quot;now&quot; - right now
2892 2893 </ul>
2893 2894 <p>
2894 2895 Lastly, there is Mercurial's internal format:
2895 2896 </p>
2896 2897 <ul>
2897 2898 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2898 2899 </ul>
2899 2900 <p>
2900 2901 This is the internal representation format for dates. The first number
2901 2902 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2902 2903 second is the offset of the local timezone, in seconds west of UTC
2903 2904 (negative if the timezone is east of UTC).
2904 2905 </p>
2905 2906 <p>
2906 2907 The log command also accepts date ranges:
2907 2908 </p>
2908 2909 <ul>
2909 2910 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2910 2911 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2911 2912 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2912 2913 <li> &quot;-DAYS&quot; - within a given number of days of today
2913 2914 </ul>
2914 2915
2915 2916 </div>
2916 2917 </div>
2917 2918 </div>
2918 2919
2919 2920
2920 2921
2921 2922 </body>
2922 2923 </html>
2923 2924
2924 2925
2925 2926 Sub-topic indexes rendered properly
2926 2927
2927 2928 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2928 2929 200 Script output follows
2929 2930
2930 2931 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2931 2932 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2932 2933 <head>
2933 2934 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2934 2935 <meta name="robots" content="index, nofollow" />
2935 2936 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2936 2937 <script type="text/javascript" src="/static/mercurial.js"></script>
2937 2938
2938 2939 <title>Help: internals</title>
2939 2940 </head>
2940 2941 <body>
2941 2942
2942 2943 <div class="container">
2943 2944 <div class="menu">
2944 2945 <div class="logo">
2945 2946 <a href="https://mercurial-scm.org/">
2946 2947 <img src="/static/hglogo.png" alt="mercurial" /></a>
2947 2948 </div>
2948 2949 <ul>
2949 2950 <li><a href="/shortlog">log</a></li>
2950 2951 <li><a href="/graph">graph</a></li>
2951 2952 <li><a href="/tags">tags</a></li>
2952 2953 <li><a href="/bookmarks">bookmarks</a></li>
2953 2954 <li><a href="/branches">branches</a></li>
2954 2955 </ul>
2955 2956 <ul>
2956 2957 <li><a href="/help">help</a></li>
2957 2958 </ul>
2958 2959 </div>
2959 2960
2960 2961 <div class="main">
2961 2962 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2962 2963 <form class="search" action="/log">
2963 2964
2964 2965 <p><input name="rev" id="search1" type="text" size="30" /></p>
2965 2966 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2966 2967 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2967 2968 </form>
2968 2969 <table class="bigtable">
2969 2970 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2970 2971
2971 2972 <tr><td>
2972 2973 <a href="/help/internals.bundles">
2973 2974 bundles
2974 2975 </a>
2975 2976 </td><td>
2976 2977 Bundles
2977 2978 </td></tr>
2978 2979 <tr><td>
2980 <a href="/help/internals.censor">
2981 censor
2982 </a>
2983 </td><td>
2984 Censor
2985 </td></tr>
2986 <tr><td>
2979 2987 <a href="/help/internals.changegroups">
2980 2988 changegroups
2981 2989 </a>
2982 2990 </td><td>
2983 2991 Changegroups
2984 2992 </td></tr>
2985 2993 <tr><td>
2986 2994 <a href="/help/internals.requirements">
2987 2995 requirements
2988 2996 </a>
2989 2997 </td><td>
2990 2998 Repository Requirements
2991 2999 </td></tr>
2992 3000 <tr><td>
2993 3001 <a href="/help/internals.revlogs">
2994 3002 revlogs
2995 3003 </a>
2996 3004 </td><td>
2997 3005 Revision Logs
2998 3006 </td></tr>
2999 3007 <tr><td>
3000 3008 <a href="/help/internals.wireprotocol">
3001 3009 wireprotocol
3002 3010 </a>
3003 3011 </td><td>
3004 3012 Wire Protocol
3005 3013 </td></tr>
3006 3014
3007 3015
3008 3016
3009 3017
3010 3018
3011 3019 </table>
3012 3020 </div>
3013 3021 </div>
3014 3022
3015 3023
3016 3024
3017 3025 </body>
3018 3026 </html>
3019 3027
3020 3028
3021 3029 Sub-topic topics rendered properly
3022 3030
3023 3031 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3024 3032 200 Script output follows
3025 3033
3026 3034 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3027 3035 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3028 3036 <head>
3029 3037 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3030 3038 <meta name="robots" content="index, nofollow" />
3031 3039 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3032 3040 <script type="text/javascript" src="/static/mercurial.js"></script>
3033 3041
3034 3042 <title>Help: internals.changegroups</title>
3035 3043 </head>
3036 3044 <body>
3037 3045
3038 3046 <div class="container">
3039 3047 <div class="menu">
3040 3048 <div class="logo">
3041 3049 <a href="https://mercurial-scm.org/">
3042 3050 <img src="/static/hglogo.png" alt="mercurial" /></a>
3043 3051 </div>
3044 3052 <ul>
3045 3053 <li><a href="/shortlog">log</a></li>
3046 3054 <li><a href="/graph">graph</a></li>
3047 3055 <li><a href="/tags">tags</a></li>
3048 3056 <li><a href="/bookmarks">bookmarks</a></li>
3049 3057 <li><a href="/branches">branches</a></li>
3050 3058 </ul>
3051 3059 <ul>
3052 3060 <li class="active"><a href="/help">help</a></li>
3053 3061 </ul>
3054 3062 </div>
3055 3063
3056 3064 <div class="main">
3057 3065 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3058 3066 <h3>Help: internals.changegroups</h3>
3059 3067
3060 3068 <form class="search" action="/log">
3061 3069
3062 3070 <p><input name="rev" id="search1" type="text" size="30" /></p>
3063 3071 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3064 3072 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3065 3073 </form>
3066 3074 <div id="doc">
3067 3075 <h1>Changegroups</h1>
3068 3076 <p>
3069 3077 Changegroups are representations of repository revlog data, specifically
3070 3078 the changelog data, root/flat manifest data, treemanifest data, and
3071 3079 filelogs.
3072 3080 </p>
3073 3081 <p>
3074 3082 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3075 3083 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3076 3084 only difference being an additional item in the *delta header*. Version
3077 3085 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3078 3086 exchanging treemanifests (enabled by setting an option on the
3079 3087 &quot;changegroup&quot; part in the bundle2).
3080 3088 </p>
3081 3089 <p>
3082 3090 Changegroups when not exchanging treemanifests consist of 3 logical
3083 3091 segments:
3084 3092 </p>
3085 3093 <pre>
3086 3094 +---------------------------------+
3087 3095 | | | |
3088 3096 | changeset | manifest | filelogs |
3089 3097 | | | |
3090 3098 | | | |
3091 3099 +---------------------------------+
3092 3100 </pre>
3093 3101 <p>
3094 3102 When exchanging treemanifests, there are 4 logical segments:
3095 3103 </p>
3096 3104 <pre>
3097 3105 +-------------------------------------------------+
3098 3106 | | | | |
3099 3107 | changeset | root | treemanifests | filelogs |
3100 3108 | | manifest | | |
3101 3109 | | | | |
3102 3110 +-------------------------------------------------+
3103 3111 </pre>
3104 3112 <p>
3105 3113 The principle building block of each segment is a *chunk*. A *chunk*
3106 3114 is a framed piece of data:
3107 3115 </p>
3108 3116 <pre>
3109 3117 +---------------------------------------+
3110 3118 | | |
3111 3119 | length | data |
3112 3120 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3113 3121 | | |
3114 3122 +---------------------------------------+
3115 3123 </pre>
3116 3124 <p>
3117 3125 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3118 3126 integer indicating the length of the entire chunk (including the length field
3119 3127 itself).
3120 3128 </p>
3121 3129 <p>
3122 3130 There is a special case chunk that has a value of 0 for the length
3123 3131 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3124 3132 </p>
3125 3133 <h2>Delta Groups</h2>
3126 3134 <p>
3127 3135 A *delta group* expresses the content of a revlog as a series of deltas,
3128 3136 or patches against previous revisions.
3129 3137 </p>
3130 3138 <p>
3131 3139 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3132 3140 to signal the end of the delta group:
3133 3141 </p>
3134 3142 <pre>
3135 3143 +------------------------------------------------------------------------+
3136 3144 | | | | | |
3137 3145 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3138 3146 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3139 3147 | | | | | |
3140 3148 +------------------------------------------------------------------------+
3141 3149 </pre>
3142 3150 <p>
3143 3151 Each *chunk*'s data consists of the following:
3144 3152 </p>
3145 3153 <pre>
3146 3154 +---------------------------------------+
3147 3155 | | |
3148 3156 | delta header | delta data |
3149 3157 | (various by version) | (various) |
3150 3158 | | |
3151 3159 +---------------------------------------+
3152 3160 </pre>
3153 3161 <p>
3154 3162 The *delta data* is a series of *delta*s that describe a diff from an existing
3155 3163 entry (either that the recipient already has, or previously specified in the
3156 3164 bundlei/changegroup).
3157 3165 </p>
3158 3166 <p>
3159 3167 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3160 3168 &quot;3&quot; of the changegroup format.
3161 3169 </p>
3162 3170 <p>
3163 3171 Version 1 (headerlen=80):
3164 3172 </p>
3165 3173 <pre>
3166 3174 +------------------------------------------------------+
3167 3175 | | | | |
3168 3176 | node | p1 node | p2 node | link node |
3169 3177 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3170 3178 | | | | |
3171 3179 +------------------------------------------------------+
3172 3180 </pre>
3173 3181 <p>
3174 3182 Version 2 (headerlen=100):
3175 3183 </p>
3176 3184 <pre>
3177 3185 +------------------------------------------------------------------+
3178 3186 | | | | | |
3179 3187 | node | p1 node | p2 node | base node | link node |
3180 3188 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3181 3189 | | | | | |
3182 3190 +------------------------------------------------------------------+
3183 3191 </pre>
3184 3192 <p>
3185 3193 Version 3 (headerlen=102):
3186 3194 </p>
3187 3195 <pre>
3188 3196 +------------------------------------------------------------------------------+
3189 3197 | | | | | | |
3190 3198 | node | p1 node | p2 node | base node | link node | flags |
3191 3199 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3192 3200 | | | | | | |
3193 3201 +------------------------------------------------------------------------------+
3194 3202 </pre>
3195 3203 <p>
3196 3204 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3197 3205 series of *delta*s, densely packed (no separators). These deltas describe a diff
3198 3206 from an existing entry (either that the recipient already has, or previously
3199 3207 specified in the bundle/changegroup). The format is described more fully in
3200 3208 &quot;hg help internals.bdiff&quot;, but briefly:
3201 3209 </p>
3202 3210 <pre>
3203 3211 +---------------------------------------------------------------+
3204 3212 | | | | |
3205 3213 | start offset | end offset | new length | content |
3206 3214 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3207 3215 | | | | |
3208 3216 +---------------------------------------------------------------+
3209 3217 </pre>
3210 3218 <p>
3211 3219 Please note that the length field in the delta data does *not* include itself.
3212 3220 </p>
3213 3221 <p>
3214 3222 In version 1, the delta is always applied against the previous node from
3215 3223 the changegroup or the first parent if this is the first entry in the
3216 3224 changegroup.
3217 3225 </p>
3218 3226 <p>
3219 3227 In version 2 and up, the delta base node is encoded in the entry in the
3220 3228 changegroup. This allows the delta to be expressed against any parent,
3221 3229 which can result in smaller deltas and more efficient encoding of data.
3222 3230 </p>
3223 3231 <h2>Changeset Segment</h2>
3224 3232 <p>
3225 3233 The *changeset segment* consists of a single *delta group* holding
3226 3234 changelog data. The *empty chunk* at the end of the *delta group* denotes
3227 3235 the boundary to the *manifest segment*.
3228 3236 </p>
3229 3237 <h2>Manifest Segment</h2>
3230 3238 <p>
3231 3239 The *manifest segment* consists of a single *delta group* holding manifest
3232 3240 data. If treemanifests are in use, it contains only the manifest for the
3233 3241 root directory of the repository. Otherwise, it contains the entire
3234 3242 manifest data. The *empty chunk* at the end of the *delta group* denotes
3235 3243 the boundary to the next segment (either the *treemanifests segment* or the
3236 3244 *filelogs segment*, depending on version and the request options).
3237 3245 </p>
3238 3246 <h3>Treemanifests Segment</h3>
3239 3247 <p>
3240 3248 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3241 3249 only if the 'treemanifest' param is part of the bundle2 changegroup part
3242 3250 (it is not possible to use changegroup version 3 outside of bundle2).
3243 3251 Aside from the filenames in the *treemanifests segment* containing a
3244 3252 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3245 3253 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3246 3254 a sub-segment with filename size 0). This denotes the boundary to the
3247 3255 *filelogs segment*.
3248 3256 </p>
3249 3257 <h2>Filelogs Segment</h2>
3250 3258 <p>
3251 3259 The *filelogs segment* consists of multiple sub-segments, each
3252 3260 corresponding to an individual file whose data is being described:
3253 3261 </p>
3254 3262 <pre>
3255 3263 +--------------------------------------------------+
3256 3264 | | | | | |
3257 3265 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3258 3266 | | | | | (4 bytes) |
3259 3267 | | | | | |
3260 3268 +--------------------------------------------------+
3261 3269 </pre>
3262 3270 <p>
3263 3271 The final filelog sub-segment is followed by an *empty chunk* (logically,
3264 3272 a sub-segment with filename size 0). This denotes the end of the segment
3265 3273 and of the overall changegroup.
3266 3274 </p>
3267 3275 <p>
3268 3276 Each filelog sub-segment consists of the following:
3269 3277 </p>
3270 3278 <pre>
3271 3279 +------------------------------------------------------+
3272 3280 | | | |
3273 3281 | filename length | filename | delta group |
3274 3282 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3275 3283 | | | |
3276 3284 +------------------------------------------------------+
3277 3285 </pre>
3278 3286 <p>
3279 3287 That is, a *chunk* consisting of the filename (not terminated or padded)
3280 3288 followed by N chunks constituting the *delta group* for this file. The
3281 3289 *empty chunk* at the end of each *delta group* denotes the boundary to the
3282 3290 next filelog sub-segment.
3283 3291 </p>
3284 3292
3285 3293 </div>
3286 3294 </div>
3287 3295 </div>
3288 3296
3289 3297
3290 3298
3291 3299 </body>
3292 3300 </html>
3293 3301
3294 3302
3295 3303 $ killdaemons.py
3296 3304
3297 3305 #endif
General Comments 0
You need to be logged in to leave comments. Login now