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