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