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