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