##// END OF EJS Templates
sparserevlog: document the config option...
Boris Feld -
r41524:261d37b9 stable
parent child Browse files
Show More
@@ -1,2766 +1,2776 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``resolve.confirm``
441 ``resolve.confirm``
442 Confirm before performing action if no filename is passed.
442 Confirm before performing action if no filename is passed.
443 (default: False)
443 (default: False)
444
444
445 ``resolve.explicit-re-merge``
445 ``resolve.explicit-re-merge``
446 Require uses of ``hg resolve`` to specify which action it should perform,
446 Require uses of ``hg resolve`` to specify which action it should perform,
447 instead of re-merging files by default.
447 instead of re-merging files by default.
448 (default: False)
448 (default: False)
449
449
450 ``resolve.mark-check``
450 ``resolve.mark-check``
451 Determines what level of checking :hg:`resolve --mark` will perform before
451 Determines what level of checking :hg:`resolve --mark` will perform before
452 marking files as resolved. Valid values are ``none`, ``warn``, and
452 marking files as resolved. Valid values are ``none`, ``warn``, and
453 ``abort``. ``warn`` will output a warning listing the file(s) that still
453 ``abort``. ``warn`` will output a warning listing the file(s) that still
454 have conflict markers in them, but will still mark everything resolved.
454 have conflict markers in them, but will still mark everything resolved.
455 ``abort`` will output the same warning but will not mark things as resolved.
455 ``abort`` will output the same warning but will not mark things as resolved.
456 If --all is passed and this is set to ``abort``, only a warning will be
456 If --all is passed and this is set to ``abort``, only a warning will be
457 shown (an error will not be raised).
457 shown (an error will not be raised).
458 (default: ``none``)
458 (default: ``none``)
459
459
460 ``status.relative``
460 ``status.relative``
461 Make paths in :hg:`status` output relative to the current directory.
461 Make paths in :hg:`status` output relative to the current directory.
462 (default: False)
462 (default: False)
463
463
464 ``status.terse``
464 ``status.terse``
465 Default value for the --terse flag, which condenses status output.
465 Default value for the --terse flag, which condenses status output.
466 (default: empty)
466 (default: empty)
467
467
468 ``update.check``
468 ``update.check``
469 Determines what level of checking :hg:`update` will perform before moving
469 Determines what level of checking :hg:`update` will perform before moving
470 to a destination revision. Valid values are ``abort``, ``none``,
470 to a destination revision. Valid values are ``abort``, ``none``,
471 ``linear``, and ``noconflict``. ``abort`` always fails if the working
471 ``linear``, and ``noconflict``. ``abort`` always fails if the working
472 directory has uncommitted changes. ``none`` performs no checking, and may
472 directory has uncommitted changes. ``none`` performs no checking, and may
473 result in a merge with uncommitted changes. ``linear`` allows any update
473 result in a merge with uncommitted changes. ``linear`` allows any update
474 as long as it follows a straight line in the revision history, and may
474 as long as it follows a straight line in the revision history, and may
475 trigger a merge with uncommitted changes. ``noconflict`` will allow any
475 trigger a merge with uncommitted changes. ``noconflict`` will allow any
476 update which would not trigger a merge with uncommitted changes, if any
476 update which would not trigger a merge with uncommitted changes, if any
477 are present.
477 are present.
478 (default: ``linear``)
478 (default: ``linear``)
479
479
480 ``update.requiredest``
480 ``update.requiredest``
481 Require that the user pass a destination when running :hg:`update`.
481 Require that the user pass a destination when running :hg:`update`.
482 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
482 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
483 will be disallowed.
483 will be disallowed.
484 (default: False)
484 (default: False)
485
485
486 ``committemplate``
486 ``committemplate``
487 ------------------
487 ------------------
488
488
489 ``changeset``
489 ``changeset``
490 String: configuration in this section is used as the template to
490 String: configuration in this section is used as the template to
491 customize the text shown in the editor when committing.
491 customize the text shown in the editor when committing.
492
492
493 In addition to pre-defined template keywords, commit log specific one
493 In addition to pre-defined template keywords, commit log specific one
494 below can be used for customization:
494 below can be used for customization:
495
495
496 ``extramsg``
496 ``extramsg``
497 String: Extra message (typically 'Leave message empty to abort
497 String: Extra message (typically 'Leave message empty to abort
498 commit.'). This may be changed by some commands or extensions.
498 commit.'). This may be changed by some commands or extensions.
499
499
500 For example, the template configuration below shows as same text as
500 For example, the template configuration below shows as same text as
501 one shown by default::
501 one shown by default::
502
502
503 [committemplate]
503 [committemplate]
504 changeset = {desc}\n\n
504 changeset = {desc}\n\n
505 HG: Enter commit message. Lines beginning with 'HG:' are removed.
505 HG: Enter commit message. Lines beginning with 'HG:' are removed.
506 HG: {extramsg}
506 HG: {extramsg}
507 HG: --
507 HG: --
508 HG: user: {author}\n{ifeq(p2rev, "-1", "",
508 HG: user: {author}\n{ifeq(p2rev, "-1", "",
509 "HG: branch merge\n")
509 "HG: branch merge\n")
510 }HG: branch '{branch}'\n{if(activebookmark,
510 }HG: branch '{branch}'\n{if(activebookmark,
511 "HG: bookmark '{activebookmark}'\n") }{subrepos %
511 "HG: bookmark '{activebookmark}'\n") }{subrepos %
512 "HG: subrepo {subrepo}\n" }{file_adds %
512 "HG: subrepo {subrepo}\n" }{file_adds %
513 "HG: added {file}\n" }{file_mods %
513 "HG: added {file}\n" }{file_mods %
514 "HG: changed {file}\n" }{file_dels %
514 "HG: changed {file}\n" }{file_dels %
515 "HG: removed {file}\n" }{if(files, "",
515 "HG: removed {file}\n" }{if(files, "",
516 "HG: no files changed\n")}
516 "HG: no files changed\n")}
517
517
518 ``diff()``
518 ``diff()``
519 String: show the diff (see :hg:`help templates` for detail)
519 String: show the diff (see :hg:`help templates` for detail)
520
520
521 Sometimes it is helpful to show the diff of the changeset in the editor without
521 Sometimes it is helpful to show the diff of the changeset in the editor without
522 having to prefix 'HG: ' to each line so that highlighting works correctly. For
522 having to prefix 'HG: ' to each line so that highlighting works correctly. For
523 this, Mercurial provides a special string which will ignore everything below
523 this, Mercurial provides a special string which will ignore everything below
524 it::
524 it::
525
525
526 HG: ------------------------ >8 ------------------------
526 HG: ------------------------ >8 ------------------------
527
527
528 For example, the template configuration below will show the diff below the
528 For example, the template configuration below will show the diff below the
529 extra message::
529 extra message::
530
530
531 [committemplate]
531 [committemplate]
532 changeset = {desc}\n\n
532 changeset = {desc}\n\n
533 HG: Enter commit message. Lines beginning with 'HG:' are removed.
533 HG: Enter commit message. Lines beginning with 'HG:' are removed.
534 HG: {extramsg}
534 HG: {extramsg}
535 HG: ------------------------ >8 ------------------------
535 HG: ------------------------ >8 ------------------------
536 HG: Do not touch the line above.
536 HG: Do not touch the line above.
537 HG: Everything below will be removed.
537 HG: Everything below will be removed.
538 {diff()}
538 {diff()}
539
539
540 .. note::
540 .. note::
541
541
542 For some problematic encodings (see :hg:`help win32mbcs` for
542 For some problematic encodings (see :hg:`help win32mbcs` for
543 detail), this customization should be configured carefully, to
543 detail), this customization should be configured carefully, to
544 avoid showing broken characters.
544 avoid showing broken characters.
545
545
546 For example, if a multibyte character ending with backslash (0x5c) is
546 For example, if a multibyte character ending with backslash (0x5c) is
547 followed by the ASCII character 'n' in the customized template,
547 followed by the ASCII character 'n' in the customized template,
548 the sequence of backslash and 'n' is treated as line-feed unexpectedly
548 the sequence of backslash and 'n' is treated as line-feed unexpectedly
549 (and the multibyte character is broken, too).
549 (and the multibyte character is broken, too).
550
550
551 Customized template is used for commands below (``--edit`` may be
551 Customized template is used for commands below (``--edit`` may be
552 required):
552 required):
553
553
554 - :hg:`backout`
554 - :hg:`backout`
555 - :hg:`commit`
555 - :hg:`commit`
556 - :hg:`fetch` (for merge commit only)
556 - :hg:`fetch` (for merge commit only)
557 - :hg:`graft`
557 - :hg:`graft`
558 - :hg:`histedit`
558 - :hg:`histedit`
559 - :hg:`import`
559 - :hg:`import`
560 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
560 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
561 - :hg:`rebase`
561 - :hg:`rebase`
562 - :hg:`shelve`
562 - :hg:`shelve`
563 - :hg:`sign`
563 - :hg:`sign`
564 - :hg:`tag`
564 - :hg:`tag`
565 - :hg:`transplant`
565 - :hg:`transplant`
566
566
567 Configuring items below instead of ``changeset`` allows showing
567 Configuring items below instead of ``changeset`` allows showing
568 customized message only for specific actions, or showing different
568 customized message only for specific actions, or showing different
569 messages for each action.
569 messages for each action.
570
570
571 - ``changeset.backout`` for :hg:`backout`
571 - ``changeset.backout`` for :hg:`backout`
572 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
572 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
573 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
573 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
574 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
574 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
575 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
575 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
576 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
576 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
577 - ``changeset.gpg.sign`` for :hg:`sign`
577 - ``changeset.gpg.sign`` for :hg:`sign`
578 - ``changeset.graft`` for :hg:`graft`
578 - ``changeset.graft`` for :hg:`graft`
579 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
579 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
580 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
580 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
581 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
581 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
582 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
582 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
583 - ``changeset.import.bypass`` for :hg:`import --bypass`
583 - ``changeset.import.bypass`` for :hg:`import --bypass`
584 - ``changeset.import.normal.merge`` for :hg:`import` on merges
584 - ``changeset.import.normal.merge`` for :hg:`import` on merges
585 - ``changeset.import.normal.normal`` for :hg:`import` on other
585 - ``changeset.import.normal.normal`` for :hg:`import` on other
586 - ``changeset.mq.qnew`` for :hg:`qnew`
586 - ``changeset.mq.qnew`` for :hg:`qnew`
587 - ``changeset.mq.qfold`` for :hg:`qfold`
587 - ``changeset.mq.qfold`` for :hg:`qfold`
588 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
588 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
589 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
589 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
590 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
590 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
591 - ``changeset.rebase.normal`` for :hg:`rebase` on other
591 - ``changeset.rebase.normal`` for :hg:`rebase` on other
592 - ``changeset.shelve.shelve`` for :hg:`shelve`
592 - ``changeset.shelve.shelve`` for :hg:`shelve`
593 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
593 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
594 - ``changeset.tag.remove`` for :hg:`tag --remove`
594 - ``changeset.tag.remove`` for :hg:`tag --remove`
595 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
595 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
596 - ``changeset.transplant.normal`` for :hg:`transplant` on other
596 - ``changeset.transplant.normal`` for :hg:`transplant` on other
597
597
598 These dot-separated lists of names are treated as hierarchical ones.
598 These dot-separated lists of names are treated as hierarchical ones.
599 For example, ``changeset.tag.remove`` customizes the commit message
599 For example, ``changeset.tag.remove`` customizes the commit message
600 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
600 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
601 commit message for :hg:`tag` regardless of ``--remove`` option.
601 commit message for :hg:`tag` regardless of ``--remove`` option.
602
602
603 When the external editor is invoked for a commit, the corresponding
603 When the external editor is invoked for a commit, the corresponding
604 dot-separated list of names without the ``changeset.`` prefix
604 dot-separated list of names without the ``changeset.`` prefix
605 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
605 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
606 variable.
606 variable.
607
607
608 In this section, items other than ``changeset`` can be referred from
608 In this section, items other than ``changeset`` can be referred from
609 others. For example, the configuration to list committed files up
609 others. For example, the configuration to list committed files up
610 below can be referred as ``{listupfiles}``::
610 below can be referred as ``{listupfiles}``::
611
611
612 [committemplate]
612 [committemplate]
613 listupfiles = {file_adds %
613 listupfiles = {file_adds %
614 "HG: added {file}\n" }{file_mods %
614 "HG: added {file}\n" }{file_mods %
615 "HG: changed {file}\n" }{file_dels %
615 "HG: changed {file}\n" }{file_dels %
616 "HG: removed {file}\n" }{if(files, "",
616 "HG: removed {file}\n" }{if(files, "",
617 "HG: no files changed\n")}
617 "HG: no files changed\n")}
618
618
619 ``decode/encode``
619 ``decode/encode``
620 -----------------
620 -----------------
621
621
622 Filters for transforming files on checkout/checkin. This would
622 Filters for transforming files on checkout/checkin. This would
623 typically be used for newline processing or other
623 typically be used for newline processing or other
624 localization/canonicalization of files.
624 localization/canonicalization of files.
625
625
626 Filters consist of a filter pattern followed by a filter command.
626 Filters consist of a filter pattern followed by a filter command.
627 Filter patterns are globs by default, rooted at the repository root.
627 Filter patterns are globs by default, rooted at the repository root.
628 For example, to match any file ending in ``.txt`` in the root
628 For example, to match any file ending in ``.txt`` in the root
629 directory only, use the pattern ``*.txt``. To match any file ending
629 directory only, use the pattern ``*.txt``. To match any file ending
630 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
630 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
631 For each file only the first matching filter applies.
631 For each file only the first matching filter applies.
632
632
633 The filter command can start with a specifier, either ``pipe:`` or
633 The filter command can start with a specifier, either ``pipe:`` or
634 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
634 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
635
635
636 A ``pipe:`` command must accept data on stdin and return the transformed
636 A ``pipe:`` command must accept data on stdin and return the transformed
637 data on stdout.
637 data on stdout.
638
638
639 Pipe example::
639 Pipe example::
640
640
641 [encode]
641 [encode]
642 # uncompress gzip files on checkin to improve delta compression
642 # uncompress gzip files on checkin to improve delta compression
643 # note: not necessarily a good idea, just an example
643 # note: not necessarily a good idea, just an example
644 *.gz = pipe: gunzip
644 *.gz = pipe: gunzip
645
645
646 [decode]
646 [decode]
647 # recompress gzip files when writing them to the working dir (we
647 # recompress gzip files when writing them to the working dir (we
648 # can safely omit "pipe:", because it's the default)
648 # can safely omit "pipe:", because it's the default)
649 *.gz = gzip
649 *.gz = gzip
650
650
651 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
651 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
652 with the name of a temporary file that contains the data to be
652 with the name of a temporary file that contains the data to be
653 filtered by the command. The string ``OUTFILE`` is replaced with the name
653 filtered by the command. The string ``OUTFILE`` is replaced with the name
654 of an empty temporary file, where the filtered data must be written by
654 of an empty temporary file, where the filtered data must be written by
655 the command.
655 the command.
656
656
657 .. container:: windows
657 .. container:: windows
658
658
659 .. note::
659 .. note::
660
660
661 The tempfile mechanism is recommended for Windows systems,
661 The tempfile mechanism is recommended for Windows systems,
662 where the standard shell I/O redirection operators often have
662 where the standard shell I/O redirection operators often have
663 strange effects and may corrupt the contents of your files.
663 strange effects and may corrupt the contents of your files.
664
664
665 This filter mechanism is used internally by the ``eol`` extension to
665 This filter mechanism is used internally by the ``eol`` extension to
666 translate line ending characters between Windows (CRLF) and Unix (LF)
666 translate line ending characters between Windows (CRLF) and Unix (LF)
667 format. We suggest you use the ``eol`` extension for convenience.
667 format. We suggest you use the ``eol`` extension for convenience.
668
668
669
669
670 ``defaults``
670 ``defaults``
671 ------------
671 ------------
672
672
673 (defaults are deprecated. Don't use them. Use aliases instead.)
673 (defaults are deprecated. Don't use them. Use aliases instead.)
674
674
675 Use the ``[defaults]`` section to define command defaults, i.e. the
675 Use the ``[defaults]`` section to define command defaults, i.e. the
676 default options/arguments to pass to the specified commands.
676 default options/arguments to pass to the specified commands.
677
677
678 The following example makes :hg:`log` run in verbose mode, and
678 The following example makes :hg:`log` run in verbose mode, and
679 :hg:`status` show only the modified files, by default::
679 :hg:`status` show only the modified files, by default::
680
680
681 [defaults]
681 [defaults]
682 log = -v
682 log = -v
683 status = -m
683 status = -m
684
684
685 The actual commands, instead of their aliases, must be used when
685 The actual commands, instead of their aliases, must be used when
686 defining command defaults. The command defaults will also be applied
686 defining command defaults. The command defaults will also be applied
687 to the aliases of the commands defined.
687 to the aliases of the commands defined.
688
688
689
689
690 ``diff``
690 ``diff``
691 --------
691 --------
692
692
693 Settings used when displaying diffs. Everything except for ``unified``
693 Settings used when displaying diffs. Everything except for ``unified``
694 is a Boolean and defaults to False. See :hg:`help config.annotate`
694 is a Boolean and defaults to False. See :hg:`help config.annotate`
695 for related options for the annotate command.
695 for related options for the annotate command.
696
696
697 ``git``
697 ``git``
698 Use git extended diff format.
698 Use git extended diff format.
699
699
700 ``nobinary``
700 ``nobinary``
701 Omit git binary patches.
701 Omit git binary patches.
702
702
703 ``nodates``
703 ``nodates``
704 Don't include dates in diff headers.
704 Don't include dates in diff headers.
705
705
706 ``noprefix``
706 ``noprefix``
707 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
707 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
708
708
709 ``showfunc``
709 ``showfunc``
710 Show which function each change is in.
710 Show which function each change is in.
711
711
712 ``ignorews``
712 ``ignorews``
713 Ignore white space when comparing lines.
713 Ignore white space when comparing lines.
714
714
715 ``ignorewsamount``
715 ``ignorewsamount``
716 Ignore changes in the amount of white space.
716 Ignore changes in the amount of white space.
717
717
718 ``ignoreblanklines``
718 ``ignoreblanklines``
719 Ignore changes whose lines are all blank.
719 Ignore changes whose lines are all blank.
720
720
721 ``unified``
721 ``unified``
722 Number of lines of context to show.
722 Number of lines of context to show.
723
723
724 ``word-diff``
724 ``word-diff``
725 Highlight changed words.
725 Highlight changed words.
726
726
727 ``email``
727 ``email``
728 ---------
728 ---------
729
729
730 Settings for extensions that send email messages.
730 Settings for extensions that send email messages.
731
731
732 ``from``
732 ``from``
733 Optional. Email address to use in "From" header and SMTP envelope
733 Optional. Email address to use in "From" header and SMTP envelope
734 of outgoing messages.
734 of outgoing messages.
735
735
736 ``to``
736 ``to``
737 Optional. Comma-separated list of recipients' email addresses.
737 Optional. Comma-separated list of recipients' email addresses.
738
738
739 ``cc``
739 ``cc``
740 Optional. Comma-separated list of carbon copy recipients'
740 Optional. Comma-separated list of carbon copy recipients'
741 email addresses.
741 email addresses.
742
742
743 ``bcc``
743 ``bcc``
744 Optional. Comma-separated list of blind carbon copy recipients'
744 Optional. Comma-separated list of blind carbon copy recipients'
745 email addresses.
745 email addresses.
746
746
747 ``method``
747 ``method``
748 Optional. Method to use to send email messages. If value is ``smtp``
748 Optional. Method to use to send email messages. If value is ``smtp``
749 (default), use SMTP (see the ``[smtp]`` section for configuration).
749 (default), use SMTP (see the ``[smtp]`` section for configuration).
750 Otherwise, use as name of program to run that acts like sendmail
750 Otherwise, use as name of program to run that acts like sendmail
751 (takes ``-f`` option for sender, list of recipients on command line,
751 (takes ``-f`` option for sender, list of recipients on command line,
752 message on stdin). Normally, setting this to ``sendmail`` or
752 message on stdin). Normally, setting this to ``sendmail`` or
753 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
753 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
754
754
755 ``charsets``
755 ``charsets``
756 Optional. Comma-separated list of character sets considered
756 Optional. Comma-separated list of character sets considered
757 convenient for recipients. Addresses, headers, and parts not
757 convenient for recipients. Addresses, headers, and parts not
758 containing patches of outgoing messages will be encoded in the
758 containing patches of outgoing messages will be encoded in the
759 first character set to which conversion from local encoding
759 first character set to which conversion from local encoding
760 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
760 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
761 conversion fails, the text in question is sent as is.
761 conversion fails, the text in question is sent as is.
762 (default: '')
762 (default: '')
763
763
764 Order of outgoing email character sets:
764 Order of outgoing email character sets:
765
765
766 1. ``us-ascii``: always first, regardless of settings
766 1. ``us-ascii``: always first, regardless of settings
767 2. ``email.charsets``: in order given by user
767 2. ``email.charsets``: in order given by user
768 3. ``ui.fallbackencoding``: if not in email.charsets
768 3. ``ui.fallbackencoding``: if not in email.charsets
769 4. ``$HGENCODING``: if not in email.charsets
769 4. ``$HGENCODING``: if not in email.charsets
770 5. ``utf-8``: always last, regardless of settings
770 5. ``utf-8``: always last, regardless of settings
771
771
772 Email example::
772 Email example::
773
773
774 [email]
774 [email]
775 from = Joseph User <joe.user@example.com>
775 from = Joseph User <joe.user@example.com>
776 method = /usr/sbin/sendmail
776 method = /usr/sbin/sendmail
777 # charsets for western Europeans
777 # charsets for western Europeans
778 # us-ascii, utf-8 omitted, as they are tried first and last
778 # us-ascii, utf-8 omitted, as they are tried first and last
779 charsets = iso-8859-1, iso-8859-15, windows-1252
779 charsets = iso-8859-1, iso-8859-15, windows-1252
780
780
781
781
782 ``extensions``
782 ``extensions``
783 --------------
783 --------------
784
784
785 Mercurial has an extension mechanism for adding new features. To
785 Mercurial has an extension mechanism for adding new features. To
786 enable an extension, create an entry for it in this section.
786 enable an extension, create an entry for it in this section.
787
787
788 If you know that the extension is already in Python's search path,
788 If you know that the extension is already in Python's search path,
789 you can give the name of the module, followed by ``=``, with nothing
789 you can give the name of the module, followed by ``=``, with nothing
790 after the ``=``.
790 after the ``=``.
791
791
792 Otherwise, give a name that you choose, followed by ``=``, followed by
792 Otherwise, give a name that you choose, followed by ``=``, followed by
793 the path to the ``.py`` file (including the file name extension) that
793 the path to the ``.py`` file (including the file name extension) that
794 defines the extension.
794 defines the extension.
795
795
796 To explicitly disable an extension that is enabled in an hgrc of
796 To explicitly disable an extension that is enabled in an hgrc of
797 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
797 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
798 or ``foo = !`` when path is not supplied.
798 or ``foo = !`` when path is not supplied.
799
799
800 Example for ``~/.hgrc``::
800 Example for ``~/.hgrc``::
801
801
802 [extensions]
802 [extensions]
803 # (the churn extension will get loaded from Mercurial's path)
803 # (the churn extension will get loaded from Mercurial's path)
804 churn =
804 churn =
805 # (this extension will get loaded from the file specified)
805 # (this extension will get loaded from the file specified)
806 myfeature = ~/.hgext/myfeature.py
806 myfeature = ~/.hgext/myfeature.py
807
807
808
808
809 ``format``
809 ``format``
810 ----------
810 ----------
811
811
812 Configuration that controls the repository format. Newer format options are more
812 Configuration that controls the repository format. Newer format options are more
813 powerful but incompatible with some older versions of Mercurial. Format options
813 powerful but incompatible with some older versions of Mercurial. Format options
814 are considered at repository initialization only. You need to make a new clone
814 are considered at repository initialization only. You need to make a new clone
815 for config change to be taken into account.
815 for config change to be taken into account.
816
816
817 For more details about repository format and version compatibility, see
817 For more details about repository format and version compatibility, see
818 https://www.mercurial-scm.org/wiki/MissingRequirement
818 https://www.mercurial-scm.org/wiki/MissingRequirement
819
819
820 ``usegeneraldelta``
820 ``usegeneraldelta``
821 Enable or disable the "generaldelta" repository format which improves
821 Enable or disable the "generaldelta" repository format which improves
822 repository compression by allowing "revlog" to store delta against arbitrary
822 repository compression by allowing "revlog" to store delta against arbitrary
823 revision instead of the previous stored one. This provides significant
823 revision instead of the previous stored one. This provides significant
824 improvement for repositories with branches.
824 improvement for repositories with branches.
825
825
826 Repositories with this on-disk format require Mercurial version 1.9.
826 Repositories with this on-disk format require Mercurial version 1.9.
827
827
828 Enabled by default.
828 Enabled by default.
829
829
830 ``dotencode``
830 ``dotencode``
831 Enable or disable the "dotencode" repository format which enhances
831 Enable or disable the "dotencode" repository format which enhances
832 the "fncache" repository format (which has to be enabled to use
832 the "fncache" repository format (which has to be enabled to use
833 dotencode) to avoid issues with filenames starting with ._ on
833 dotencode) to avoid issues with filenames starting with ._ on
834 Mac OS X and spaces on Windows.
834 Mac OS X and spaces on Windows.
835
835
836 Repositories with this on-disk format require Mercurial version 1.7.
836 Repositories with this on-disk format require Mercurial version 1.7.
837
837
838 Enabled by default.
838 Enabled by default.
839
839
840 ``usefncache``
840 ``usefncache``
841 Enable or disable the "fncache" repository format which enhances
841 Enable or disable the "fncache" repository format which enhances
842 the "store" repository format (which has to be enabled to use
842 the "store" repository format (which has to be enabled to use
843 fncache) to allow longer filenames and avoids using Windows
843 fncache) to allow longer filenames and avoids using Windows
844 reserved names, e.g. "nul".
844 reserved names, e.g. "nul".
845
845
846 Repositories with this on-disk format require Mercurial version 1.1.
846 Repositories with this on-disk format require Mercurial version 1.1.
847
847
848 Enabled by default.
848 Enabled by default.
849
849
850 ``usestore``
850 ``usestore``
851 Enable or disable the "store" repository format which improves
851 Enable or disable the "store" repository format which improves
852 compatibility with systems that fold case or otherwise mangle
852 compatibility with systems that fold case or otherwise mangle
853 filenames. Disabling this option will allow you to store longer filenames
853 filenames. Disabling this option will allow you to store longer filenames
854 in some situations at the expense of compatibility.
854 in some situations at the expense of compatibility.
855
855
856 Repositories with this on-disk format require Mercurial version 0.9.4.
856 Repositories with this on-disk format require Mercurial version 0.9.4.
857
857
858 Enabled by default.
858 Enabled by default.
859
859
860 ``sparse-revlog``
861 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
862 delta re-use inside revlog. For very branchy repositories, it results in a
863 smaller store. For repositories with many revisions, it also helps
864 performance (by using shortened delta chains.)
865
866 Repositories with this on-disk format require Mercurial version 4.7
867
868 Enabled by default.
869
860 ``graph``
870 ``graph``
861 ---------
871 ---------
862
872
863 Web graph view configuration. This section let you change graph
873 Web graph view configuration. This section let you change graph
864 elements display properties by branches, for instance to make the
874 elements display properties by branches, for instance to make the
865 ``default`` branch stand out.
875 ``default`` branch stand out.
866
876
867 Each line has the following format::
877 Each line has the following format::
868
878
869 <branch>.<argument> = <value>
879 <branch>.<argument> = <value>
870
880
871 where ``<branch>`` is the name of the branch being
881 where ``<branch>`` is the name of the branch being
872 customized. Example::
882 customized. Example::
873
883
874 [graph]
884 [graph]
875 # 2px width
885 # 2px width
876 default.width = 2
886 default.width = 2
877 # red color
887 # red color
878 default.color = FF0000
888 default.color = FF0000
879
889
880 Supported arguments:
890 Supported arguments:
881
891
882 ``width``
892 ``width``
883 Set branch edges width in pixels.
893 Set branch edges width in pixels.
884
894
885 ``color``
895 ``color``
886 Set branch edges color in hexadecimal RGB notation.
896 Set branch edges color in hexadecimal RGB notation.
887
897
888 ``hooks``
898 ``hooks``
889 ---------
899 ---------
890
900
891 Commands or Python functions that get automatically executed by
901 Commands or Python functions that get automatically executed by
892 various actions such as starting or finishing a commit. Multiple
902 various actions such as starting or finishing a commit. Multiple
893 hooks can be run for the same action by appending a suffix to the
903 hooks can be run for the same action by appending a suffix to the
894 action. Overriding a site-wide hook can be done by changing its
904 action. Overriding a site-wide hook can be done by changing its
895 value or setting it to an empty string. Hooks can be prioritized
905 value or setting it to an empty string. Hooks can be prioritized
896 by adding a prefix of ``priority.`` to the hook name on a new line
906 by adding a prefix of ``priority.`` to the hook name on a new line
897 and setting the priority. The default priority is 0.
907 and setting the priority. The default priority is 0.
898
908
899 Example ``.hg/hgrc``::
909 Example ``.hg/hgrc``::
900
910
901 [hooks]
911 [hooks]
902 # update working directory after adding changesets
912 # update working directory after adding changesets
903 changegroup.update = hg update
913 changegroup.update = hg update
904 # do not use the site-wide hook
914 # do not use the site-wide hook
905 incoming =
915 incoming =
906 incoming.email = /my/email/hook
916 incoming.email = /my/email/hook
907 incoming.autobuild = /my/build/hook
917 incoming.autobuild = /my/build/hook
908 # force autobuild hook to run before other incoming hooks
918 # force autobuild hook to run before other incoming hooks
909 priority.incoming.autobuild = 1
919 priority.incoming.autobuild = 1
910
920
911 Most hooks are run with environment variables set that give useful
921 Most hooks are run with environment variables set that give useful
912 additional information. For each hook below, the environment variables
922 additional information. For each hook below, the environment variables
913 it is passed are listed with names in the form ``$HG_foo``. The
923 it is passed are listed with names in the form ``$HG_foo``. The
914 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
924 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
915 They contain the type of hook which triggered the run and the full name
925 They contain the type of hook which triggered the run and the full name
916 of the hook in the config, respectively. In the example above, this will
926 of the hook in the config, respectively. In the example above, this will
917 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
927 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
918
928
919 .. container:: windows
929 .. container:: windows
920
930
921 Some basic Unix syntax can be enabled for portability, including ``$VAR``
931 Some basic Unix syntax can be enabled for portability, including ``$VAR``
922 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
932 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
923 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
933 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
924 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
934 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
925 slash or inside of a strong quote. Strong quotes will be replaced by
935 slash or inside of a strong quote. Strong quotes will be replaced by
926 double quotes after processing.
936 double quotes after processing.
927
937
928 This feature is enabled by adding a prefix of ``tonative.`` to the hook
938 This feature is enabled by adding a prefix of ``tonative.`` to the hook
929 name on a new line, and setting it to ``True``. For example::
939 name on a new line, and setting it to ``True``. For example::
930
940
931 [hooks]
941 [hooks]
932 incoming.autobuild = /my/build/hook
942 incoming.autobuild = /my/build/hook
933 # enable translation to cmd.exe syntax for autobuild hook
943 # enable translation to cmd.exe syntax for autobuild hook
934 tonative.incoming.autobuild = True
944 tonative.incoming.autobuild = True
935
945
936 ``changegroup``
946 ``changegroup``
937 Run after a changegroup has been added via push, pull or unbundle. The ID of
947 Run after a changegroup has been added via push, pull or unbundle. The ID of
938 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
948 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
939 The URL from which changes came is in ``$HG_URL``.
949 The URL from which changes came is in ``$HG_URL``.
940
950
941 ``commit``
951 ``commit``
942 Run after a changeset has been created in the local repository. The ID
952 Run after a changeset has been created in the local repository. The ID
943 of the newly created changeset is in ``$HG_NODE``. Parent changeset
953 of the newly created changeset is in ``$HG_NODE``. Parent changeset
944 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
954 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
945
955
946 ``incoming``
956 ``incoming``
947 Run after a changeset has been pulled, pushed, or unbundled into
957 Run after a changeset has been pulled, pushed, or unbundled into
948 the local repository. The ID of the newly arrived changeset is in
958 the local repository. The ID of the newly arrived changeset is in
949 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
959 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
950
960
951 ``outgoing``
961 ``outgoing``
952 Run after sending changes from the local repository to another. The ID of
962 Run after sending changes from the local repository to another. The ID of
953 first changeset sent is in ``$HG_NODE``. The source of operation is in
963 first changeset sent is in ``$HG_NODE``. The source of operation is in
954 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
964 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
955
965
956 ``post-<command>``
966 ``post-<command>``
957 Run after successful invocations of the associated command. The
967 Run after successful invocations of the associated command. The
958 contents of the command line are passed as ``$HG_ARGS`` and the result
968 contents of the command line are passed as ``$HG_ARGS`` and the result
959 code in ``$HG_RESULT``. Parsed command line arguments are passed as
969 code in ``$HG_RESULT``. Parsed command line arguments are passed as
960 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
970 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
961 the python data internally passed to <command>. ``$HG_OPTS`` is a
971 the python data internally passed to <command>. ``$HG_OPTS`` is a
962 dictionary of options (with unspecified options set to their defaults).
972 dictionary of options (with unspecified options set to their defaults).
963 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
973 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
964
974
965 ``fail-<command>``
975 ``fail-<command>``
966 Run after a failed invocation of an associated command. The contents
976 Run after a failed invocation of an associated command. The contents
967 of the command line are passed as ``$HG_ARGS``. Parsed command line
977 of the command line are passed as ``$HG_ARGS``. Parsed command line
968 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
978 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
969 string representations of the python data internally passed to
979 string representations of the python data internally passed to
970 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
980 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
971 options set to their defaults). ``$HG_PATS`` is a list of arguments.
981 options set to their defaults). ``$HG_PATS`` is a list of arguments.
972 Hook failure is ignored.
982 Hook failure is ignored.
973
983
974 ``pre-<command>``
984 ``pre-<command>``
975 Run before executing the associated command. The contents of the
985 Run before executing the associated command. The contents of the
976 command line are passed as ``$HG_ARGS``. Parsed command line arguments
986 command line are passed as ``$HG_ARGS``. Parsed command line arguments
977 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
987 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
978 representations of the data internally passed to <command>. ``$HG_OPTS``
988 representations of the data internally passed to <command>. ``$HG_OPTS``
979 is a dictionary of options (with unspecified options set to their
989 is a dictionary of options (with unspecified options set to their
980 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
990 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
981 failure, the command doesn't execute and Mercurial returns the failure
991 failure, the command doesn't execute and Mercurial returns the failure
982 code.
992 code.
983
993
984 ``prechangegroup``
994 ``prechangegroup``
985 Run before a changegroup is added via push, pull or unbundle. Exit
995 Run before a changegroup is added via push, pull or unbundle. Exit
986 status 0 allows the changegroup to proceed. A non-zero status will
996 status 0 allows the changegroup to proceed. A non-zero status will
987 cause the push, pull or unbundle to fail. The URL from which changes
997 cause the push, pull or unbundle to fail. The URL from which changes
988 will come is in ``$HG_URL``.
998 will come is in ``$HG_URL``.
989
999
990 ``precommit``
1000 ``precommit``
991 Run before starting a local commit. Exit status 0 allows the
1001 Run before starting a local commit. Exit status 0 allows the
992 commit to proceed. A non-zero status will cause the commit to fail.
1002 commit to proceed. A non-zero status will cause the commit to fail.
993 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1003 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
994
1004
995 ``prelistkeys``
1005 ``prelistkeys``
996 Run before listing pushkeys (like bookmarks) in the
1006 Run before listing pushkeys (like bookmarks) in the
997 repository. A non-zero status will cause failure. The key namespace is
1007 repository. A non-zero status will cause failure. The key namespace is
998 in ``$HG_NAMESPACE``.
1008 in ``$HG_NAMESPACE``.
999
1009
1000 ``preoutgoing``
1010 ``preoutgoing``
1001 Run before collecting changes to send from the local repository to
1011 Run before collecting changes to send from the local repository to
1002 another. A non-zero status will cause failure. This lets you prevent
1012 another. A non-zero status will cause failure. This lets you prevent
1003 pull over HTTP or SSH. It can also prevent propagating commits (via
1013 pull over HTTP or SSH. It can also prevent propagating commits (via
1004 local pull, push (outbound) or bundle commands), but not completely,
1014 local pull, push (outbound) or bundle commands), but not completely,
1005 since you can just copy files instead. The source of operation is in
1015 since you can just copy files instead. The source of operation is in
1006 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1016 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1007 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1017 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1008 is happening on behalf of a repository on same system.
1018 is happening on behalf of a repository on same system.
1009
1019
1010 ``prepushkey``
1020 ``prepushkey``
1011 Run before a pushkey (like a bookmark) is added to the
1021 Run before a pushkey (like a bookmark) is added to the
1012 repository. A non-zero status will cause the key to be rejected. The
1022 repository. A non-zero status will cause the key to be rejected. The
1013 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1023 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1014 the old value (if any) is in ``$HG_OLD``, and the new value is in
1024 the old value (if any) is in ``$HG_OLD``, and the new value is in
1015 ``$HG_NEW``.
1025 ``$HG_NEW``.
1016
1026
1017 ``pretag``
1027 ``pretag``
1018 Run before creating a tag. Exit status 0 allows the tag to be
1028 Run before creating a tag. Exit status 0 allows the tag to be
1019 created. A non-zero status will cause the tag to fail. The ID of the
1029 created. A non-zero status will cause the tag to fail. The ID of the
1020 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1030 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1021 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1031 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1022
1032
1023 ``pretxnopen``
1033 ``pretxnopen``
1024 Run before any new repository transaction is open. The reason for the
1034 Run before any new repository transaction is open. The reason for the
1025 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1035 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1026 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
1036 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
1027 transaction from being opened.
1037 transaction from being opened.
1028
1038
1029 ``pretxnclose``
1039 ``pretxnclose``
1030 Run right before the transaction is actually finalized. Any repository change
1040 Run right before the transaction is actually finalized. Any repository change
1031 will be visible to the hook program. This lets you validate the transaction
1041 will be visible to the hook program. This lets you validate the transaction
1032 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1042 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1033 status will cause the transaction to be rolled back. The reason for the
1043 status will cause the transaction to be rolled back. The reason for the
1034 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1044 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1035 the transaction will be in ``HG_TXNID``. The rest of the available data will
1045 the transaction will be in ``HG_TXNID``. The rest of the available data will
1036 vary according the transaction type. New changesets will add ``$HG_NODE``
1046 vary according the transaction type. New changesets will add ``$HG_NODE``
1037 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1047 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1038 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1048 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1039 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1049 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1040 respectively, etc.
1050 respectively, etc.
1041
1051
1042 ``pretxnclose-bookmark``
1052 ``pretxnclose-bookmark``
1043 Run right before a bookmark change is actually finalized. Any repository
1053 Run right before a bookmark change is actually finalized. Any repository
1044 change will be visible to the hook program. This lets you validate the
1054 change will be visible to the hook program. This lets you validate the
1045 transaction content or change it. Exit status 0 allows the commit to
1055 transaction content or change it. Exit status 0 allows the commit to
1046 proceed. A non-zero status will cause the transaction to be rolled back.
1056 proceed. A non-zero status will cause the transaction to be rolled back.
1047 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1057 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1048 bookmark location will be available in ``$HG_NODE`` while the previous
1058 bookmark location will be available in ``$HG_NODE`` while the previous
1049 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1059 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1050 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1060 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1051 will be empty.
1061 will be empty.
1052 In addition, the reason for the transaction opening will be in
1062 In addition, the reason for the transaction opening will be in
1053 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1063 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1054 ``HG_TXNID``.
1064 ``HG_TXNID``.
1055
1065
1056 ``pretxnclose-phase``
1066 ``pretxnclose-phase``
1057 Run right before a phase change is actually finalized. Any repository change
1067 Run right before a phase change is actually finalized. Any repository change
1058 will be visible to the hook program. This lets you validate the transaction
1068 will be visible to the hook program. This lets you validate the transaction
1059 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1069 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1060 status will cause the transaction to be rolled back. The hook is called
1070 status will cause the transaction to be rolled back. The hook is called
1061 multiple times, once for each revision affected by a phase change.
1071 multiple times, once for each revision affected by a phase change.
1062 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1072 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1063 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1073 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1064 will be empty. In addition, the reason for the transaction opening will be in
1074 will be empty. In addition, the reason for the transaction opening will be in
1065 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1075 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1066 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1076 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1067 the ``$HG_OLDPHASE`` entry will be empty.
1077 the ``$HG_OLDPHASE`` entry will be empty.
1068
1078
1069 ``txnclose``
1079 ``txnclose``
1070 Run after any repository transaction has been committed. At this
1080 Run after any repository transaction has been committed. At this
1071 point, the transaction can no longer be rolled back. The hook will run
1081 point, the transaction can no longer be rolled back. The hook will run
1072 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1082 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1073 details about available variables.
1083 details about available variables.
1074
1084
1075 ``txnclose-bookmark``
1085 ``txnclose-bookmark``
1076 Run after any bookmark change has been committed. At this point, the
1086 Run after any bookmark change has been committed. At this point, the
1077 transaction can no longer be rolled back. The hook will run after the lock
1087 transaction can no longer be rolled back. The hook will run after the lock
1078 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1088 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1079 about available variables.
1089 about available variables.
1080
1090
1081 ``txnclose-phase``
1091 ``txnclose-phase``
1082 Run after any phase change has been committed. At this point, the
1092 Run after any phase change has been committed. At this point, the
1083 transaction can no longer be rolled back. The hook will run after the lock
1093 transaction can no longer be rolled back. The hook will run after the lock
1084 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1094 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1085 available variables.
1095 available variables.
1086
1096
1087 ``txnabort``
1097 ``txnabort``
1088 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1098 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1089 for details about available variables.
1099 for details about available variables.
1090
1100
1091 ``pretxnchangegroup``
1101 ``pretxnchangegroup``
1092 Run after a changegroup has been added via push, pull or unbundle, but before
1102 Run after a changegroup has been added via push, pull or unbundle, but before
1093 the transaction has been committed. The changegroup is visible to the hook
1103 the transaction has been committed. The changegroup is visible to the hook
1094 program. This allows validation of incoming changes before accepting them.
1104 program. This allows validation of incoming changes before accepting them.
1095 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1105 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1096 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1106 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1097 status will cause the transaction to be rolled back, and the push, pull or
1107 status will cause the transaction to be rolled back, and the push, pull or
1098 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1108 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1099
1109
1100 ``pretxncommit``
1110 ``pretxncommit``
1101 Run after a changeset has been created, but before the transaction is
1111 Run after a changeset has been created, but before the transaction is
1102 committed. The changeset is visible to the hook program. This allows
1112 committed. The changeset is visible to the hook program. This allows
1103 validation of the commit message and changes. Exit status 0 allows the
1113 validation of the commit message and changes. Exit status 0 allows the
1104 commit to proceed. A non-zero status will cause the transaction to
1114 commit to proceed. A non-zero status will cause the transaction to
1105 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1115 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1106 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1116 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1107
1117
1108 ``preupdate``
1118 ``preupdate``
1109 Run before updating the working directory. Exit status 0 allows
1119 Run before updating the working directory. Exit status 0 allows
1110 the update to proceed. A non-zero status will prevent the update.
1120 the update to proceed. A non-zero status will prevent the update.
1111 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1121 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1112 merge, the ID of second new parent is in ``$HG_PARENT2``.
1122 merge, the ID of second new parent is in ``$HG_PARENT2``.
1113
1123
1114 ``listkeys``
1124 ``listkeys``
1115 Run after listing pushkeys (like bookmarks) in the repository. The
1125 Run after listing pushkeys (like bookmarks) in the repository. The
1116 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1126 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1117 dictionary containing the keys and values.
1127 dictionary containing the keys and values.
1118
1128
1119 ``pushkey``
1129 ``pushkey``
1120 Run after a pushkey (like a bookmark) is added to the
1130 Run after a pushkey (like a bookmark) is added to the
1121 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1131 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1122 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1132 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1123 value is in ``$HG_NEW``.
1133 value is in ``$HG_NEW``.
1124
1134
1125 ``tag``
1135 ``tag``
1126 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1136 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1127 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1137 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1128 the repository if ``$HG_LOCAL=0``.
1138 the repository if ``$HG_LOCAL=0``.
1129
1139
1130 ``update``
1140 ``update``
1131 Run after updating the working directory. The changeset ID of first
1141 Run after updating the working directory. The changeset ID of first
1132 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1142 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1133 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1143 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1134 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1144 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1135
1145
1136 .. note::
1146 .. note::
1137
1147
1138 It is generally better to use standard hooks rather than the
1148 It is generally better to use standard hooks rather than the
1139 generic pre- and post- command hooks, as they are guaranteed to be
1149 generic pre- and post- command hooks, as they are guaranteed to be
1140 called in the appropriate contexts for influencing transactions.
1150 called in the appropriate contexts for influencing transactions.
1141 Also, hooks like "commit" will be called in all contexts that
1151 Also, hooks like "commit" will be called in all contexts that
1142 generate a commit (e.g. tag) and not just the commit command.
1152 generate a commit (e.g. tag) and not just the commit command.
1143
1153
1144 .. note::
1154 .. note::
1145
1155
1146 Environment variables with empty values may not be passed to
1156 Environment variables with empty values may not be passed to
1147 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1157 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1148 will have an empty value under Unix-like platforms for non-merge
1158 will have an empty value under Unix-like platforms for non-merge
1149 changesets, while it will not be available at all under Windows.
1159 changesets, while it will not be available at all under Windows.
1150
1160
1151 The syntax for Python hooks is as follows::
1161 The syntax for Python hooks is as follows::
1152
1162
1153 hookname = python:modulename.submodule.callable
1163 hookname = python:modulename.submodule.callable
1154 hookname = python:/path/to/python/module.py:callable
1164 hookname = python:/path/to/python/module.py:callable
1155
1165
1156 Python hooks are run within the Mercurial process. Each hook is
1166 Python hooks are run within the Mercurial process. Each hook is
1157 called with at least three keyword arguments: a ui object (keyword
1167 called with at least three keyword arguments: a ui object (keyword
1158 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1168 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1159 keyword that tells what kind of hook is used. Arguments listed as
1169 keyword that tells what kind of hook is used. Arguments listed as
1160 environment variables above are passed as keyword arguments, with no
1170 environment variables above are passed as keyword arguments, with no
1161 ``HG_`` prefix, and names in lower case.
1171 ``HG_`` prefix, and names in lower case.
1162
1172
1163 If a Python hook returns a "true" value or raises an exception, this
1173 If a Python hook returns a "true" value or raises an exception, this
1164 is treated as a failure.
1174 is treated as a failure.
1165
1175
1166
1176
1167 ``hostfingerprints``
1177 ``hostfingerprints``
1168 --------------------
1178 --------------------
1169
1179
1170 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1180 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1171
1181
1172 Fingerprints of the certificates of known HTTPS servers.
1182 Fingerprints of the certificates of known HTTPS servers.
1173
1183
1174 A HTTPS connection to a server with a fingerprint configured here will
1184 A HTTPS connection to a server with a fingerprint configured here will
1175 only succeed if the servers certificate matches the fingerprint.
1185 only succeed if the servers certificate matches the fingerprint.
1176 This is very similar to how ssh known hosts works.
1186 This is very similar to how ssh known hosts works.
1177
1187
1178 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1188 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1179 Multiple values can be specified (separated by spaces or commas). This can
1189 Multiple values can be specified (separated by spaces or commas). This can
1180 be used to define both old and new fingerprints while a host transitions
1190 be used to define both old and new fingerprints while a host transitions
1181 to a new certificate.
1191 to a new certificate.
1182
1192
1183 The CA chain and web.cacerts is not used for servers with a fingerprint.
1193 The CA chain and web.cacerts is not used for servers with a fingerprint.
1184
1194
1185 For example::
1195 For example::
1186
1196
1187 [hostfingerprints]
1197 [hostfingerprints]
1188 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1198 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1189 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1199 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1190
1200
1191 ``hostsecurity``
1201 ``hostsecurity``
1192 ----------------
1202 ----------------
1193
1203
1194 Used to specify global and per-host security settings for connecting to
1204 Used to specify global and per-host security settings for connecting to
1195 other machines.
1205 other machines.
1196
1206
1197 The following options control default behavior for all hosts.
1207 The following options control default behavior for all hosts.
1198
1208
1199 ``ciphers``
1209 ``ciphers``
1200 Defines the cryptographic ciphers to use for connections.
1210 Defines the cryptographic ciphers to use for connections.
1201
1211
1202 Value must be a valid OpenSSL Cipher List Format as documented at
1212 Value must be a valid OpenSSL Cipher List Format as documented at
1203 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1213 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1204
1214
1205 This setting is for advanced users only. Setting to incorrect values
1215 This setting is for advanced users only. Setting to incorrect values
1206 can significantly lower connection security or decrease performance.
1216 can significantly lower connection security or decrease performance.
1207 You have been warned.
1217 You have been warned.
1208
1218
1209 This option requires Python 2.7.
1219 This option requires Python 2.7.
1210
1220
1211 ``minimumprotocol``
1221 ``minimumprotocol``
1212 Defines the minimum channel encryption protocol to use.
1222 Defines the minimum channel encryption protocol to use.
1213
1223
1214 By default, the highest version of TLS supported by both client and server
1224 By default, the highest version of TLS supported by both client and server
1215 is used.
1225 is used.
1216
1226
1217 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1227 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1218
1228
1219 When running on an old Python version, only ``tls1.0`` is allowed since
1229 When running on an old Python version, only ``tls1.0`` is allowed since
1220 old versions of Python only support up to TLS 1.0.
1230 old versions of Python only support up to TLS 1.0.
1221
1231
1222 When running a Python that supports modern TLS versions, the default is
1232 When running a Python that supports modern TLS versions, the default is
1223 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1233 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1224 weakens security and should only be used as a feature of last resort if
1234 weakens security and should only be used as a feature of last resort if
1225 a server does not support TLS 1.1+.
1235 a server does not support TLS 1.1+.
1226
1236
1227 Options in the ``[hostsecurity]`` section can have the form
1237 Options in the ``[hostsecurity]`` section can have the form
1228 ``hostname``:``setting``. This allows multiple settings to be defined on a
1238 ``hostname``:``setting``. This allows multiple settings to be defined on a
1229 per-host basis.
1239 per-host basis.
1230
1240
1231 The following per-host settings can be defined.
1241 The following per-host settings can be defined.
1232
1242
1233 ``ciphers``
1243 ``ciphers``
1234 This behaves like ``ciphers`` as described above except it only applies
1244 This behaves like ``ciphers`` as described above except it only applies
1235 to the host on which it is defined.
1245 to the host on which it is defined.
1236
1246
1237 ``fingerprints``
1247 ``fingerprints``
1238 A list of hashes of the DER encoded peer/remote certificate. Values have
1248 A list of hashes of the DER encoded peer/remote certificate. Values have
1239 the form ``algorithm``:``fingerprint``. e.g.
1249 the form ``algorithm``:``fingerprint``. e.g.
1240 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1250 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1241 In addition, colons (``:``) can appear in the fingerprint part.
1251 In addition, colons (``:``) can appear in the fingerprint part.
1242
1252
1243 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1253 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1244 ``sha512``.
1254 ``sha512``.
1245
1255
1246 Use of ``sha256`` or ``sha512`` is preferred.
1256 Use of ``sha256`` or ``sha512`` is preferred.
1247
1257
1248 If a fingerprint is specified, the CA chain is not validated for this
1258 If a fingerprint is specified, the CA chain is not validated for this
1249 host and Mercurial will require the remote certificate to match one
1259 host and Mercurial will require the remote certificate to match one
1250 of the fingerprints specified. This means if the server updates its
1260 of the fingerprints specified. This means if the server updates its
1251 certificate, Mercurial will abort until a new fingerprint is defined.
1261 certificate, Mercurial will abort until a new fingerprint is defined.
1252 This can provide stronger security than traditional CA-based validation
1262 This can provide stronger security than traditional CA-based validation
1253 at the expense of convenience.
1263 at the expense of convenience.
1254
1264
1255 This option takes precedence over ``verifycertsfile``.
1265 This option takes precedence over ``verifycertsfile``.
1256
1266
1257 ``minimumprotocol``
1267 ``minimumprotocol``
1258 This behaves like ``minimumprotocol`` as described above except it
1268 This behaves like ``minimumprotocol`` as described above except it
1259 only applies to the host on which it is defined.
1269 only applies to the host on which it is defined.
1260
1270
1261 ``verifycertsfile``
1271 ``verifycertsfile``
1262 Path to file a containing a list of PEM encoded certificates used to
1272 Path to file a containing a list of PEM encoded certificates used to
1263 verify the server certificate. Environment variables and ``~user``
1273 verify the server certificate. Environment variables and ``~user``
1264 constructs are expanded in the filename.
1274 constructs are expanded in the filename.
1265
1275
1266 The server certificate or the certificate's certificate authority (CA)
1276 The server certificate or the certificate's certificate authority (CA)
1267 must match a certificate from this file or certificate verification
1277 must match a certificate from this file or certificate verification
1268 will fail and connections to the server will be refused.
1278 will fail and connections to the server will be refused.
1269
1279
1270 If defined, only certificates provided by this file will be used:
1280 If defined, only certificates provided by this file will be used:
1271 ``web.cacerts`` and any system/default certificates will not be
1281 ``web.cacerts`` and any system/default certificates will not be
1272 used.
1282 used.
1273
1283
1274 This option has no effect if the per-host ``fingerprints`` option
1284 This option has no effect if the per-host ``fingerprints`` option
1275 is set.
1285 is set.
1276
1286
1277 The format of the file is as follows::
1287 The format of the file is as follows::
1278
1288
1279 -----BEGIN CERTIFICATE-----
1289 -----BEGIN CERTIFICATE-----
1280 ... (certificate in base64 PEM encoding) ...
1290 ... (certificate in base64 PEM encoding) ...
1281 -----END CERTIFICATE-----
1291 -----END CERTIFICATE-----
1282 -----BEGIN CERTIFICATE-----
1292 -----BEGIN CERTIFICATE-----
1283 ... (certificate in base64 PEM encoding) ...
1293 ... (certificate in base64 PEM encoding) ...
1284 -----END CERTIFICATE-----
1294 -----END CERTIFICATE-----
1285
1295
1286 For example::
1296 For example::
1287
1297
1288 [hostsecurity]
1298 [hostsecurity]
1289 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1299 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1290 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1300 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1291 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1301 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1292 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1302 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1293
1303
1294 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1304 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1295 when connecting to ``hg.example.com``::
1305 when connecting to ``hg.example.com``::
1296
1306
1297 [hostsecurity]
1307 [hostsecurity]
1298 minimumprotocol = tls1.2
1308 minimumprotocol = tls1.2
1299 hg.example.com:minimumprotocol = tls1.1
1309 hg.example.com:minimumprotocol = tls1.1
1300
1310
1301 ``http_proxy``
1311 ``http_proxy``
1302 --------------
1312 --------------
1303
1313
1304 Used to access web-based Mercurial repositories through a HTTP
1314 Used to access web-based Mercurial repositories through a HTTP
1305 proxy.
1315 proxy.
1306
1316
1307 ``host``
1317 ``host``
1308 Host name and (optional) port of the proxy server, for example
1318 Host name and (optional) port of the proxy server, for example
1309 "myproxy:8000".
1319 "myproxy:8000".
1310
1320
1311 ``no``
1321 ``no``
1312 Optional. Comma-separated list of host names that should bypass
1322 Optional. Comma-separated list of host names that should bypass
1313 the proxy.
1323 the proxy.
1314
1324
1315 ``passwd``
1325 ``passwd``
1316 Optional. Password to authenticate with at the proxy server.
1326 Optional. Password to authenticate with at the proxy server.
1317
1327
1318 ``user``
1328 ``user``
1319 Optional. User name to authenticate with at the proxy server.
1329 Optional. User name to authenticate with at the proxy server.
1320
1330
1321 ``always``
1331 ``always``
1322 Optional. Always use the proxy, even for localhost and any entries
1332 Optional. Always use the proxy, even for localhost and any entries
1323 in ``http_proxy.no``. (default: False)
1333 in ``http_proxy.no``. (default: False)
1324
1334
1325 ``http``
1335 ``http``
1326 ----------
1336 ----------
1327
1337
1328 Used to configure access to Mercurial repositories via HTTP.
1338 Used to configure access to Mercurial repositories via HTTP.
1329
1339
1330 ``timeout``
1340 ``timeout``
1331 If set, blocking operations will timeout after that many seconds.
1341 If set, blocking operations will timeout after that many seconds.
1332 (default: None)
1342 (default: None)
1333
1343
1334 ``merge``
1344 ``merge``
1335 ---------
1345 ---------
1336
1346
1337 This section specifies behavior during merges and updates.
1347 This section specifies behavior during merges and updates.
1338
1348
1339 ``checkignored``
1349 ``checkignored``
1340 Controls behavior when an ignored file on disk has the same name as a tracked
1350 Controls behavior when an ignored file on disk has the same name as a tracked
1341 file in the changeset being merged or updated to, and has different
1351 file in the changeset being merged or updated to, and has different
1342 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1352 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1343 abort on such files. With ``warn``, warn on such files and back them up as
1353 abort on such files. With ``warn``, warn on such files and back them up as
1344 ``.orig``. With ``ignore``, don't print a warning and back them up as
1354 ``.orig``. With ``ignore``, don't print a warning and back them up as
1345 ``.orig``. (default: ``abort``)
1355 ``.orig``. (default: ``abort``)
1346
1356
1347 ``checkunknown``
1357 ``checkunknown``
1348 Controls behavior when an unknown file that isn't ignored has the same name
1358 Controls behavior when an unknown file that isn't ignored has the same name
1349 as a tracked file in the changeset being merged or updated to, and has
1359 as a tracked file in the changeset being merged or updated to, and has
1350 different contents. Similar to ``merge.checkignored``, except for files that
1360 different contents. Similar to ``merge.checkignored``, except for files that
1351 are not ignored. (default: ``abort``)
1361 are not ignored. (default: ``abort``)
1352
1362
1353 ``on-failure``
1363 ``on-failure``
1354 When set to ``continue`` (the default), the merge process attempts to
1364 When set to ``continue`` (the default), the merge process attempts to
1355 merge all unresolved files using the merge chosen tool, regardless of
1365 merge all unresolved files using the merge chosen tool, regardless of
1356 whether previous file merge attempts during the process succeeded or not.
1366 whether previous file merge attempts during the process succeeded or not.
1357 Setting this to ``prompt`` will prompt after any merge failure continue
1367 Setting this to ``prompt`` will prompt after any merge failure continue
1358 or halt the merge process. Setting this to ``halt`` will automatically
1368 or halt the merge process. Setting this to ``halt`` will automatically
1359 halt the merge process on any merge tool failure. The merge process
1369 halt the merge process on any merge tool failure. The merge process
1360 can be restarted by using the ``resolve`` command. When a merge is
1370 can be restarted by using the ``resolve`` command. When a merge is
1361 halted, the repository is left in a normal ``unresolved`` merge state.
1371 halted, the repository is left in a normal ``unresolved`` merge state.
1362 (default: ``continue``)
1372 (default: ``continue``)
1363
1373
1364 ``strict-capability-check``
1374 ``strict-capability-check``
1365 Whether capabilities of internal merge tools are checked strictly
1375 Whether capabilities of internal merge tools are checked strictly
1366 or not, while examining rules to decide merge tool to be used.
1376 or not, while examining rules to decide merge tool to be used.
1367 (default: False)
1377 (default: False)
1368
1378
1369 ``merge-patterns``
1379 ``merge-patterns``
1370 ------------------
1380 ------------------
1371
1381
1372 This section specifies merge tools to associate with particular file
1382 This section specifies merge tools to associate with particular file
1373 patterns. Tools matched here will take precedence over the default
1383 patterns. Tools matched here will take precedence over the default
1374 merge tool. Patterns are globs by default, rooted at the repository
1384 merge tool. Patterns are globs by default, rooted at the repository
1375 root.
1385 root.
1376
1386
1377 Example::
1387 Example::
1378
1388
1379 [merge-patterns]
1389 [merge-patterns]
1380 **.c = kdiff3
1390 **.c = kdiff3
1381 **.jpg = myimgmerge
1391 **.jpg = myimgmerge
1382
1392
1383 ``merge-tools``
1393 ``merge-tools``
1384 ---------------
1394 ---------------
1385
1395
1386 This section configures external merge tools to use for file-level
1396 This section configures external merge tools to use for file-level
1387 merges. This section has likely been preconfigured at install time.
1397 merges. This section has likely been preconfigured at install time.
1388 Use :hg:`config merge-tools` to check the existing configuration.
1398 Use :hg:`config merge-tools` to check the existing configuration.
1389 Also see :hg:`help merge-tools` for more details.
1399 Also see :hg:`help merge-tools` for more details.
1390
1400
1391 Example ``~/.hgrc``::
1401 Example ``~/.hgrc``::
1392
1402
1393 [merge-tools]
1403 [merge-tools]
1394 # Override stock tool location
1404 # Override stock tool location
1395 kdiff3.executable = ~/bin/kdiff3
1405 kdiff3.executable = ~/bin/kdiff3
1396 # Specify command line
1406 # Specify command line
1397 kdiff3.args = $base $local $other -o $output
1407 kdiff3.args = $base $local $other -o $output
1398 # Give higher priority
1408 # Give higher priority
1399 kdiff3.priority = 1
1409 kdiff3.priority = 1
1400
1410
1401 # Changing the priority of preconfigured tool
1411 # Changing the priority of preconfigured tool
1402 meld.priority = 0
1412 meld.priority = 0
1403
1413
1404 # Disable a preconfigured tool
1414 # Disable a preconfigured tool
1405 vimdiff.disabled = yes
1415 vimdiff.disabled = yes
1406
1416
1407 # Define new tool
1417 # Define new tool
1408 myHtmlTool.args = -m $local $other $base $output
1418 myHtmlTool.args = -m $local $other $base $output
1409 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1419 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1410 myHtmlTool.priority = 1
1420 myHtmlTool.priority = 1
1411
1421
1412 Supported arguments:
1422 Supported arguments:
1413
1423
1414 ``priority``
1424 ``priority``
1415 The priority in which to evaluate this tool.
1425 The priority in which to evaluate this tool.
1416 (default: 0)
1426 (default: 0)
1417
1427
1418 ``executable``
1428 ``executable``
1419 Either just the name of the executable or its pathname.
1429 Either just the name of the executable or its pathname.
1420
1430
1421 .. container:: windows
1431 .. container:: windows
1422
1432
1423 On Windows, the path can use environment variables with ${ProgramFiles}
1433 On Windows, the path can use environment variables with ${ProgramFiles}
1424 syntax.
1434 syntax.
1425
1435
1426 (default: the tool name)
1436 (default: the tool name)
1427
1437
1428 ``args``
1438 ``args``
1429 The arguments to pass to the tool executable. You can refer to the
1439 The arguments to pass to the tool executable. You can refer to the
1430 files being merged as well as the output file through these
1440 files being merged as well as the output file through these
1431 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1441 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1432
1442
1433 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1443 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1434 being performed. During an update or merge, ``$local`` represents the original
1444 being performed. During an update or merge, ``$local`` represents the original
1435 state of the file, while ``$other`` represents the commit you are updating to or
1445 state of the file, while ``$other`` represents the commit you are updating to or
1436 the commit you are merging with. During a rebase, ``$local`` represents the
1446 the commit you are merging with. During a rebase, ``$local`` represents the
1437 destination of the rebase, and ``$other`` represents the commit being rebased.
1447 destination of the rebase, and ``$other`` represents the commit being rebased.
1438
1448
1439 Some operations define custom labels to assist with identifying the revisions,
1449 Some operations define custom labels to assist with identifying the revisions,
1440 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1450 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1441 labels are not available, these will be ``local``, ``other``, and ``base``,
1451 labels are not available, these will be ``local``, ``other``, and ``base``,
1442 respectively.
1452 respectively.
1443 (default: ``$local $base $other``)
1453 (default: ``$local $base $other``)
1444
1454
1445 ``premerge``
1455 ``premerge``
1446 Attempt to run internal non-interactive 3-way merge tool before
1456 Attempt to run internal non-interactive 3-way merge tool before
1447 launching external tool. Options are ``true``, ``false``, ``keep`` or
1457 launching external tool. Options are ``true``, ``false``, ``keep`` or
1448 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1458 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1449 premerge fails. The ``keep-merge3`` will do the same but include information
1459 premerge fails. The ``keep-merge3`` will do the same but include information
1450 about the base of the merge in the marker (see internal :merge3 in
1460 about the base of the merge in the marker (see internal :merge3 in
1451 :hg:`help merge-tools`).
1461 :hg:`help merge-tools`).
1452 (default: True)
1462 (default: True)
1453
1463
1454 ``binary``
1464 ``binary``
1455 This tool can merge binary files. (default: False, unless tool
1465 This tool can merge binary files. (default: False, unless tool
1456 was selected by file pattern match)
1466 was selected by file pattern match)
1457
1467
1458 ``symlink``
1468 ``symlink``
1459 This tool can merge symlinks. (default: False)
1469 This tool can merge symlinks. (default: False)
1460
1470
1461 ``check``
1471 ``check``
1462 A list of merge success-checking options:
1472 A list of merge success-checking options:
1463
1473
1464 ``changed``
1474 ``changed``
1465 Ask whether merge was successful when the merged file shows no changes.
1475 Ask whether merge was successful when the merged file shows no changes.
1466 ``conflicts``
1476 ``conflicts``
1467 Check whether there are conflicts even though the tool reported success.
1477 Check whether there are conflicts even though the tool reported success.
1468 ``prompt``
1478 ``prompt``
1469 Always prompt for merge success, regardless of success reported by tool.
1479 Always prompt for merge success, regardless of success reported by tool.
1470
1480
1471 ``fixeol``
1481 ``fixeol``
1472 Attempt to fix up EOL changes caused by the merge tool.
1482 Attempt to fix up EOL changes caused by the merge tool.
1473 (default: False)
1483 (default: False)
1474
1484
1475 ``gui``
1485 ``gui``
1476 This tool requires a graphical interface to run. (default: False)
1486 This tool requires a graphical interface to run. (default: False)
1477
1487
1478 ``mergemarkers``
1488 ``mergemarkers``
1479 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1489 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1480 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1490 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1481 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1491 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1482 markers generated during premerge will be ``detailed`` if either this option or
1492 markers generated during premerge will be ``detailed`` if either this option or
1483 the corresponding option in the ``[ui]`` section is ``detailed``.
1493 the corresponding option in the ``[ui]`` section is ``detailed``.
1484 (default: ``basic``)
1494 (default: ``basic``)
1485
1495
1486 ``mergemarkertemplate``
1496 ``mergemarkertemplate``
1487 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1497 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1488 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1498 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1489 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1499 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1490 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1500 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1491 information.
1501 information.
1492
1502
1493 .. container:: windows
1503 .. container:: windows
1494
1504
1495 ``regkey``
1505 ``regkey``
1496 Windows registry key which describes install location of this
1506 Windows registry key which describes install location of this
1497 tool. Mercurial will search for this key first under
1507 tool. Mercurial will search for this key first under
1498 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1508 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1499 (default: None)
1509 (default: None)
1500
1510
1501 ``regkeyalt``
1511 ``regkeyalt``
1502 An alternate Windows registry key to try if the first key is not
1512 An alternate Windows registry key to try if the first key is not
1503 found. The alternate key uses the same ``regname`` and ``regappend``
1513 found. The alternate key uses the same ``regname`` and ``regappend``
1504 semantics of the primary key. The most common use for this key
1514 semantics of the primary key. The most common use for this key
1505 is to search for 32bit applications on 64bit operating systems.
1515 is to search for 32bit applications on 64bit operating systems.
1506 (default: None)
1516 (default: None)
1507
1517
1508 ``regname``
1518 ``regname``
1509 Name of value to read from specified registry key.
1519 Name of value to read from specified registry key.
1510 (default: the unnamed (default) value)
1520 (default: the unnamed (default) value)
1511
1521
1512 ``regappend``
1522 ``regappend``
1513 String to append to the value read from the registry, typically
1523 String to append to the value read from the registry, typically
1514 the executable name of the tool.
1524 the executable name of the tool.
1515 (default: None)
1525 (default: None)
1516
1526
1517 ``pager``
1527 ``pager``
1518 ---------
1528 ---------
1519
1529
1520 Setting used to control when to paginate and with what external tool. See
1530 Setting used to control when to paginate and with what external tool. See
1521 :hg:`help pager` for details.
1531 :hg:`help pager` for details.
1522
1532
1523 ``pager``
1533 ``pager``
1524 Define the external tool used as pager.
1534 Define the external tool used as pager.
1525
1535
1526 If no pager is set, Mercurial uses the environment variable $PAGER.
1536 If no pager is set, Mercurial uses the environment variable $PAGER.
1527 If neither pager.pager, nor $PAGER is set, a default pager will be
1537 If neither pager.pager, nor $PAGER is set, a default pager will be
1528 used, typically `less` on Unix and `more` on Windows. Example::
1538 used, typically `less` on Unix and `more` on Windows. Example::
1529
1539
1530 [pager]
1540 [pager]
1531 pager = less -FRX
1541 pager = less -FRX
1532
1542
1533 ``ignore``
1543 ``ignore``
1534 List of commands to disable the pager for. Example::
1544 List of commands to disable the pager for. Example::
1535
1545
1536 [pager]
1546 [pager]
1537 ignore = version, help, update
1547 ignore = version, help, update
1538
1548
1539 ``patch``
1549 ``patch``
1540 ---------
1550 ---------
1541
1551
1542 Settings used when applying patches, for instance through the 'import'
1552 Settings used when applying patches, for instance through the 'import'
1543 command or with Mercurial Queues extension.
1553 command or with Mercurial Queues extension.
1544
1554
1545 ``eol``
1555 ``eol``
1546 When set to 'strict' patch content and patched files end of lines
1556 When set to 'strict' patch content and patched files end of lines
1547 are preserved. When set to ``lf`` or ``crlf``, both files end of
1557 are preserved. When set to ``lf`` or ``crlf``, both files end of
1548 lines are ignored when patching and the result line endings are
1558 lines are ignored when patching and the result line endings are
1549 normalized to either LF (Unix) or CRLF (Windows). When set to
1559 normalized to either LF (Unix) or CRLF (Windows). When set to
1550 ``auto``, end of lines are again ignored while patching but line
1560 ``auto``, end of lines are again ignored while patching but line
1551 endings in patched files are normalized to their original setting
1561 endings in patched files are normalized to their original setting
1552 on a per-file basis. If target file does not exist or has no end
1562 on a per-file basis. If target file does not exist or has no end
1553 of line, patch line endings are preserved.
1563 of line, patch line endings are preserved.
1554 (default: strict)
1564 (default: strict)
1555
1565
1556 ``fuzz``
1566 ``fuzz``
1557 The number of lines of 'fuzz' to allow when applying patches. This
1567 The number of lines of 'fuzz' to allow when applying patches. This
1558 controls how much context the patcher is allowed to ignore when
1568 controls how much context the patcher is allowed to ignore when
1559 trying to apply a patch.
1569 trying to apply a patch.
1560 (default: 2)
1570 (default: 2)
1561
1571
1562 ``paths``
1572 ``paths``
1563 ---------
1573 ---------
1564
1574
1565 Assigns symbolic names and behavior to repositories.
1575 Assigns symbolic names and behavior to repositories.
1566
1576
1567 Options are symbolic names defining the URL or directory that is the
1577 Options are symbolic names defining the URL or directory that is the
1568 location of the repository. Example::
1578 location of the repository. Example::
1569
1579
1570 [paths]
1580 [paths]
1571 my_server = https://example.com/my_repo
1581 my_server = https://example.com/my_repo
1572 local_path = /home/me/repo
1582 local_path = /home/me/repo
1573
1583
1574 These symbolic names can be used from the command line. To pull
1584 These symbolic names can be used from the command line. To pull
1575 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1585 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1576 :hg:`push local_path`.
1586 :hg:`push local_path`.
1577
1587
1578 Options containing colons (``:``) denote sub-options that can influence
1588 Options containing colons (``:``) denote sub-options that can influence
1579 behavior for that specific path. Example::
1589 behavior for that specific path. Example::
1580
1590
1581 [paths]
1591 [paths]
1582 my_server = https://example.com/my_path
1592 my_server = https://example.com/my_path
1583 my_server:pushurl = ssh://example.com/my_path
1593 my_server:pushurl = ssh://example.com/my_path
1584
1594
1585 The following sub-options can be defined:
1595 The following sub-options can be defined:
1586
1596
1587 ``pushurl``
1597 ``pushurl``
1588 The URL to use for push operations. If not defined, the location
1598 The URL to use for push operations. If not defined, the location
1589 defined by the path's main entry is used.
1599 defined by the path's main entry is used.
1590
1600
1591 ``pushrev``
1601 ``pushrev``
1592 A revset defining which revisions to push by default.
1602 A revset defining which revisions to push by default.
1593
1603
1594 When :hg:`push` is executed without a ``-r`` argument, the revset
1604 When :hg:`push` is executed without a ``-r`` argument, the revset
1595 defined by this sub-option is evaluated to determine what to push.
1605 defined by this sub-option is evaluated to determine what to push.
1596
1606
1597 For example, a value of ``.`` will push the working directory's
1607 For example, a value of ``.`` will push the working directory's
1598 revision by default.
1608 revision by default.
1599
1609
1600 Revsets specifying bookmarks will not result in the bookmark being
1610 Revsets specifying bookmarks will not result in the bookmark being
1601 pushed.
1611 pushed.
1602
1612
1603 The following special named paths exist:
1613 The following special named paths exist:
1604
1614
1605 ``default``
1615 ``default``
1606 The URL or directory to use when no source or remote is specified.
1616 The URL or directory to use when no source or remote is specified.
1607
1617
1608 :hg:`clone` will automatically define this path to the location the
1618 :hg:`clone` will automatically define this path to the location the
1609 repository was cloned from.
1619 repository was cloned from.
1610
1620
1611 ``default-push``
1621 ``default-push``
1612 (deprecated) The URL or directory for the default :hg:`push` location.
1622 (deprecated) The URL or directory for the default :hg:`push` location.
1613 ``default:pushurl`` should be used instead.
1623 ``default:pushurl`` should be used instead.
1614
1624
1615 ``phases``
1625 ``phases``
1616 ----------
1626 ----------
1617
1627
1618 Specifies default handling of phases. See :hg:`help phases` for more
1628 Specifies default handling of phases. See :hg:`help phases` for more
1619 information about working with phases.
1629 information about working with phases.
1620
1630
1621 ``publish``
1631 ``publish``
1622 Controls draft phase behavior when working as a server. When true,
1632 Controls draft phase behavior when working as a server. When true,
1623 pushed changesets are set to public in both client and server and
1633 pushed changesets are set to public in both client and server and
1624 pulled or cloned changesets are set to public in the client.
1634 pulled or cloned changesets are set to public in the client.
1625 (default: True)
1635 (default: True)
1626
1636
1627 ``new-commit``
1637 ``new-commit``
1628 Phase of newly-created commits.
1638 Phase of newly-created commits.
1629 (default: draft)
1639 (default: draft)
1630
1640
1631 ``checksubrepos``
1641 ``checksubrepos``
1632 Check the phase of the current revision of each subrepository. Allowed
1642 Check the phase of the current revision of each subrepository. Allowed
1633 values are "ignore", "follow" and "abort". For settings other than
1643 values are "ignore", "follow" and "abort". For settings other than
1634 "ignore", the phase of the current revision of each subrepository is
1644 "ignore", the phase of the current revision of each subrepository is
1635 checked before committing the parent repository. If any of those phases is
1645 checked before committing the parent repository. If any of those phases is
1636 greater than the phase of the parent repository (e.g. if a subrepo is in a
1646 greater than the phase of the parent repository (e.g. if a subrepo is in a
1637 "secret" phase while the parent repo is in "draft" phase), the commit is
1647 "secret" phase while the parent repo is in "draft" phase), the commit is
1638 either aborted (if checksubrepos is set to "abort") or the higher phase is
1648 either aborted (if checksubrepos is set to "abort") or the higher phase is
1639 used for the parent repository commit (if set to "follow").
1649 used for the parent repository commit (if set to "follow").
1640 (default: follow)
1650 (default: follow)
1641
1651
1642
1652
1643 ``profiling``
1653 ``profiling``
1644 -------------
1654 -------------
1645
1655
1646 Specifies profiling type, format, and file output. Two profilers are
1656 Specifies profiling type, format, and file output. Two profilers are
1647 supported: an instrumenting profiler (named ``ls``), and a sampling
1657 supported: an instrumenting profiler (named ``ls``), and a sampling
1648 profiler (named ``stat``).
1658 profiler (named ``stat``).
1649
1659
1650 In this section description, 'profiling data' stands for the raw data
1660 In this section description, 'profiling data' stands for the raw data
1651 collected during profiling, while 'profiling report' stands for a
1661 collected during profiling, while 'profiling report' stands for a
1652 statistical text report generated from the profiling data.
1662 statistical text report generated from the profiling data.
1653
1663
1654 ``enabled``
1664 ``enabled``
1655 Enable the profiler.
1665 Enable the profiler.
1656 (default: false)
1666 (default: false)
1657
1667
1658 This is equivalent to passing ``--profile`` on the command line.
1668 This is equivalent to passing ``--profile`` on the command line.
1659
1669
1660 ``type``
1670 ``type``
1661 The type of profiler to use.
1671 The type of profiler to use.
1662 (default: stat)
1672 (default: stat)
1663
1673
1664 ``ls``
1674 ``ls``
1665 Use Python's built-in instrumenting profiler. This profiler
1675 Use Python's built-in instrumenting profiler. This profiler
1666 works on all platforms, but each line number it reports is the
1676 works on all platforms, but each line number it reports is the
1667 first line of a function. This restriction makes it difficult to
1677 first line of a function. This restriction makes it difficult to
1668 identify the expensive parts of a non-trivial function.
1678 identify the expensive parts of a non-trivial function.
1669 ``stat``
1679 ``stat``
1670 Use a statistical profiler, statprof. This profiler is most
1680 Use a statistical profiler, statprof. This profiler is most
1671 useful for profiling commands that run for longer than about 0.1
1681 useful for profiling commands that run for longer than about 0.1
1672 seconds.
1682 seconds.
1673
1683
1674 ``format``
1684 ``format``
1675 Profiling format. Specific to the ``ls`` instrumenting profiler.
1685 Profiling format. Specific to the ``ls`` instrumenting profiler.
1676 (default: text)
1686 (default: text)
1677
1687
1678 ``text``
1688 ``text``
1679 Generate a profiling report. When saving to a file, it should be
1689 Generate a profiling report. When saving to a file, it should be
1680 noted that only the report is saved, and the profiling data is
1690 noted that only the report is saved, and the profiling data is
1681 not kept.
1691 not kept.
1682 ``kcachegrind``
1692 ``kcachegrind``
1683 Format profiling data for kcachegrind use: when saving to a
1693 Format profiling data for kcachegrind use: when saving to a
1684 file, the generated file can directly be loaded into
1694 file, the generated file can directly be loaded into
1685 kcachegrind.
1695 kcachegrind.
1686
1696
1687 ``statformat``
1697 ``statformat``
1688 Profiling format for the ``stat`` profiler.
1698 Profiling format for the ``stat`` profiler.
1689 (default: hotpath)
1699 (default: hotpath)
1690
1700
1691 ``hotpath``
1701 ``hotpath``
1692 Show a tree-based display containing the hot path of execution (where
1702 Show a tree-based display containing the hot path of execution (where
1693 most time was spent).
1703 most time was spent).
1694 ``bymethod``
1704 ``bymethod``
1695 Show a table of methods ordered by how frequently they are active.
1705 Show a table of methods ordered by how frequently they are active.
1696 ``byline``
1706 ``byline``
1697 Show a table of lines in files ordered by how frequently they are active.
1707 Show a table of lines in files ordered by how frequently they are active.
1698 ``json``
1708 ``json``
1699 Render profiling data as JSON.
1709 Render profiling data as JSON.
1700
1710
1701 ``frequency``
1711 ``frequency``
1702 Sampling frequency. Specific to the ``stat`` sampling profiler.
1712 Sampling frequency. Specific to the ``stat`` sampling profiler.
1703 (default: 1000)
1713 (default: 1000)
1704
1714
1705 ``output``
1715 ``output``
1706 File path where profiling data or report should be saved. If the
1716 File path where profiling data or report should be saved. If the
1707 file exists, it is replaced. (default: None, data is printed on
1717 file exists, it is replaced. (default: None, data is printed on
1708 stderr)
1718 stderr)
1709
1719
1710 ``sort``
1720 ``sort``
1711 Sort field. Specific to the ``ls`` instrumenting profiler.
1721 Sort field. Specific to the ``ls`` instrumenting profiler.
1712 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1722 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1713 ``inlinetime``.
1723 ``inlinetime``.
1714 (default: inlinetime)
1724 (default: inlinetime)
1715
1725
1716 ``time-track``
1726 ``time-track``
1717 Control if the stat profiler track ``cpu`` or ``real`` time.
1727 Control if the stat profiler track ``cpu`` or ``real`` time.
1718 (default: ``cpu`` on Windows, otherwise ``real``)
1728 (default: ``cpu`` on Windows, otherwise ``real``)
1719
1729
1720 ``limit``
1730 ``limit``
1721 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1731 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1722 (default: 30)
1732 (default: 30)
1723
1733
1724 ``nested``
1734 ``nested``
1725 Show at most this number of lines of drill-down info after each main entry.
1735 Show at most this number of lines of drill-down info after each main entry.
1726 This can help explain the difference between Total and Inline.
1736 This can help explain the difference between Total and Inline.
1727 Specific to the ``ls`` instrumenting profiler.
1737 Specific to the ``ls`` instrumenting profiler.
1728 (default: 0)
1738 (default: 0)
1729
1739
1730 ``showmin``
1740 ``showmin``
1731 Minimum fraction of samples an entry must have for it to be displayed.
1741 Minimum fraction of samples an entry must have for it to be displayed.
1732 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1742 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1733 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1743 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1734
1744
1735 Only used by the ``stat`` profiler.
1745 Only used by the ``stat`` profiler.
1736
1746
1737 For the ``hotpath`` format, default is ``0.05``.
1747 For the ``hotpath`` format, default is ``0.05``.
1738 For the ``chrome`` format, default is ``0.005``.
1748 For the ``chrome`` format, default is ``0.005``.
1739
1749
1740 The option is unused on other formats.
1750 The option is unused on other formats.
1741
1751
1742 ``showmax``
1752 ``showmax``
1743 Maximum fraction of samples an entry can have before it is ignored in
1753 Maximum fraction of samples an entry can have before it is ignored in
1744 display. Values format is the same as ``showmin``.
1754 display. Values format is the same as ``showmin``.
1745
1755
1746 Only used by the ``stat`` profiler.
1756 Only used by the ``stat`` profiler.
1747
1757
1748 For the ``chrome`` format, default is ``0.999``.
1758 For the ``chrome`` format, default is ``0.999``.
1749
1759
1750 The option is unused on other formats.
1760 The option is unused on other formats.
1751
1761
1752 ``progress``
1762 ``progress``
1753 ------------
1763 ------------
1754
1764
1755 Mercurial commands can draw progress bars that are as informative as
1765 Mercurial commands can draw progress bars that are as informative as
1756 possible. Some progress bars only offer indeterminate information, while others
1766 possible. Some progress bars only offer indeterminate information, while others
1757 have a definite end point.
1767 have a definite end point.
1758
1768
1759 ``debug``
1769 ``debug``
1760 Whether to print debug info when updating the progress bar. (default: False)
1770 Whether to print debug info when updating the progress bar. (default: False)
1761
1771
1762 ``delay``
1772 ``delay``
1763 Number of seconds (float) before showing the progress bar. (default: 3)
1773 Number of seconds (float) before showing the progress bar. (default: 3)
1764
1774
1765 ``changedelay``
1775 ``changedelay``
1766 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1776 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1767 that value will be used instead. (default: 1)
1777 that value will be used instead. (default: 1)
1768
1778
1769 ``estimateinterval``
1779 ``estimateinterval``
1770 Maximum sampling interval in seconds for speed and estimated time
1780 Maximum sampling interval in seconds for speed and estimated time
1771 calculation. (default: 60)
1781 calculation. (default: 60)
1772
1782
1773 ``refresh``
1783 ``refresh``
1774 Time in seconds between refreshes of the progress bar. (default: 0.1)
1784 Time in seconds between refreshes of the progress bar. (default: 0.1)
1775
1785
1776 ``format``
1786 ``format``
1777 Format of the progress bar.
1787 Format of the progress bar.
1778
1788
1779 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1789 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1780 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1790 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1781 last 20 characters of the item, but this can be changed by adding either
1791 last 20 characters of the item, but this can be changed by adding either
1782 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1792 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1783 first num characters.
1793 first num characters.
1784
1794
1785 (default: topic bar number estimate)
1795 (default: topic bar number estimate)
1786
1796
1787 ``width``
1797 ``width``
1788 If set, the maximum width of the progress information (that is, min(width,
1798 If set, the maximum width of the progress information (that is, min(width,
1789 term width) will be used).
1799 term width) will be used).
1790
1800
1791 ``clear-complete``
1801 ``clear-complete``
1792 Clear the progress bar after it's done. (default: True)
1802 Clear the progress bar after it's done. (default: True)
1793
1803
1794 ``disable``
1804 ``disable``
1795 If true, don't show a progress bar.
1805 If true, don't show a progress bar.
1796
1806
1797 ``assume-tty``
1807 ``assume-tty``
1798 If true, ALWAYS show a progress bar, unless disable is given.
1808 If true, ALWAYS show a progress bar, unless disable is given.
1799
1809
1800 ``rebase``
1810 ``rebase``
1801 ----------
1811 ----------
1802
1812
1803 ``evolution.allowdivergence``
1813 ``evolution.allowdivergence``
1804 Default to False, when True allow creating divergence when performing
1814 Default to False, when True allow creating divergence when performing
1805 rebase of obsolete changesets.
1815 rebase of obsolete changesets.
1806
1816
1807 ``revsetalias``
1817 ``revsetalias``
1808 ---------------
1818 ---------------
1809
1819
1810 Alias definitions for revsets. See :hg:`help revsets` for details.
1820 Alias definitions for revsets. See :hg:`help revsets` for details.
1811
1821
1812 ``rewrite``
1822 ``rewrite``
1813 -----------
1823 -----------
1814
1824
1815 ``backup-bundle``
1825 ``backup-bundle``
1816 Whether to save stripped changesets to a bundle file. (default: True)
1826 Whether to save stripped changesets to a bundle file. (default: True)
1817
1827
1818 ``update-timestamp``
1828 ``update-timestamp``
1819 If true, updates the date and time of the changeset to current. It is only
1829 If true, updates the date and time of the changeset to current. It is only
1820 applicable for hg amend in current version.
1830 applicable for hg amend in current version.
1821
1831
1822 ``storage``
1832 ``storage``
1823 -----------
1833 -----------
1824
1834
1825 Control the strategy Mercurial uses internally to store history. Options in this
1835 Control the strategy Mercurial uses internally to store history. Options in this
1826 category impact performance and repository size.
1836 category impact performance and repository size.
1827
1837
1828 ``revlog.optimize-delta-parent-choice``
1838 ``revlog.optimize-delta-parent-choice``
1829 When storing a merge revision, both parents will be equally considered as
1839 When storing a merge revision, both parents will be equally considered as
1830 a possible delta base. This results in better delta selection and improved
1840 a possible delta base. This results in better delta selection and improved
1831 revlog compression. This option is enabled by default.
1841 revlog compression. This option is enabled by default.
1832
1842
1833 Turning this option off can result in large increase of repository size for
1843 Turning this option off can result in large increase of repository size for
1834 repository with many merges.
1844 repository with many merges.
1835
1845
1836 ``server``
1846 ``server``
1837 ----------
1847 ----------
1838
1848
1839 Controls generic server settings.
1849 Controls generic server settings.
1840
1850
1841 ``bookmarks-pushkey-compat``
1851 ``bookmarks-pushkey-compat``
1842 Trigger pushkey hook when being pushed bookmark updates. This config exist
1852 Trigger pushkey hook when being pushed bookmark updates. This config exist
1843 for compatibility purpose (default to True)
1853 for compatibility purpose (default to True)
1844
1854
1845 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1855 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1846 movement we recommend you migrate them to ``txnclose-bookmark`` and
1856 movement we recommend you migrate them to ``txnclose-bookmark`` and
1847 ``pretxnclose-bookmark``.
1857 ``pretxnclose-bookmark``.
1848
1858
1849 ``compressionengines``
1859 ``compressionengines``
1850 List of compression engines and their relative priority to advertise
1860 List of compression engines and their relative priority to advertise
1851 to clients.
1861 to clients.
1852
1862
1853 The order of compression engines determines their priority, the first
1863 The order of compression engines determines their priority, the first
1854 having the highest priority. If a compression engine is not listed
1864 having the highest priority. If a compression engine is not listed
1855 here, it won't be advertised to clients.
1865 here, it won't be advertised to clients.
1856
1866
1857 If not set (the default), built-in defaults are used. Run
1867 If not set (the default), built-in defaults are used. Run
1858 :hg:`debuginstall` to list available compression engines and their
1868 :hg:`debuginstall` to list available compression engines and their
1859 default wire protocol priority.
1869 default wire protocol priority.
1860
1870
1861 Older Mercurial clients only support zlib compression and this setting
1871 Older Mercurial clients only support zlib compression and this setting
1862 has no effect for legacy clients.
1872 has no effect for legacy clients.
1863
1873
1864 ``uncompressed``
1874 ``uncompressed``
1865 Whether to allow clients to clone a repository using the
1875 Whether to allow clients to clone a repository using the
1866 uncompressed streaming protocol. This transfers about 40% more
1876 uncompressed streaming protocol. This transfers about 40% more
1867 data than a regular clone, but uses less memory and CPU on both
1877 data than a regular clone, but uses less memory and CPU on both
1868 server and client. Over a LAN (100 Mbps or better) or a very fast
1878 server and client. Over a LAN (100 Mbps or better) or a very fast
1869 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1879 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1870 regular clone. Over most WAN connections (anything slower than
1880 regular clone. Over most WAN connections (anything slower than
1871 about 6 Mbps), uncompressed streaming is slower, because of the
1881 about 6 Mbps), uncompressed streaming is slower, because of the
1872 extra data transfer overhead. This mode will also temporarily hold
1882 extra data transfer overhead. This mode will also temporarily hold
1873 the write lock while determining what data to transfer.
1883 the write lock while determining what data to transfer.
1874 (default: True)
1884 (default: True)
1875
1885
1876 ``uncompressedallowsecret``
1886 ``uncompressedallowsecret``
1877 Whether to allow stream clones when the repository contains secret
1887 Whether to allow stream clones when the repository contains secret
1878 changesets. (default: False)
1888 changesets. (default: False)
1879
1889
1880 ``preferuncompressed``
1890 ``preferuncompressed``
1881 When set, clients will try to use the uncompressed streaming
1891 When set, clients will try to use the uncompressed streaming
1882 protocol. (default: False)
1892 protocol. (default: False)
1883
1893
1884 ``disablefullbundle``
1894 ``disablefullbundle``
1885 When set, servers will refuse attempts to do pull-based clones.
1895 When set, servers will refuse attempts to do pull-based clones.
1886 If this option is set, ``preferuncompressed`` and/or clone bundles
1896 If this option is set, ``preferuncompressed`` and/or clone bundles
1887 are highly recommended. Partial clones will still be allowed.
1897 are highly recommended. Partial clones will still be allowed.
1888 (default: False)
1898 (default: False)
1889
1899
1890 ``streamunbundle``
1900 ``streamunbundle``
1891 When set, servers will apply data sent from the client directly,
1901 When set, servers will apply data sent from the client directly,
1892 otherwise it will be written to a temporary file first. This option
1902 otherwise it will be written to a temporary file first. This option
1893 effectively prevents concurrent pushes.
1903 effectively prevents concurrent pushes.
1894
1904
1895 ``pullbundle``
1905 ``pullbundle``
1896 When set, the server will check pullbundle.manifest for bundles
1906 When set, the server will check pullbundle.manifest for bundles
1897 covering the requested heads and common nodes. The first matching
1907 covering the requested heads and common nodes. The first matching
1898 entry will be streamed to the client.
1908 entry will be streamed to the client.
1899
1909
1900 For HTTP transport, the stream will still use zlib compression
1910 For HTTP transport, the stream will still use zlib compression
1901 for older clients.
1911 for older clients.
1902
1912
1903 ``concurrent-push-mode``
1913 ``concurrent-push-mode``
1904 Level of allowed race condition between two pushing clients.
1914 Level of allowed race condition between two pushing clients.
1905
1915
1906 - 'strict': push is abort if another client touched the repository
1916 - 'strict': push is abort if another client touched the repository
1907 while the push was preparing. (default)
1917 while the push was preparing. (default)
1908 - 'check-related': push is only aborted if it affects head that got also
1918 - 'check-related': push is only aborted if it affects head that got also
1909 affected while the push was preparing.
1919 affected while the push was preparing.
1910
1920
1911 This requires compatible client (version 4.3 and later). Old client will
1921 This requires compatible client (version 4.3 and later). Old client will
1912 use 'strict'.
1922 use 'strict'.
1913
1923
1914 ``validate``
1924 ``validate``
1915 Whether to validate the completeness of pushed changesets by
1925 Whether to validate the completeness of pushed changesets by
1916 checking that all new file revisions specified in manifests are
1926 checking that all new file revisions specified in manifests are
1917 present. (default: False)
1927 present. (default: False)
1918
1928
1919 ``maxhttpheaderlen``
1929 ``maxhttpheaderlen``
1920 Instruct HTTP clients not to send request headers longer than this
1930 Instruct HTTP clients not to send request headers longer than this
1921 many bytes. (default: 1024)
1931 many bytes. (default: 1024)
1922
1932
1923 ``bundle1``
1933 ``bundle1``
1924 Whether to allow clients to push and pull using the legacy bundle1
1934 Whether to allow clients to push and pull using the legacy bundle1
1925 exchange format. (default: True)
1935 exchange format. (default: True)
1926
1936
1927 ``bundle1gd``
1937 ``bundle1gd``
1928 Like ``bundle1`` but only used if the repository is using the
1938 Like ``bundle1`` but only used if the repository is using the
1929 *generaldelta* storage format. (default: True)
1939 *generaldelta* storage format. (default: True)
1930
1940
1931 ``bundle1.push``
1941 ``bundle1.push``
1932 Whether to allow clients to push using the legacy bundle1 exchange
1942 Whether to allow clients to push using the legacy bundle1 exchange
1933 format. (default: True)
1943 format. (default: True)
1934
1944
1935 ``bundle1gd.push``
1945 ``bundle1gd.push``
1936 Like ``bundle1.push`` but only used if the repository is using the
1946 Like ``bundle1.push`` but only used if the repository is using the
1937 *generaldelta* storage format. (default: True)
1947 *generaldelta* storage format. (default: True)
1938
1948
1939 ``bundle1.pull``
1949 ``bundle1.pull``
1940 Whether to allow clients to pull using the legacy bundle1 exchange
1950 Whether to allow clients to pull using the legacy bundle1 exchange
1941 format. (default: True)
1951 format. (default: True)
1942
1952
1943 ``bundle1gd.pull``
1953 ``bundle1gd.pull``
1944 Like ``bundle1.pull`` but only used if the repository is using the
1954 Like ``bundle1.pull`` but only used if the repository is using the
1945 *generaldelta* storage format. (default: True)
1955 *generaldelta* storage format. (default: True)
1946
1956
1947 Large repositories using the *generaldelta* storage format should
1957 Large repositories using the *generaldelta* storage format should
1948 consider setting this option because converting *generaldelta*
1958 consider setting this option because converting *generaldelta*
1949 repositories to the exchange format required by the bundle1 data
1959 repositories to the exchange format required by the bundle1 data
1950 format can consume a lot of CPU.
1960 format can consume a lot of CPU.
1951
1961
1952 ``bundle2.stream``
1962 ``bundle2.stream``
1953 Whether to allow clients to pull using the bundle2 streaming protocol.
1963 Whether to allow clients to pull using the bundle2 streaming protocol.
1954 (default: True)
1964 (default: True)
1955
1965
1956 ``zliblevel``
1966 ``zliblevel``
1957 Integer between ``-1`` and ``9`` that controls the zlib compression level
1967 Integer between ``-1`` and ``9`` that controls the zlib compression level
1958 for wire protocol commands that send zlib compressed output (notably the
1968 for wire protocol commands that send zlib compressed output (notably the
1959 commands that send repository history data).
1969 commands that send repository history data).
1960
1970
1961 The default (``-1``) uses the default zlib compression level, which is
1971 The default (``-1``) uses the default zlib compression level, which is
1962 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1972 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1963 maximum compression.
1973 maximum compression.
1964
1974
1965 Setting this option allows server operators to make trade-offs between
1975 Setting this option allows server operators to make trade-offs between
1966 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1976 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1967 but sends more bytes to clients.
1977 but sends more bytes to clients.
1968
1978
1969 This option only impacts the HTTP server.
1979 This option only impacts the HTTP server.
1970
1980
1971 ``zstdlevel``
1981 ``zstdlevel``
1972 Integer between ``1`` and ``22`` that controls the zstd compression level
1982 Integer between ``1`` and ``22`` that controls the zstd compression level
1973 for wire protocol commands. ``1`` is the minimal amount of compression and
1983 for wire protocol commands. ``1`` is the minimal amount of compression and
1974 ``22`` is the highest amount of compression.
1984 ``22`` is the highest amount of compression.
1975
1985
1976 The default (``3``) should be significantly faster than zlib while likely
1986 The default (``3``) should be significantly faster than zlib while likely
1977 delivering better compression ratios.
1987 delivering better compression ratios.
1978
1988
1979 This option only impacts the HTTP server.
1989 This option only impacts the HTTP server.
1980
1990
1981 See also ``server.zliblevel``.
1991 See also ``server.zliblevel``.
1982
1992
1983 ``smtp``
1993 ``smtp``
1984 --------
1994 --------
1985
1995
1986 Configuration for extensions that need to send email messages.
1996 Configuration for extensions that need to send email messages.
1987
1997
1988 ``host``
1998 ``host``
1989 Host name of mail server, e.g. "mail.example.com".
1999 Host name of mail server, e.g. "mail.example.com".
1990
2000
1991 ``port``
2001 ``port``
1992 Optional. Port to connect to on mail server. (default: 465 if
2002 Optional. Port to connect to on mail server. (default: 465 if
1993 ``tls`` is smtps; 25 otherwise)
2003 ``tls`` is smtps; 25 otherwise)
1994
2004
1995 ``tls``
2005 ``tls``
1996 Optional. Method to enable TLS when connecting to mail server: starttls,
2006 Optional. Method to enable TLS when connecting to mail server: starttls,
1997 smtps or none. (default: none)
2007 smtps or none. (default: none)
1998
2008
1999 ``username``
2009 ``username``
2000 Optional. User name for authenticating with the SMTP server.
2010 Optional. User name for authenticating with the SMTP server.
2001 (default: None)
2011 (default: None)
2002
2012
2003 ``password``
2013 ``password``
2004 Optional. Password for authenticating with the SMTP server. If not
2014 Optional. Password for authenticating with the SMTP server. If not
2005 specified, interactive sessions will prompt the user for a
2015 specified, interactive sessions will prompt the user for a
2006 password; non-interactive sessions will fail. (default: None)
2016 password; non-interactive sessions will fail. (default: None)
2007
2017
2008 ``local_hostname``
2018 ``local_hostname``
2009 Optional. The hostname that the sender can use to identify
2019 Optional. The hostname that the sender can use to identify
2010 itself to the MTA.
2020 itself to the MTA.
2011
2021
2012
2022
2013 ``subpaths``
2023 ``subpaths``
2014 ------------
2024 ------------
2015
2025
2016 Subrepository source URLs can go stale if a remote server changes name
2026 Subrepository source URLs can go stale if a remote server changes name
2017 or becomes temporarily unavailable. This section lets you define
2027 or becomes temporarily unavailable. This section lets you define
2018 rewrite rules of the form::
2028 rewrite rules of the form::
2019
2029
2020 <pattern> = <replacement>
2030 <pattern> = <replacement>
2021
2031
2022 where ``pattern`` is a regular expression matching a subrepository
2032 where ``pattern`` is a regular expression matching a subrepository
2023 source URL and ``replacement`` is the replacement string used to
2033 source URL and ``replacement`` is the replacement string used to
2024 rewrite it. Groups can be matched in ``pattern`` and referenced in
2034 rewrite it. Groups can be matched in ``pattern`` and referenced in
2025 ``replacements``. For instance::
2035 ``replacements``. For instance::
2026
2036
2027 http://server/(.*)-hg/ = http://hg.server/\1/
2037 http://server/(.*)-hg/ = http://hg.server/\1/
2028
2038
2029 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2039 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2030
2040
2031 Relative subrepository paths are first made absolute, and the
2041 Relative subrepository paths are first made absolute, and the
2032 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2042 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2033 doesn't match the full path, an attempt is made to apply it on the
2043 doesn't match the full path, an attempt is made to apply it on the
2034 relative path alone. The rules are applied in definition order.
2044 relative path alone. The rules are applied in definition order.
2035
2045
2036 ``subrepos``
2046 ``subrepos``
2037 ------------
2047 ------------
2038
2048
2039 This section contains options that control the behavior of the
2049 This section contains options that control the behavior of the
2040 subrepositories feature. See also :hg:`help subrepos`.
2050 subrepositories feature. See also :hg:`help subrepos`.
2041
2051
2042 Security note: auditing in Mercurial is known to be insufficient to
2052 Security note: auditing in Mercurial is known to be insufficient to
2043 prevent clone-time code execution with carefully constructed Git
2053 prevent clone-time code execution with carefully constructed Git
2044 subrepos. It is unknown if a similar detect is present in Subversion
2054 subrepos. It is unknown if a similar detect is present in Subversion
2045 subrepos. Both Git and Subversion subrepos are disabled by default
2055 subrepos. Both Git and Subversion subrepos are disabled by default
2046 out of security concerns. These subrepo types can be enabled using
2056 out of security concerns. These subrepo types can be enabled using
2047 the respective options below.
2057 the respective options below.
2048
2058
2049 ``allowed``
2059 ``allowed``
2050 Whether subrepositories are allowed in the working directory.
2060 Whether subrepositories are allowed in the working directory.
2051
2061
2052 When false, commands involving subrepositories (like :hg:`update`)
2062 When false, commands involving subrepositories (like :hg:`update`)
2053 will fail for all subrepository types.
2063 will fail for all subrepository types.
2054 (default: true)
2064 (default: true)
2055
2065
2056 ``hg:allowed``
2066 ``hg:allowed``
2057 Whether Mercurial subrepositories are allowed in the working
2067 Whether Mercurial subrepositories are allowed in the working
2058 directory. This option only has an effect if ``subrepos.allowed``
2068 directory. This option only has an effect if ``subrepos.allowed``
2059 is true.
2069 is true.
2060 (default: true)
2070 (default: true)
2061
2071
2062 ``git:allowed``
2072 ``git:allowed``
2063 Whether Git subrepositories are allowed in the working directory.
2073 Whether Git subrepositories are allowed in the working directory.
2064 This option only has an effect if ``subrepos.allowed`` is true.
2074 This option only has an effect if ``subrepos.allowed`` is true.
2065
2075
2066 See the security note above before enabling Git subrepos.
2076 See the security note above before enabling Git subrepos.
2067 (default: false)
2077 (default: false)
2068
2078
2069 ``svn:allowed``
2079 ``svn:allowed``
2070 Whether Subversion subrepositories are allowed in the working
2080 Whether Subversion subrepositories are allowed in the working
2071 directory. This option only has an effect if ``subrepos.allowed``
2081 directory. This option only has an effect if ``subrepos.allowed``
2072 is true.
2082 is true.
2073
2083
2074 See the security note above before enabling Subversion subrepos.
2084 See the security note above before enabling Subversion subrepos.
2075 (default: false)
2085 (default: false)
2076
2086
2077 ``templatealias``
2087 ``templatealias``
2078 -----------------
2088 -----------------
2079
2089
2080 Alias definitions for templates. See :hg:`help templates` for details.
2090 Alias definitions for templates. See :hg:`help templates` for details.
2081
2091
2082 ``templates``
2092 ``templates``
2083 -------------
2093 -------------
2084
2094
2085 Use the ``[templates]`` section to define template strings.
2095 Use the ``[templates]`` section to define template strings.
2086 See :hg:`help templates` for details.
2096 See :hg:`help templates` for details.
2087
2097
2088 ``trusted``
2098 ``trusted``
2089 -----------
2099 -----------
2090
2100
2091 Mercurial will not use the settings in the
2101 Mercurial will not use the settings in the
2092 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2102 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2093 user or to a trusted group, as various hgrc features allow arbitrary
2103 user or to a trusted group, as various hgrc features allow arbitrary
2094 commands to be run. This issue is often encountered when configuring
2104 commands to be run. This issue is often encountered when configuring
2095 hooks or extensions for shared repositories or servers. However,
2105 hooks or extensions for shared repositories or servers. However,
2096 the web interface will use some safe settings from the ``[web]``
2106 the web interface will use some safe settings from the ``[web]``
2097 section.
2107 section.
2098
2108
2099 This section specifies what users and groups are trusted. The
2109 This section specifies what users and groups are trusted. The
2100 current user is always trusted. To trust everybody, list a user or a
2110 current user is always trusted. To trust everybody, list a user or a
2101 group with name ``*``. These settings must be placed in an
2111 group with name ``*``. These settings must be placed in an
2102 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2112 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2103 user or service running Mercurial.
2113 user or service running Mercurial.
2104
2114
2105 ``users``
2115 ``users``
2106 Comma-separated list of trusted users.
2116 Comma-separated list of trusted users.
2107
2117
2108 ``groups``
2118 ``groups``
2109 Comma-separated list of trusted groups.
2119 Comma-separated list of trusted groups.
2110
2120
2111
2121
2112 ``ui``
2122 ``ui``
2113 ------
2123 ------
2114
2124
2115 User interface controls.
2125 User interface controls.
2116
2126
2117 ``archivemeta``
2127 ``archivemeta``
2118 Whether to include the .hg_archival.txt file containing meta data
2128 Whether to include the .hg_archival.txt file containing meta data
2119 (hashes for the repository base and for tip) in archives created
2129 (hashes for the repository base and for tip) in archives created
2120 by the :hg:`archive` command or downloaded via hgweb.
2130 by the :hg:`archive` command or downloaded via hgweb.
2121 (default: True)
2131 (default: True)
2122
2132
2123 ``askusername``
2133 ``askusername``
2124 Whether to prompt for a username when committing. If True, and
2134 Whether to prompt for a username when committing. If True, and
2125 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2135 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2126 be prompted to enter a username. If no username is entered, the
2136 be prompted to enter a username. If no username is entered, the
2127 default ``USER@HOST`` is used instead.
2137 default ``USER@HOST`` is used instead.
2128 (default: False)
2138 (default: False)
2129
2139
2130 ``clonebundles``
2140 ``clonebundles``
2131 Whether the "clone bundles" feature is enabled.
2141 Whether the "clone bundles" feature is enabled.
2132
2142
2133 When enabled, :hg:`clone` may download and apply a server-advertised
2143 When enabled, :hg:`clone` may download and apply a server-advertised
2134 bundle file from a URL instead of using the normal exchange mechanism.
2144 bundle file from a URL instead of using the normal exchange mechanism.
2135
2145
2136 This can likely result in faster and more reliable clones.
2146 This can likely result in faster and more reliable clones.
2137
2147
2138 (default: True)
2148 (default: True)
2139
2149
2140 ``clonebundlefallback``
2150 ``clonebundlefallback``
2141 Whether failure to apply an advertised "clone bundle" from a server
2151 Whether failure to apply an advertised "clone bundle" from a server
2142 should result in fallback to a regular clone.
2152 should result in fallback to a regular clone.
2143
2153
2144 This is disabled by default because servers advertising "clone
2154 This is disabled by default because servers advertising "clone
2145 bundles" often do so to reduce server load. If advertised bundles
2155 bundles" often do so to reduce server load. If advertised bundles
2146 start mass failing and clients automatically fall back to a regular
2156 start mass failing and clients automatically fall back to a regular
2147 clone, this would add significant and unexpected load to the server
2157 clone, this would add significant and unexpected load to the server
2148 since the server is expecting clone operations to be offloaded to
2158 since the server is expecting clone operations to be offloaded to
2149 pre-generated bundles. Failing fast (the default behavior) ensures
2159 pre-generated bundles. Failing fast (the default behavior) ensures
2150 clients don't overwhelm the server when "clone bundle" application
2160 clients don't overwhelm the server when "clone bundle" application
2151 fails.
2161 fails.
2152
2162
2153 (default: False)
2163 (default: False)
2154
2164
2155 ``clonebundleprefers``
2165 ``clonebundleprefers``
2156 Defines preferences for which "clone bundles" to use.
2166 Defines preferences for which "clone bundles" to use.
2157
2167
2158 Servers advertising "clone bundles" may advertise multiple available
2168 Servers advertising "clone bundles" may advertise multiple available
2159 bundles. Each bundle may have different attributes, such as the bundle
2169 bundles. Each bundle may have different attributes, such as the bundle
2160 type and compression format. This option is used to prefer a particular
2170 type and compression format. This option is used to prefer a particular
2161 bundle over another.
2171 bundle over another.
2162
2172
2163 The following keys are defined by Mercurial:
2173 The following keys are defined by Mercurial:
2164
2174
2165 BUNDLESPEC
2175 BUNDLESPEC
2166 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2176 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2167 e.g. ``gzip-v2`` or ``bzip2-v1``.
2177 e.g. ``gzip-v2`` or ``bzip2-v1``.
2168
2178
2169 COMPRESSION
2179 COMPRESSION
2170 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2180 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2171
2181
2172 Server operators may define custom keys.
2182 Server operators may define custom keys.
2173
2183
2174 Example values: ``COMPRESSION=bzip2``,
2184 Example values: ``COMPRESSION=bzip2``,
2175 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2185 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2176
2186
2177 By default, the first bundle advertised by the server is used.
2187 By default, the first bundle advertised by the server is used.
2178
2188
2179 ``color``
2189 ``color``
2180 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2190 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2181 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2191 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2182 seems possible. See :hg:`help color` for details.
2192 seems possible. See :hg:`help color` for details.
2183
2193
2184 ``commitsubrepos``
2194 ``commitsubrepos``
2185 Whether to commit modified subrepositories when committing the
2195 Whether to commit modified subrepositories when committing the
2186 parent repository. If False and one subrepository has uncommitted
2196 parent repository. If False and one subrepository has uncommitted
2187 changes, abort the commit.
2197 changes, abort the commit.
2188 (default: False)
2198 (default: False)
2189
2199
2190 ``debug``
2200 ``debug``
2191 Print debugging information. (default: False)
2201 Print debugging information. (default: False)
2192
2202
2193 ``editor``
2203 ``editor``
2194 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2204 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2195
2205
2196 ``fallbackencoding``
2206 ``fallbackencoding``
2197 Encoding to try if it's not possible to decode the changelog using
2207 Encoding to try if it's not possible to decode the changelog using
2198 UTF-8. (default: ISO-8859-1)
2208 UTF-8. (default: ISO-8859-1)
2199
2209
2200 ``graphnodetemplate``
2210 ``graphnodetemplate``
2201 The template used to print changeset nodes in an ASCII revision graph.
2211 The template used to print changeset nodes in an ASCII revision graph.
2202 (default: ``{graphnode}``)
2212 (default: ``{graphnode}``)
2203
2213
2204 ``ignore``
2214 ``ignore``
2205 A file to read per-user ignore patterns from. This file should be
2215 A file to read per-user ignore patterns from. This file should be
2206 in the same format as a repository-wide .hgignore file. Filenames
2216 in the same format as a repository-wide .hgignore file. Filenames
2207 are relative to the repository root. This option supports hook syntax,
2217 are relative to the repository root. This option supports hook syntax,
2208 so if you want to specify multiple ignore files, you can do so by
2218 so if you want to specify multiple ignore files, you can do so by
2209 setting something like ``ignore.other = ~/.hgignore2``. For details
2219 setting something like ``ignore.other = ~/.hgignore2``. For details
2210 of the ignore file format, see the ``hgignore(5)`` man page.
2220 of the ignore file format, see the ``hgignore(5)`` man page.
2211
2221
2212 ``interactive``
2222 ``interactive``
2213 Allow to prompt the user. (default: True)
2223 Allow to prompt the user. (default: True)
2214
2224
2215 ``interface``
2225 ``interface``
2216 Select the default interface for interactive features (default: text).
2226 Select the default interface for interactive features (default: text).
2217 Possible values are 'text' and 'curses'.
2227 Possible values are 'text' and 'curses'.
2218
2228
2219 ``interface.chunkselector``
2229 ``interface.chunkselector``
2220 Select the interface for change recording (e.g. :hg:`commit -i`).
2230 Select the interface for change recording (e.g. :hg:`commit -i`).
2221 Possible values are 'text' and 'curses'.
2231 Possible values are 'text' and 'curses'.
2222 This config overrides the interface specified by ui.interface.
2232 This config overrides the interface specified by ui.interface.
2223
2233
2224 ``large-file-limit``
2234 ``large-file-limit``
2225 Largest file size that gives no memory use warning.
2235 Largest file size that gives no memory use warning.
2226 Possible values are integers or 0 to disable the check.
2236 Possible values are integers or 0 to disable the check.
2227 (default: 10000000)
2237 (default: 10000000)
2228
2238
2229 ``logtemplate``
2239 ``logtemplate``
2230 Template string for commands that print changesets.
2240 Template string for commands that print changesets.
2231
2241
2232 ``merge``
2242 ``merge``
2233 The conflict resolution program to use during a manual merge.
2243 The conflict resolution program to use during a manual merge.
2234 For more information on merge tools see :hg:`help merge-tools`.
2244 For more information on merge tools see :hg:`help merge-tools`.
2235 For configuring merge tools see the ``[merge-tools]`` section.
2245 For configuring merge tools see the ``[merge-tools]`` section.
2236
2246
2237 ``mergemarkers``
2247 ``mergemarkers``
2238 Sets the merge conflict marker label styling. The ``detailed``
2248 Sets the merge conflict marker label styling. The ``detailed``
2239 style uses the ``mergemarkertemplate`` setting to style the labels.
2249 style uses the ``mergemarkertemplate`` setting to style the labels.
2240 The ``basic`` style just uses 'local' and 'other' as the marker label.
2250 The ``basic`` style just uses 'local' and 'other' as the marker label.
2241 One of ``basic`` or ``detailed``.
2251 One of ``basic`` or ``detailed``.
2242 (default: ``basic``)
2252 (default: ``basic``)
2243
2253
2244 ``mergemarkertemplate``
2254 ``mergemarkertemplate``
2245 The template used to print the commit description next to each conflict
2255 The template used to print the commit description next to each conflict
2246 marker during merge conflicts. See :hg:`help templates` for the template
2256 marker during merge conflicts. See :hg:`help templates` for the template
2247 format.
2257 format.
2248
2258
2249 Defaults to showing the hash, tags, branches, bookmarks, author, and
2259 Defaults to showing the hash, tags, branches, bookmarks, author, and
2250 the first line of the commit description.
2260 the first line of the commit description.
2251
2261
2252 If you use non-ASCII characters in names for tags, branches, bookmarks,
2262 If you use non-ASCII characters in names for tags, branches, bookmarks,
2253 authors, and/or commit descriptions, you must pay attention to encodings of
2263 authors, and/or commit descriptions, you must pay attention to encodings of
2254 managed files. At template expansion, non-ASCII characters use the encoding
2264 managed files. At template expansion, non-ASCII characters use the encoding
2255 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2265 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2256 environment variables that govern your locale. If the encoding of the merge
2266 environment variables that govern your locale. If the encoding of the merge
2257 markers is different from the encoding of the merged files,
2267 markers is different from the encoding of the merged files,
2258 serious problems may occur.
2268 serious problems may occur.
2259
2269
2260 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2270 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2261
2271
2262 ``message-output``
2272 ``message-output``
2263 Where to write status and error messages. (default: ``stdio``)
2273 Where to write status and error messages. (default: ``stdio``)
2264
2274
2265 ``stderr``
2275 ``stderr``
2266 Everything to stderr.
2276 Everything to stderr.
2267 ``stdio``
2277 ``stdio``
2268 Status to stdout, and error to stderr.
2278 Status to stdout, and error to stderr.
2269
2279
2270 ``origbackuppath``
2280 ``origbackuppath``
2271 The path to a directory used to store generated .orig files. If the path is
2281 The path to a directory used to store generated .orig files. If the path is
2272 not a directory, one will be created. If set, files stored in this
2282 not a directory, one will be created. If set, files stored in this
2273 directory have the same name as the original file and do not have a .orig
2283 directory have the same name as the original file and do not have a .orig
2274 suffix.
2284 suffix.
2275
2285
2276 ``paginate``
2286 ``paginate``
2277 Control the pagination of command output (default: True). See :hg:`help pager`
2287 Control the pagination of command output (default: True). See :hg:`help pager`
2278 for details.
2288 for details.
2279
2289
2280 ``patch``
2290 ``patch``
2281 An optional external tool that ``hg import`` and some extensions
2291 An optional external tool that ``hg import`` and some extensions
2282 will use for applying patches. By default Mercurial uses an
2292 will use for applying patches. By default Mercurial uses an
2283 internal patch utility. The external tool must work as the common
2293 internal patch utility. The external tool must work as the common
2284 Unix ``patch`` program. In particular, it must accept a ``-p``
2294 Unix ``patch`` program. In particular, it must accept a ``-p``
2285 argument to strip patch headers, a ``-d`` argument to specify the
2295 argument to strip patch headers, a ``-d`` argument to specify the
2286 current directory, a file name to patch, and a patch file to take
2296 current directory, a file name to patch, and a patch file to take
2287 from stdin.
2297 from stdin.
2288
2298
2289 It is possible to specify a patch tool together with extra
2299 It is possible to specify a patch tool together with extra
2290 arguments. For example, setting this option to ``patch --merge``
2300 arguments. For example, setting this option to ``patch --merge``
2291 will use the ``patch`` program with its 2-way merge option.
2301 will use the ``patch`` program with its 2-way merge option.
2292
2302
2293 ``portablefilenames``
2303 ``portablefilenames``
2294 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2304 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2295 (default: ``warn``)
2305 (default: ``warn``)
2296
2306
2297 ``warn``
2307 ``warn``
2298 Print a warning message on POSIX platforms, if a file with a non-portable
2308 Print a warning message on POSIX platforms, if a file with a non-portable
2299 filename is added (e.g. a file with a name that can't be created on
2309 filename is added (e.g. a file with a name that can't be created on
2300 Windows because it contains reserved parts like ``AUX``, reserved
2310 Windows because it contains reserved parts like ``AUX``, reserved
2301 characters like ``:``, or would cause a case collision with an existing
2311 characters like ``:``, or would cause a case collision with an existing
2302 file).
2312 file).
2303
2313
2304 ``ignore``
2314 ``ignore``
2305 Don't print a warning.
2315 Don't print a warning.
2306
2316
2307 ``abort``
2317 ``abort``
2308 The command is aborted.
2318 The command is aborted.
2309
2319
2310 ``true``
2320 ``true``
2311 Alias for ``warn``.
2321 Alias for ``warn``.
2312
2322
2313 ``false``
2323 ``false``
2314 Alias for ``ignore``.
2324 Alias for ``ignore``.
2315
2325
2316 .. container:: windows
2326 .. container:: windows
2317
2327
2318 On Windows, this configuration option is ignored and the command aborted.
2328 On Windows, this configuration option is ignored and the command aborted.
2319
2329
2320 ``pre-merge-tool-output-template``
2330 ``pre-merge-tool-output-template``
2321 A template that is printed before executing an external merge tool. This can
2331 A template that is printed before executing an external merge tool. This can
2322 be used to print out additional context that might be useful to have during
2332 be used to print out additional context that might be useful to have during
2323 the conflict resolution, such as the description of the various commits
2333 the conflict resolution, such as the description of the various commits
2324 involved or bookmarks/tags.
2334 involved or bookmarks/tags.
2325
2335
2326 Additional information is available in the ``local`, ``base``, and ``other``
2336 Additional information is available in the ``local`, ``base``, and ``other``
2327 dicts. For example: ``{local.label}``, ``{base.name}``, or
2337 dicts. For example: ``{local.label}``, ``{base.name}``, or
2328 ``{other.islink}``.
2338 ``{other.islink}``.
2329
2339
2330 ``quiet``
2340 ``quiet``
2331 Reduce the amount of output printed.
2341 Reduce the amount of output printed.
2332 (default: False)
2342 (default: False)
2333
2343
2334 ``remotecmd``
2344 ``remotecmd``
2335 Remote command to use for clone/push/pull operations.
2345 Remote command to use for clone/push/pull operations.
2336 (default: ``hg``)
2346 (default: ``hg``)
2337
2347
2338 ``report_untrusted``
2348 ``report_untrusted``
2339 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2349 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2340 trusted user or group.
2350 trusted user or group.
2341 (default: True)
2351 (default: True)
2342
2352
2343 ``slash``
2353 ``slash``
2344 (Deprecated. Use ``slashpath`` template filter instead.)
2354 (Deprecated. Use ``slashpath`` template filter instead.)
2345
2355
2346 Display paths using a slash (``/``) as the path separator. This
2356 Display paths using a slash (``/``) as the path separator. This
2347 only makes a difference on systems where the default path
2357 only makes a difference on systems where the default path
2348 separator is not the slash character (e.g. Windows uses the
2358 separator is not the slash character (e.g. Windows uses the
2349 backslash character (``\``)).
2359 backslash character (``\``)).
2350 (default: False)
2360 (default: False)
2351
2361
2352 ``statuscopies``
2362 ``statuscopies``
2353 Display copies in the status command.
2363 Display copies in the status command.
2354
2364
2355 ``ssh``
2365 ``ssh``
2356 Command to use for SSH connections. (default: ``ssh``)
2366 Command to use for SSH connections. (default: ``ssh``)
2357
2367
2358 ``ssherrorhint``
2368 ``ssherrorhint``
2359 A hint shown to the user in the case of SSH error (e.g.
2369 A hint shown to the user in the case of SSH error (e.g.
2360 ``Please see http://company/internalwiki/ssh.html``)
2370 ``Please see http://company/internalwiki/ssh.html``)
2361
2371
2362 ``strict``
2372 ``strict``
2363 Require exact command names, instead of allowing unambiguous
2373 Require exact command names, instead of allowing unambiguous
2364 abbreviations. (default: False)
2374 abbreviations. (default: False)
2365
2375
2366 ``style``
2376 ``style``
2367 Name of style to use for command output.
2377 Name of style to use for command output.
2368
2378
2369 ``supportcontact``
2379 ``supportcontact``
2370 A URL where users should report a Mercurial traceback. Use this if you are a
2380 A URL where users should report a Mercurial traceback. Use this if you are a
2371 large organisation with its own Mercurial deployment process and crash
2381 large organisation with its own Mercurial deployment process and crash
2372 reports should be addressed to your internal support.
2382 reports should be addressed to your internal support.
2373
2383
2374 ``textwidth``
2384 ``textwidth``
2375 Maximum width of help text. A longer line generated by ``hg help`` or
2385 Maximum width of help text. A longer line generated by ``hg help`` or
2376 ``hg subcommand --help`` will be broken after white space to get this
2386 ``hg subcommand --help`` will be broken after white space to get this
2377 width or the terminal width, whichever comes first.
2387 width or the terminal width, whichever comes first.
2378 A non-positive value will disable this and the terminal width will be
2388 A non-positive value will disable this and the terminal width will be
2379 used. (default: 78)
2389 used. (default: 78)
2380
2390
2381 ``timeout``
2391 ``timeout``
2382 The timeout used when a lock is held (in seconds), a negative value
2392 The timeout used when a lock is held (in seconds), a negative value
2383 means no timeout. (default: 600)
2393 means no timeout. (default: 600)
2384
2394
2385 ``timeout.warn``
2395 ``timeout.warn``
2386 Time (in seconds) before a warning is printed about held lock. A negative
2396 Time (in seconds) before a warning is printed about held lock. A negative
2387 value means no warning. (default: 0)
2397 value means no warning. (default: 0)
2388
2398
2389 ``traceback``
2399 ``traceback``
2390 Mercurial always prints a traceback when an unknown exception
2400 Mercurial always prints a traceback when an unknown exception
2391 occurs. Setting this to True will make Mercurial print a traceback
2401 occurs. Setting this to True will make Mercurial print a traceback
2392 on all exceptions, even those recognized by Mercurial (such as
2402 on all exceptions, even those recognized by Mercurial (such as
2393 IOError or MemoryError). (default: False)
2403 IOError or MemoryError). (default: False)
2394
2404
2395 ``tweakdefaults``
2405 ``tweakdefaults``
2396
2406
2397 By default Mercurial's behavior changes very little from release
2407 By default Mercurial's behavior changes very little from release
2398 to release, but over time the recommended config settings
2408 to release, but over time the recommended config settings
2399 shift. Enable this config to opt in to get automatic tweaks to
2409 shift. Enable this config to opt in to get automatic tweaks to
2400 Mercurial's behavior over time. This config setting will have no
2410 Mercurial's behavior over time. This config setting will have no
2401 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2411 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2402 not include ``tweakdefaults``. (default: False)
2412 not include ``tweakdefaults``. (default: False)
2403
2413
2404 It currently means::
2414 It currently means::
2405
2415
2406 .. tweakdefaultsmarker
2416 .. tweakdefaultsmarker
2407
2417
2408 ``username``
2418 ``username``
2409 The committer of a changeset created when running "commit".
2419 The committer of a changeset created when running "commit".
2410 Typically a person's name and email address, e.g. ``Fred Widget
2420 Typically a person's name and email address, e.g. ``Fred Widget
2411 <fred@example.com>``. Environment variables in the
2421 <fred@example.com>``. Environment variables in the
2412 username are expanded.
2422 username are expanded.
2413
2423
2414 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2424 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2415 hgrc is empty, e.g. if the system admin set ``username =`` in the
2425 hgrc is empty, e.g. if the system admin set ``username =`` in the
2416 system hgrc, it has to be specified manually or in a different
2426 system hgrc, it has to be specified manually or in a different
2417 hgrc file)
2427 hgrc file)
2418
2428
2419 ``verbose``
2429 ``verbose``
2420 Increase the amount of output printed. (default: False)
2430 Increase the amount of output printed. (default: False)
2421
2431
2422
2432
2423 ``web``
2433 ``web``
2424 -------
2434 -------
2425
2435
2426 Web interface configuration. The settings in this section apply to
2436 Web interface configuration. The settings in this section apply to
2427 both the builtin webserver (started by :hg:`serve`) and the script you
2437 both the builtin webserver (started by :hg:`serve`) and the script you
2428 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2438 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2429 and WSGI).
2439 and WSGI).
2430
2440
2431 The Mercurial webserver does no authentication (it does not prompt for
2441 The Mercurial webserver does no authentication (it does not prompt for
2432 usernames and passwords to validate *who* users are), but it does do
2442 usernames and passwords to validate *who* users are), but it does do
2433 authorization (it grants or denies access for *authenticated users*
2443 authorization (it grants or denies access for *authenticated users*
2434 based on settings in this section). You must either configure your
2444 based on settings in this section). You must either configure your
2435 webserver to do authentication for you, or disable the authorization
2445 webserver to do authentication for you, or disable the authorization
2436 checks.
2446 checks.
2437
2447
2438 For a quick setup in a trusted environment, e.g., a private LAN, where
2448 For a quick setup in a trusted environment, e.g., a private LAN, where
2439 you want it to accept pushes from anybody, you can use the following
2449 you want it to accept pushes from anybody, you can use the following
2440 command line::
2450 command line::
2441
2451
2442 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2452 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2443
2453
2444 Note that this will allow anybody to push anything to the server and
2454 Note that this will allow anybody to push anything to the server and
2445 that this should not be used for public servers.
2455 that this should not be used for public servers.
2446
2456
2447 The full set of options is:
2457 The full set of options is:
2448
2458
2449 ``accesslog``
2459 ``accesslog``
2450 Where to output the access log. (default: stdout)
2460 Where to output the access log. (default: stdout)
2451
2461
2452 ``address``
2462 ``address``
2453 Interface address to bind to. (default: all)
2463 Interface address to bind to. (default: all)
2454
2464
2455 ``allow-archive``
2465 ``allow-archive``
2456 List of archive format (bz2, gz, zip) allowed for downloading.
2466 List of archive format (bz2, gz, zip) allowed for downloading.
2457 (default: empty)
2467 (default: empty)
2458
2468
2459 ``allowbz2``
2469 ``allowbz2``
2460 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2470 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2461 revisions.
2471 revisions.
2462 (default: False)
2472 (default: False)
2463
2473
2464 ``allowgz``
2474 ``allowgz``
2465 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2475 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2466 revisions.
2476 revisions.
2467 (default: False)
2477 (default: False)
2468
2478
2469 ``allow-pull``
2479 ``allow-pull``
2470 Whether to allow pulling from the repository. (default: True)
2480 Whether to allow pulling from the repository. (default: True)
2471
2481
2472 ``allow-push``
2482 ``allow-push``
2473 Whether to allow pushing to the repository. If empty or not set,
2483 Whether to allow pushing to the repository. If empty or not set,
2474 pushing is not allowed. If the special value ``*``, any remote
2484 pushing is not allowed. If the special value ``*``, any remote
2475 user can push, including unauthenticated users. Otherwise, the
2485 user can push, including unauthenticated users. Otherwise, the
2476 remote user must have been authenticated, and the authenticated
2486 remote user must have been authenticated, and the authenticated
2477 user name must be present in this list. The contents of the
2487 user name must be present in this list. The contents of the
2478 allow-push list are examined after the deny_push list.
2488 allow-push list are examined after the deny_push list.
2479
2489
2480 ``allow_read``
2490 ``allow_read``
2481 If the user has not already been denied repository access due to
2491 If the user has not already been denied repository access due to
2482 the contents of deny_read, this list determines whether to grant
2492 the contents of deny_read, this list determines whether to grant
2483 repository access to the user. If this list is not empty, and the
2493 repository access to the user. If this list is not empty, and the
2484 user is unauthenticated or not present in the list, then access is
2494 user is unauthenticated or not present in the list, then access is
2485 denied for the user. If the list is empty or not set, then access
2495 denied for the user. If the list is empty or not set, then access
2486 is permitted to all users by default. Setting allow_read to the
2496 is permitted to all users by default. Setting allow_read to the
2487 special value ``*`` is equivalent to it not being set (i.e. access
2497 special value ``*`` is equivalent to it not being set (i.e. access
2488 is permitted to all users). The contents of the allow_read list are
2498 is permitted to all users). The contents of the allow_read list are
2489 examined after the deny_read list.
2499 examined after the deny_read list.
2490
2500
2491 ``allowzip``
2501 ``allowzip``
2492 (DEPRECATED) Whether to allow .zip downloading of repository
2502 (DEPRECATED) Whether to allow .zip downloading of repository
2493 revisions. This feature creates temporary files.
2503 revisions. This feature creates temporary files.
2494 (default: False)
2504 (default: False)
2495
2505
2496 ``archivesubrepos``
2506 ``archivesubrepos``
2497 Whether to recurse into subrepositories when archiving.
2507 Whether to recurse into subrepositories when archiving.
2498 (default: False)
2508 (default: False)
2499
2509
2500 ``baseurl``
2510 ``baseurl``
2501 Base URL to use when publishing URLs in other locations, so
2511 Base URL to use when publishing URLs in other locations, so
2502 third-party tools like email notification hooks can construct
2512 third-party tools like email notification hooks can construct
2503 URLs. Example: ``http://hgserver/repos/``.
2513 URLs. Example: ``http://hgserver/repos/``.
2504
2514
2505 ``cacerts``
2515 ``cacerts``
2506 Path to file containing a list of PEM encoded certificate
2516 Path to file containing a list of PEM encoded certificate
2507 authority certificates. Environment variables and ``~user``
2517 authority certificates. Environment variables and ``~user``
2508 constructs are expanded in the filename. If specified on the
2518 constructs are expanded in the filename. If specified on the
2509 client, then it will verify the identity of remote HTTPS servers
2519 client, then it will verify the identity of remote HTTPS servers
2510 with these certificates.
2520 with these certificates.
2511
2521
2512 To disable SSL verification temporarily, specify ``--insecure`` from
2522 To disable SSL verification temporarily, specify ``--insecure`` from
2513 command line.
2523 command line.
2514
2524
2515 You can use OpenSSL's CA certificate file if your platform has
2525 You can use OpenSSL's CA certificate file if your platform has
2516 one. On most Linux systems this will be
2526 one. On most Linux systems this will be
2517 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2527 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2518 generate this file manually. The form must be as follows::
2528 generate this file manually. The form must be as follows::
2519
2529
2520 -----BEGIN CERTIFICATE-----
2530 -----BEGIN CERTIFICATE-----
2521 ... (certificate in base64 PEM encoding) ...
2531 ... (certificate in base64 PEM encoding) ...
2522 -----END CERTIFICATE-----
2532 -----END CERTIFICATE-----
2523 -----BEGIN CERTIFICATE-----
2533 -----BEGIN CERTIFICATE-----
2524 ... (certificate in base64 PEM encoding) ...
2534 ... (certificate in base64 PEM encoding) ...
2525 -----END CERTIFICATE-----
2535 -----END CERTIFICATE-----
2526
2536
2527 ``cache``
2537 ``cache``
2528 Whether to support caching in hgweb. (default: True)
2538 Whether to support caching in hgweb. (default: True)
2529
2539
2530 ``certificate``
2540 ``certificate``
2531 Certificate to use when running :hg:`serve`.
2541 Certificate to use when running :hg:`serve`.
2532
2542
2533 ``collapse``
2543 ``collapse``
2534 With ``descend`` enabled, repositories in subdirectories are shown at
2544 With ``descend`` enabled, repositories in subdirectories are shown at
2535 a single level alongside repositories in the current path. With
2545 a single level alongside repositories in the current path. With
2536 ``collapse`` also enabled, repositories residing at a deeper level than
2546 ``collapse`` also enabled, repositories residing at a deeper level than
2537 the current path are grouped behind navigable directory entries that
2547 the current path are grouped behind navigable directory entries that
2538 lead to the locations of these repositories. In effect, this setting
2548 lead to the locations of these repositories. In effect, this setting
2539 collapses each collection of repositories found within a subdirectory
2549 collapses each collection of repositories found within a subdirectory
2540 into a single entry for that subdirectory. (default: False)
2550 into a single entry for that subdirectory. (default: False)
2541
2551
2542 ``comparisoncontext``
2552 ``comparisoncontext``
2543 Number of lines of context to show in side-by-side file comparison. If
2553 Number of lines of context to show in side-by-side file comparison. If
2544 negative or the value ``full``, whole files are shown. (default: 5)
2554 negative or the value ``full``, whole files are shown. (default: 5)
2545
2555
2546 This setting can be overridden by a ``context`` request parameter to the
2556 This setting can be overridden by a ``context`` request parameter to the
2547 ``comparison`` command, taking the same values.
2557 ``comparison`` command, taking the same values.
2548
2558
2549 ``contact``
2559 ``contact``
2550 Name or email address of the person in charge of the repository.
2560 Name or email address of the person in charge of the repository.
2551 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2561 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2552
2562
2553 ``csp``
2563 ``csp``
2554 Send a ``Content-Security-Policy`` HTTP header with this value.
2564 Send a ``Content-Security-Policy`` HTTP header with this value.
2555
2565
2556 The value may contain a special string ``%nonce%``, which will be replaced
2566 The value may contain a special string ``%nonce%``, which will be replaced
2557 by a randomly-generated one-time use value. If the value contains
2567 by a randomly-generated one-time use value. If the value contains
2558 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2568 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2559 one-time property of the nonce. This nonce will also be inserted into
2569 one-time property of the nonce. This nonce will also be inserted into
2560 ``<script>`` elements containing inline JavaScript.
2570 ``<script>`` elements containing inline JavaScript.
2561
2571
2562 Note: lots of HTML content sent by the server is derived from repository
2572 Note: lots of HTML content sent by the server is derived from repository
2563 data. Please consider the potential for malicious repository data to
2573 data. Please consider the potential for malicious repository data to
2564 "inject" itself into generated HTML content as part of your security
2574 "inject" itself into generated HTML content as part of your security
2565 threat model.
2575 threat model.
2566
2576
2567 ``deny_push``
2577 ``deny_push``
2568 Whether to deny pushing to the repository. If empty or not set,
2578 Whether to deny pushing to the repository. If empty or not set,
2569 push is not denied. If the special value ``*``, all remote users are
2579 push is not denied. If the special value ``*``, all remote users are
2570 denied push. Otherwise, unauthenticated users are all denied, and
2580 denied push. Otherwise, unauthenticated users are all denied, and
2571 any authenticated user name present in this list is also denied. The
2581 any authenticated user name present in this list is also denied. The
2572 contents of the deny_push list are examined before the allow-push list.
2582 contents of the deny_push list are examined before the allow-push list.
2573
2583
2574 ``deny_read``
2584 ``deny_read``
2575 Whether to deny reading/viewing of the repository. If this list is
2585 Whether to deny reading/viewing of the repository. If this list is
2576 not empty, unauthenticated users are all denied, and any
2586 not empty, unauthenticated users are all denied, and any
2577 authenticated user name present in this list is also denied access to
2587 authenticated user name present in this list is also denied access to
2578 the repository. If set to the special value ``*``, all remote users
2588 the repository. If set to the special value ``*``, all remote users
2579 are denied access (rarely needed ;). If deny_read is empty or not set,
2589 are denied access (rarely needed ;). If deny_read is empty or not set,
2580 the determination of repository access depends on the presence and
2590 the determination of repository access depends on the presence and
2581 content of the allow_read list (see description). If both
2591 content of the allow_read list (see description). If both
2582 deny_read and allow_read are empty or not set, then access is
2592 deny_read and allow_read are empty or not set, then access is
2583 permitted to all users by default. If the repository is being
2593 permitted to all users by default. If the repository is being
2584 served via hgwebdir, denied users will not be able to see it in
2594 served via hgwebdir, denied users will not be able to see it in
2585 the list of repositories. The contents of the deny_read list have
2595 the list of repositories. The contents of the deny_read list have
2586 priority over (are examined before) the contents of the allow_read
2596 priority over (are examined before) the contents of the allow_read
2587 list.
2597 list.
2588
2598
2589 ``descend``
2599 ``descend``
2590 hgwebdir indexes will not descend into subdirectories. Only repositories
2600 hgwebdir indexes will not descend into subdirectories. Only repositories
2591 directly in the current path will be shown (other repositories are still
2601 directly in the current path will be shown (other repositories are still
2592 available from the index corresponding to their containing path).
2602 available from the index corresponding to their containing path).
2593
2603
2594 ``description``
2604 ``description``
2595 Textual description of the repository's purpose or contents.
2605 Textual description of the repository's purpose or contents.
2596 (default: "unknown")
2606 (default: "unknown")
2597
2607
2598 ``encoding``
2608 ``encoding``
2599 Character encoding name. (default: the current locale charset)
2609 Character encoding name. (default: the current locale charset)
2600 Example: "UTF-8".
2610 Example: "UTF-8".
2601
2611
2602 ``errorlog``
2612 ``errorlog``
2603 Where to output the error log. (default: stderr)
2613 Where to output the error log. (default: stderr)
2604
2614
2605 ``guessmime``
2615 ``guessmime``
2606 Control MIME types for raw download of file content.
2616 Control MIME types for raw download of file content.
2607 Set to True to let hgweb guess the content type from the file
2617 Set to True to let hgweb guess the content type from the file
2608 extension. This will serve HTML files as ``text/html`` and might
2618 extension. This will serve HTML files as ``text/html`` and might
2609 allow cross-site scripting attacks when serving untrusted
2619 allow cross-site scripting attacks when serving untrusted
2610 repositories. (default: False)
2620 repositories. (default: False)
2611
2621
2612 ``hidden``
2622 ``hidden``
2613 Whether to hide the repository in the hgwebdir index.
2623 Whether to hide the repository in the hgwebdir index.
2614 (default: False)
2624 (default: False)
2615
2625
2616 ``ipv6``
2626 ``ipv6``
2617 Whether to use IPv6. (default: False)
2627 Whether to use IPv6. (default: False)
2618
2628
2619 ``labels``
2629 ``labels``
2620 List of string *labels* associated with the repository.
2630 List of string *labels* associated with the repository.
2621
2631
2622 Labels are exposed as a template keyword and can be used to customize
2632 Labels are exposed as a template keyword and can be used to customize
2623 output. e.g. the ``index`` template can group or filter repositories
2633 output. e.g. the ``index`` template can group or filter repositories
2624 by labels and the ``summary`` template can display additional content
2634 by labels and the ``summary`` template can display additional content
2625 if a specific label is present.
2635 if a specific label is present.
2626
2636
2627 ``logoimg``
2637 ``logoimg``
2628 File name of the logo image that some templates display on each page.
2638 File name of the logo image that some templates display on each page.
2629 The file name is relative to ``staticurl``. That is, the full path to
2639 The file name is relative to ``staticurl``. That is, the full path to
2630 the logo image is "staticurl/logoimg".
2640 the logo image is "staticurl/logoimg".
2631 If unset, ``hglogo.png`` will be used.
2641 If unset, ``hglogo.png`` will be used.
2632
2642
2633 ``logourl``
2643 ``logourl``
2634 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2644 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2635 will be used.
2645 will be used.
2636
2646
2637 ``maxchanges``
2647 ``maxchanges``
2638 Maximum number of changes to list on the changelog. (default: 10)
2648 Maximum number of changes to list on the changelog. (default: 10)
2639
2649
2640 ``maxfiles``
2650 ``maxfiles``
2641 Maximum number of files to list per changeset. (default: 10)
2651 Maximum number of files to list per changeset. (default: 10)
2642
2652
2643 ``maxshortchanges``
2653 ``maxshortchanges``
2644 Maximum number of changes to list on the shortlog, graph or filelog
2654 Maximum number of changes to list on the shortlog, graph or filelog
2645 pages. (default: 60)
2655 pages. (default: 60)
2646
2656
2647 ``name``
2657 ``name``
2648 Repository name to use in the web interface.
2658 Repository name to use in the web interface.
2649 (default: current working directory)
2659 (default: current working directory)
2650
2660
2651 ``port``
2661 ``port``
2652 Port to listen on. (default: 8000)
2662 Port to listen on. (default: 8000)
2653
2663
2654 ``prefix``
2664 ``prefix``
2655 Prefix path to serve from. (default: '' (server root))
2665 Prefix path to serve from. (default: '' (server root))
2656
2666
2657 ``push_ssl``
2667 ``push_ssl``
2658 Whether to require that inbound pushes be transported over SSL to
2668 Whether to require that inbound pushes be transported over SSL to
2659 prevent password sniffing. (default: True)
2669 prevent password sniffing. (default: True)
2660
2670
2661 ``refreshinterval``
2671 ``refreshinterval``
2662 How frequently directory listings re-scan the filesystem for new
2672 How frequently directory listings re-scan the filesystem for new
2663 repositories, in seconds. This is relevant when wildcards are used
2673 repositories, in seconds. This is relevant when wildcards are used
2664 to define paths. Depending on how much filesystem traversal is
2674 to define paths. Depending on how much filesystem traversal is
2665 required, refreshing may negatively impact performance.
2675 required, refreshing may negatively impact performance.
2666
2676
2667 Values less than or equal to 0 always refresh.
2677 Values less than or equal to 0 always refresh.
2668 (default: 20)
2678 (default: 20)
2669
2679
2670 ``server-header``
2680 ``server-header``
2671 Value for HTTP ``Server`` response header.
2681 Value for HTTP ``Server`` response header.
2672
2682
2673 ``static``
2683 ``static``
2674 Directory where static files are served from.
2684 Directory where static files are served from.
2675
2685
2676 ``staticurl``
2686 ``staticurl``
2677 Base URL to use for static files. If unset, static files (e.g. the
2687 Base URL to use for static files. If unset, static files (e.g. the
2678 hgicon.png favicon) will be served by the CGI script itself. Use
2688 hgicon.png favicon) will be served by the CGI script itself. Use
2679 this setting to serve them directly with the HTTP server.
2689 this setting to serve them directly with the HTTP server.
2680 Example: ``http://hgserver/static/``.
2690 Example: ``http://hgserver/static/``.
2681
2691
2682 ``stripes``
2692 ``stripes``
2683 How many lines a "zebra stripe" should span in multi-line output.
2693 How many lines a "zebra stripe" should span in multi-line output.
2684 Set to 0 to disable. (default: 1)
2694 Set to 0 to disable. (default: 1)
2685
2695
2686 ``style``
2696 ``style``
2687 Which template map style to use. The available options are the names of
2697 Which template map style to use. The available options are the names of
2688 subdirectories in the HTML templates path. (default: ``paper``)
2698 subdirectories in the HTML templates path. (default: ``paper``)
2689 Example: ``monoblue``.
2699 Example: ``monoblue``.
2690
2700
2691 ``templates``
2701 ``templates``
2692 Where to find the HTML templates. The default path to the HTML templates
2702 Where to find the HTML templates. The default path to the HTML templates
2693 can be obtained from ``hg debuginstall``.
2703 can be obtained from ``hg debuginstall``.
2694
2704
2695 ``websub``
2705 ``websub``
2696 ----------
2706 ----------
2697
2707
2698 Web substitution filter definition. You can use this section to
2708 Web substitution filter definition. You can use this section to
2699 define a set of regular expression substitution patterns which
2709 define a set of regular expression substitution patterns which
2700 let you automatically modify the hgweb server output.
2710 let you automatically modify the hgweb server output.
2701
2711
2702 The default hgweb templates only apply these substitution patterns
2712 The default hgweb templates only apply these substitution patterns
2703 on the revision description fields. You can apply them anywhere
2713 on the revision description fields. You can apply them anywhere
2704 you want when you create your own templates by adding calls to the
2714 you want when you create your own templates by adding calls to the
2705 "websub" filter (usually after calling the "escape" filter).
2715 "websub" filter (usually after calling the "escape" filter).
2706
2716
2707 This can be used, for example, to convert issue references to links
2717 This can be used, for example, to convert issue references to links
2708 to your issue tracker, or to convert "markdown-like" syntax into
2718 to your issue tracker, or to convert "markdown-like" syntax into
2709 HTML (see the examples below).
2719 HTML (see the examples below).
2710
2720
2711 Each entry in this section names a substitution filter.
2721 Each entry in this section names a substitution filter.
2712 The value of each entry defines the substitution expression itself.
2722 The value of each entry defines the substitution expression itself.
2713 The websub expressions follow the old interhg extension syntax,
2723 The websub expressions follow the old interhg extension syntax,
2714 which in turn imitates the Unix sed replacement syntax::
2724 which in turn imitates the Unix sed replacement syntax::
2715
2725
2716 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2726 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2717
2727
2718 You can use any separator other than "/". The final "i" is optional
2728 You can use any separator other than "/". The final "i" is optional
2719 and indicates that the search must be case insensitive.
2729 and indicates that the search must be case insensitive.
2720
2730
2721 Examples::
2731 Examples::
2722
2732
2723 [websub]
2733 [websub]
2724 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2734 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2725 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2735 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2726 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2736 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2727
2737
2728 ``worker``
2738 ``worker``
2729 ----------
2739 ----------
2730
2740
2731 Parallel master/worker configuration. We currently perform working
2741 Parallel master/worker configuration. We currently perform working
2732 directory updates in parallel on Unix-like systems, which greatly
2742 directory updates in parallel on Unix-like systems, which greatly
2733 helps performance.
2743 helps performance.
2734
2744
2735 ``enabled``
2745 ``enabled``
2736 Whether to enable workers code to be used.
2746 Whether to enable workers code to be used.
2737 (default: true)
2747 (default: true)
2738
2748
2739 ``numcpus``
2749 ``numcpus``
2740 Number of CPUs to use for parallel operations. A zero or
2750 Number of CPUs to use for parallel operations. A zero or
2741 negative value is treated as ``use the default``.
2751 negative value is treated as ``use the default``.
2742 (default: 4 or the number of CPUs on the system, whichever is larger)
2752 (default: 4 or the number of CPUs on the system, whichever is larger)
2743
2753
2744 ``backgroundclose``
2754 ``backgroundclose``
2745 Whether to enable closing file handles on background threads during certain
2755 Whether to enable closing file handles on background threads during certain
2746 operations. Some platforms aren't very efficient at closing file
2756 operations. Some platforms aren't very efficient at closing file
2747 handles that have been written or appended to. By performing file closing
2757 handles that have been written or appended to. By performing file closing
2748 on background threads, file write rate can increase substantially.
2758 on background threads, file write rate can increase substantially.
2749 (default: true on Windows, false elsewhere)
2759 (default: true on Windows, false elsewhere)
2750
2760
2751 ``backgroundcloseminfilecount``
2761 ``backgroundcloseminfilecount``
2752 Minimum number of files required to trigger background file closing.
2762 Minimum number of files required to trigger background file closing.
2753 Operations not writing this many files won't start background close
2763 Operations not writing this many files won't start background close
2754 threads.
2764 threads.
2755 (default: 2048)
2765 (default: 2048)
2756
2766
2757 ``backgroundclosemaxqueue``
2767 ``backgroundclosemaxqueue``
2758 The maximum number of opened file handles waiting to be closed in the
2768 The maximum number of opened file handles waiting to be closed in the
2759 background. This option only has an effect if ``backgroundclose`` is
2769 background. This option only has an effect if ``backgroundclose`` is
2760 enabled.
2770 enabled.
2761 (default: 384)
2771 (default: 384)
2762
2772
2763 ``backgroundclosethreadcount``
2773 ``backgroundclosethreadcount``
2764 Number of threads to process background file closes. Only relevant if
2774 Number of threads to process background file closes. Only relevant if
2765 ``backgroundclose`` is enabled.
2775 ``backgroundclose`` is enabled.
2766 (default: 4)
2776 (default: 4)
@@ -1,3090 +1,3089 b''
1 # localrepo.py - read/write repository class for mercurial
1 # localrepo.py - read/write repository class for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 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 errno
10 import errno
11 import hashlib
11 import hashlib
12 import os
12 import os
13 import random
13 import random
14 import sys
14 import sys
15 import time
15 import time
16 import weakref
16 import weakref
17
17
18 from .i18n import _
18 from .i18n import _
19 from .node import (
19 from .node import (
20 bin,
20 bin,
21 hex,
21 hex,
22 nullid,
22 nullid,
23 nullrev,
23 nullrev,
24 short,
24 short,
25 )
25 )
26 from . import (
26 from . import (
27 bookmarks,
27 bookmarks,
28 branchmap,
28 branchmap,
29 bundle2,
29 bundle2,
30 changegroup,
30 changegroup,
31 changelog,
31 changelog,
32 color,
32 color,
33 context,
33 context,
34 dirstate,
34 dirstate,
35 dirstateguard,
35 dirstateguard,
36 discovery,
36 discovery,
37 encoding,
37 encoding,
38 error,
38 error,
39 exchange,
39 exchange,
40 extensions,
40 extensions,
41 filelog,
41 filelog,
42 hook,
42 hook,
43 lock as lockmod,
43 lock as lockmod,
44 manifest,
44 manifest,
45 match as matchmod,
45 match as matchmod,
46 merge as mergemod,
46 merge as mergemod,
47 mergeutil,
47 mergeutil,
48 namespaces,
48 namespaces,
49 narrowspec,
49 narrowspec,
50 obsolete,
50 obsolete,
51 pathutil,
51 pathutil,
52 phases,
52 phases,
53 pushkey,
53 pushkey,
54 pycompat,
54 pycompat,
55 repository,
55 repository,
56 repoview,
56 repoview,
57 revset,
57 revset,
58 revsetlang,
58 revsetlang,
59 scmutil,
59 scmutil,
60 sparse,
60 sparse,
61 store as storemod,
61 store as storemod,
62 subrepoutil,
62 subrepoutil,
63 tags as tagsmod,
63 tags as tagsmod,
64 transaction,
64 transaction,
65 txnutil,
65 txnutil,
66 util,
66 util,
67 vfs as vfsmod,
67 vfs as vfsmod,
68 )
68 )
69 from .utils import (
69 from .utils import (
70 interfaceutil,
70 interfaceutil,
71 procutil,
71 procutil,
72 stringutil,
72 stringutil,
73 )
73 )
74
74
75 from .revlogutils import (
75 from .revlogutils import (
76 constants as revlogconst,
76 constants as revlogconst,
77 )
77 )
78
78
79 release = lockmod.release
79 release = lockmod.release
80 urlerr = util.urlerr
80 urlerr = util.urlerr
81 urlreq = util.urlreq
81 urlreq = util.urlreq
82
82
83 # set of (path, vfs-location) tuples. vfs-location is:
83 # set of (path, vfs-location) tuples. vfs-location is:
84 # - 'plain for vfs relative paths
84 # - 'plain for vfs relative paths
85 # - '' for svfs relative paths
85 # - '' for svfs relative paths
86 _cachedfiles = set()
86 _cachedfiles = set()
87
87
88 class _basefilecache(scmutil.filecache):
88 class _basefilecache(scmutil.filecache):
89 """All filecache usage on repo are done for logic that should be unfiltered
89 """All filecache usage on repo are done for logic that should be unfiltered
90 """
90 """
91 def __get__(self, repo, type=None):
91 def __get__(self, repo, type=None):
92 if repo is None:
92 if repo is None:
93 return self
93 return self
94 # proxy to unfiltered __dict__ since filtered repo has no entry
94 # proxy to unfiltered __dict__ since filtered repo has no entry
95 unfi = repo.unfiltered()
95 unfi = repo.unfiltered()
96 try:
96 try:
97 return unfi.__dict__[self.sname]
97 return unfi.__dict__[self.sname]
98 except KeyError:
98 except KeyError:
99 pass
99 pass
100 return super(_basefilecache, self).__get__(unfi, type)
100 return super(_basefilecache, self).__get__(unfi, type)
101
101
102 def set(self, repo, value):
102 def set(self, repo, value):
103 return super(_basefilecache, self).set(repo.unfiltered(), value)
103 return super(_basefilecache, self).set(repo.unfiltered(), value)
104
104
105 class repofilecache(_basefilecache):
105 class repofilecache(_basefilecache):
106 """filecache for files in .hg but outside of .hg/store"""
106 """filecache for files in .hg but outside of .hg/store"""
107 def __init__(self, *paths):
107 def __init__(self, *paths):
108 super(repofilecache, self).__init__(*paths)
108 super(repofilecache, self).__init__(*paths)
109 for path in paths:
109 for path in paths:
110 _cachedfiles.add((path, 'plain'))
110 _cachedfiles.add((path, 'plain'))
111
111
112 def join(self, obj, fname):
112 def join(self, obj, fname):
113 return obj.vfs.join(fname)
113 return obj.vfs.join(fname)
114
114
115 class storecache(_basefilecache):
115 class storecache(_basefilecache):
116 """filecache for files in the store"""
116 """filecache for files in the store"""
117 def __init__(self, *paths):
117 def __init__(self, *paths):
118 super(storecache, self).__init__(*paths)
118 super(storecache, self).__init__(*paths)
119 for path in paths:
119 for path in paths:
120 _cachedfiles.add((path, ''))
120 _cachedfiles.add((path, ''))
121
121
122 def join(self, obj, fname):
122 def join(self, obj, fname):
123 return obj.sjoin(fname)
123 return obj.sjoin(fname)
124
124
125 def isfilecached(repo, name):
125 def isfilecached(repo, name):
126 """check if a repo has already cached "name" filecache-ed property
126 """check if a repo has already cached "name" filecache-ed property
127
127
128 This returns (cachedobj-or-None, iscached) tuple.
128 This returns (cachedobj-or-None, iscached) tuple.
129 """
129 """
130 cacheentry = repo.unfiltered()._filecache.get(name, None)
130 cacheentry = repo.unfiltered()._filecache.get(name, None)
131 if not cacheentry:
131 if not cacheentry:
132 return None, False
132 return None, False
133 return cacheentry.obj, True
133 return cacheentry.obj, True
134
134
135 class unfilteredpropertycache(util.propertycache):
135 class unfilteredpropertycache(util.propertycache):
136 """propertycache that apply to unfiltered repo only"""
136 """propertycache that apply to unfiltered repo only"""
137
137
138 def __get__(self, repo, type=None):
138 def __get__(self, repo, type=None):
139 unfi = repo.unfiltered()
139 unfi = repo.unfiltered()
140 if unfi is repo:
140 if unfi is repo:
141 return super(unfilteredpropertycache, self).__get__(unfi)
141 return super(unfilteredpropertycache, self).__get__(unfi)
142 return getattr(unfi, self.name)
142 return getattr(unfi, self.name)
143
143
144 class filteredpropertycache(util.propertycache):
144 class filteredpropertycache(util.propertycache):
145 """propertycache that must take filtering in account"""
145 """propertycache that must take filtering in account"""
146
146
147 def cachevalue(self, obj, value):
147 def cachevalue(self, obj, value):
148 object.__setattr__(obj, self.name, value)
148 object.__setattr__(obj, self.name, value)
149
149
150
150
151 def hasunfilteredcache(repo, name):
151 def hasunfilteredcache(repo, name):
152 """check if a repo has an unfilteredpropertycache value for <name>"""
152 """check if a repo has an unfilteredpropertycache value for <name>"""
153 return name in vars(repo.unfiltered())
153 return name in vars(repo.unfiltered())
154
154
155 def unfilteredmethod(orig):
155 def unfilteredmethod(orig):
156 """decorate method that always need to be run on unfiltered version"""
156 """decorate method that always need to be run on unfiltered version"""
157 def wrapper(repo, *args, **kwargs):
157 def wrapper(repo, *args, **kwargs):
158 return orig(repo.unfiltered(), *args, **kwargs)
158 return orig(repo.unfiltered(), *args, **kwargs)
159 return wrapper
159 return wrapper
160
160
161 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
161 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
162 'unbundle'}
162 'unbundle'}
163 legacycaps = moderncaps.union({'changegroupsubset'})
163 legacycaps = moderncaps.union({'changegroupsubset'})
164
164
165 @interfaceutil.implementer(repository.ipeercommandexecutor)
165 @interfaceutil.implementer(repository.ipeercommandexecutor)
166 class localcommandexecutor(object):
166 class localcommandexecutor(object):
167 def __init__(self, peer):
167 def __init__(self, peer):
168 self._peer = peer
168 self._peer = peer
169 self._sent = False
169 self._sent = False
170 self._closed = False
170 self._closed = False
171
171
172 def __enter__(self):
172 def __enter__(self):
173 return self
173 return self
174
174
175 def __exit__(self, exctype, excvalue, exctb):
175 def __exit__(self, exctype, excvalue, exctb):
176 self.close()
176 self.close()
177
177
178 def callcommand(self, command, args):
178 def callcommand(self, command, args):
179 if self._sent:
179 if self._sent:
180 raise error.ProgrammingError('callcommand() cannot be used after '
180 raise error.ProgrammingError('callcommand() cannot be used after '
181 'sendcommands()')
181 'sendcommands()')
182
182
183 if self._closed:
183 if self._closed:
184 raise error.ProgrammingError('callcommand() cannot be used after '
184 raise error.ProgrammingError('callcommand() cannot be used after '
185 'close()')
185 'close()')
186
186
187 # We don't need to support anything fancy. Just call the named
187 # We don't need to support anything fancy. Just call the named
188 # method on the peer and return a resolved future.
188 # method on the peer and return a resolved future.
189 fn = getattr(self._peer, pycompat.sysstr(command))
189 fn = getattr(self._peer, pycompat.sysstr(command))
190
190
191 f = pycompat.futures.Future()
191 f = pycompat.futures.Future()
192
192
193 try:
193 try:
194 result = fn(**pycompat.strkwargs(args))
194 result = fn(**pycompat.strkwargs(args))
195 except Exception:
195 except Exception:
196 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
196 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
197 else:
197 else:
198 f.set_result(result)
198 f.set_result(result)
199
199
200 return f
200 return f
201
201
202 def sendcommands(self):
202 def sendcommands(self):
203 self._sent = True
203 self._sent = True
204
204
205 def close(self):
205 def close(self):
206 self._closed = True
206 self._closed = True
207
207
208 @interfaceutil.implementer(repository.ipeercommands)
208 @interfaceutil.implementer(repository.ipeercommands)
209 class localpeer(repository.peer):
209 class localpeer(repository.peer):
210 '''peer for a local repo; reflects only the most recent API'''
210 '''peer for a local repo; reflects only the most recent API'''
211
211
212 def __init__(self, repo, caps=None):
212 def __init__(self, repo, caps=None):
213 super(localpeer, self).__init__()
213 super(localpeer, self).__init__()
214
214
215 if caps is None:
215 if caps is None:
216 caps = moderncaps.copy()
216 caps = moderncaps.copy()
217 self._repo = repo.filtered('served')
217 self._repo = repo.filtered('served')
218 self.ui = repo.ui
218 self.ui = repo.ui
219 self._caps = repo._restrictcapabilities(caps)
219 self._caps = repo._restrictcapabilities(caps)
220
220
221 # Begin of _basepeer interface.
221 # Begin of _basepeer interface.
222
222
223 def url(self):
223 def url(self):
224 return self._repo.url()
224 return self._repo.url()
225
225
226 def local(self):
226 def local(self):
227 return self._repo
227 return self._repo
228
228
229 def peer(self):
229 def peer(self):
230 return self
230 return self
231
231
232 def canpush(self):
232 def canpush(self):
233 return True
233 return True
234
234
235 def close(self):
235 def close(self):
236 self._repo.close()
236 self._repo.close()
237
237
238 # End of _basepeer interface.
238 # End of _basepeer interface.
239
239
240 # Begin of _basewirecommands interface.
240 # Begin of _basewirecommands interface.
241
241
242 def branchmap(self):
242 def branchmap(self):
243 return self._repo.branchmap()
243 return self._repo.branchmap()
244
244
245 def capabilities(self):
245 def capabilities(self):
246 return self._caps
246 return self._caps
247
247
248 def clonebundles(self):
248 def clonebundles(self):
249 return self._repo.tryread('clonebundles.manifest')
249 return self._repo.tryread('clonebundles.manifest')
250
250
251 def debugwireargs(self, one, two, three=None, four=None, five=None):
251 def debugwireargs(self, one, two, three=None, four=None, five=None):
252 """Used to test argument passing over the wire"""
252 """Used to test argument passing over the wire"""
253 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
253 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
254 pycompat.bytestr(four),
254 pycompat.bytestr(four),
255 pycompat.bytestr(five))
255 pycompat.bytestr(five))
256
256
257 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
257 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
258 **kwargs):
258 **kwargs):
259 chunks = exchange.getbundlechunks(self._repo, source, heads=heads,
259 chunks = exchange.getbundlechunks(self._repo, source, heads=heads,
260 common=common, bundlecaps=bundlecaps,
260 common=common, bundlecaps=bundlecaps,
261 **kwargs)[1]
261 **kwargs)[1]
262 cb = util.chunkbuffer(chunks)
262 cb = util.chunkbuffer(chunks)
263
263
264 if exchange.bundle2requested(bundlecaps):
264 if exchange.bundle2requested(bundlecaps):
265 # When requesting a bundle2, getbundle returns a stream to make the
265 # When requesting a bundle2, getbundle returns a stream to make the
266 # wire level function happier. We need to build a proper object
266 # wire level function happier. We need to build a proper object
267 # from it in local peer.
267 # from it in local peer.
268 return bundle2.getunbundler(self.ui, cb)
268 return bundle2.getunbundler(self.ui, cb)
269 else:
269 else:
270 return changegroup.getunbundler('01', cb, None)
270 return changegroup.getunbundler('01', cb, None)
271
271
272 def heads(self):
272 def heads(self):
273 return self._repo.heads()
273 return self._repo.heads()
274
274
275 def known(self, nodes):
275 def known(self, nodes):
276 return self._repo.known(nodes)
276 return self._repo.known(nodes)
277
277
278 def listkeys(self, namespace):
278 def listkeys(self, namespace):
279 return self._repo.listkeys(namespace)
279 return self._repo.listkeys(namespace)
280
280
281 def lookup(self, key):
281 def lookup(self, key):
282 return self._repo.lookup(key)
282 return self._repo.lookup(key)
283
283
284 def pushkey(self, namespace, key, old, new):
284 def pushkey(self, namespace, key, old, new):
285 return self._repo.pushkey(namespace, key, old, new)
285 return self._repo.pushkey(namespace, key, old, new)
286
286
287 def stream_out(self):
287 def stream_out(self):
288 raise error.Abort(_('cannot perform stream clone against local '
288 raise error.Abort(_('cannot perform stream clone against local '
289 'peer'))
289 'peer'))
290
290
291 def unbundle(self, bundle, heads, url):
291 def unbundle(self, bundle, heads, url):
292 """apply a bundle on a repo
292 """apply a bundle on a repo
293
293
294 This function handles the repo locking itself."""
294 This function handles the repo locking itself."""
295 try:
295 try:
296 try:
296 try:
297 bundle = exchange.readbundle(self.ui, bundle, None)
297 bundle = exchange.readbundle(self.ui, bundle, None)
298 ret = exchange.unbundle(self._repo, bundle, heads, 'push', url)
298 ret = exchange.unbundle(self._repo, bundle, heads, 'push', url)
299 if util.safehasattr(ret, 'getchunks'):
299 if util.safehasattr(ret, 'getchunks'):
300 # This is a bundle20 object, turn it into an unbundler.
300 # This is a bundle20 object, turn it into an unbundler.
301 # This little dance should be dropped eventually when the
301 # This little dance should be dropped eventually when the
302 # API is finally improved.
302 # API is finally improved.
303 stream = util.chunkbuffer(ret.getchunks())
303 stream = util.chunkbuffer(ret.getchunks())
304 ret = bundle2.getunbundler(self.ui, stream)
304 ret = bundle2.getunbundler(self.ui, stream)
305 return ret
305 return ret
306 except Exception as exc:
306 except Exception as exc:
307 # If the exception contains output salvaged from a bundle2
307 # If the exception contains output salvaged from a bundle2
308 # reply, we need to make sure it is printed before continuing
308 # reply, we need to make sure it is printed before continuing
309 # to fail. So we build a bundle2 with such output and consume
309 # to fail. So we build a bundle2 with such output and consume
310 # it directly.
310 # it directly.
311 #
311 #
312 # This is not very elegant but allows a "simple" solution for
312 # This is not very elegant but allows a "simple" solution for
313 # issue4594
313 # issue4594
314 output = getattr(exc, '_bundle2salvagedoutput', ())
314 output = getattr(exc, '_bundle2salvagedoutput', ())
315 if output:
315 if output:
316 bundler = bundle2.bundle20(self._repo.ui)
316 bundler = bundle2.bundle20(self._repo.ui)
317 for out in output:
317 for out in output:
318 bundler.addpart(out)
318 bundler.addpart(out)
319 stream = util.chunkbuffer(bundler.getchunks())
319 stream = util.chunkbuffer(bundler.getchunks())
320 b = bundle2.getunbundler(self.ui, stream)
320 b = bundle2.getunbundler(self.ui, stream)
321 bundle2.processbundle(self._repo, b)
321 bundle2.processbundle(self._repo, b)
322 raise
322 raise
323 except error.PushRaced as exc:
323 except error.PushRaced as exc:
324 raise error.ResponseError(_('push failed:'),
324 raise error.ResponseError(_('push failed:'),
325 stringutil.forcebytestr(exc))
325 stringutil.forcebytestr(exc))
326
326
327 # End of _basewirecommands interface.
327 # End of _basewirecommands interface.
328
328
329 # Begin of peer interface.
329 # Begin of peer interface.
330
330
331 def commandexecutor(self):
331 def commandexecutor(self):
332 return localcommandexecutor(self)
332 return localcommandexecutor(self)
333
333
334 # End of peer interface.
334 # End of peer interface.
335
335
336 @interfaceutil.implementer(repository.ipeerlegacycommands)
336 @interfaceutil.implementer(repository.ipeerlegacycommands)
337 class locallegacypeer(localpeer):
337 class locallegacypeer(localpeer):
338 '''peer extension which implements legacy methods too; used for tests with
338 '''peer extension which implements legacy methods too; used for tests with
339 restricted capabilities'''
339 restricted capabilities'''
340
340
341 def __init__(self, repo):
341 def __init__(self, repo):
342 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
342 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
343
343
344 # Begin of baselegacywirecommands interface.
344 # Begin of baselegacywirecommands interface.
345
345
346 def between(self, pairs):
346 def between(self, pairs):
347 return self._repo.between(pairs)
347 return self._repo.between(pairs)
348
348
349 def branches(self, nodes):
349 def branches(self, nodes):
350 return self._repo.branches(nodes)
350 return self._repo.branches(nodes)
351
351
352 def changegroup(self, nodes, source):
352 def changegroup(self, nodes, source):
353 outgoing = discovery.outgoing(self._repo, missingroots=nodes,
353 outgoing = discovery.outgoing(self._repo, missingroots=nodes,
354 missingheads=self._repo.heads())
354 missingheads=self._repo.heads())
355 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
355 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
356
356
357 def changegroupsubset(self, bases, heads, source):
357 def changegroupsubset(self, bases, heads, source):
358 outgoing = discovery.outgoing(self._repo, missingroots=bases,
358 outgoing = discovery.outgoing(self._repo, missingroots=bases,
359 missingheads=heads)
359 missingheads=heads)
360 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
360 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
361
361
362 # End of baselegacywirecommands interface.
362 # End of baselegacywirecommands interface.
363
363
364 # Increment the sub-version when the revlog v2 format changes to lock out old
364 # Increment the sub-version when the revlog v2 format changes to lock out old
365 # clients.
365 # clients.
366 REVLOGV2_REQUIREMENT = 'exp-revlogv2.1'
366 REVLOGV2_REQUIREMENT = 'exp-revlogv2.1'
367
367
368 # A repository with the sparserevlog feature will have delta chains that
368 # A repository with the sparserevlog feature will have delta chains that
369 # can spread over a larger span. Sparse reading cuts these large spans into
369 # can spread over a larger span. Sparse reading cuts these large spans into
370 # pieces, so that each piece isn't too big.
370 # pieces, so that each piece isn't too big.
371 # Without the sparserevlog capability, reading from the repository could use
371 # Without the sparserevlog capability, reading from the repository could use
372 # huge amounts of memory, because the whole span would be read at once,
372 # huge amounts of memory, because the whole span would be read at once,
373 # including all the intermediate revisions that aren't pertinent for the chain.
373 # including all the intermediate revisions that aren't pertinent for the chain.
374 # This is why once a repository has enabled sparse-read, it becomes required.
374 # This is why once a repository has enabled sparse-read, it becomes required.
375 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
375 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
376
376
377 # Functions receiving (ui, features) that extensions can register to impact
377 # Functions receiving (ui, features) that extensions can register to impact
378 # the ability to load repositories with custom requirements. Only
378 # the ability to load repositories with custom requirements. Only
379 # functions defined in loaded extensions are called.
379 # functions defined in loaded extensions are called.
380 #
380 #
381 # The function receives a set of requirement strings that the repository
381 # The function receives a set of requirement strings that the repository
382 # is capable of opening. Functions will typically add elements to the
382 # is capable of opening. Functions will typically add elements to the
383 # set to reflect that the extension knows how to handle that requirements.
383 # set to reflect that the extension knows how to handle that requirements.
384 featuresetupfuncs = set()
384 featuresetupfuncs = set()
385
385
386 def makelocalrepository(baseui, path, intents=None):
386 def makelocalrepository(baseui, path, intents=None):
387 """Create a local repository object.
387 """Create a local repository object.
388
388
389 Given arguments needed to construct a local repository, this function
389 Given arguments needed to construct a local repository, this function
390 performs various early repository loading functionality (such as
390 performs various early repository loading functionality (such as
391 reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that
391 reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that
392 the repository can be opened, derives a type suitable for representing
392 the repository can be opened, derives a type suitable for representing
393 that repository, and returns an instance of it.
393 that repository, and returns an instance of it.
394
394
395 The returned object conforms to the ``repository.completelocalrepository``
395 The returned object conforms to the ``repository.completelocalrepository``
396 interface.
396 interface.
397
397
398 The repository type is derived by calling a series of factory functions
398 The repository type is derived by calling a series of factory functions
399 for each aspect/interface of the final repository. These are defined by
399 for each aspect/interface of the final repository. These are defined by
400 ``REPO_INTERFACES``.
400 ``REPO_INTERFACES``.
401
401
402 Each factory function is called to produce a type implementing a specific
402 Each factory function is called to produce a type implementing a specific
403 interface. The cumulative list of returned types will be combined into a
403 interface. The cumulative list of returned types will be combined into a
404 new type and that type will be instantiated to represent the local
404 new type and that type will be instantiated to represent the local
405 repository.
405 repository.
406
406
407 The factory functions each receive various state that may be consulted
407 The factory functions each receive various state that may be consulted
408 as part of deriving a type.
408 as part of deriving a type.
409
409
410 Extensions should wrap these factory functions to customize repository type
410 Extensions should wrap these factory functions to customize repository type
411 creation. Note that an extension's wrapped function may be called even if
411 creation. Note that an extension's wrapped function may be called even if
412 that extension is not loaded for the repo being constructed. Extensions
412 that extension is not loaded for the repo being constructed. Extensions
413 should check if their ``__name__`` appears in the
413 should check if their ``__name__`` appears in the
414 ``extensionmodulenames`` set passed to the factory function and no-op if
414 ``extensionmodulenames`` set passed to the factory function and no-op if
415 not.
415 not.
416 """
416 """
417 ui = baseui.copy()
417 ui = baseui.copy()
418 # Prevent copying repo configuration.
418 # Prevent copying repo configuration.
419 ui.copy = baseui.copy
419 ui.copy = baseui.copy
420
420
421 # Working directory VFS rooted at repository root.
421 # Working directory VFS rooted at repository root.
422 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
422 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
423
423
424 # Main VFS for .hg/ directory.
424 # Main VFS for .hg/ directory.
425 hgpath = wdirvfs.join(b'.hg')
425 hgpath = wdirvfs.join(b'.hg')
426 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
426 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
427
427
428 # The .hg/ path should exist and should be a directory. All other
428 # The .hg/ path should exist and should be a directory. All other
429 # cases are errors.
429 # cases are errors.
430 if not hgvfs.isdir():
430 if not hgvfs.isdir():
431 try:
431 try:
432 hgvfs.stat()
432 hgvfs.stat()
433 except OSError as e:
433 except OSError as e:
434 if e.errno != errno.ENOENT:
434 if e.errno != errno.ENOENT:
435 raise
435 raise
436
436
437 raise error.RepoError(_(b'repository %s not found') % path)
437 raise error.RepoError(_(b'repository %s not found') % path)
438
438
439 # .hg/requires file contains a newline-delimited list of
439 # .hg/requires file contains a newline-delimited list of
440 # features/capabilities the opener (us) must have in order to use
440 # features/capabilities the opener (us) must have in order to use
441 # the repository. This file was introduced in Mercurial 0.9.2,
441 # the repository. This file was introduced in Mercurial 0.9.2,
442 # which means very old repositories may not have one. We assume
442 # which means very old repositories may not have one. We assume
443 # a missing file translates to no requirements.
443 # a missing file translates to no requirements.
444 try:
444 try:
445 requirements = set(hgvfs.read(b'requires').splitlines())
445 requirements = set(hgvfs.read(b'requires').splitlines())
446 except IOError as e:
446 except IOError as e:
447 if e.errno != errno.ENOENT:
447 if e.errno != errno.ENOENT:
448 raise
448 raise
449 requirements = set()
449 requirements = set()
450
450
451 # The .hg/hgrc file may load extensions or contain config options
451 # The .hg/hgrc file may load extensions or contain config options
452 # that influence repository construction. Attempt to load it and
452 # that influence repository construction. Attempt to load it and
453 # process any new extensions that it may have pulled in.
453 # process any new extensions that it may have pulled in.
454 if loadhgrc(ui, wdirvfs, hgvfs, requirements):
454 if loadhgrc(ui, wdirvfs, hgvfs, requirements):
455 afterhgrcload(ui, wdirvfs, hgvfs, requirements)
455 afterhgrcload(ui, wdirvfs, hgvfs, requirements)
456 extensions.loadall(ui)
456 extensions.loadall(ui)
457 extensions.populateui(ui)
457 extensions.populateui(ui)
458
458
459 # Set of module names of extensions loaded for this repository.
459 # Set of module names of extensions loaded for this repository.
460 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)}
460 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)}
461
461
462 supportedrequirements = gathersupportedrequirements(ui)
462 supportedrequirements = gathersupportedrequirements(ui)
463
463
464 # We first validate the requirements are known.
464 # We first validate the requirements are known.
465 ensurerequirementsrecognized(requirements, supportedrequirements)
465 ensurerequirementsrecognized(requirements, supportedrequirements)
466
466
467 # Then we validate that the known set is reasonable to use together.
467 # Then we validate that the known set is reasonable to use together.
468 ensurerequirementscompatible(ui, requirements)
468 ensurerequirementscompatible(ui, requirements)
469
469
470 # TODO there are unhandled edge cases related to opening repositories with
470 # TODO there are unhandled edge cases related to opening repositories with
471 # shared storage. If storage is shared, we should also test for requirements
471 # shared storage. If storage is shared, we should also test for requirements
472 # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in
472 # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in
473 # that repo, as that repo may load extensions needed to open it. This is a
473 # that repo, as that repo may load extensions needed to open it. This is a
474 # bit complicated because we don't want the other hgrc to overwrite settings
474 # bit complicated because we don't want the other hgrc to overwrite settings
475 # in this hgrc.
475 # in this hgrc.
476 #
476 #
477 # This bug is somewhat mitigated by the fact that we copy the .hg/requires
477 # This bug is somewhat mitigated by the fact that we copy the .hg/requires
478 # file when sharing repos. But if a requirement is added after the share is
478 # file when sharing repos. But if a requirement is added after the share is
479 # performed, thereby introducing a new requirement for the opener, we may
479 # performed, thereby introducing a new requirement for the opener, we may
480 # will not see that and could encounter a run-time error interacting with
480 # will not see that and could encounter a run-time error interacting with
481 # that shared store since it has an unknown-to-us requirement.
481 # that shared store since it has an unknown-to-us requirement.
482
482
483 # At this point, we know we should be capable of opening the repository.
483 # At this point, we know we should be capable of opening the repository.
484 # Now get on with doing that.
484 # Now get on with doing that.
485
485
486 features = set()
486 features = set()
487
487
488 # The "store" part of the repository holds versioned data. How it is
488 # The "store" part of the repository holds versioned data. How it is
489 # accessed is determined by various requirements. The ``shared`` or
489 # accessed is determined by various requirements. The ``shared`` or
490 # ``relshared`` requirements indicate the store lives in the path contained
490 # ``relshared`` requirements indicate the store lives in the path contained
491 # in the ``.hg/sharedpath`` file. This is an absolute path for
491 # in the ``.hg/sharedpath`` file. This is an absolute path for
492 # ``shared`` and relative to ``.hg/`` for ``relshared``.
492 # ``shared`` and relative to ``.hg/`` for ``relshared``.
493 if b'shared' in requirements or b'relshared' in requirements:
493 if b'shared' in requirements or b'relshared' in requirements:
494 sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n')
494 sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n')
495 if b'relshared' in requirements:
495 if b'relshared' in requirements:
496 sharedpath = hgvfs.join(sharedpath)
496 sharedpath = hgvfs.join(sharedpath)
497
497
498 sharedvfs = vfsmod.vfs(sharedpath, realpath=True)
498 sharedvfs = vfsmod.vfs(sharedpath, realpath=True)
499
499
500 if not sharedvfs.exists():
500 if not sharedvfs.exists():
501 raise error.RepoError(_(b'.hg/sharedpath points to nonexistent '
501 raise error.RepoError(_(b'.hg/sharedpath points to nonexistent '
502 b'directory %s') % sharedvfs.base)
502 b'directory %s') % sharedvfs.base)
503
503
504 features.add(repository.REPO_FEATURE_SHARED_STORAGE)
504 features.add(repository.REPO_FEATURE_SHARED_STORAGE)
505
505
506 storebasepath = sharedvfs.base
506 storebasepath = sharedvfs.base
507 cachepath = sharedvfs.join(b'cache')
507 cachepath = sharedvfs.join(b'cache')
508 else:
508 else:
509 storebasepath = hgvfs.base
509 storebasepath = hgvfs.base
510 cachepath = hgvfs.join(b'cache')
510 cachepath = hgvfs.join(b'cache')
511 wcachepath = hgvfs.join(b'wcache')
511 wcachepath = hgvfs.join(b'wcache')
512
512
513
513
514 # The store has changed over time and the exact layout is dictated by
514 # The store has changed over time and the exact layout is dictated by
515 # requirements. The store interface abstracts differences across all
515 # requirements. The store interface abstracts differences across all
516 # of them.
516 # of them.
517 store = makestore(requirements, storebasepath,
517 store = makestore(requirements, storebasepath,
518 lambda base: vfsmod.vfs(base, cacheaudited=True))
518 lambda base: vfsmod.vfs(base, cacheaudited=True))
519 hgvfs.createmode = store.createmode
519 hgvfs.createmode = store.createmode
520
520
521 storevfs = store.vfs
521 storevfs = store.vfs
522 storevfs.options = resolvestorevfsoptions(ui, requirements, features)
522 storevfs.options = resolvestorevfsoptions(ui, requirements, features)
523
523
524 # The cache vfs is used to manage cache files.
524 # The cache vfs is used to manage cache files.
525 cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
525 cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
526 cachevfs.createmode = store.createmode
526 cachevfs.createmode = store.createmode
527 # The cache vfs is used to manage cache files related to the working copy
527 # The cache vfs is used to manage cache files related to the working copy
528 wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True)
528 wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True)
529 wcachevfs.createmode = store.createmode
529 wcachevfs.createmode = store.createmode
530
530
531 # Now resolve the type for the repository object. We do this by repeatedly
531 # Now resolve the type for the repository object. We do this by repeatedly
532 # calling a factory function to produces types for specific aspects of the
532 # calling a factory function to produces types for specific aspects of the
533 # repo's operation. The aggregate returned types are used as base classes
533 # repo's operation. The aggregate returned types are used as base classes
534 # for a dynamically-derived type, which will represent our new repository.
534 # for a dynamically-derived type, which will represent our new repository.
535
535
536 bases = []
536 bases = []
537 extrastate = {}
537 extrastate = {}
538
538
539 for iface, fn in REPO_INTERFACES:
539 for iface, fn in REPO_INTERFACES:
540 # We pass all potentially useful state to give extensions tons of
540 # We pass all potentially useful state to give extensions tons of
541 # flexibility.
541 # flexibility.
542 typ = fn()(ui=ui,
542 typ = fn()(ui=ui,
543 intents=intents,
543 intents=intents,
544 requirements=requirements,
544 requirements=requirements,
545 features=features,
545 features=features,
546 wdirvfs=wdirvfs,
546 wdirvfs=wdirvfs,
547 hgvfs=hgvfs,
547 hgvfs=hgvfs,
548 store=store,
548 store=store,
549 storevfs=storevfs,
549 storevfs=storevfs,
550 storeoptions=storevfs.options,
550 storeoptions=storevfs.options,
551 cachevfs=cachevfs,
551 cachevfs=cachevfs,
552 wcachevfs=wcachevfs,
552 wcachevfs=wcachevfs,
553 extensionmodulenames=extensionmodulenames,
553 extensionmodulenames=extensionmodulenames,
554 extrastate=extrastate,
554 extrastate=extrastate,
555 baseclasses=bases)
555 baseclasses=bases)
556
556
557 if not isinstance(typ, type):
557 if not isinstance(typ, type):
558 raise error.ProgrammingError('unable to construct type for %s' %
558 raise error.ProgrammingError('unable to construct type for %s' %
559 iface)
559 iface)
560
560
561 bases.append(typ)
561 bases.append(typ)
562
562
563 # type() allows you to use characters in type names that wouldn't be
563 # type() allows you to use characters in type names that wouldn't be
564 # recognized as Python symbols in source code. We abuse that to add
564 # recognized as Python symbols in source code. We abuse that to add
565 # rich information about our constructed repo.
565 # rich information about our constructed repo.
566 name = pycompat.sysstr(b'derivedrepo:%s<%s>' % (
566 name = pycompat.sysstr(b'derivedrepo:%s<%s>' % (
567 wdirvfs.base,
567 wdirvfs.base,
568 b','.join(sorted(requirements))))
568 b','.join(sorted(requirements))))
569
569
570 cls = type(name, tuple(bases), {})
570 cls = type(name, tuple(bases), {})
571
571
572 return cls(
572 return cls(
573 baseui=baseui,
573 baseui=baseui,
574 ui=ui,
574 ui=ui,
575 origroot=path,
575 origroot=path,
576 wdirvfs=wdirvfs,
576 wdirvfs=wdirvfs,
577 hgvfs=hgvfs,
577 hgvfs=hgvfs,
578 requirements=requirements,
578 requirements=requirements,
579 supportedrequirements=supportedrequirements,
579 supportedrequirements=supportedrequirements,
580 sharedpath=storebasepath,
580 sharedpath=storebasepath,
581 store=store,
581 store=store,
582 cachevfs=cachevfs,
582 cachevfs=cachevfs,
583 wcachevfs=wcachevfs,
583 wcachevfs=wcachevfs,
584 features=features,
584 features=features,
585 intents=intents)
585 intents=intents)
586
586
587 def loadhgrc(ui, wdirvfs, hgvfs, requirements):
587 def loadhgrc(ui, wdirvfs, hgvfs, requirements):
588 """Load hgrc files/content into a ui instance.
588 """Load hgrc files/content into a ui instance.
589
589
590 This is called during repository opening to load any additional
590 This is called during repository opening to load any additional
591 config files or settings relevant to the current repository.
591 config files or settings relevant to the current repository.
592
592
593 Returns a bool indicating whether any additional configs were loaded.
593 Returns a bool indicating whether any additional configs were loaded.
594
594
595 Extensions should monkeypatch this function to modify how per-repo
595 Extensions should monkeypatch this function to modify how per-repo
596 configs are loaded. For example, an extension may wish to pull in
596 configs are loaded. For example, an extension may wish to pull in
597 configs from alternate files or sources.
597 configs from alternate files or sources.
598 """
598 """
599 try:
599 try:
600 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base)
600 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base)
601 return True
601 return True
602 except IOError:
602 except IOError:
603 return False
603 return False
604
604
605 def afterhgrcload(ui, wdirvfs, hgvfs, requirements):
605 def afterhgrcload(ui, wdirvfs, hgvfs, requirements):
606 """Perform additional actions after .hg/hgrc is loaded.
606 """Perform additional actions after .hg/hgrc is loaded.
607
607
608 This function is called during repository loading immediately after
608 This function is called during repository loading immediately after
609 the .hg/hgrc file is loaded and before per-repo extensions are loaded.
609 the .hg/hgrc file is loaded and before per-repo extensions are loaded.
610
610
611 The function can be used to validate configs, automatically add
611 The function can be used to validate configs, automatically add
612 options (including extensions) based on requirements, etc.
612 options (including extensions) based on requirements, etc.
613 """
613 """
614
614
615 # Map of requirements to list of extensions to load automatically when
615 # Map of requirements to list of extensions to load automatically when
616 # requirement is present.
616 # requirement is present.
617 autoextensions = {
617 autoextensions = {
618 b'largefiles': [b'largefiles'],
618 b'largefiles': [b'largefiles'],
619 b'lfs': [b'lfs'],
619 b'lfs': [b'lfs'],
620 }
620 }
621
621
622 for requirement, names in sorted(autoextensions.items()):
622 for requirement, names in sorted(autoextensions.items()):
623 if requirement not in requirements:
623 if requirement not in requirements:
624 continue
624 continue
625
625
626 for name in names:
626 for name in names:
627 if not ui.hasconfig(b'extensions', name):
627 if not ui.hasconfig(b'extensions', name):
628 ui.setconfig(b'extensions', name, b'', source='autoload')
628 ui.setconfig(b'extensions', name, b'', source='autoload')
629
629
630 def gathersupportedrequirements(ui):
630 def gathersupportedrequirements(ui):
631 """Determine the complete set of recognized requirements."""
631 """Determine the complete set of recognized requirements."""
632 # Start with all requirements supported by this file.
632 # Start with all requirements supported by this file.
633 supported = set(localrepository._basesupported)
633 supported = set(localrepository._basesupported)
634
634
635 # Execute ``featuresetupfuncs`` entries if they belong to an extension
635 # Execute ``featuresetupfuncs`` entries if they belong to an extension
636 # relevant to this ui instance.
636 # relevant to this ui instance.
637 modules = {m.__name__ for n, m in extensions.extensions(ui)}
637 modules = {m.__name__ for n, m in extensions.extensions(ui)}
638
638
639 for fn in featuresetupfuncs:
639 for fn in featuresetupfuncs:
640 if fn.__module__ in modules:
640 if fn.__module__ in modules:
641 fn(ui, supported)
641 fn(ui, supported)
642
642
643 # Add derived requirements from registered compression engines.
643 # Add derived requirements from registered compression engines.
644 for name in util.compengines:
644 for name in util.compengines:
645 engine = util.compengines[name]
645 engine = util.compengines[name]
646 if engine.revlogheader():
646 if engine.revlogheader():
647 supported.add(b'exp-compression-%s' % name)
647 supported.add(b'exp-compression-%s' % name)
648
648
649 return supported
649 return supported
650
650
651 def ensurerequirementsrecognized(requirements, supported):
651 def ensurerequirementsrecognized(requirements, supported):
652 """Validate that a set of local requirements is recognized.
652 """Validate that a set of local requirements is recognized.
653
653
654 Receives a set of requirements. Raises an ``error.RepoError`` if there
654 Receives a set of requirements. Raises an ``error.RepoError`` if there
655 exists any requirement in that set that currently loaded code doesn't
655 exists any requirement in that set that currently loaded code doesn't
656 recognize.
656 recognize.
657
657
658 Returns a set of supported requirements.
658 Returns a set of supported requirements.
659 """
659 """
660 missing = set()
660 missing = set()
661
661
662 for requirement in requirements:
662 for requirement in requirements:
663 if requirement in supported:
663 if requirement in supported:
664 continue
664 continue
665
665
666 if not requirement or not requirement[0:1].isalnum():
666 if not requirement or not requirement[0:1].isalnum():
667 raise error.RequirementError(_(b'.hg/requires file is corrupt'))
667 raise error.RequirementError(_(b'.hg/requires file is corrupt'))
668
668
669 missing.add(requirement)
669 missing.add(requirement)
670
670
671 if missing:
671 if missing:
672 raise error.RequirementError(
672 raise error.RequirementError(
673 _(b'repository requires features unknown to this Mercurial: %s') %
673 _(b'repository requires features unknown to this Mercurial: %s') %
674 b' '.join(sorted(missing)),
674 b' '.join(sorted(missing)),
675 hint=_(b'see https://mercurial-scm.org/wiki/MissingRequirement '
675 hint=_(b'see https://mercurial-scm.org/wiki/MissingRequirement '
676 b'for more information'))
676 b'for more information'))
677
677
678 def ensurerequirementscompatible(ui, requirements):
678 def ensurerequirementscompatible(ui, requirements):
679 """Validates that a set of recognized requirements is mutually compatible.
679 """Validates that a set of recognized requirements is mutually compatible.
680
680
681 Some requirements may not be compatible with others or require
681 Some requirements may not be compatible with others or require
682 config options that aren't enabled. This function is called during
682 config options that aren't enabled. This function is called during
683 repository opening to ensure that the set of requirements needed
683 repository opening to ensure that the set of requirements needed
684 to open a repository is sane and compatible with config options.
684 to open a repository is sane and compatible with config options.
685
685
686 Extensions can monkeypatch this function to perform additional
686 Extensions can monkeypatch this function to perform additional
687 checking.
687 checking.
688
688
689 ``error.RepoError`` should be raised on failure.
689 ``error.RepoError`` should be raised on failure.
690 """
690 """
691 if b'exp-sparse' in requirements and not sparse.enabled:
691 if b'exp-sparse' in requirements and not sparse.enabled:
692 raise error.RepoError(_(b'repository is using sparse feature but '
692 raise error.RepoError(_(b'repository is using sparse feature but '
693 b'sparse is not enabled; enable the '
693 b'sparse is not enabled; enable the '
694 b'"sparse" extensions to access'))
694 b'"sparse" extensions to access'))
695
695
696 def makestore(requirements, path, vfstype):
696 def makestore(requirements, path, vfstype):
697 """Construct a storage object for a repository."""
697 """Construct a storage object for a repository."""
698 if b'store' in requirements:
698 if b'store' in requirements:
699 if b'fncache' in requirements:
699 if b'fncache' in requirements:
700 return storemod.fncachestore(path, vfstype,
700 return storemod.fncachestore(path, vfstype,
701 b'dotencode' in requirements)
701 b'dotencode' in requirements)
702
702
703 return storemod.encodedstore(path, vfstype)
703 return storemod.encodedstore(path, vfstype)
704
704
705 return storemod.basicstore(path, vfstype)
705 return storemod.basicstore(path, vfstype)
706
706
707 def resolvestorevfsoptions(ui, requirements, features):
707 def resolvestorevfsoptions(ui, requirements, features):
708 """Resolve the options to pass to the store vfs opener.
708 """Resolve the options to pass to the store vfs opener.
709
709
710 The returned dict is used to influence behavior of the storage layer.
710 The returned dict is used to influence behavior of the storage layer.
711 """
711 """
712 options = {}
712 options = {}
713
713
714 if b'treemanifest' in requirements:
714 if b'treemanifest' in requirements:
715 options[b'treemanifest'] = True
715 options[b'treemanifest'] = True
716
716
717 # experimental config: format.manifestcachesize
717 # experimental config: format.manifestcachesize
718 manifestcachesize = ui.configint(b'format', b'manifestcachesize')
718 manifestcachesize = ui.configint(b'format', b'manifestcachesize')
719 if manifestcachesize is not None:
719 if manifestcachesize is not None:
720 options[b'manifestcachesize'] = manifestcachesize
720 options[b'manifestcachesize'] = manifestcachesize
721
721
722 # In the absence of another requirement superseding a revlog-related
722 # In the absence of another requirement superseding a revlog-related
723 # requirement, we have to assume the repo is using revlog version 0.
723 # requirement, we have to assume the repo is using revlog version 0.
724 # This revlog format is super old and we don't bother trying to parse
724 # This revlog format is super old and we don't bother trying to parse
725 # opener options for it because those options wouldn't do anything
725 # opener options for it because those options wouldn't do anything
726 # meaningful on such old repos.
726 # meaningful on such old repos.
727 if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements:
727 if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements:
728 options.update(resolverevlogstorevfsoptions(ui, requirements, features))
728 options.update(resolverevlogstorevfsoptions(ui, requirements, features))
729
729
730 return options
730 return options
731
731
732 def resolverevlogstorevfsoptions(ui, requirements, features):
732 def resolverevlogstorevfsoptions(ui, requirements, features):
733 """Resolve opener options specific to revlogs."""
733 """Resolve opener options specific to revlogs."""
734
734
735 options = {}
735 options = {}
736 options[b'flagprocessors'] = {}
736 options[b'flagprocessors'] = {}
737
737
738 if b'revlogv1' in requirements:
738 if b'revlogv1' in requirements:
739 options[b'revlogv1'] = True
739 options[b'revlogv1'] = True
740 if REVLOGV2_REQUIREMENT in requirements:
740 if REVLOGV2_REQUIREMENT in requirements:
741 options[b'revlogv2'] = True
741 options[b'revlogv2'] = True
742
742
743 if b'generaldelta' in requirements:
743 if b'generaldelta' in requirements:
744 options[b'generaldelta'] = True
744 options[b'generaldelta'] = True
745
745
746 # experimental config: format.chunkcachesize
746 # experimental config: format.chunkcachesize
747 chunkcachesize = ui.configint(b'format', b'chunkcachesize')
747 chunkcachesize = ui.configint(b'format', b'chunkcachesize')
748 if chunkcachesize is not None:
748 if chunkcachesize is not None:
749 options[b'chunkcachesize'] = chunkcachesize
749 options[b'chunkcachesize'] = chunkcachesize
750
750
751 deltabothparents = ui.configbool(b'storage',
751 deltabothparents = ui.configbool(b'storage',
752 b'revlog.optimize-delta-parent-choice')
752 b'revlog.optimize-delta-parent-choice')
753 options[b'deltabothparents'] = deltabothparents
753 options[b'deltabothparents'] = deltabothparents
754
754
755 options[b'lazydeltabase'] = not scmutil.gddeltaconfig(ui)
755 options[b'lazydeltabase'] = not scmutil.gddeltaconfig(ui)
756
756
757 chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan')
757 chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan')
758 if 0 <= chainspan:
758 if 0 <= chainspan:
759 options[b'maxdeltachainspan'] = chainspan
759 options[b'maxdeltachainspan'] = chainspan
760
760
761 mmapindexthreshold = ui.configbytes(b'experimental',
761 mmapindexthreshold = ui.configbytes(b'experimental',
762 b'mmapindexthreshold')
762 b'mmapindexthreshold')
763 if mmapindexthreshold is not None:
763 if mmapindexthreshold is not None:
764 options[b'mmapindexthreshold'] = mmapindexthreshold
764 options[b'mmapindexthreshold'] = mmapindexthreshold
765
765
766 withsparseread = ui.configbool(b'experimental', b'sparse-read')
766 withsparseread = ui.configbool(b'experimental', b'sparse-read')
767 srdensitythres = float(ui.config(b'experimental',
767 srdensitythres = float(ui.config(b'experimental',
768 b'sparse-read.density-threshold'))
768 b'sparse-read.density-threshold'))
769 srmingapsize = ui.configbytes(b'experimental',
769 srmingapsize = ui.configbytes(b'experimental',
770 b'sparse-read.min-gap-size')
770 b'sparse-read.min-gap-size')
771 options[b'with-sparse-read'] = withsparseread
771 options[b'with-sparse-read'] = withsparseread
772 options[b'sparse-read-density-threshold'] = srdensitythres
772 options[b'sparse-read-density-threshold'] = srdensitythres
773 options[b'sparse-read-min-gap-size'] = srmingapsize
773 options[b'sparse-read-min-gap-size'] = srmingapsize
774
774
775 sparserevlog = SPARSEREVLOG_REQUIREMENT in requirements
775 sparserevlog = SPARSEREVLOG_REQUIREMENT in requirements
776 options[b'sparse-revlog'] = sparserevlog
776 options[b'sparse-revlog'] = sparserevlog
777 if sparserevlog:
777 if sparserevlog:
778 options[b'generaldelta'] = True
778 options[b'generaldelta'] = True
779
779
780 maxchainlen = None
780 maxchainlen = None
781 if sparserevlog:
781 if sparserevlog:
782 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
782 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
783 # experimental config: format.maxchainlen
783 # experimental config: format.maxchainlen
784 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen)
784 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen)
785 if maxchainlen is not None:
785 if maxchainlen is not None:
786 options[b'maxchainlen'] = maxchainlen
786 options[b'maxchainlen'] = maxchainlen
787
787
788 for r in requirements:
788 for r in requirements:
789 if r.startswith(b'exp-compression-'):
789 if r.startswith(b'exp-compression-'):
790 options[b'compengine'] = r[len(b'exp-compression-'):]
790 options[b'compengine'] = r[len(b'exp-compression-'):]
791
791
792 if repository.NARROW_REQUIREMENT in requirements:
792 if repository.NARROW_REQUIREMENT in requirements:
793 options[b'enableellipsis'] = True
793 options[b'enableellipsis'] = True
794
794
795 return options
795 return options
796
796
797 def makemain(**kwargs):
797 def makemain(**kwargs):
798 """Produce a type conforming to ``ilocalrepositorymain``."""
798 """Produce a type conforming to ``ilocalrepositorymain``."""
799 return localrepository
799 return localrepository
800
800
801 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
801 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
802 class revlogfilestorage(object):
802 class revlogfilestorage(object):
803 """File storage when using revlogs."""
803 """File storage when using revlogs."""
804
804
805 def file(self, path):
805 def file(self, path):
806 if path[0] == b'/':
806 if path[0] == b'/':
807 path = path[1:]
807 path = path[1:]
808
808
809 return filelog.filelog(self.svfs, path)
809 return filelog.filelog(self.svfs, path)
810
810
811 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
811 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
812 class revlognarrowfilestorage(object):
812 class revlognarrowfilestorage(object):
813 """File storage when using revlogs and narrow files."""
813 """File storage when using revlogs and narrow files."""
814
814
815 def file(self, path):
815 def file(self, path):
816 if path[0] == b'/':
816 if path[0] == b'/':
817 path = path[1:]
817 path = path[1:]
818
818
819 return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
819 return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
820
820
821 def makefilestorage(requirements, features, **kwargs):
821 def makefilestorage(requirements, features, **kwargs):
822 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
822 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
823 features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE)
823 features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE)
824 features.add(repository.REPO_FEATURE_STREAM_CLONE)
824 features.add(repository.REPO_FEATURE_STREAM_CLONE)
825
825
826 if repository.NARROW_REQUIREMENT in requirements:
826 if repository.NARROW_REQUIREMENT in requirements:
827 return revlognarrowfilestorage
827 return revlognarrowfilestorage
828 else:
828 else:
829 return revlogfilestorage
829 return revlogfilestorage
830
830
831 # List of repository interfaces and factory functions for them. Each
831 # List of repository interfaces and factory functions for them. Each
832 # will be called in order during ``makelocalrepository()`` to iteratively
832 # will be called in order during ``makelocalrepository()`` to iteratively
833 # derive the final type for a local repository instance. We capture the
833 # derive the final type for a local repository instance. We capture the
834 # function as a lambda so we don't hold a reference and the module-level
834 # function as a lambda so we don't hold a reference and the module-level
835 # functions can be wrapped.
835 # functions can be wrapped.
836 REPO_INTERFACES = [
836 REPO_INTERFACES = [
837 (repository.ilocalrepositorymain, lambda: makemain),
837 (repository.ilocalrepositorymain, lambda: makemain),
838 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage),
838 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage),
839 ]
839 ]
840
840
841 @interfaceutil.implementer(repository.ilocalrepositorymain)
841 @interfaceutil.implementer(repository.ilocalrepositorymain)
842 class localrepository(object):
842 class localrepository(object):
843 """Main class for representing local repositories.
843 """Main class for representing local repositories.
844
844
845 All local repositories are instances of this class.
845 All local repositories are instances of this class.
846
846
847 Constructed on its own, instances of this class are not usable as
847 Constructed on its own, instances of this class are not usable as
848 repository objects. To obtain a usable repository object, call
848 repository objects. To obtain a usable repository object, call
849 ``hg.repository()``, ``localrepo.instance()``, or
849 ``hg.repository()``, ``localrepo.instance()``, or
850 ``localrepo.makelocalrepository()``. The latter is the lowest-level.
850 ``localrepo.makelocalrepository()``. The latter is the lowest-level.
851 ``instance()`` adds support for creating new repositories.
851 ``instance()`` adds support for creating new repositories.
852 ``hg.repository()`` adds more extension integration, including calling
852 ``hg.repository()`` adds more extension integration, including calling
853 ``reposetup()``. Generally speaking, ``hg.repository()`` should be
853 ``reposetup()``. Generally speaking, ``hg.repository()`` should be
854 used.
854 used.
855 """
855 """
856
856
857 # obsolete experimental requirements:
857 # obsolete experimental requirements:
858 # - manifestv2: An experimental new manifest format that allowed
858 # - manifestv2: An experimental new manifest format that allowed
859 # for stem compression of long paths. Experiment ended up not
859 # for stem compression of long paths. Experiment ended up not
860 # being successful (repository sizes went up due to worse delta
860 # being successful (repository sizes went up due to worse delta
861 # chains), and the code was deleted in 4.6.
861 # chains), and the code was deleted in 4.6.
862 supportedformats = {
862 supportedformats = {
863 'revlogv1',
863 'revlogv1',
864 'generaldelta',
864 'generaldelta',
865 'treemanifest',
865 'treemanifest',
866 REVLOGV2_REQUIREMENT,
866 REVLOGV2_REQUIREMENT,
867 SPARSEREVLOG_REQUIREMENT,
867 SPARSEREVLOG_REQUIREMENT,
868 }
868 }
869 _basesupported = supportedformats | {
869 _basesupported = supportedformats | {
870 'store',
870 'store',
871 'fncache',
871 'fncache',
872 'shared',
872 'shared',
873 'relshared',
873 'relshared',
874 'dotencode',
874 'dotencode',
875 'exp-sparse',
875 'exp-sparse',
876 'internal-phase'
876 'internal-phase'
877 }
877 }
878
878
879 # list of prefix for file which can be written without 'wlock'
879 # list of prefix for file which can be written without 'wlock'
880 # Extensions should extend this list when needed
880 # Extensions should extend this list when needed
881 _wlockfreeprefix = {
881 _wlockfreeprefix = {
882 # We migh consider requiring 'wlock' for the next
882 # We migh consider requiring 'wlock' for the next
883 # two, but pretty much all the existing code assume
883 # two, but pretty much all the existing code assume
884 # wlock is not needed so we keep them excluded for
884 # wlock is not needed so we keep them excluded for
885 # now.
885 # now.
886 'hgrc',
886 'hgrc',
887 'requires',
887 'requires',
888 # XXX cache is a complicatged business someone
888 # XXX cache is a complicatged business someone
889 # should investigate this in depth at some point
889 # should investigate this in depth at some point
890 'cache/',
890 'cache/',
891 # XXX shouldn't be dirstate covered by the wlock?
891 # XXX shouldn't be dirstate covered by the wlock?
892 'dirstate',
892 'dirstate',
893 # XXX bisect was still a bit too messy at the time
893 # XXX bisect was still a bit too messy at the time
894 # this changeset was introduced. Someone should fix
894 # this changeset was introduced. Someone should fix
895 # the remainig bit and drop this line
895 # the remainig bit and drop this line
896 'bisect.state',
896 'bisect.state',
897 }
897 }
898
898
899 def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, requirements,
899 def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, requirements,
900 supportedrequirements, sharedpath, store, cachevfs, wcachevfs,
900 supportedrequirements, sharedpath, store, cachevfs, wcachevfs,
901 features, intents=None):
901 features, intents=None):
902 """Create a new local repository instance.
902 """Create a new local repository instance.
903
903
904 Most callers should use ``hg.repository()``, ``localrepo.instance()``,
904 Most callers should use ``hg.repository()``, ``localrepo.instance()``,
905 or ``localrepo.makelocalrepository()`` for obtaining a new repository
905 or ``localrepo.makelocalrepository()`` for obtaining a new repository
906 object.
906 object.
907
907
908 Arguments:
908 Arguments:
909
909
910 baseui
910 baseui
911 ``ui.ui`` instance that ``ui`` argument was based off of.
911 ``ui.ui`` instance that ``ui`` argument was based off of.
912
912
913 ui
913 ui
914 ``ui.ui`` instance for use by the repository.
914 ``ui.ui`` instance for use by the repository.
915
915
916 origroot
916 origroot
917 ``bytes`` path to working directory root of this repository.
917 ``bytes`` path to working directory root of this repository.
918
918
919 wdirvfs
919 wdirvfs
920 ``vfs.vfs`` rooted at the working directory.
920 ``vfs.vfs`` rooted at the working directory.
921
921
922 hgvfs
922 hgvfs
923 ``vfs.vfs`` rooted at .hg/
923 ``vfs.vfs`` rooted at .hg/
924
924
925 requirements
925 requirements
926 ``set`` of bytestrings representing repository opening requirements.
926 ``set`` of bytestrings representing repository opening requirements.
927
927
928 supportedrequirements
928 supportedrequirements
929 ``set`` of bytestrings representing repository requirements that we
929 ``set`` of bytestrings representing repository requirements that we
930 know how to open. May be a supetset of ``requirements``.
930 know how to open. May be a supetset of ``requirements``.
931
931
932 sharedpath
932 sharedpath
933 ``bytes`` Defining path to storage base directory. Points to a
933 ``bytes`` Defining path to storage base directory. Points to a
934 ``.hg/`` directory somewhere.
934 ``.hg/`` directory somewhere.
935
935
936 store
936 store
937 ``store.basicstore`` (or derived) instance providing access to
937 ``store.basicstore`` (or derived) instance providing access to
938 versioned storage.
938 versioned storage.
939
939
940 cachevfs
940 cachevfs
941 ``vfs.vfs`` used for cache files.
941 ``vfs.vfs`` used for cache files.
942
942
943 wcachevfs
943 wcachevfs
944 ``vfs.vfs`` used for cache files related to the working copy.
944 ``vfs.vfs`` used for cache files related to the working copy.
945
945
946 features
946 features
947 ``set`` of bytestrings defining features/capabilities of this
947 ``set`` of bytestrings defining features/capabilities of this
948 instance.
948 instance.
949
949
950 intents
950 intents
951 ``set`` of system strings indicating what this repo will be used
951 ``set`` of system strings indicating what this repo will be used
952 for.
952 for.
953 """
953 """
954 self.baseui = baseui
954 self.baseui = baseui
955 self.ui = ui
955 self.ui = ui
956 self.origroot = origroot
956 self.origroot = origroot
957 # vfs rooted at working directory.
957 # vfs rooted at working directory.
958 self.wvfs = wdirvfs
958 self.wvfs = wdirvfs
959 self.root = wdirvfs.base
959 self.root = wdirvfs.base
960 # vfs rooted at .hg/. Used to access most non-store paths.
960 # vfs rooted at .hg/. Used to access most non-store paths.
961 self.vfs = hgvfs
961 self.vfs = hgvfs
962 self.path = hgvfs.base
962 self.path = hgvfs.base
963 self.requirements = requirements
963 self.requirements = requirements
964 self.supported = supportedrequirements
964 self.supported = supportedrequirements
965 self.sharedpath = sharedpath
965 self.sharedpath = sharedpath
966 self.store = store
966 self.store = store
967 self.cachevfs = cachevfs
967 self.cachevfs = cachevfs
968 self.wcachevfs = wcachevfs
968 self.wcachevfs = wcachevfs
969 self.features = features
969 self.features = features
970
970
971 self.filtername = None
971 self.filtername = None
972
972
973 if (self.ui.configbool('devel', 'all-warnings') or
973 if (self.ui.configbool('devel', 'all-warnings') or
974 self.ui.configbool('devel', 'check-locks')):
974 self.ui.configbool('devel', 'check-locks')):
975 self.vfs.audit = self._getvfsward(self.vfs.audit)
975 self.vfs.audit = self._getvfsward(self.vfs.audit)
976 # A list of callback to shape the phase if no data were found.
976 # A list of callback to shape the phase if no data were found.
977 # Callback are in the form: func(repo, roots) --> processed root.
977 # Callback are in the form: func(repo, roots) --> processed root.
978 # This list it to be filled by extension during repo setup
978 # This list it to be filled by extension during repo setup
979 self._phasedefaults = []
979 self._phasedefaults = []
980
980
981 color.setup(self.ui)
981 color.setup(self.ui)
982
982
983 self.spath = self.store.path
983 self.spath = self.store.path
984 self.svfs = self.store.vfs
984 self.svfs = self.store.vfs
985 self.sjoin = self.store.join
985 self.sjoin = self.store.join
986 if (self.ui.configbool('devel', 'all-warnings') or
986 if (self.ui.configbool('devel', 'all-warnings') or
987 self.ui.configbool('devel', 'check-locks')):
987 self.ui.configbool('devel', 'check-locks')):
988 if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs
988 if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs
989 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
989 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
990 else: # standard vfs
990 else: # standard vfs
991 self.svfs.audit = self._getsvfsward(self.svfs.audit)
991 self.svfs.audit = self._getsvfsward(self.svfs.audit)
992
992
993 self._dirstatevalidatewarned = False
993 self._dirstatevalidatewarned = False
994
994
995 self._branchcaches = {}
995 self._branchcaches = {}
996 self._revbranchcache = None
996 self._revbranchcache = None
997 self._filterpats = {}
997 self._filterpats = {}
998 self._datafilters = {}
998 self._datafilters = {}
999 self._transref = self._lockref = self._wlockref = None
999 self._transref = self._lockref = self._wlockref = None
1000
1000
1001 # A cache for various files under .hg/ that tracks file changes,
1001 # A cache for various files under .hg/ that tracks file changes,
1002 # (used by the filecache decorator)
1002 # (used by the filecache decorator)
1003 #
1003 #
1004 # Maps a property name to its util.filecacheentry
1004 # Maps a property name to its util.filecacheentry
1005 self._filecache = {}
1005 self._filecache = {}
1006
1006
1007 # hold sets of revision to be filtered
1007 # hold sets of revision to be filtered
1008 # should be cleared when something might have changed the filter value:
1008 # should be cleared when something might have changed the filter value:
1009 # - new changesets,
1009 # - new changesets,
1010 # - phase change,
1010 # - phase change,
1011 # - new obsolescence marker,
1011 # - new obsolescence marker,
1012 # - working directory parent change,
1012 # - working directory parent change,
1013 # - bookmark changes
1013 # - bookmark changes
1014 self.filteredrevcache = {}
1014 self.filteredrevcache = {}
1015
1015
1016 # post-dirstate-status hooks
1016 # post-dirstate-status hooks
1017 self._postdsstatus = []
1017 self._postdsstatus = []
1018
1018
1019 # generic mapping between names and nodes
1019 # generic mapping between names and nodes
1020 self.names = namespaces.namespaces()
1020 self.names = namespaces.namespaces()
1021
1021
1022 # Key to signature value.
1022 # Key to signature value.
1023 self._sparsesignaturecache = {}
1023 self._sparsesignaturecache = {}
1024 # Signature to cached matcher instance.
1024 # Signature to cached matcher instance.
1025 self._sparsematchercache = {}
1025 self._sparsematchercache = {}
1026
1026
1027 def _getvfsward(self, origfunc):
1027 def _getvfsward(self, origfunc):
1028 """build a ward for self.vfs"""
1028 """build a ward for self.vfs"""
1029 rref = weakref.ref(self)
1029 rref = weakref.ref(self)
1030 def checkvfs(path, mode=None):
1030 def checkvfs(path, mode=None):
1031 ret = origfunc(path, mode=mode)
1031 ret = origfunc(path, mode=mode)
1032 repo = rref()
1032 repo = rref()
1033 if (repo is None
1033 if (repo is None
1034 or not util.safehasattr(repo, '_wlockref')
1034 or not util.safehasattr(repo, '_wlockref')
1035 or not util.safehasattr(repo, '_lockref')):
1035 or not util.safehasattr(repo, '_lockref')):
1036 return
1036 return
1037 if mode in (None, 'r', 'rb'):
1037 if mode in (None, 'r', 'rb'):
1038 return
1038 return
1039 if path.startswith(repo.path):
1039 if path.startswith(repo.path):
1040 # truncate name relative to the repository (.hg)
1040 # truncate name relative to the repository (.hg)
1041 path = path[len(repo.path) + 1:]
1041 path = path[len(repo.path) + 1:]
1042 if path.startswith('cache/'):
1042 if path.startswith('cache/'):
1043 msg = 'accessing cache with vfs instead of cachevfs: "%s"'
1043 msg = 'accessing cache with vfs instead of cachevfs: "%s"'
1044 repo.ui.develwarn(msg % path, stacklevel=3, config="cache-vfs")
1044 repo.ui.develwarn(msg % path, stacklevel=3, config="cache-vfs")
1045 if path.startswith('journal.') or path.startswith('undo.'):
1045 if path.startswith('journal.') or path.startswith('undo.'):
1046 # journal is covered by 'lock'
1046 # journal is covered by 'lock'
1047 if repo._currentlock(repo._lockref) is None:
1047 if repo._currentlock(repo._lockref) is None:
1048 repo.ui.develwarn('write with no lock: "%s"' % path,
1048 repo.ui.develwarn('write with no lock: "%s"' % path,
1049 stacklevel=3, config='check-locks')
1049 stacklevel=3, config='check-locks')
1050 elif repo._currentlock(repo._wlockref) is None:
1050 elif repo._currentlock(repo._wlockref) is None:
1051 # rest of vfs files are covered by 'wlock'
1051 # rest of vfs files are covered by 'wlock'
1052 #
1052 #
1053 # exclude special files
1053 # exclude special files
1054 for prefix in self._wlockfreeprefix:
1054 for prefix in self._wlockfreeprefix:
1055 if path.startswith(prefix):
1055 if path.startswith(prefix):
1056 return
1056 return
1057 repo.ui.develwarn('write with no wlock: "%s"' % path,
1057 repo.ui.develwarn('write with no wlock: "%s"' % path,
1058 stacklevel=3, config='check-locks')
1058 stacklevel=3, config='check-locks')
1059 return ret
1059 return ret
1060 return checkvfs
1060 return checkvfs
1061
1061
1062 def _getsvfsward(self, origfunc):
1062 def _getsvfsward(self, origfunc):
1063 """build a ward for self.svfs"""
1063 """build a ward for self.svfs"""
1064 rref = weakref.ref(self)
1064 rref = weakref.ref(self)
1065 def checksvfs(path, mode=None):
1065 def checksvfs(path, mode=None):
1066 ret = origfunc(path, mode=mode)
1066 ret = origfunc(path, mode=mode)
1067 repo = rref()
1067 repo = rref()
1068 if repo is None or not util.safehasattr(repo, '_lockref'):
1068 if repo is None or not util.safehasattr(repo, '_lockref'):
1069 return
1069 return
1070 if mode in (None, 'r', 'rb'):
1070 if mode in (None, 'r', 'rb'):
1071 return
1071 return
1072 if path.startswith(repo.sharedpath):
1072 if path.startswith(repo.sharedpath):
1073 # truncate name relative to the repository (.hg)
1073 # truncate name relative to the repository (.hg)
1074 path = path[len(repo.sharedpath) + 1:]
1074 path = path[len(repo.sharedpath) + 1:]
1075 if repo._currentlock(repo._lockref) is None:
1075 if repo._currentlock(repo._lockref) is None:
1076 repo.ui.develwarn('write with no lock: "%s"' % path,
1076 repo.ui.develwarn('write with no lock: "%s"' % path,
1077 stacklevel=4)
1077 stacklevel=4)
1078 return ret
1078 return ret
1079 return checksvfs
1079 return checksvfs
1080
1080
1081 def close(self):
1081 def close(self):
1082 self._writecaches()
1082 self._writecaches()
1083
1083
1084 def _writecaches(self):
1084 def _writecaches(self):
1085 if self._revbranchcache:
1085 if self._revbranchcache:
1086 self._revbranchcache.write()
1086 self._revbranchcache.write()
1087
1087
1088 def _restrictcapabilities(self, caps):
1088 def _restrictcapabilities(self, caps):
1089 if self.ui.configbool('experimental', 'bundle2-advertise'):
1089 if self.ui.configbool('experimental', 'bundle2-advertise'):
1090 caps = set(caps)
1090 caps = set(caps)
1091 capsblob = bundle2.encodecaps(bundle2.getrepocaps(self,
1091 capsblob = bundle2.encodecaps(bundle2.getrepocaps(self,
1092 role='client'))
1092 role='client'))
1093 caps.add('bundle2=' + urlreq.quote(capsblob))
1093 caps.add('bundle2=' + urlreq.quote(capsblob))
1094 return caps
1094 return caps
1095
1095
1096 def _writerequirements(self):
1096 def _writerequirements(self):
1097 scmutil.writerequires(self.vfs, self.requirements)
1097 scmutil.writerequires(self.vfs, self.requirements)
1098
1098
1099 # Don't cache auditor/nofsauditor, or you'll end up with reference cycle:
1099 # Don't cache auditor/nofsauditor, or you'll end up with reference cycle:
1100 # self -> auditor -> self._checknested -> self
1100 # self -> auditor -> self._checknested -> self
1101
1101
1102 @property
1102 @property
1103 def auditor(self):
1103 def auditor(self):
1104 # This is only used by context.workingctx.match in order to
1104 # This is only used by context.workingctx.match in order to
1105 # detect files in subrepos.
1105 # detect files in subrepos.
1106 return pathutil.pathauditor(self.root, callback=self._checknested)
1106 return pathutil.pathauditor(self.root, callback=self._checknested)
1107
1107
1108 @property
1108 @property
1109 def nofsauditor(self):
1109 def nofsauditor(self):
1110 # This is only used by context.basectx.match in order to detect
1110 # This is only used by context.basectx.match in order to detect
1111 # files in subrepos.
1111 # files in subrepos.
1112 return pathutil.pathauditor(self.root, callback=self._checknested,
1112 return pathutil.pathauditor(self.root, callback=self._checknested,
1113 realfs=False, cached=True)
1113 realfs=False, cached=True)
1114
1114
1115 def _checknested(self, path):
1115 def _checknested(self, path):
1116 """Determine if path is a legal nested repository."""
1116 """Determine if path is a legal nested repository."""
1117 if not path.startswith(self.root):
1117 if not path.startswith(self.root):
1118 return False
1118 return False
1119 subpath = path[len(self.root) + 1:]
1119 subpath = path[len(self.root) + 1:]
1120 normsubpath = util.pconvert(subpath)
1120 normsubpath = util.pconvert(subpath)
1121
1121
1122 # XXX: Checking against the current working copy is wrong in
1122 # XXX: Checking against the current working copy is wrong in
1123 # the sense that it can reject things like
1123 # the sense that it can reject things like
1124 #
1124 #
1125 # $ hg cat -r 10 sub/x.txt
1125 # $ hg cat -r 10 sub/x.txt
1126 #
1126 #
1127 # if sub/ is no longer a subrepository in the working copy
1127 # if sub/ is no longer a subrepository in the working copy
1128 # parent revision.
1128 # parent revision.
1129 #
1129 #
1130 # However, it can of course also allow things that would have
1130 # However, it can of course also allow things that would have
1131 # been rejected before, such as the above cat command if sub/
1131 # been rejected before, such as the above cat command if sub/
1132 # is a subrepository now, but was a normal directory before.
1132 # is a subrepository now, but was a normal directory before.
1133 # The old path auditor would have rejected by mistake since it
1133 # The old path auditor would have rejected by mistake since it
1134 # panics when it sees sub/.hg/.
1134 # panics when it sees sub/.hg/.
1135 #
1135 #
1136 # All in all, checking against the working copy seems sensible
1136 # All in all, checking against the working copy seems sensible
1137 # since we want to prevent access to nested repositories on
1137 # since we want to prevent access to nested repositories on
1138 # the filesystem *now*.
1138 # the filesystem *now*.
1139 ctx = self[None]
1139 ctx = self[None]
1140 parts = util.splitpath(subpath)
1140 parts = util.splitpath(subpath)
1141 while parts:
1141 while parts:
1142 prefix = '/'.join(parts)
1142 prefix = '/'.join(parts)
1143 if prefix in ctx.substate:
1143 if prefix in ctx.substate:
1144 if prefix == normsubpath:
1144 if prefix == normsubpath:
1145 return True
1145 return True
1146 else:
1146 else:
1147 sub = ctx.sub(prefix)
1147 sub = ctx.sub(prefix)
1148 return sub.checknested(subpath[len(prefix) + 1:])
1148 return sub.checknested(subpath[len(prefix) + 1:])
1149 else:
1149 else:
1150 parts.pop()
1150 parts.pop()
1151 return False
1151 return False
1152
1152
1153 def peer(self):
1153 def peer(self):
1154 return localpeer(self) # not cached to avoid reference cycle
1154 return localpeer(self) # not cached to avoid reference cycle
1155
1155
1156 def unfiltered(self):
1156 def unfiltered(self):
1157 """Return unfiltered version of the repository
1157 """Return unfiltered version of the repository
1158
1158
1159 Intended to be overwritten by filtered repo."""
1159 Intended to be overwritten by filtered repo."""
1160 return self
1160 return self
1161
1161
1162 def filtered(self, name, visibilityexceptions=None):
1162 def filtered(self, name, visibilityexceptions=None):
1163 """Return a filtered version of a repository"""
1163 """Return a filtered version of a repository"""
1164 cls = repoview.newtype(self.unfiltered().__class__)
1164 cls = repoview.newtype(self.unfiltered().__class__)
1165 return cls(self, name, visibilityexceptions)
1165 return cls(self, name, visibilityexceptions)
1166
1166
1167 @repofilecache('bookmarks', 'bookmarks.current')
1167 @repofilecache('bookmarks', 'bookmarks.current')
1168 def _bookmarks(self):
1168 def _bookmarks(self):
1169 return bookmarks.bmstore(self)
1169 return bookmarks.bmstore(self)
1170
1170
1171 @property
1171 @property
1172 def _activebookmark(self):
1172 def _activebookmark(self):
1173 return self._bookmarks.active
1173 return self._bookmarks.active
1174
1174
1175 # _phasesets depend on changelog. what we need is to call
1175 # _phasesets depend on changelog. what we need is to call
1176 # _phasecache.invalidate() if '00changelog.i' was changed, but it
1176 # _phasecache.invalidate() if '00changelog.i' was changed, but it
1177 # can't be easily expressed in filecache mechanism.
1177 # can't be easily expressed in filecache mechanism.
1178 @storecache('phaseroots', '00changelog.i')
1178 @storecache('phaseroots', '00changelog.i')
1179 def _phasecache(self):
1179 def _phasecache(self):
1180 return phases.phasecache(self, self._phasedefaults)
1180 return phases.phasecache(self, self._phasedefaults)
1181
1181
1182 @storecache('obsstore')
1182 @storecache('obsstore')
1183 def obsstore(self):
1183 def obsstore(self):
1184 return obsolete.makestore(self.ui, self)
1184 return obsolete.makestore(self.ui, self)
1185
1185
1186 @storecache('00changelog.i')
1186 @storecache('00changelog.i')
1187 def changelog(self):
1187 def changelog(self):
1188 return changelog.changelog(self.svfs,
1188 return changelog.changelog(self.svfs,
1189 trypending=txnutil.mayhavepending(self.root))
1189 trypending=txnutil.mayhavepending(self.root))
1190
1190
1191 @storecache('00manifest.i')
1191 @storecache('00manifest.i')
1192 def manifestlog(self):
1192 def manifestlog(self):
1193 rootstore = manifest.manifestrevlog(self.svfs)
1193 rootstore = manifest.manifestrevlog(self.svfs)
1194 return manifest.manifestlog(self.svfs, self, rootstore,
1194 return manifest.manifestlog(self.svfs, self, rootstore,
1195 self._storenarrowmatch)
1195 self._storenarrowmatch)
1196
1196
1197 @repofilecache('dirstate')
1197 @repofilecache('dirstate')
1198 def dirstate(self):
1198 def dirstate(self):
1199 return self._makedirstate()
1199 return self._makedirstate()
1200
1200
1201 def _makedirstate(self):
1201 def _makedirstate(self):
1202 """Extension point for wrapping the dirstate per-repo."""
1202 """Extension point for wrapping the dirstate per-repo."""
1203 sparsematchfn = lambda: sparse.matcher(self)
1203 sparsematchfn = lambda: sparse.matcher(self)
1204
1204
1205 return dirstate.dirstate(self.vfs, self.ui, self.root,
1205 return dirstate.dirstate(self.vfs, self.ui, self.root,
1206 self._dirstatevalidate, sparsematchfn)
1206 self._dirstatevalidate, sparsematchfn)
1207
1207
1208 def _dirstatevalidate(self, node):
1208 def _dirstatevalidate(self, node):
1209 try:
1209 try:
1210 self.changelog.rev(node)
1210 self.changelog.rev(node)
1211 return node
1211 return node
1212 except error.LookupError:
1212 except error.LookupError:
1213 if not self._dirstatevalidatewarned:
1213 if not self._dirstatevalidatewarned:
1214 self._dirstatevalidatewarned = True
1214 self._dirstatevalidatewarned = True
1215 self.ui.warn(_("warning: ignoring unknown"
1215 self.ui.warn(_("warning: ignoring unknown"
1216 " working parent %s!\n") % short(node))
1216 " working parent %s!\n") % short(node))
1217 return nullid
1217 return nullid
1218
1218
1219 @storecache(narrowspec.FILENAME)
1219 @storecache(narrowspec.FILENAME)
1220 def narrowpats(self):
1220 def narrowpats(self):
1221 """matcher patterns for this repository's narrowspec
1221 """matcher patterns for this repository's narrowspec
1222
1222
1223 A tuple of (includes, excludes).
1223 A tuple of (includes, excludes).
1224 """
1224 """
1225 return narrowspec.load(self)
1225 return narrowspec.load(self)
1226
1226
1227 @storecache(narrowspec.FILENAME)
1227 @storecache(narrowspec.FILENAME)
1228 def _storenarrowmatch(self):
1228 def _storenarrowmatch(self):
1229 if repository.NARROW_REQUIREMENT not in self.requirements:
1229 if repository.NARROW_REQUIREMENT not in self.requirements:
1230 return matchmod.always(self.root, '')
1230 return matchmod.always(self.root, '')
1231 include, exclude = self.narrowpats
1231 include, exclude = self.narrowpats
1232 return narrowspec.match(self.root, include=include, exclude=exclude)
1232 return narrowspec.match(self.root, include=include, exclude=exclude)
1233
1233
1234 @storecache(narrowspec.FILENAME)
1234 @storecache(narrowspec.FILENAME)
1235 def _narrowmatch(self):
1235 def _narrowmatch(self):
1236 if repository.NARROW_REQUIREMENT not in self.requirements:
1236 if repository.NARROW_REQUIREMENT not in self.requirements:
1237 return matchmod.always(self.root, '')
1237 return matchmod.always(self.root, '')
1238 narrowspec.checkworkingcopynarrowspec(self)
1238 narrowspec.checkworkingcopynarrowspec(self)
1239 include, exclude = self.narrowpats
1239 include, exclude = self.narrowpats
1240 return narrowspec.match(self.root, include=include, exclude=exclude)
1240 return narrowspec.match(self.root, include=include, exclude=exclude)
1241
1241
1242 def narrowmatch(self, match=None, includeexact=False):
1242 def narrowmatch(self, match=None, includeexact=False):
1243 """matcher corresponding the the repo's narrowspec
1243 """matcher corresponding the the repo's narrowspec
1244
1244
1245 If `match` is given, then that will be intersected with the narrow
1245 If `match` is given, then that will be intersected with the narrow
1246 matcher.
1246 matcher.
1247
1247
1248 If `includeexact` is True, then any exact matches from `match` will
1248 If `includeexact` is True, then any exact matches from `match` will
1249 be included even if they're outside the narrowspec.
1249 be included even if they're outside the narrowspec.
1250 """
1250 """
1251 if match:
1251 if match:
1252 if includeexact and not self._narrowmatch.always():
1252 if includeexact and not self._narrowmatch.always():
1253 # do not exclude explicitly-specified paths so that they can
1253 # do not exclude explicitly-specified paths so that they can
1254 # be warned later on
1254 # be warned later on
1255 em = matchmod.exact(match._root, match._cwd, match.files())
1255 em = matchmod.exact(match._root, match._cwd, match.files())
1256 nm = matchmod.unionmatcher([self._narrowmatch, em])
1256 nm = matchmod.unionmatcher([self._narrowmatch, em])
1257 return matchmod.intersectmatchers(match, nm)
1257 return matchmod.intersectmatchers(match, nm)
1258 return matchmod.intersectmatchers(match, self._narrowmatch)
1258 return matchmod.intersectmatchers(match, self._narrowmatch)
1259 return self._narrowmatch
1259 return self._narrowmatch
1260
1260
1261 def setnarrowpats(self, newincludes, newexcludes):
1261 def setnarrowpats(self, newincludes, newexcludes):
1262 narrowspec.save(self, newincludes, newexcludes)
1262 narrowspec.save(self, newincludes, newexcludes)
1263 self.invalidate(clearfilecache=True)
1263 self.invalidate(clearfilecache=True)
1264
1264
1265 def __getitem__(self, changeid):
1265 def __getitem__(self, changeid):
1266 if changeid is None:
1266 if changeid is None:
1267 return context.workingctx(self)
1267 return context.workingctx(self)
1268 if isinstance(changeid, context.basectx):
1268 if isinstance(changeid, context.basectx):
1269 return changeid
1269 return changeid
1270 if isinstance(changeid, slice):
1270 if isinstance(changeid, slice):
1271 # wdirrev isn't contiguous so the slice shouldn't include it
1271 # wdirrev isn't contiguous so the slice shouldn't include it
1272 return [self[i]
1272 return [self[i]
1273 for i in pycompat.xrange(*changeid.indices(len(self)))
1273 for i in pycompat.xrange(*changeid.indices(len(self)))
1274 if i not in self.changelog.filteredrevs]
1274 if i not in self.changelog.filteredrevs]
1275 try:
1275 try:
1276 if isinstance(changeid, int):
1276 if isinstance(changeid, int):
1277 node = self.changelog.node(changeid)
1277 node = self.changelog.node(changeid)
1278 rev = changeid
1278 rev = changeid
1279 elif changeid == 'null':
1279 elif changeid == 'null':
1280 node = nullid
1280 node = nullid
1281 rev = nullrev
1281 rev = nullrev
1282 elif changeid == 'tip':
1282 elif changeid == 'tip':
1283 node = self.changelog.tip()
1283 node = self.changelog.tip()
1284 rev = self.changelog.rev(node)
1284 rev = self.changelog.rev(node)
1285 elif changeid == '.':
1285 elif changeid == '.':
1286 # this is a hack to delay/avoid loading obsmarkers
1286 # this is a hack to delay/avoid loading obsmarkers
1287 # when we know that '.' won't be hidden
1287 # when we know that '.' won't be hidden
1288 node = self.dirstate.p1()
1288 node = self.dirstate.p1()
1289 rev = self.unfiltered().changelog.rev(node)
1289 rev = self.unfiltered().changelog.rev(node)
1290 elif len(changeid) == 20:
1290 elif len(changeid) == 20:
1291 try:
1291 try:
1292 node = changeid
1292 node = changeid
1293 rev = self.changelog.rev(changeid)
1293 rev = self.changelog.rev(changeid)
1294 except error.FilteredLookupError:
1294 except error.FilteredLookupError:
1295 changeid = hex(changeid) # for the error message
1295 changeid = hex(changeid) # for the error message
1296 raise
1296 raise
1297 except LookupError:
1297 except LookupError:
1298 # check if it might have come from damaged dirstate
1298 # check if it might have come from damaged dirstate
1299 #
1299 #
1300 # XXX we could avoid the unfiltered if we had a recognizable
1300 # XXX we could avoid the unfiltered if we had a recognizable
1301 # exception for filtered changeset access
1301 # exception for filtered changeset access
1302 if (self.local()
1302 if (self.local()
1303 and changeid in self.unfiltered().dirstate.parents()):
1303 and changeid in self.unfiltered().dirstate.parents()):
1304 msg = _("working directory has unknown parent '%s'!")
1304 msg = _("working directory has unknown parent '%s'!")
1305 raise error.Abort(msg % short(changeid))
1305 raise error.Abort(msg % short(changeid))
1306 changeid = hex(changeid) # for the error message
1306 changeid = hex(changeid) # for the error message
1307 raise
1307 raise
1308
1308
1309 elif len(changeid) == 40:
1309 elif len(changeid) == 40:
1310 node = bin(changeid)
1310 node = bin(changeid)
1311 rev = self.changelog.rev(node)
1311 rev = self.changelog.rev(node)
1312 else:
1312 else:
1313 raise error.ProgrammingError(
1313 raise error.ProgrammingError(
1314 "unsupported changeid '%s' of type %s" %
1314 "unsupported changeid '%s' of type %s" %
1315 (changeid, type(changeid)))
1315 (changeid, type(changeid)))
1316
1316
1317 return context.changectx(self, rev, node)
1317 return context.changectx(self, rev, node)
1318
1318
1319 except (error.FilteredIndexError, error.FilteredLookupError):
1319 except (error.FilteredIndexError, error.FilteredLookupError):
1320 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
1320 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
1321 % pycompat.bytestr(changeid))
1321 % pycompat.bytestr(changeid))
1322 except (IndexError, LookupError):
1322 except (IndexError, LookupError):
1323 raise error.RepoLookupError(
1323 raise error.RepoLookupError(
1324 _("unknown revision '%s'") % pycompat.bytestr(changeid))
1324 _("unknown revision '%s'") % pycompat.bytestr(changeid))
1325 except error.WdirUnsupported:
1325 except error.WdirUnsupported:
1326 return context.workingctx(self)
1326 return context.workingctx(self)
1327
1327
1328 def __contains__(self, changeid):
1328 def __contains__(self, changeid):
1329 """True if the given changeid exists
1329 """True if the given changeid exists
1330
1330
1331 error.AmbiguousPrefixLookupError is raised if an ambiguous node
1331 error.AmbiguousPrefixLookupError is raised if an ambiguous node
1332 specified.
1332 specified.
1333 """
1333 """
1334 try:
1334 try:
1335 self[changeid]
1335 self[changeid]
1336 return True
1336 return True
1337 except error.RepoLookupError:
1337 except error.RepoLookupError:
1338 return False
1338 return False
1339
1339
1340 def __nonzero__(self):
1340 def __nonzero__(self):
1341 return True
1341 return True
1342
1342
1343 __bool__ = __nonzero__
1343 __bool__ = __nonzero__
1344
1344
1345 def __len__(self):
1345 def __len__(self):
1346 # no need to pay the cost of repoview.changelog
1346 # no need to pay the cost of repoview.changelog
1347 unfi = self.unfiltered()
1347 unfi = self.unfiltered()
1348 return len(unfi.changelog)
1348 return len(unfi.changelog)
1349
1349
1350 def __iter__(self):
1350 def __iter__(self):
1351 return iter(self.changelog)
1351 return iter(self.changelog)
1352
1352
1353 def revs(self, expr, *args):
1353 def revs(self, expr, *args):
1354 '''Find revisions matching a revset.
1354 '''Find revisions matching a revset.
1355
1355
1356 The revset is specified as a string ``expr`` that may contain
1356 The revset is specified as a string ``expr`` that may contain
1357 %-formatting to escape certain types. See ``revsetlang.formatspec``.
1357 %-formatting to escape certain types. See ``revsetlang.formatspec``.
1358
1358
1359 Revset aliases from the configuration are not expanded. To expand
1359 Revset aliases from the configuration are not expanded. To expand
1360 user aliases, consider calling ``scmutil.revrange()`` or
1360 user aliases, consider calling ``scmutil.revrange()`` or
1361 ``repo.anyrevs([expr], user=True)``.
1361 ``repo.anyrevs([expr], user=True)``.
1362
1362
1363 Returns a revset.abstractsmartset, which is a list-like interface
1363 Returns a revset.abstractsmartset, which is a list-like interface
1364 that contains integer revisions.
1364 that contains integer revisions.
1365 '''
1365 '''
1366 tree = revsetlang.spectree(expr, *args)
1366 tree = revsetlang.spectree(expr, *args)
1367 return revset.makematcher(tree)(self)
1367 return revset.makematcher(tree)(self)
1368
1368
1369 def set(self, expr, *args):
1369 def set(self, expr, *args):
1370 '''Find revisions matching a revset and emit changectx instances.
1370 '''Find revisions matching a revset and emit changectx instances.
1371
1371
1372 This is a convenience wrapper around ``revs()`` that iterates the
1372 This is a convenience wrapper around ``revs()`` that iterates the
1373 result and is a generator of changectx instances.
1373 result and is a generator of changectx instances.
1374
1374
1375 Revset aliases from the configuration are not expanded. To expand
1375 Revset aliases from the configuration are not expanded. To expand
1376 user aliases, consider calling ``scmutil.revrange()``.
1376 user aliases, consider calling ``scmutil.revrange()``.
1377 '''
1377 '''
1378 for r in self.revs(expr, *args):
1378 for r in self.revs(expr, *args):
1379 yield self[r]
1379 yield self[r]
1380
1380
1381 def anyrevs(self, specs, user=False, localalias=None):
1381 def anyrevs(self, specs, user=False, localalias=None):
1382 '''Find revisions matching one of the given revsets.
1382 '''Find revisions matching one of the given revsets.
1383
1383
1384 Revset aliases from the configuration are not expanded by default. To
1384 Revset aliases from the configuration are not expanded by default. To
1385 expand user aliases, specify ``user=True``. To provide some local
1385 expand user aliases, specify ``user=True``. To provide some local
1386 definitions overriding user aliases, set ``localalias`` to
1386 definitions overriding user aliases, set ``localalias`` to
1387 ``{name: definitionstring}``.
1387 ``{name: definitionstring}``.
1388 '''
1388 '''
1389 if user:
1389 if user:
1390 m = revset.matchany(self.ui, specs,
1390 m = revset.matchany(self.ui, specs,
1391 lookup=revset.lookupfn(self),
1391 lookup=revset.lookupfn(self),
1392 localalias=localalias)
1392 localalias=localalias)
1393 else:
1393 else:
1394 m = revset.matchany(None, specs, localalias=localalias)
1394 m = revset.matchany(None, specs, localalias=localalias)
1395 return m(self)
1395 return m(self)
1396
1396
1397 def url(self):
1397 def url(self):
1398 return 'file:' + self.root
1398 return 'file:' + self.root
1399
1399
1400 def hook(self, name, throw=False, **args):
1400 def hook(self, name, throw=False, **args):
1401 """Call a hook, passing this repo instance.
1401 """Call a hook, passing this repo instance.
1402
1402
1403 This a convenience method to aid invoking hooks. Extensions likely
1403 This a convenience method to aid invoking hooks. Extensions likely
1404 won't call this unless they have registered a custom hook or are
1404 won't call this unless they have registered a custom hook or are
1405 replacing code that is expected to call a hook.
1405 replacing code that is expected to call a hook.
1406 """
1406 """
1407 return hook.hook(self.ui, self, name, throw, **args)
1407 return hook.hook(self.ui, self, name, throw, **args)
1408
1408
1409 @filteredpropertycache
1409 @filteredpropertycache
1410 def _tagscache(self):
1410 def _tagscache(self):
1411 '''Returns a tagscache object that contains various tags related
1411 '''Returns a tagscache object that contains various tags related
1412 caches.'''
1412 caches.'''
1413
1413
1414 # This simplifies its cache management by having one decorated
1414 # This simplifies its cache management by having one decorated
1415 # function (this one) and the rest simply fetch things from it.
1415 # function (this one) and the rest simply fetch things from it.
1416 class tagscache(object):
1416 class tagscache(object):
1417 def __init__(self):
1417 def __init__(self):
1418 # These two define the set of tags for this repository. tags
1418 # These two define the set of tags for this repository. tags
1419 # maps tag name to node; tagtypes maps tag name to 'global' or
1419 # maps tag name to node; tagtypes maps tag name to 'global' or
1420 # 'local'. (Global tags are defined by .hgtags across all
1420 # 'local'. (Global tags are defined by .hgtags across all
1421 # heads, and local tags are defined in .hg/localtags.)
1421 # heads, and local tags are defined in .hg/localtags.)
1422 # They constitute the in-memory cache of tags.
1422 # They constitute the in-memory cache of tags.
1423 self.tags = self.tagtypes = None
1423 self.tags = self.tagtypes = None
1424
1424
1425 self.nodetagscache = self.tagslist = None
1425 self.nodetagscache = self.tagslist = None
1426
1426
1427 cache = tagscache()
1427 cache = tagscache()
1428 cache.tags, cache.tagtypes = self._findtags()
1428 cache.tags, cache.tagtypes = self._findtags()
1429
1429
1430 return cache
1430 return cache
1431
1431
1432 def tags(self):
1432 def tags(self):
1433 '''return a mapping of tag to node'''
1433 '''return a mapping of tag to node'''
1434 t = {}
1434 t = {}
1435 if self.changelog.filteredrevs:
1435 if self.changelog.filteredrevs:
1436 tags, tt = self._findtags()
1436 tags, tt = self._findtags()
1437 else:
1437 else:
1438 tags = self._tagscache.tags
1438 tags = self._tagscache.tags
1439 rev = self.changelog.rev
1439 rev = self.changelog.rev
1440 for k, v in tags.iteritems():
1440 for k, v in tags.iteritems():
1441 try:
1441 try:
1442 # ignore tags to unknown nodes
1442 # ignore tags to unknown nodes
1443 rev(v)
1443 rev(v)
1444 t[k] = v
1444 t[k] = v
1445 except (error.LookupError, ValueError):
1445 except (error.LookupError, ValueError):
1446 pass
1446 pass
1447 return t
1447 return t
1448
1448
1449 def _findtags(self):
1449 def _findtags(self):
1450 '''Do the hard work of finding tags. Return a pair of dicts
1450 '''Do the hard work of finding tags. Return a pair of dicts
1451 (tags, tagtypes) where tags maps tag name to node, and tagtypes
1451 (tags, tagtypes) where tags maps tag name to node, and tagtypes
1452 maps tag name to a string like \'global\' or \'local\'.
1452 maps tag name to a string like \'global\' or \'local\'.
1453 Subclasses or extensions are free to add their own tags, but
1453 Subclasses or extensions are free to add their own tags, but
1454 should be aware that the returned dicts will be retained for the
1454 should be aware that the returned dicts will be retained for the
1455 duration of the localrepo object.'''
1455 duration of the localrepo object.'''
1456
1456
1457 # XXX what tagtype should subclasses/extensions use? Currently
1457 # XXX what tagtype should subclasses/extensions use? Currently
1458 # mq and bookmarks add tags, but do not set the tagtype at all.
1458 # mq and bookmarks add tags, but do not set the tagtype at all.
1459 # Should each extension invent its own tag type? Should there
1459 # Should each extension invent its own tag type? Should there
1460 # be one tagtype for all such "virtual" tags? Or is the status
1460 # be one tagtype for all such "virtual" tags? Or is the status
1461 # quo fine?
1461 # quo fine?
1462
1462
1463
1463
1464 # map tag name to (node, hist)
1464 # map tag name to (node, hist)
1465 alltags = tagsmod.findglobaltags(self.ui, self)
1465 alltags = tagsmod.findglobaltags(self.ui, self)
1466 # map tag name to tag type
1466 # map tag name to tag type
1467 tagtypes = dict((tag, 'global') for tag in alltags)
1467 tagtypes = dict((tag, 'global') for tag in alltags)
1468
1468
1469 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
1469 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
1470
1470
1471 # Build the return dicts. Have to re-encode tag names because
1471 # Build the return dicts. Have to re-encode tag names because
1472 # the tags module always uses UTF-8 (in order not to lose info
1472 # the tags module always uses UTF-8 (in order not to lose info
1473 # writing to the cache), but the rest of Mercurial wants them in
1473 # writing to the cache), but the rest of Mercurial wants them in
1474 # local encoding.
1474 # local encoding.
1475 tags = {}
1475 tags = {}
1476 for (name, (node, hist)) in alltags.iteritems():
1476 for (name, (node, hist)) in alltags.iteritems():
1477 if node != nullid:
1477 if node != nullid:
1478 tags[encoding.tolocal(name)] = node
1478 tags[encoding.tolocal(name)] = node
1479 tags['tip'] = self.changelog.tip()
1479 tags['tip'] = self.changelog.tip()
1480 tagtypes = dict([(encoding.tolocal(name), value)
1480 tagtypes = dict([(encoding.tolocal(name), value)
1481 for (name, value) in tagtypes.iteritems()])
1481 for (name, value) in tagtypes.iteritems()])
1482 return (tags, tagtypes)
1482 return (tags, tagtypes)
1483
1483
1484 def tagtype(self, tagname):
1484 def tagtype(self, tagname):
1485 '''
1485 '''
1486 return the type of the given tag. result can be:
1486 return the type of the given tag. result can be:
1487
1487
1488 'local' : a local tag
1488 'local' : a local tag
1489 'global' : a global tag
1489 'global' : a global tag
1490 None : tag does not exist
1490 None : tag does not exist
1491 '''
1491 '''
1492
1492
1493 return self._tagscache.tagtypes.get(tagname)
1493 return self._tagscache.tagtypes.get(tagname)
1494
1494
1495 def tagslist(self):
1495 def tagslist(self):
1496 '''return a list of tags ordered by revision'''
1496 '''return a list of tags ordered by revision'''
1497 if not self._tagscache.tagslist:
1497 if not self._tagscache.tagslist:
1498 l = []
1498 l = []
1499 for t, n in self.tags().iteritems():
1499 for t, n in self.tags().iteritems():
1500 l.append((self.changelog.rev(n), t, n))
1500 l.append((self.changelog.rev(n), t, n))
1501 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
1501 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
1502
1502
1503 return self._tagscache.tagslist
1503 return self._tagscache.tagslist
1504
1504
1505 def nodetags(self, node):
1505 def nodetags(self, node):
1506 '''return the tags associated with a node'''
1506 '''return the tags associated with a node'''
1507 if not self._tagscache.nodetagscache:
1507 if not self._tagscache.nodetagscache:
1508 nodetagscache = {}
1508 nodetagscache = {}
1509 for t, n in self._tagscache.tags.iteritems():
1509 for t, n in self._tagscache.tags.iteritems():
1510 nodetagscache.setdefault(n, []).append(t)
1510 nodetagscache.setdefault(n, []).append(t)
1511 for tags in nodetagscache.itervalues():
1511 for tags in nodetagscache.itervalues():
1512 tags.sort()
1512 tags.sort()
1513 self._tagscache.nodetagscache = nodetagscache
1513 self._tagscache.nodetagscache = nodetagscache
1514 return self._tagscache.nodetagscache.get(node, [])
1514 return self._tagscache.nodetagscache.get(node, [])
1515
1515
1516 def nodebookmarks(self, node):
1516 def nodebookmarks(self, node):
1517 """return the list of bookmarks pointing to the specified node"""
1517 """return the list of bookmarks pointing to the specified node"""
1518 return self._bookmarks.names(node)
1518 return self._bookmarks.names(node)
1519
1519
1520 def branchmap(self):
1520 def branchmap(self):
1521 '''returns a dictionary {branch: [branchheads]} with branchheads
1521 '''returns a dictionary {branch: [branchheads]} with branchheads
1522 ordered by increasing revision number'''
1522 ordered by increasing revision number'''
1523 branchmap.updatecache(self)
1523 branchmap.updatecache(self)
1524 return self._branchcaches[self.filtername]
1524 return self._branchcaches[self.filtername]
1525
1525
1526 @unfilteredmethod
1526 @unfilteredmethod
1527 def revbranchcache(self):
1527 def revbranchcache(self):
1528 if not self._revbranchcache:
1528 if not self._revbranchcache:
1529 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
1529 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
1530 return self._revbranchcache
1530 return self._revbranchcache
1531
1531
1532 def branchtip(self, branch, ignoremissing=False):
1532 def branchtip(self, branch, ignoremissing=False):
1533 '''return the tip node for a given branch
1533 '''return the tip node for a given branch
1534
1534
1535 If ignoremissing is True, then this method will not raise an error.
1535 If ignoremissing is True, then this method will not raise an error.
1536 This is helpful for callers that only expect None for a missing branch
1536 This is helpful for callers that only expect None for a missing branch
1537 (e.g. namespace).
1537 (e.g. namespace).
1538
1538
1539 '''
1539 '''
1540 try:
1540 try:
1541 return self.branchmap().branchtip(branch)
1541 return self.branchmap().branchtip(branch)
1542 except KeyError:
1542 except KeyError:
1543 if not ignoremissing:
1543 if not ignoremissing:
1544 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
1544 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
1545 else:
1545 else:
1546 pass
1546 pass
1547
1547
1548 def lookup(self, key):
1548 def lookup(self, key):
1549 return scmutil.revsymbol(self, key).node()
1549 return scmutil.revsymbol(self, key).node()
1550
1550
1551 def lookupbranch(self, key):
1551 def lookupbranch(self, key):
1552 if key in self.branchmap():
1552 if key in self.branchmap():
1553 return key
1553 return key
1554
1554
1555 return scmutil.revsymbol(self, key).branch()
1555 return scmutil.revsymbol(self, key).branch()
1556
1556
1557 def known(self, nodes):
1557 def known(self, nodes):
1558 cl = self.changelog
1558 cl = self.changelog
1559 nm = cl.nodemap
1559 nm = cl.nodemap
1560 filtered = cl.filteredrevs
1560 filtered = cl.filteredrevs
1561 result = []
1561 result = []
1562 for n in nodes:
1562 for n in nodes:
1563 r = nm.get(n)
1563 r = nm.get(n)
1564 resp = not (r is None or r in filtered)
1564 resp = not (r is None or r in filtered)
1565 result.append(resp)
1565 result.append(resp)
1566 return result
1566 return result
1567
1567
1568 def local(self):
1568 def local(self):
1569 return self
1569 return self
1570
1570
1571 def publishing(self):
1571 def publishing(self):
1572 # it's safe (and desirable) to trust the publish flag unconditionally
1572 # it's safe (and desirable) to trust the publish flag unconditionally
1573 # so that we don't finalize changes shared between users via ssh or nfs
1573 # so that we don't finalize changes shared between users via ssh or nfs
1574 return self.ui.configbool('phases', 'publish', untrusted=True)
1574 return self.ui.configbool('phases', 'publish', untrusted=True)
1575
1575
1576 def cancopy(self):
1576 def cancopy(self):
1577 # so statichttprepo's override of local() works
1577 # so statichttprepo's override of local() works
1578 if not self.local():
1578 if not self.local():
1579 return False
1579 return False
1580 if not self.publishing():
1580 if not self.publishing():
1581 return True
1581 return True
1582 # if publishing we can't copy if there is filtered content
1582 # if publishing we can't copy if there is filtered content
1583 return not self.filtered('visible').changelog.filteredrevs
1583 return not self.filtered('visible').changelog.filteredrevs
1584
1584
1585 def shared(self):
1585 def shared(self):
1586 '''the type of shared repository (None if not shared)'''
1586 '''the type of shared repository (None if not shared)'''
1587 if self.sharedpath != self.path:
1587 if self.sharedpath != self.path:
1588 return 'store'
1588 return 'store'
1589 return None
1589 return None
1590
1590
1591 def wjoin(self, f, *insidef):
1591 def wjoin(self, f, *insidef):
1592 return self.vfs.reljoin(self.root, f, *insidef)
1592 return self.vfs.reljoin(self.root, f, *insidef)
1593
1593
1594 def setparents(self, p1, p2=nullid):
1594 def setparents(self, p1, p2=nullid):
1595 with self.dirstate.parentchange():
1595 with self.dirstate.parentchange():
1596 copies = self.dirstate.setparents(p1, p2)
1596 copies = self.dirstate.setparents(p1, p2)
1597 pctx = self[p1]
1597 pctx = self[p1]
1598 if copies:
1598 if copies:
1599 # Adjust copy records, the dirstate cannot do it, it
1599 # Adjust copy records, the dirstate cannot do it, it
1600 # requires access to parents manifests. Preserve them
1600 # requires access to parents manifests. Preserve them
1601 # only for entries added to first parent.
1601 # only for entries added to first parent.
1602 for f in copies:
1602 for f in copies:
1603 if f not in pctx and copies[f] in pctx:
1603 if f not in pctx and copies[f] in pctx:
1604 self.dirstate.copy(copies[f], f)
1604 self.dirstate.copy(copies[f], f)
1605 if p2 == nullid:
1605 if p2 == nullid:
1606 for f, s in sorted(self.dirstate.copies().items()):
1606 for f, s in sorted(self.dirstate.copies().items()):
1607 if f not in pctx and s not in pctx:
1607 if f not in pctx and s not in pctx:
1608 self.dirstate.copy(None, f)
1608 self.dirstate.copy(None, f)
1609
1609
1610 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1610 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1611 """changeid must be a changeset revision, if specified.
1611 """changeid must be a changeset revision, if specified.
1612 fileid can be a file revision or node."""
1612 fileid can be a file revision or node."""
1613 return context.filectx(self, path, changeid, fileid,
1613 return context.filectx(self, path, changeid, fileid,
1614 changectx=changectx)
1614 changectx=changectx)
1615
1615
1616 def getcwd(self):
1616 def getcwd(self):
1617 return self.dirstate.getcwd()
1617 return self.dirstate.getcwd()
1618
1618
1619 def pathto(self, f, cwd=None):
1619 def pathto(self, f, cwd=None):
1620 return self.dirstate.pathto(f, cwd)
1620 return self.dirstate.pathto(f, cwd)
1621
1621
1622 def _loadfilter(self, filter):
1622 def _loadfilter(self, filter):
1623 if filter not in self._filterpats:
1623 if filter not in self._filterpats:
1624 l = []
1624 l = []
1625 for pat, cmd in self.ui.configitems(filter):
1625 for pat, cmd in self.ui.configitems(filter):
1626 if cmd == '!':
1626 if cmd == '!':
1627 continue
1627 continue
1628 mf = matchmod.match(self.root, '', [pat])
1628 mf = matchmod.match(self.root, '', [pat])
1629 fn = None
1629 fn = None
1630 params = cmd
1630 params = cmd
1631 for name, filterfn in self._datafilters.iteritems():
1631 for name, filterfn in self._datafilters.iteritems():
1632 if cmd.startswith(name):
1632 if cmd.startswith(name):
1633 fn = filterfn
1633 fn = filterfn
1634 params = cmd[len(name):].lstrip()
1634 params = cmd[len(name):].lstrip()
1635 break
1635 break
1636 if not fn:
1636 if not fn:
1637 fn = lambda s, c, **kwargs: procutil.filter(s, c)
1637 fn = lambda s, c, **kwargs: procutil.filter(s, c)
1638 # Wrap old filters not supporting keyword arguments
1638 # Wrap old filters not supporting keyword arguments
1639 if not pycompat.getargspec(fn)[2]:
1639 if not pycompat.getargspec(fn)[2]:
1640 oldfn = fn
1640 oldfn = fn
1641 fn = lambda s, c, **kwargs: oldfn(s, c)
1641 fn = lambda s, c, **kwargs: oldfn(s, c)
1642 l.append((mf, fn, params))
1642 l.append((mf, fn, params))
1643 self._filterpats[filter] = l
1643 self._filterpats[filter] = l
1644 return self._filterpats[filter]
1644 return self._filterpats[filter]
1645
1645
1646 def _filter(self, filterpats, filename, data):
1646 def _filter(self, filterpats, filename, data):
1647 for mf, fn, cmd in filterpats:
1647 for mf, fn, cmd in filterpats:
1648 if mf(filename):
1648 if mf(filename):
1649 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
1649 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
1650 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
1650 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
1651 break
1651 break
1652
1652
1653 return data
1653 return data
1654
1654
1655 @unfilteredpropertycache
1655 @unfilteredpropertycache
1656 def _encodefilterpats(self):
1656 def _encodefilterpats(self):
1657 return self._loadfilter('encode')
1657 return self._loadfilter('encode')
1658
1658
1659 @unfilteredpropertycache
1659 @unfilteredpropertycache
1660 def _decodefilterpats(self):
1660 def _decodefilterpats(self):
1661 return self._loadfilter('decode')
1661 return self._loadfilter('decode')
1662
1662
1663 def adddatafilter(self, name, filter):
1663 def adddatafilter(self, name, filter):
1664 self._datafilters[name] = filter
1664 self._datafilters[name] = filter
1665
1665
1666 def wread(self, filename):
1666 def wread(self, filename):
1667 if self.wvfs.islink(filename):
1667 if self.wvfs.islink(filename):
1668 data = self.wvfs.readlink(filename)
1668 data = self.wvfs.readlink(filename)
1669 else:
1669 else:
1670 data = self.wvfs.read(filename)
1670 data = self.wvfs.read(filename)
1671 return self._filter(self._encodefilterpats, filename, data)
1671 return self._filter(self._encodefilterpats, filename, data)
1672
1672
1673 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
1673 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
1674 """write ``data`` into ``filename`` in the working directory
1674 """write ``data`` into ``filename`` in the working directory
1675
1675
1676 This returns length of written (maybe decoded) data.
1676 This returns length of written (maybe decoded) data.
1677 """
1677 """
1678 data = self._filter(self._decodefilterpats, filename, data)
1678 data = self._filter(self._decodefilterpats, filename, data)
1679 if 'l' in flags:
1679 if 'l' in flags:
1680 self.wvfs.symlink(data, filename)
1680 self.wvfs.symlink(data, filename)
1681 else:
1681 else:
1682 self.wvfs.write(filename, data, backgroundclose=backgroundclose,
1682 self.wvfs.write(filename, data, backgroundclose=backgroundclose,
1683 **kwargs)
1683 **kwargs)
1684 if 'x' in flags:
1684 if 'x' in flags:
1685 self.wvfs.setflags(filename, False, True)
1685 self.wvfs.setflags(filename, False, True)
1686 else:
1686 else:
1687 self.wvfs.setflags(filename, False, False)
1687 self.wvfs.setflags(filename, False, False)
1688 return len(data)
1688 return len(data)
1689
1689
1690 def wwritedata(self, filename, data):
1690 def wwritedata(self, filename, data):
1691 return self._filter(self._decodefilterpats, filename, data)
1691 return self._filter(self._decodefilterpats, filename, data)
1692
1692
1693 def currenttransaction(self):
1693 def currenttransaction(self):
1694 """return the current transaction or None if non exists"""
1694 """return the current transaction or None if non exists"""
1695 if self._transref:
1695 if self._transref:
1696 tr = self._transref()
1696 tr = self._transref()
1697 else:
1697 else:
1698 tr = None
1698 tr = None
1699
1699
1700 if tr and tr.running():
1700 if tr and tr.running():
1701 return tr
1701 return tr
1702 return None
1702 return None
1703
1703
1704 def transaction(self, desc, report=None):
1704 def transaction(self, desc, report=None):
1705 if (self.ui.configbool('devel', 'all-warnings')
1705 if (self.ui.configbool('devel', 'all-warnings')
1706 or self.ui.configbool('devel', 'check-locks')):
1706 or self.ui.configbool('devel', 'check-locks')):
1707 if self._currentlock(self._lockref) is None:
1707 if self._currentlock(self._lockref) is None:
1708 raise error.ProgrammingError('transaction requires locking')
1708 raise error.ProgrammingError('transaction requires locking')
1709 tr = self.currenttransaction()
1709 tr = self.currenttransaction()
1710 if tr is not None:
1710 if tr is not None:
1711 return tr.nest(name=desc)
1711 return tr.nest(name=desc)
1712
1712
1713 # abort here if the journal already exists
1713 # abort here if the journal already exists
1714 if self.svfs.exists("journal"):
1714 if self.svfs.exists("journal"):
1715 raise error.RepoError(
1715 raise error.RepoError(
1716 _("abandoned transaction found"),
1716 _("abandoned transaction found"),
1717 hint=_("run 'hg recover' to clean up transaction"))
1717 hint=_("run 'hg recover' to clean up transaction"))
1718
1718
1719 idbase = "%.40f#%f" % (random.random(), time.time())
1719 idbase = "%.40f#%f" % (random.random(), time.time())
1720 ha = hex(hashlib.sha1(idbase).digest())
1720 ha = hex(hashlib.sha1(idbase).digest())
1721 txnid = 'TXN:' + ha
1721 txnid = 'TXN:' + ha
1722 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
1722 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
1723
1723
1724 self._writejournal(desc)
1724 self._writejournal(desc)
1725 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
1725 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
1726 if report:
1726 if report:
1727 rp = report
1727 rp = report
1728 else:
1728 else:
1729 rp = self.ui.warn
1729 rp = self.ui.warn
1730 vfsmap = {'plain': self.vfs, 'store': self.svfs} # root of .hg/
1730 vfsmap = {'plain': self.vfs, 'store': self.svfs} # root of .hg/
1731 # we must avoid cyclic reference between repo and transaction.
1731 # we must avoid cyclic reference between repo and transaction.
1732 reporef = weakref.ref(self)
1732 reporef = weakref.ref(self)
1733 # Code to track tag movement
1733 # Code to track tag movement
1734 #
1734 #
1735 # Since tags are all handled as file content, it is actually quite hard
1735 # Since tags are all handled as file content, it is actually quite hard
1736 # to track these movement from a code perspective. So we fallback to a
1736 # to track these movement from a code perspective. So we fallback to a
1737 # tracking at the repository level. One could envision to track changes
1737 # tracking at the repository level. One could envision to track changes
1738 # to the '.hgtags' file through changegroup apply but that fails to
1738 # to the '.hgtags' file through changegroup apply but that fails to
1739 # cope with case where transaction expose new heads without changegroup
1739 # cope with case where transaction expose new heads without changegroup
1740 # being involved (eg: phase movement).
1740 # being involved (eg: phase movement).
1741 #
1741 #
1742 # For now, We gate the feature behind a flag since this likely comes
1742 # For now, We gate the feature behind a flag since this likely comes
1743 # with performance impacts. The current code run more often than needed
1743 # with performance impacts. The current code run more often than needed
1744 # and do not use caches as much as it could. The current focus is on
1744 # and do not use caches as much as it could. The current focus is on
1745 # the behavior of the feature so we disable it by default. The flag
1745 # the behavior of the feature so we disable it by default. The flag
1746 # will be removed when we are happy with the performance impact.
1746 # will be removed when we are happy with the performance impact.
1747 #
1747 #
1748 # Once this feature is no longer experimental move the following
1748 # Once this feature is no longer experimental move the following
1749 # documentation to the appropriate help section:
1749 # documentation to the appropriate help section:
1750 #
1750 #
1751 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
1751 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
1752 # tags (new or changed or deleted tags). In addition the details of
1752 # tags (new or changed or deleted tags). In addition the details of
1753 # these changes are made available in a file at:
1753 # these changes are made available in a file at:
1754 # ``REPOROOT/.hg/changes/tags.changes``.
1754 # ``REPOROOT/.hg/changes/tags.changes``.
1755 # Make sure you check for HG_TAG_MOVED before reading that file as it
1755 # Make sure you check for HG_TAG_MOVED before reading that file as it
1756 # might exist from a previous transaction even if no tag were touched
1756 # might exist from a previous transaction even if no tag were touched
1757 # in this one. Changes are recorded in a line base format::
1757 # in this one. Changes are recorded in a line base format::
1758 #
1758 #
1759 # <action> <hex-node> <tag-name>\n
1759 # <action> <hex-node> <tag-name>\n
1760 #
1760 #
1761 # Actions are defined as follow:
1761 # Actions are defined as follow:
1762 # "-R": tag is removed,
1762 # "-R": tag is removed,
1763 # "+A": tag is added,
1763 # "+A": tag is added,
1764 # "-M": tag is moved (old value),
1764 # "-M": tag is moved (old value),
1765 # "+M": tag is moved (new value),
1765 # "+M": tag is moved (new value),
1766 tracktags = lambda x: None
1766 tracktags = lambda x: None
1767 # experimental config: experimental.hook-track-tags
1767 # experimental config: experimental.hook-track-tags
1768 shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags')
1768 shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags')
1769 if desc != 'strip' and shouldtracktags:
1769 if desc != 'strip' and shouldtracktags:
1770 oldheads = self.changelog.headrevs()
1770 oldheads = self.changelog.headrevs()
1771 def tracktags(tr2):
1771 def tracktags(tr2):
1772 repo = reporef()
1772 repo = reporef()
1773 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
1773 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
1774 newheads = repo.changelog.headrevs()
1774 newheads = repo.changelog.headrevs()
1775 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
1775 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
1776 # notes: we compare lists here.
1776 # notes: we compare lists here.
1777 # As we do it only once buiding set would not be cheaper
1777 # As we do it only once buiding set would not be cheaper
1778 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
1778 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
1779 if changes:
1779 if changes:
1780 tr2.hookargs['tag_moved'] = '1'
1780 tr2.hookargs['tag_moved'] = '1'
1781 with repo.vfs('changes/tags.changes', 'w',
1781 with repo.vfs('changes/tags.changes', 'w',
1782 atomictemp=True) as changesfile:
1782 atomictemp=True) as changesfile:
1783 # note: we do not register the file to the transaction
1783 # note: we do not register the file to the transaction
1784 # because we needs it to still exist on the transaction
1784 # because we needs it to still exist on the transaction
1785 # is close (for txnclose hooks)
1785 # is close (for txnclose hooks)
1786 tagsmod.writediff(changesfile, changes)
1786 tagsmod.writediff(changesfile, changes)
1787 def validate(tr2):
1787 def validate(tr2):
1788 """will run pre-closing hooks"""
1788 """will run pre-closing hooks"""
1789 # XXX the transaction API is a bit lacking here so we take a hacky
1789 # XXX the transaction API is a bit lacking here so we take a hacky
1790 # path for now
1790 # path for now
1791 #
1791 #
1792 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
1792 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
1793 # dict is copied before these run. In addition we needs the data
1793 # dict is copied before these run. In addition we needs the data
1794 # available to in memory hooks too.
1794 # available to in memory hooks too.
1795 #
1795 #
1796 # Moreover, we also need to make sure this runs before txnclose
1796 # Moreover, we also need to make sure this runs before txnclose
1797 # hooks and there is no "pending" mechanism that would execute
1797 # hooks and there is no "pending" mechanism that would execute
1798 # logic only if hooks are about to run.
1798 # logic only if hooks are about to run.
1799 #
1799 #
1800 # Fixing this limitation of the transaction is also needed to track
1800 # Fixing this limitation of the transaction is also needed to track
1801 # other families of changes (bookmarks, phases, obsolescence).
1801 # other families of changes (bookmarks, phases, obsolescence).
1802 #
1802 #
1803 # This will have to be fixed before we remove the experimental
1803 # This will have to be fixed before we remove the experimental
1804 # gating.
1804 # gating.
1805 tracktags(tr2)
1805 tracktags(tr2)
1806 repo = reporef()
1806 repo = reporef()
1807 if repo.ui.configbool('experimental', 'single-head-per-branch'):
1807 if repo.ui.configbool('experimental', 'single-head-per-branch'):
1808 scmutil.enforcesinglehead(repo, tr2, desc)
1808 scmutil.enforcesinglehead(repo, tr2, desc)
1809 if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
1809 if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
1810 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
1810 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
1811 args = tr.hookargs.copy()
1811 args = tr.hookargs.copy()
1812 args.update(bookmarks.preparehookargs(name, old, new))
1812 args.update(bookmarks.preparehookargs(name, old, new))
1813 repo.hook('pretxnclose-bookmark', throw=True,
1813 repo.hook('pretxnclose-bookmark', throw=True,
1814 txnname=desc,
1814 txnname=desc,
1815 **pycompat.strkwargs(args))
1815 **pycompat.strkwargs(args))
1816 if hook.hashook(repo.ui, 'pretxnclose-phase'):
1816 if hook.hashook(repo.ui, 'pretxnclose-phase'):
1817 cl = repo.unfiltered().changelog
1817 cl = repo.unfiltered().changelog
1818 for rev, (old, new) in tr.changes['phases'].items():
1818 for rev, (old, new) in tr.changes['phases'].items():
1819 args = tr.hookargs.copy()
1819 args = tr.hookargs.copy()
1820 node = hex(cl.node(rev))
1820 node = hex(cl.node(rev))
1821 args.update(phases.preparehookargs(node, old, new))
1821 args.update(phases.preparehookargs(node, old, new))
1822 repo.hook('pretxnclose-phase', throw=True, txnname=desc,
1822 repo.hook('pretxnclose-phase', throw=True, txnname=desc,
1823 **pycompat.strkwargs(args))
1823 **pycompat.strkwargs(args))
1824
1824
1825 repo.hook('pretxnclose', throw=True,
1825 repo.hook('pretxnclose', throw=True,
1826 txnname=desc, **pycompat.strkwargs(tr.hookargs))
1826 txnname=desc, **pycompat.strkwargs(tr.hookargs))
1827 def releasefn(tr, success):
1827 def releasefn(tr, success):
1828 repo = reporef()
1828 repo = reporef()
1829 if success:
1829 if success:
1830 # this should be explicitly invoked here, because
1830 # this should be explicitly invoked here, because
1831 # in-memory changes aren't written out at closing
1831 # in-memory changes aren't written out at closing
1832 # transaction, if tr.addfilegenerator (via
1832 # transaction, if tr.addfilegenerator (via
1833 # dirstate.write or so) isn't invoked while
1833 # dirstate.write or so) isn't invoked while
1834 # transaction running
1834 # transaction running
1835 repo.dirstate.write(None)
1835 repo.dirstate.write(None)
1836 else:
1836 else:
1837 # discard all changes (including ones already written
1837 # discard all changes (including ones already written
1838 # out) in this transaction
1838 # out) in this transaction
1839 narrowspec.restorebackup(self, 'journal.narrowspec')
1839 narrowspec.restorebackup(self, 'journal.narrowspec')
1840 narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate')
1840 narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate')
1841 repo.dirstate.restorebackup(None, 'journal.dirstate')
1841 repo.dirstate.restorebackup(None, 'journal.dirstate')
1842
1842
1843 repo.invalidate(clearfilecache=True)
1843 repo.invalidate(clearfilecache=True)
1844
1844
1845 tr = transaction.transaction(rp, self.svfs, vfsmap,
1845 tr = transaction.transaction(rp, self.svfs, vfsmap,
1846 "journal",
1846 "journal",
1847 "undo",
1847 "undo",
1848 aftertrans(renames),
1848 aftertrans(renames),
1849 self.store.createmode,
1849 self.store.createmode,
1850 validator=validate,
1850 validator=validate,
1851 releasefn=releasefn,
1851 releasefn=releasefn,
1852 checkambigfiles=_cachedfiles,
1852 checkambigfiles=_cachedfiles,
1853 name=desc)
1853 name=desc)
1854 tr.changes['origrepolen'] = len(self)
1854 tr.changes['origrepolen'] = len(self)
1855 tr.changes['obsmarkers'] = set()
1855 tr.changes['obsmarkers'] = set()
1856 tr.changes['phases'] = {}
1856 tr.changes['phases'] = {}
1857 tr.changes['bookmarks'] = {}
1857 tr.changes['bookmarks'] = {}
1858
1858
1859 tr.hookargs['txnid'] = txnid
1859 tr.hookargs['txnid'] = txnid
1860 # note: writing the fncache only during finalize mean that the file is
1860 # note: writing the fncache only during finalize mean that the file is
1861 # outdated when running hooks. As fncache is used for streaming clone,
1861 # outdated when running hooks. As fncache is used for streaming clone,
1862 # this is not expected to break anything that happen during the hooks.
1862 # this is not expected to break anything that happen during the hooks.
1863 tr.addfinalize('flush-fncache', self.store.write)
1863 tr.addfinalize('flush-fncache', self.store.write)
1864 def txnclosehook(tr2):
1864 def txnclosehook(tr2):
1865 """To be run if transaction is successful, will schedule a hook run
1865 """To be run if transaction is successful, will schedule a hook run
1866 """
1866 """
1867 # Don't reference tr2 in hook() so we don't hold a reference.
1867 # Don't reference tr2 in hook() so we don't hold a reference.
1868 # This reduces memory consumption when there are multiple
1868 # This reduces memory consumption when there are multiple
1869 # transactions per lock. This can likely go away if issue5045
1869 # transactions per lock. This can likely go away if issue5045
1870 # fixes the function accumulation.
1870 # fixes the function accumulation.
1871 hookargs = tr2.hookargs
1871 hookargs = tr2.hookargs
1872
1872
1873 def hookfunc():
1873 def hookfunc():
1874 repo = reporef()
1874 repo = reporef()
1875 if hook.hashook(repo.ui, 'txnclose-bookmark'):
1875 if hook.hashook(repo.ui, 'txnclose-bookmark'):
1876 bmchanges = sorted(tr.changes['bookmarks'].items())
1876 bmchanges = sorted(tr.changes['bookmarks'].items())
1877 for name, (old, new) in bmchanges:
1877 for name, (old, new) in bmchanges:
1878 args = tr.hookargs.copy()
1878 args = tr.hookargs.copy()
1879 args.update(bookmarks.preparehookargs(name, old, new))
1879 args.update(bookmarks.preparehookargs(name, old, new))
1880 repo.hook('txnclose-bookmark', throw=False,
1880 repo.hook('txnclose-bookmark', throw=False,
1881 txnname=desc, **pycompat.strkwargs(args))
1881 txnname=desc, **pycompat.strkwargs(args))
1882
1882
1883 if hook.hashook(repo.ui, 'txnclose-phase'):
1883 if hook.hashook(repo.ui, 'txnclose-phase'):
1884 cl = repo.unfiltered().changelog
1884 cl = repo.unfiltered().changelog
1885 phasemv = sorted(tr.changes['phases'].items())
1885 phasemv = sorted(tr.changes['phases'].items())
1886 for rev, (old, new) in phasemv:
1886 for rev, (old, new) in phasemv:
1887 args = tr.hookargs.copy()
1887 args = tr.hookargs.copy()
1888 node = hex(cl.node(rev))
1888 node = hex(cl.node(rev))
1889 args.update(phases.preparehookargs(node, old, new))
1889 args.update(phases.preparehookargs(node, old, new))
1890 repo.hook('txnclose-phase', throw=False, txnname=desc,
1890 repo.hook('txnclose-phase', throw=False, txnname=desc,
1891 **pycompat.strkwargs(args))
1891 **pycompat.strkwargs(args))
1892
1892
1893 repo.hook('txnclose', throw=False, txnname=desc,
1893 repo.hook('txnclose', throw=False, txnname=desc,
1894 **pycompat.strkwargs(hookargs))
1894 **pycompat.strkwargs(hookargs))
1895 reporef()._afterlock(hookfunc)
1895 reporef()._afterlock(hookfunc)
1896 tr.addfinalize('txnclose-hook', txnclosehook)
1896 tr.addfinalize('txnclose-hook', txnclosehook)
1897 # Include a leading "-" to make it happen before the transaction summary
1897 # Include a leading "-" to make it happen before the transaction summary
1898 # reports registered via scmutil.registersummarycallback() whose names
1898 # reports registered via scmutil.registersummarycallback() whose names
1899 # are 00-txnreport etc. That way, the caches will be warm when the
1899 # are 00-txnreport etc. That way, the caches will be warm when the
1900 # callbacks run.
1900 # callbacks run.
1901 tr.addpostclose('-warm-cache', self._buildcacheupdater(tr))
1901 tr.addpostclose('-warm-cache', self._buildcacheupdater(tr))
1902 def txnaborthook(tr2):
1902 def txnaborthook(tr2):
1903 """To be run if transaction is aborted
1903 """To be run if transaction is aborted
1904 """
1904 """
1905 reporef().hook('txnabort', throw=False, txnname=desc,
1905 reporef().hook('txnabort', throw=False, txnname=desc,
1906 **pycompat.strkwargs(tr2.hookargs))
1906 **pycompat.strkwargs(tr2.hookargs))
1907 tr.addabort('txnabort-hook', txnaborthook)
1907 tr.addabort('txnabort-hook', txnaborthook)
1908 # avoid eager cache invalidation. in-memory data should be identical
1908 # avoid eager cache invalidation. in-memory data should be identical
1909 # to stored data if transaction has no error.
1909 # to stored data if transaction has no error.
1910 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1910 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1911 self._transref = weakref.ref(tr)
1911 self._transref = weakref.ref(tr)
1912 scmutil.registersummarycallback(self, tr, desc)
1912 scmutil.registersummarycallback(self, tr, desc)
1913 return tr
1913 return tr
1914
1914
1915 def _journalfiles(self):
1915 def _journalfiles(self):
1916 return ((self.svfs, 'journal'),
1916 return ((self.svfs, 'journal'),
1917 (self.svfs, 'journal.narrowspec'),
1917 (self.svfs, 'journal.narrowspec'),
1918 (self.vfs, 'journal.narrowspec.dirstate'),
1918 (self.vfs, 'journal.narrowspec.dirstate'),
1919 (self.vfs, 'journal.dirstate'),
1919 (self.vfs, 'journal.dirstate'),
1920 (self.vfs, 'journal.branch'),
1920 (self.vfs, 'journal.branch'),
1921 (self.vfs, 'journal.desc'),
1921 (self.vfs, 'journal.desc'),
1922 (self.vfs, 'journal.bookmarks'),
1922 (self.vfs, 'journal.bookmarks'),
1923 (self.svfs, 'journal.phaseroots'))
1923 (self.svfs, 'journal.phaseroots'))
1924
1924
1925 def undofiles(self):
1925 def undofiles(self):
1926 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
1926 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
1927
1927
1928 @unfilteredmethod
1928 @unfilteredmethod
1929 def _writejournal(self, desc):
1929 def _writejournal(self, desc):
1930 self.dirstate.savebackup(None, 'journal.dirstate')
1930 self.dirstate.savebackup(None, 'journal.dirstate')
1931 narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate')
1931 narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate')
1932 narrowspec.savebackup(self, 'journal.narrowspec')
1932 narrowspec.savebackup(self, 'journal.narrowspec')
1933 self.vfs.write("journal.branch",
1933 self.vfs.write("journal.branch",
1934 encoding.fromlocal(self.dirstate.branch()))
1934 encoding.fromlocal(self.dirstate.branch()))
1935 self.vfs.write("journal.desc",
1935 self.vfs.write("journal.desc",
1936 "%d\n%s\n" % (len(self), desc))
1936 "%d\n%s\n" % (len(self), desc))
1937 self.vfs.write("journal.bookmarks",
1937 self.vfs.write("journal.bookmarks",
1938 self.vfs.tryread("bookmarks"))
1938 self.vfs.tryread("bookmarks"))
1939 self.svfs.write("journal.phaseroots",
1939 self.svfs.write("journal.phaseroots",
1940 self.svfs.tryread("phaseroots"))
1940 self.svfs.tryread("phaseroots"))
1941
1941
1942 def recover(self):
1942 def recover(self):
1943 with self.lock():
1943 with self.lock():
1944 if self.svfs.exists("journal"):
1944 if self.svfs.exists("journal"):
1945 self.ui.status(_("rolling back interrupted transaction\n"))
1945 self.ui.status(_("rolling back interrupted transaction\n"))
1946 vfsmap = {'': self.svfs,
1946 vfsmap = {'': self.svfs,
1947 'plain': self.vfs,}
1947 'plain': self.vfs,}
1948 transaction.rollback(self.svfs, vfsmap, "journal",
1948 transaction.rollback(self.svfs, vfsmap, "journal",
1949 self.ui.warn,
1949 self.ui.warn,
1950 checkambigfiles=_cachedfiles)
1950 checkambigfiles=_cachedfiles)
1951 self.invalidate()
1951 self.invalidate()
1952 return True
1952 return True
1953 else:
1953 else:
1954 self.ui.warn(_("no interrupted transaction available\n"))
1954 self.ui.warn(_("no interrupted transaction available\n"))
1955 return False
1955 return False
1956
1956
1957 def rollback(self, dryrun=False, force=False):
1957 def rollback(self, dryrun=False, force=False):
1958 wlock = lock = dsguard = None
1958 wlock = lock = dsguard = None
1959 try:
1959 try:
1960 wlock = self.wlock()
1960 wlock = self.wlock()
1961 lock = self.lock()
1961 lock = self.lock()
1962 if self.svfs.exists("undo"):
1962 if self.svfs.exists("undo"):
1963 dsguard = dirstateguard.dirstateguard(self, 'rollback')
1963 dsguard = dirstateguard.dirstateguard(self, 'rollback')
1964
1964
1965 return self._rollback(dryrun, force, dsguard)
1965 return self._rollback(dryrun, force, dsguard)
1966 else:
1966 else:
1967 self.ui.warn(_("no rollback information available\n"))
1967 self.ui.warn(_("no rollback information available\n"))
1968 return 1
1968 return 1
1969 finally:
1969 finally:
1970 release(dsguard, lock, wlock)
1970 release(dsguard, lock, wlock)
1971
1971
1972 @unfilteredmethod # Until we get smarter cache management
1972 @unfilteredmethod # Until we get smarter cache management
1973 def _rollback(self, dryrun, force, dsguard):
1973 def _rollback(self, dryrun, force, dsguard):
1974 ui = self.ui
1974 ui = self.ui
1975 try:
1975 try:
1976 args = self.vfs.read('undo.desc').splitlines()
1976 args = self.vfs.read('undo.desc').splitlines()
1977 (oldlen, desc, detail) = (int(args[0]), args[1], None)
1977 (oldlen, desc, detail) = (int(args[0]), args[1], None)
1978 if len(args) >= 3:
1978 if len(args) >= 3:
1979 detail = args[2]
1979 detail = args[2]
1980 oldtip = oldlen - 1
1980 oldtip = oldlen - 1
1981
1981
1982 if detail and ui.verbose:
1982 if detail and ui.verbose:
1983 msg = (_('repository tip rolled back to revision %d'
1983 msg = (_('repository tip rolled back to revision %d'
1984 ' (undo %s: %s)\n')
1984 ' (undo %s: %s)\n')
1985 % (oldtip, desc, detail))
1985 % (oldtip, desc, detail))
1986 else:
1986 else:
1987 msg = (_('repository tip rolled back to revision %d'
1987 msg = (_('repository tip rolled back to revision %d'
1988 ' (undo %s)\n')
1988 ' (undo %s)\n')
1989 % (oldtip, desc))
1989 % (oldtip, desc))
1990 except IOError:
1990 except IOError:
1991 msg = _('rolling back unknown transaction\n')
1991 msg = _('rolling back unknown transaction\n')
1992 desc = None
1992 desc = None
1993
1993
1994 if not force and self['.'] != self['tip'] and desc == 'commit':
1994 if not force and self['.'] != self['tip'] and desc == 'commit':
1995 raise error.Abort(
1995 raise error.Abort(
1996 _('rollback of last commit while not checked out '
1996 _('rollback of last commit while not checked out '
1997 'may lose data'), hint=_('use -f to force'))
1997 'may lose data'), hint=_('use -f to force'))
1998
1998
1999 ui.status(msg)
1999 ui.status(msg)
2000 if dryrun:
2000 if dryrun:
2001 return 0
2001 return 0
2002
2002
2003 parents = self.dirstate.parents()
2003 parents = self.dirstate.parents()
2004 self.destroying()
2004 self.destroying()
2005 vfsmap = {'plain': self.vfs, '': self.svfs}
2005 vfsmap = {'plain': self.vfs, '': self.svfs}
2006 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn,
2006 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn,
2007 checkambigfiles=_cachedfiles)
2007 checkambigfiles=_cachedfiles)
2008 if self.vfs.exists('undo.bookmarks'):
2008 if self.vfs.exists('undo.bookmarks'):
2009 self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True)
2009 self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True)
2010 if self.svfs.exists('undo.phaseroots'):
2010 if self.svfs.exists('undo.phaseroots'):
2011 self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True)
2011 self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True)
2012 self.invalidate()
2012 self.invalidate()
2013
2013
2014 parentgone = (parents[0] not in self.changelog.nodemap or
2014 parentgone = (parents[0] not in self.changelog.nodemap or
2015 parents[1] not in self.changelog.nodemap)
2015 parents[1] not in self.changelog.nodemap)
2016 if parentgone:
2016 if parentgone:
2017 # prevent dirstateguard from overwriting already restored one
2017 # prevent dirstateguard from overwriting already restored one
2018 dsguard.close()
2018 dsguard.close()
2019
2019
2020 narrowspec.restorebackup(self, 'undo.narrowspec')
2020 narrowspec.restorebackup(self, 'undo.narrowspec')
2021 narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate')
2021 narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate')
2022 self.dirstate.restorebackup(None, 'undo.dirstate')
2022 self.dirstate.restorebackup(None, 'undo.dirstate')
2023 try:
2023 try:
2024 branch = self.vfs.read('undo.branch')
2024 branch = self.vfs.read('undo.branch')
2025 self.dirstate.setbranch(encoding.tolocal(branch))
2025 self.dirstate.setbranch(encoding.tolocal(branch))
2026 except IOError:
2026 except IOError:
2027 ui.warn(_('named branch could not be reset: '
2027 ui.warn(_('named branch could not be reset: '
2028 'current branch is still \'%s\'\n')
2028 'current branch is still \'%s\'\n')
2029 % self.dirstate.branch())
2029 % self.dirstate.branch())
2030
2030
2031 parents = tuple([p.rev() for p in self[None].parents()])
2031 parents = tuple([p.rev() for p in self[None].parents()])
2032 if len(parents) > 1:
2032 if len(parents) > 1:
2033 ui.status(_('working directory now based on '
2033 ui.status(_('working directory now based on '
2034 'revisions %d and %d\n') % parents)
2034 'revisions %d and %d\n') % parents)
2035 else:
2035 else:
2036 ui.status(_('working directory now based on '
2036 ui.status(_('working directory now based on '
2037 'revision %d\n') % parents)
2037 'revision %d\n') % parents)
2038 mergemod.mergestate.clean(self, self['.'].node())
2038 mergemod.mergestate.clean(self, self['.'].node())
2039
2039
2040 # TODO: if we know which new heads may result from this rollback, pass
2040 # TODO: if we know which new heads may result from this rollback, pass
2041 # them to destroy(), which will prevent the branchhead cache from being
2041 # them to destroy(), which will prevent the branchhead cache from being
2042 # invalidated.
2042 # invalidated.
2043 self.destroyed()
2043 self.destroyed()
2044 return 0
2044 return 0
2045
2045
2046 def _buildcacheupdater(self, newtransaction):
2046 def _buildcacheupdater(self, newtransaction):
2047 """called during transaction to build the callback updating cache
2047 """called during transaction to build the callback updating cache
2048
2048
2049 Lives on the repository to help extension who might want to augment
2049 Lives on the repository to help extension who might want to augment
2050 this logic. For this purpose, the created transaction is passed to the
2050 this logic. For this purpose, the created transaction is passed to the
2051 method.
2051 method.
2052 """
2052 """
2053 # we must avoid cyclic reference between repo and transaction.
2053 # we must avoid cyclic reference between repo and transaction.
2054 reporef = weakref.ref(self)
2054 reporef = weakref.ref(self)
2055 def updater(tr):
2055 def updater(tr):
2056 repo = reporef()
2056 repo = reporef()
2057 repo.updatecaches(tr)
2057 repo.updatecaches(tr)
2058 return updater
2058 return updater
2059
2059
2060 @unfilteredmethod
2060 @unfilteredmethod
2061 def updatecaches(self, tr=None, full=False):
2061 def updatecaches(self, tr=None, full=False):
2062 """warm appropriate caches
2062 """warm appropriate caches
2063
2063
2064 If this function is called after a transaction closed. The transaction
2064 If this function is called after a transaction closed. The transaction
2065 will be available in the 'tr' argument. This can be used to selectively
2065 will be available in the 'tr' argument. This can be used to selectively
2066 update caches relevant to the changes in that transaction.
2066 update caches relevant to the changes in that transaction.
2067
2067
2068 If 'full' is set, make sure all caches the function knows about have
2068 If 'full' is set, make sure all caches the function knows about have
2069 up-to-date data. Even the ones usually loaded more lazily.
2069 up-to-date data. Even the ones usually loaded more lazily.
2070 """
2070 """
2071 if tr is not None and tr.hookargs.get('source') == 'strip':
2071 if tr is not None and tr.hookargs.get('source') == 'strip':
2072 # During strip, many caches are invalid but
2072 # During strip, many caches are invalid but
2073 # later call to `destroyed` will refresh them.
2073 # later call to `destroyed` will refresh them.
2074 return
2074 return
2075
2075
2076 if tr is None or tr.changes['origrepolen'] < len(self):
2076 if tr is None or tr.changes['origrepolen'] < len(self):
2077 # updating the unfiltered branchmap should refresh all the others,
2077 # updating the unfiltered branchmap should refresh all the others,
2078 self.ui.debug('updating the branch cache\n')
2078 self.ui.debug('updating the branch cache\n')
2079 branchmap.updatecache(self.filtered('served'))
2079 branchmap.updatecache(self.filtered('served'))
2080
2080
2081 if full:
2081 if full:
2082 rbc = self.revbranchcache()
2082 rbc = self.revbranchcache()
2083 for r in self.changelog:
2083 for r in self.changelog:
2084 rbc.branchinfo(r)
2084 rbc.branchinfo(r)
2085 rbc.write()
2085 rbc.write()
2086
2086
2087 # ensure the working copy parents are in the manifestfulltextcache
2087 # ensure the working copy parents are in the manifestfulltextcache
2088 for ctx in self['.'].parents():
2088 for ctx in self['.'].parents():
2089 ctx.manifest() # accessing the manifest is enough
2089 ctx.manifest() # accessing the manifest is enough
2090
2090
2091 def invalidatecaches(self):
2091 def invalidatecaches(self):
2092
2092
2093 if r'_tagscache' in vars(self):
2093 if r'_tagscache' in vars(self):
2094 # can't use delattr on proxy
2094 # can't use delattr on proxy
2095 del self.__dict__[r'_tagscache']
2095 del self.__dict__[r'_tagscache']
2096
2096
2097 self.unfiltered()._branchcaches.clear()
2097 self.unfiltered()._branchcaches.clear()
2098 self.invalidatevolatilesets()
2098 self.invalidatevolatilesets()
2099 self._sparsesignaturecache.clear()
2099 self._sparsesignaturecache.clear()
2100
2100
2101 def invalidatevolatilesets(self):
2101 def invalidatevolatilesets(self):
2102 self.filteredrevcache.clear()
2102 self.filteredrevcache.clear()
2103 obsolete.clearobscaches(self)
2103 obsolete.clearobscaches(self)
2104
2104
2105 def invalidatedirstate(self):
2105 def invalidatedirstate(self):
2106 '''Invalidates the dirstate, causing the next call to dirstate
2106 '''Invalidates the dirstate, causing the next call to dirstate
2107 to check if it was modified since the last time it was read,
2107 to check if it was modified since the last time it was read,
2108 rereading it if it has.
2108 rereading it if it has.
2109
2109
2110 This is different to dirstate.invalidate() that it doesn't always
2110 This is different to dirstate.invalidate() that it doesn't always
2111 rereads the dirstate. Use dirstate.invalidate() if you want to
2111 rereads the dirstate. Use dirstate.invalidate() if you want to
2112 explicitly read the dirstate again (i.e. restoring it to a previous
2112 explicitly read the dirstate again (i.e. restoring it to a previous
2113 known good state).'''
2113 known good state).'''
2114 if hasunfilteredcache(self, r'dirstate'):
2114 if hasunfilteredcache(self, r'dirstate'):
2115 for k in self.dirstate._filecache:
2115 for k in self.dirstate._filecache:
2116 try:
2116 try:
2117 delattr(self.dirstate, k)
2117 delattr(self.dirstate, k)
2118 except AttributeError:
2118 except AttributeError:
2119 pass
2119 pass
2120 delattr(self.unfiltered(), r'dirstate')
2120 delattr(self.unfiltered(), r'dirstate')
2121
2121
2122 def invalidate(self, clearfilecache=False):
2122 def invalidate(self, clearfilecache=False):
2123 '''Invalidates both store and non-store parts other than dirstate
2123 '''Invalidates both store and non-store parts other than dirstate
2124
2124
2125 If a transaction is running, invalidation of store is omitted,
2125 If a transaction is running, invalidation of store is omitted,
2126 because discarding in-memory changes might cause inconsistency
2126 because discarding in-memory changes might cause inconsistency
2127 (e.g. incomplete fncache causes unintentional failure, but
2127 (e.g. incomplete fncache causes unintentional failure, but
2128 redundant one doesn't).
2128 redundant one doesn't).
2129 '''
2129 '''
2130 unfiltered = self.unfiltered() # all file caches are stored unfiltered
2130 unfiltered = self.unfiltered() # all file caches are stored unfiltered
2131 for k in list(self._filecache.keys()):
2131 for k in list(self._filecache.keys()):
2132 # dirstate is invalidated separately in invalidatedirstate()
2132 # dirstate is invalidated separately in invalidatedirstate()
2133 if k == 'dirstate':
2133 if k == 'dirstate':
2134 continue
2134 continue
2135 if (k == 'changelog' and
2135 if (k == 'changelog' and
2136 self.currenttransaction() and
2136 self.currenttransaction() and
2137 self.changelog._delayed):
2137 self.changelog._delayed):
2138 # The changelog object may store unwritten revisions. We don't
2138 # The changelog object may store unwritten revisions. We don't
2139 # want to lose them.
2139 # want to lose them.
2140 # TODO: Solve the problem instead of working around it.
2140 # TODO: Solve the problem instead of working around it.
2141 continue
2141 continue
2142
2142
2143 if clearfilecache:
2143 if clearfilecache:
2144 del self._filecache[k]
2144 del self._filecache[k]
2145 try:
2145 try:
2146 delattr(unfiltered, k)
2146 delattr(unfiltered, k)
2147 except AttributeError:
2147 except AttributeError:
2148 pass
2148 pass
2149 self.invalidatecaches()
2149 self.invalidatecaches()
2150 if not self.currenttransaction():
2150 if not self.currenttransaction():
2151 # TODO: Changing contents of store outside transaction
2151 # TODO: Changing contents of store outside transaction
2152 # causes inconsistency. We should make in-memory store
2152 # causes inconsistency. We should make in-memory store
2153 # changes detectable, and abort if changed.
2153 # changes detectable, and abort if changed.
2154 self.store.invalidatecaches()
2154 self.store.invalidatecaches()
2155
2155
2156 def invalidateall(self):
2156 def invalidateall(self):
2157 '''Fully invalidates both store and non-store parts, causing the
2157 '''Fully invalidates both store and non-store parts, causing the
2158 subsequent operation to reread any outside changes.'''
2158 subsequent operation to reread any outside changes.'''
2159 # extension should hook this to invalidate its caches
2159 # extension should hook this to invalidate its caches
2160 self.invalidate()
2160 self.invalidate()
2161 self.invalidatedirstate()
2161 self.invalidatedirstate()
2162
2162
2163 @unfilteredmethod
2163 @unfilteredmethod
2164 def _refreshfilecachestats(self, tr):
2164 def _refreshfilecachestats(self, tr):
2165 """Reload stats of cached files so that they are flagged as valid"""
2165 """Reload stats of cached files so that they are flagged as valid"""
2166 for k, ce in self._filecache.items():
2166 for k, ce in self._filecache.items():
2167 k = pycompat.sysstr(k)
2167 k = pycompat.sysstr(k)
2168 if k == r'dirstate' or k not in self.__dict__:
2168 if k == r'dirstate' or k not in self.__dict__:
2169 continue
2169 continue
2170 ce.refresh()
2170 ce.refresh()
2171
2171
2172 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc,
2172 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc,
2173 inheritchecker=None, parentenvvar=None):
2173 inheritchecker=None, parentenvvar=None):
2174 parentlock = None
2174 parentlock = None
2175 # the contents of parentenvvar are used by the underlying lock to
2175 # the contents of parentenvvar are used by the underlying lock to
2176 # determine whether it can be inherited
2176 # determine whether it can be inherited
2177 if parentenvvar is not None:
2177 if parentenvvar is not None:
2178 parentlock = encoding.environ.get(parentenvvar)
2178 parentlock = encoding.environ.get(parentenvvar)
2179
2179
2180 timeout = 0
2180 timeout = 0
2181 warntimeout = 0
2181 warntimeout = 0
2182 if wait:
2182 if wait:
2183 timeout = self.ui.configint("ui", "timeout")
2183 timeout = self.ui.configint("ui", "timeout")
2184 warntimeout = self.ui.configint("ui", "timeout.warn")
2184 warntimeout = self.ui.configint("ui", "timeout.warn")
2185 # internal config: ui.signal-safe-lock
2185 # internal config: ui.signal-safe-lock
2186 signalsafe = self.ui.configbool('ui', 'signal-safe-lock')
2186 signalsafe = self.ui.configbool('ui', 'signal-safe-lock')
2187
2187
2188 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
2188 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
2189 releasefn=releasefn,
2189 releasefn=releasefn,
2190 acquirefn=acquirefn, desc=desc,
2190 acquirefn=acquirefn, desc=desc,
2191 inheritchecker=inheritchecker,
2191 inheritchecker=inheritchecker,
2192 parentlock=parentlock,
2192 parentlock=parentlock,
2193 signalsafe=signalsafe)
2193 signalsafe=signalsafe)
2194 return l
2194 return l
2195
2195
2196 def _afterlock(self, callback):
2196 def _afterlock(self, callback):
2197 """add a callback to be run when the repository is fully unlocked
2197 """add a callback to be run when the repository is fully unlocked
2198
2198
2199 The callback will be executed when the outermost lock is released
2199 The callback will be executed when the outermost lock is released
2200 (with wlock being higher level than 'lock')."""
2200 (with wlock being higher level than 'lock')."""
2201 for ref in (self._wlockref, self._lockref):
2201 for ref in (self._wlockref, self._lockref):
2202 l = ref and ref()
2202 l = ref and ref()
2203 if l and l.held:
2203 if l and l.held:
2204 l.postrelease.append(callback)
2204 l.postrelease.append(callback)
2205 break
2205 break
2206 else: # no lock have been found.
2206 else: # no lock have been found.
2207 callback()
2207 callback()
2208
2208
2209 def lock(self, wait=True):
2209 def lock(self, wait=True):
2210 '''Lock the repository store (.hg/store) and return a weak reference
2210 '''Lock the repository store (.hg/store) and return a weak reference
2211 to the lock. Use this before modifying the store (e.g. committing or
2211 to the lock. Use this before modifying the store (e.g. committing or
2212 stripping). If you are opening a transaction, get a lock as well.)
2212 stripping). If you are opening a transaction, get a lock as well.)
2213
2213
2214 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2214 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2215 'wlock' first to avoid a dead-lock hazard.'''
2215 'wlock' first to avoid a dead-lock hazard.'''
2216 l = self._currentlock(self._lockref)
2216 l = self._currentlock(self._lockref)
2217 if l is not None:
2217 if l is not None:
2218 l.lock()
2218 l.lock()
2219 return l
2219 return l
2220
2220
2221 l = self._lock(self.svfs, "lock", wait, None,
2221 l = self._lock(self.svfs, "lock", wait, None,
2222 self.invalidate, _('repository %s') % self.origroot)
2222 self.invalidate, _('repository %s') % self.origroot)
2223 self._lockref = weakref.ref(l)
2223 self._lockref = weakref.ref(l)
2224 return l
2224 return l
2225
2225
2226 def _wlockchecktransaction(self):
2226 def _wlockchecktransaction(self):
2227 if self.currenttransaction() is not None:
2227 if self.currenttransaction() is not None:
2228 raise error.LockInheritanceContractViolation(
2228 raise error.LockInheritanceContractViolation(
2229 'wlock cannot be inherited in the middle of a transaction')
2229 'wlock cannot be inherited in the middle of a transaction')
2230
2230
2231 def wlock(self, wait=True):
2231 def wlock(self, wait=True):
2232 '''Lock the non-store parts of the repository (everything under
2232 '''Lock the non-store parts of the repository (everything under
2233 .hg except .hg/store) and return a weak reference to the lock.
2233 .hg except .hg/store) and return a weak reference to the lock.
2234
2234
2235 Use this before modifying files in .hg.
2235 Use this before modifying files in .hg.
2236
2236
2237 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2237 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2238 'wlock' first to avoid a dead-lock hazard.'''
2238 'wlock' first to avoid a dead-lock hazard.'''
2239 l = self._wlockref and self._wlockref()
2239 l = self._wlockref and self._wlockref()
2240 if l is not None and l.held:
2240 if l is not None and l.held:
2241 l.lock()
2241 l.lock()
2242 return l
2242 return l
2243
2243
2244 # We do not need to check for non-waiting lock acquisition. Such
2244 # We do not need to check for non-waiting lock acquisition. Such
2245 # acquisition would not cause dead-lock as they would just fail.
2245 # acquisition would not cause dead-lock as they would just fail.
2246 if wait and (self.ui.configbool('devel', 'all-warnings')
2246 if wait and (self.ui.configbool('devel', 'all-warnings')
2247 or self.ui.configbool('devel', 'check-locks')):
2247 or self.ui.configbool('devel', 'check-locks')):
2248 if self._currentlock(self._lockref) is not None:
2248 if self._currentlock(self._lockref) is not None:
2249 self.ui.develwarn('"wlock" acquired after "lock"')
2249 self.ui.develwarn('"wlock" acquired after "lock"')
2250
2250
2251 def unlock():
2251 def unlock():
2252 if self.dirstate.pendingparentchange():
2252 if self.dirstate.pendingparentchange():
2253 self.dirstate.invalidate()
2253 self.dirstate.invalidate()
2254 else:
2254 else:
2255 self.dirstate.write(None)
2255 self.dirstate.write(None)
2256
2256
2257 self._filecache['dirstate'].refresh()
2257 self._filecache['dirstate'].refresh()
2258
2258
2259 l = self._lock(self.vfs, "wlock", wait, unlock,
2259 l = self._lock(self.vfs, "wlock", wait, unlock,
2260 self.invalidatedirstate, _('working directory of %s') %
2260 self.invalidatedirstate, _('working directory of %s') %
2261 self.origroot,
2261 self.origroot,
2262 inheritchecker=self._wlockchecktransaction,
2262 inheritchecker=self._wlockchecktransaction,
2263 parentenvvar='HG_WLOCK_LOCKER')
2263 parentenvvar='HG_WLOCK_LOCKER')
2264 self._wlockref = weakref.ref(l)
2264 self._wlockref = weakref.ref(l)
2265 return l
2265 return l
2266
2266
2267 def _currentlock(self, lockref):
2267 def _currentlock(self, lockref):
2268 """Returns the lock if it's held, or None if it's not."""
2268 """Returns the lock if it's held, or None if it's not."""
2269 if lockref is None:
2269 if lockref is None:
2270 return None
2270 return None
2271 l = lockref()
2271 l = lockref()
2272 if l is None or not l.held:
2272 if l is None or not l.held:
2273 return None
2273 return None
2274 return l
2274 return l
2275
2275
2276 def currentwlock(self):
2276 def currentwlock(self):
2277 """Returns the wlock if it's held, or None if it's not."""
2277 """Returns the wlock if it's held, or None if it's not."""
2278 return self._currentlock(self._wlockref)
2278 return self._currentlock(self._wlockref)
2279
2279
2280 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
2280 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
2281 """
2281 """
2282 commit an individual file as part of a larger transaction
2282 commit an individual file as part of a larger transaction
2283 """
2283 """
2284
2284
2285 fname = fctx.path()
2285 fname = fctx.path()
2286 fparent1 = manifest1.get(fname, nullid)
2286 fparent1 = manifest1.get(fname, nullid)
2287 fparent2 = manifest2.get(fname, nullid)
2287 fparent2 = manifest2.get(fname, nullid)
2288 if isinstance(fctx, context.filectx):
2288 if isinstance(fctx, context.filectx):
2289 node = fctx.filenode()
2289 node = fctx.filenode()
2290 if node in [fparent1, fparent2]:
2290 if node in [fparent1, fparent2]:
2291 self.ui.debug('reusing %s filelog entry\n' % fname)
2291 self.ui.debug('reusing %s filelog entry\n' % fname)
2292 if manifest1.flags(fname) != fctx.flags():
2292 if manifest1.flags(fname) != fctx.flags():
2293 changelist.append(fname)
2293 changelist.append(fname)
2294 return node
2294 return node
2295
2295
2296 flog = self.file(fname)
2296 flog = self.file(fname)
2297 meta = {}
2297 meta = {}
2298 copy = fctx.renamed()
2298 copy = fctx.renamed()
2299 if copy and copy[0] != fname:
2299 if copy and copy[0] != fname:
2300 # Mark the new revision of this file as a copy of another
2300 # Mark the new revision of this file as a copy of another
2301 # file. This copy data will effectively act as a parent
2301 # file. This copy data will effectively act as a parent
2302 # of this new revision. If this is a merge, the first
2302 # of this new revision. If this is a merge, the first
2303 # parent will be the nullid (meaning "look up the copy data")
2303 # parent will be the nullid (meaning "look up the copy data")
2304 # and the second one will be the other parent. For example:
2304 # and the second one will be the other parent. For example:
2305 #
2305 #
2306 # 0 --- 1 --- 3 rev1 changes file foo
2306 # 0 --- 1 --- 3 rev1 changes file foo
2307 # \ / rev2 renames foo to bar and changes it
2307 # \ / rev2 renames foo to bar and changes it
2308 # \- 2 -/ rev3 should have bar with all changes and
2308 # \- 2 -/ rev3 should have bar with all changes and
2309 # should record that bar descends from
2309 # should record that bar descends from
2310 # bar in rev2 and foo in rev1
2310 # bar in rev2 and foo in rev1
2311 #
2311 #
2312 # this allows this merge to succeed:
2312 # this allows this merge to succeed:
2313 #
2313 #
2314 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
2314 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
2315 # \ / merging rev3 and rev4 should use bar@rev2
2315 # \ / merging rev3 and rev4 should use bar@rev2
2316 # \- 2 --- 4 as the merge base
2316 # \- 2 --- 4 as the merge base
2317 #
2317 #
2318
2318
2319 cfname = copy[0]
2319 cfname = copy[0]
2320 crev = manifest1.get(cfname)
2320 crev = manifest1.get(cfname)
2321 newfparent = fparent2
2321 newfparent = fparent2
2322
2322
2323 if manifest2: # branch merge
2323 if manifest2: # branch merge
2324 if fparent2 == nullid or crev is None: # copied on remote side
2324 if fparent2 == nullid or crev is None: # copied on remote side
2325 if cfname in manifest2:
2325 if cfname in manifest2:
2326 crev = manifest2[cfname]
2326 crev = manifest2[cfname]
2327 newfparent = fparent1
2327 newfparent = fparent1
2328
2328
2329 # Here, we used to search backwards through history to try to find
2329 # Here, we used to search backwards through history to try to find
2330 # where the file copy came from if the source of a copy was not in
2330 # where the file copy came from if the source of a copy was not in
2331 # the parent directory. However, this doesn't actually make sense to
2331 # the parent directory. However, this doesn't actually make sense to
2332 # do (what does a copy from something not in your working copy even
2332 # do (what does a copy from something not in your working copy even
2333 # mean?) and it causes bugs (eg, issue4476). Instead, we will warn
2333 # mean?) and it causes bugs (eg, issue4476). Instead, we will warn
2334 # the user that copy information was dropped, so if they didn't
2334 # the user that copy information was dropped, so if they didn't
2335 # expect this outcome it can be fixed, but this is the correct
2335 # expect this outcome it can be fixed, but this is the correct
2336 # behavior in this circumstance.
2336 # behavior in this circumstance.
2337
2337
2338 if crev:
2338 if crev:
2339 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
2339 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
2340 meta["copy"] = cfname
2340 meta["copy"] = cfname
2341 meta["copyrev"] = hex(crev)
2341 meta["copyrev"] = hex(crev)
2342 fparent1, fparent2 = nullid, newfparent
2342 fparent1, fparent2 = nullid, newfparent
2343 else:
2343 else:
2344 self.ui.warn(_("warning: can't find ancestor for '%s' "
2344 self.ui.warn(_("warning: can't find ancestor for '%s' "
2345 "copied from '%s'!\n") % (fname, cfname))
2345 "copied from '%s'!\n") % (fname, cfname))
2346
2346
2347 elif fparent1 == nullid:
2347 elif fparent1 == nullid:
2348 fparent1, fparent2 = fparent2, nullid
2348 fparent1, fparent2 = fparent2, nullid
2349 elif fparent2 != nullid:
2349 elif fparent2 != nullid:
2350 # is one parent an ancestor of the other?
2350 # is one parent an ancestor of the other?
2351 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
2351 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
2352 if fparent1 in fparentancestors:
2352 if fparent1 in fparentancestors:
2353 fparent1, fparent2 = fparent2, nullid
2353 fparent1, fparent2 = fparent2, nullid
2354 elif fparent2 in fparentancestors:
2354 elif fparent2 in fparentancestors:
2355 fparent2 = nullid
2355 fparent2 = nullid
2356
2356
2357 # is the file changed?
2357 # is the file changed?
2358 text = fctx.data()
2358 text = fctx.data()
2359 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
2359 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
2360 changelist.append(fname)
2360 changelist.append(fname)
2361 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
2361 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
2362 # are just the flags changed during merge?
2362 # are just the flags changed during merge?
2363 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags():
2363 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags():
2364 changelist.append(fname)
2364 changelist.append(fname)
2365
2365
2366 return fparent1
2366 return fparent1
2367
2367
2368 def checkcommitpatterns(self, wctx, vdirs, match, status, fail):
2368 def checkcommitpatterns(self, wctx, vdirs, match, status, fail):
2369 """check for commit arguments that aren't committable"""
2369 """check for commit arguments that aren't committable"""
2370 if match.isexact() or match.prefix():
2370 if match.isexact() or match.prefix():
2371 matched = set(status.modified + status.added + status.removed)
2371 matched = set(status.modified + status.added + status.removed)
2372
2372
2373 for f in match.files():
2373 for f in match.files():
2374 f = self.dirstate.normalize(f)
2374 f = self.dirstate.normalize(f)
2375 if f == '.' or f in matched or f in wctx.substate:
2375 if f == '.' or f in matched or f in wctx.substate:
2376 continue
2376 continue
2377 if f in status.deleted:
2377 if f in status.deleted:
2378 fail(f, _('file not found!'))
2378 fail(f, _('file not found!'))
2379 if f in vdirs: # visited directory
2379 if f in vdirs: # visited directory
2380 d = f + '/'
2380 d = f + '/'
2381 for mf in matched:
2381 for mf in matched:
2382 if mf.startswith(d):
2382 if mf.startswith(d):
2383 break
2383 break
2384 else:
2384 else:
2385 fail(f, _("no match under directory!"))
2385 fail(f, _("no match under directory!"))
2386 elif f not in self.dirstate:
2386 elif f not in self.dirstate:
2387 fail(f, _("file not tracked!"))
2387 fail(f, _("file not tracked!"))
2388
2388
2389 @unfilteredmethod
2389 @unfilteredmethod
2390 def commit(self, text="", user=None, date=None, match=None, force=False,
2390 def commit(self, text="", user=None, date=None, match=None, force=False,
2391 editor=False, extra=None):
2391 editor=False, extra=None):
2392 """Add a new revision to current repository.
2392 """Add a new revision to current repository.
2393
2393
2394 Revision information is gathered from the working directory,
2394 Revision information is gathered from the working directory,
2395 match can be used to filter the committed files. If editor is
2395 match can be used to filter the committed files. If editor is
2396 supplied, it is called to get a commit message.
2396 supplied, it is called to get a commit message.
2397 """
2397 """
2398 if extra is None:
2398 if extra is None:
2399 extra = {}
2399 extra = {}
2400
2400
2401 def fail(f, msg):
2401 def fail(f, msg):
2402 raise error.Abort('%s: %s' % (f, msg))
2402 raise error.Abort('%s: %s' % (f, msg))
2403
2403
2404 if not match:
2404 if not match:
2405 match = matchmod.always(self.root, '')
2405 match = matchmod.always(self.root, '')
2406
2406
2407 if not force:
2407 if not force:
2408 vdirs = []
2408 vdirs = []
2409 match.explicitdir = vdirs.append
2409 match.explicitdir = vdirs.append
2410 match.bad = fail
2410 match.bad = fail
2411
2411
2412 wlock = lock = tr = None
2412 wlock = lock = tr = None
2413 try:
2413 try:
2414 wlock = self.wlock()
2414 wlock = self.wlock()
2415 lock = self.lock() # for recent changelog (see issue4368)
2415 lock = self.lock() # for recent changelog (see issue4368)
2416
2416
2417 wctx = self[None]
2417 wctx = self[None]
2418 merge = len(wctx.parents()) > 1
2418 merge = len(wctx.parents()) > 1
2419
2419
2420 if not force and merge and not match.always():
2420 if not force and merge and not match.always():
2421 raise error.Abort(_('cannot partially commit a merge '
2421 raise error.Abort(_('cannot partially commit a merge '
2422 '(do not specify files or patterns)'))
2422 '(do not specify files or patterns)'))
2423
2423
2424 status = self.status(match=match, clean=force)
2424 status = self.status(match=match, clean=force)
2425 if force:
2425 if force:
2426 status.modified.extend(status.clean) # mq may commit clean files
2426 status.modified.extend(status.clean) # mq may commit clean files
2427
2427
2428 # check subrepos
2428 # check subrepos
2429 subs, commitsubs, newstate = subrepoutil.precommit(
2429 subs, commitsubs, newstate = subrepoutil.precommit(
2430 self.ui, wctx, status, match, force=force)
2430 self.ui, wctx, status, match, force=force)
2431
2431
2432 # make sure all explicit patterns are matched
2432 # make sure all explicit patterns are matched
2433 if not force:
2433 if not force:
2434 self.checkcommitpatterns(wctx, vdirs, match, status, fail)
2434 self.checkcommitpatterns(wctx, vdirs, match, status, fail)
2435
2435
2436 cctx = context.workingcommitctx(self, status,
2436 cctx = context.workingcommitctx(self, status,
2437 text, user, date, extra)
2437 text, user, date, extra)
2438
2438
2439 # internal config: ui.allowemptycommit
2439 # internal config: ui.allowemptycommit
2440 allowemptycommit = (wctx.branch() != wctx.p1().branch()
2440 allowemptycommit = (wctx.branch() != wctx.p1().branch()
2441 or extra.get('close') or merge or cctx.files()
2441 or extra.get('close') or merge or cctx.files()
2442 or self.ui.configbool('ui', 'allowemptycommit'))
2442 or self.ui.configbool('ui', 'allowemptycommit'))
2443 if not allowemptycommit:
2443 if not allowemptycommit:
2444 return None
2444 return None
2445
2445
2446 if merge and cctx.deleted():
2446 if merge and cctx.deleted():
2447 raise error.Abort(_("cannot commit merge with missing files"))
2447 raise error.Abort(_("cannot commit merge with missing files"))
2448
2448
2449 ms = mergemod.mergestate.read(self)
2449 ms = mergemod.mergestate.read(self)
2450 mergeutil.checkunresolved(ms)
2450 mergeutil.checkunresolved(ms)
2451
2451
2452 if editor:
2452 if editor:
2453 cctx._text = editor(self, cctx, subs)
2453 cctx._text = editor(self, cctx, subs)
2454 edited = (text != cctx._text)
2454 edited = (text != cctx._text)
2455
2455
2456 # Save commit message in case this transaction gets rolled back
2456 # Save commit message in case this transaction gets rolled back
2457 # (e.g. by a pretxncommit hook). Leave the content alone on
2457 # (e.g. by a pretxncommit hook). Leave the content alone on
2458 # the assumption that the user will use the same editor again.
2458 # the assumption that the user will use the same editor again.
2459 msgfn = self.savecommitmessage(cctx._text)
2459 msgfn = self.savecommitmessage(cctx._text)
2460
2460
2461 # commit subs and write new state
2461 # commit subs and write new state
2462 if subs:
2462 if subs:
2463 for s in sorted(commitsubs):
2463 for s in sorted(commitsubs):
2464 sub = wctx.sub(s)
2464 sub = wctx.sub(s)
2465 self.ui.status(_('committing subrepository %s\n') %
2465 self.ui.status(_('committing subrepository %s\n') %
2466 subrepoutil.subrelpath(sub))
2466 subrepoutil.subrelpath(sub))
2467 sr = sub.commit(cctx._text, user, date)
2467 sr = sub.commit(cctx._text, user, date)
2468 newstate[s] = (newstate[s][0], sr)
2468 newstate[s] = (newstate[s][0], sr)
2469 subrepoutil.writestate(self, newstate)
2469 subrepoutil.writestate(self, newstate)
2470
2470
2471 p1, p2 = self.dirstate.parents()
2471 p1, p2 = self.dirstate.parents()
2472 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
2472 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
2473 try:
2473 try:
2474 self.hook("precommit", throw=True, parent1=hookp1,
2474 self.hook("precommit", throw=True, parent1=hookp1,
2475 parent2=hookp2)
2475 parent2=hookp2)
2476 tr = self.transaction('commit')
2476 tr = self.transaction('commit')
2477 ret = self.commitctx(cctx, True)
2477 ret = self.commitctx(cctx, True)
2478 except: # re-raises
2478 except: # re-raises
2479 if edited:
2479 if edited:
2480 self.ui.write(
2480 self.ui.write(
2481 _('note: commit message saved in %s\n') % msgfn)
2481 _('note: commit message saved in %s\n') % msgfn)
2482 raise
2482 raise
2483 # update bookmarks, dirstate and mergestate
2483 # update bookmarks, dirstate and mergestate
2484 bookmarks.update(self, [p1, p2], ret)
2484 bookmarks.update(self, [p1, p2], ret)
2485 cctx.markcommitted(ret)
2485 cctx.markcommitted(ret)
2486 ms.reset()
2486 ms.reset()
2487 tr.close()
2487 tr.close()
2488
2488
2489 finally:
2489 finally:
2490 lockmod.release(tr, lock, wlock)
2490 lockmod.release(tr, lock, wlock)
2491
2491
2492 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
2492 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
2493 # hack for command that use a temporary commit (eg: histedit)
2493 # hack for command that use a temporary commit (eg: histedit)
2494 # temporary commit got stripped before hook release
2494 # temporary commit got stripped before hook release
2495 if self.changelog.hasnode(ret):
2495 if self.changelog.hasnode(ret):
2496 self.hook("commit", node=node, parent1=parent1,
2496 self.hook("commit", node=node, parent1=parent1,
2497 parent2=parent2)
2497 parent2=parent2)
2498 self._afterlock(commithook)
2498 self._afterlock(commithook)
2499 return ret
2499 return ret
2500
2500
2501 @unfilteredmethod
2501 @unfilteredmethod
2502 def commitctx(self, ctx, error=False):
2502 def commitctx(self, ctx, error=False):
2503 """Add a new revision to current repository.
2503 """Add a new revision to current repository.
2504 Revision information is passed via the context argument.
2504 Revision information is passed via the context argument.
2505
2505
2506 ctx.files() should list all files involved in this commit, i.e.
2506 ctx.files() should list all files involved in this commit, i.e.
2507 modified/added/removed files. On merge, it may be wider than the
2507 modified/added/removed files. On merge, it may be wider than the
2508 ctx.files() to be committed, since any file nodes derived directly
2508 ctx.files() to be committed, since any file nodes derived directly
2509 from p1 or p2 are excluded from the committed ctx.files().
2509 from p1 or p2 are excluded from the committed ctx.files().
2510 """
2510 """
2511
2511
2512 tr = None
2512 tr = None
2513 p1, p2 = ctx.p1(), ctx.p2()
2513 p1, p2 = ctx.p1(), ctx.p2()
2514 user = ctx.user()
2514 user = ctx.user()
2515
2515
2516 lock = self.lock()
2516 lock = self.lock()
2517 try:
2517 try:
2518 tr = self.transaction("commit")
2518 tr = self.transaction("commit")
2519 trp = weakref.proxy(tr)
2519 trp = weakref.proxy(tr)
2520
2520
2521 if ctx.manifestnode():
2521 if ctx.manifestnode():
2522 # reuse an existing manifest revision
2522 # reuse an existing manifest revision
2523 self.ui.debug('reusing known manifest\n')
2523 self.ui.debug('reusing known manifest\n')
2524 mn = ctx.manifestnode()
2524 mn = ctx.manifestnode()
2525 files = ctx.files()
2525 files = ctx.files()
2526 elif ctx.files():
2526 elif ctx.files():
2527 m1ctx = p1.manifestctx()
2527 m1ctx = p1.manifestctx()
2528 m2ctx = p2.manifestctx()
2528 m2ctx = p2.manifestctx()
2529 mctx = m1ctx.copy()
2529 mctx = m1ctx.copy()
2530
2530
2531 m = mctx.read()
2531 m = mctx.read()
2532 m1 = m1ctx.read()
2532 m1 = m1ctx.read()
2533 m2 = m2ctx.read()
2533 m2 = m2ctx.read()
2534
2534
2535 # check in files
2535 # check in files
2536 added = []
2536 added = []
2537 changed = []
2537 changed = []
2538 removed = list(ctx.removed())
2538 removed = list(ctx.removed())
2539 linkrev = len(self)
2539 linkrev = len(self)
2540 self.ui.note(_("committing files:\n"))
2540 self.ui.note(_("committing files:\n"))
2541 for f in sorted(ctx.modified() + ctx.added()):
2541 for f in sorted(ctx.modified() + ctx.added()):
2542 self.ui.note(f + "\n")
2542 self.ui.note(f + "\n")
2543 try:
2543 try:
2544 fctx = ctx[f]
2544 fctx = ctx[f]
2545 if fctx is None:
2545 if fctx is None:
2546 removed.append(f)
2546 removed.append(f)
2547 else:
2547 else:
2548 added.append(f)
2548 added.append(f)
2549 m[f] = self._filecommit(fctx, m1, m2, linkrev,
2549 m[f] = self._filecommit(fctx, m1, m2, linkrev,
2550 trp, changed)
2550 trp, changed)
2551 m.setflag(f, fctx.flags())
2551 m.setflag(f, fctx.flags())
2552 except OSError as inst:
2552 except OSError as inst:
2553 self.ui.warn(_("trouble committing %s!\n") % f)
2553 self.ui.warn(_("trouble committing %s!\n") % f)
2554 raise
2554 raise
2555 except IOError as inst:
2555 except IOError as inst:
2556 errcode = getattr(inst, 'errno', errno.ENOENT)
2556 errcode = getattr(inst, 'errno', errno.ENOENT)
2557 if error or errcode and errcode != errno.ENOENT:
2557 if error or errcode and errcode != errno.ENOENT:
2558 self.ui.warn(_("trouble committing %s!\n") % f)
2558 self.ui.warn(_("trouble committing %s!\n") % f)
2559 raise
2559 raise
2560
2560
2561 # update manifest
2561 # update manifest
2562 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2562 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2563 drop = [f for f in removed if f in m]
2563 drop = [f for f in removed if f in m]
2564 for f in drop:
2564 for f in drop:
2565 del m[f]
2565 del m[f]
2566 files = changed + removed
2566 files = changed + removed
2567 md = None
2567 md = None
2568 if not files:
2568 if not files:
2569 # if no "files" actually changed in terms of the changelog,
2569 # if no "files" actually changed in terms of the changelog,
2570 # try hard to detect unmodified manifest entry so that the
2570 # try hard to detect unmodified manifest entry so that the
2571 # exact same commit can be reproduced later on convert.
2571 # exact same commit can be reproduced later on convert.
2572 md = m1.diff(m, scmutil.matchfiles(self, ctx.files()))
2572 md = m1.diff(m, scmutil.matchfiles(self, ctx.files()))
2573 if not files and md:
2573 if not files and md:
2574 self.ui.debug('not reusing manifest (no file change in '
2574 self.ui.debug('not reusing manifest (no file change in '
2575 'changelog, but manifest differs)\n')
2575 'changelog, but manifest differs)\n')
2576 if files or md:
2576 if files or md:
2577 self.ui.note(_("committing manifest\n"))
2577 self.ui.note(_("committing manifest\n"))
2578 # we're using narrowmatch here since it's already applied at
2578 # we're using narrowmatch here since it's already applied at
2579 # other stages (such as dirstate.walk), so we're already
2579 # other stages (such as dirstate.walk), so we're already
2580 # ignoring things outside of narrowspec in most cases. The
2580 # ignoring things outside of narrowspec in most cases. The
2581 # one case where we might have files outside the narrowspec
2581 # one case where we might have files outside the narrowspec
2582 # at this point is merges, and we already error out in the
2582 # at this point is merges, and we already error out in the
2583 # case where the merge has files outside of the narrowspec,
2583 # case where the merge has files outside of the narrowspec,
2584 # so this is safe.
2584 # so this is safe.
2585 mn = mctx.write(trp, linkrev,
2585 mn = mctx.write(trp, linkrev,
2586 p1.manifestnode(), p2.manifestnode(),
2586 p1.manifestnode(), p2.manifestnode(),
2587 added, drop, match=self.narrowmatch())
2587 added, drop, match=self.narrowmatch())
2588 else:
2588 else:
2589 self.ui.debug('reusing manifest form p1 (listed files '
2589 self.ui.debug('reusing manifest form p1 (listed files '
2590 'actually unchanged)\n')
2590 'actually unchanged)\n')
2591 mn = p1.manifestnode()
2591 mn = p1.manifestnode()
2592 else:
2592 else:
2593 self.ui.debug('reusing manifest from p1 (no file change)\n')
2593 self.ui.debug('reusing manifest from p1 (no file change)\n')
2594 mn = p1.manifestnode()
2594 mn = p1.manifestnode()
2595 files = []
2595 files = []
2596
2596
2597 # update changelog
2597 # update changelog
2598 self.ui.note(_("committing changelog\n"))
2598 self.ui.note(_("committing changelog\n"))
2599 self.changelog.delayupdate(tr)
2599 self.changelog.delayupdate(tr)
2600 n = self.changelog.add(mn, files, ctx.description(),
2600 n = self.changelog.add(mn, files, ctx.description(),
2601 trp, p1.node(), p2.node(),
2601 trp, p1.node(), p2.node(),
2602 user, ctx.date(), ctx.extra().copy())
2602 user, ctx.date(), ctx.extra().copy())
2603 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
2603 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
2604 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
2604 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
2605 parent2=xp2)
2605 parent2=xp2)
2606 # set the new commit is proper phase
2606 # set the new commit is proper phase
2607 targetphase = subrepoutil.newcommitphase(self.ui, ctx)
2607 targetphase = subrepoutil.newcommitphase(self.ui, ctx)
2608 if targetphase:
2608 if targetphase:
2609 # retract boundary do not alter parent changeset.
2609 # retract boundary do not alter parent changeset.
2610 # if a parent have higher the resulting phase will
2610 # if a parent have higher the resulting phase will
2611 # be compliant anyway
2611 # be compliant anyway
2612 #
2612 #
2613 # if minimal phase was 0 we don't need to retract anything
2613 # if minimal phase was 0 we don't need to retract anything
2614 phases.registernew(self, tr, targetphase, [n])
2614 phases.registernew(self, tr, targetphase, [n])
2615 tr.close()
2615 tr.close()
2616 return n
2616 return n
2617 finally:
2617 finally:
2618 if tr:
2618 if tr:
2619 tr.release()
2619 tr.release()
2620 lock.release()
2620 lock.release()
2621
2621
2622 @unfilteredmethod
2622 @unfilteredmethod
2623 def destroying(self):
2623 def destroying(self):
2624 '''Inform the repository that nodes are about to be destroyed.
2624 '''Inform the repository that nodes are about to be destroyed.
2625 Intended for use by strip and rollback, so there's a common
2625 Intended for use by strip and rollback, so there's a common
2626 place for anything that has to be done before destroying history.
2626 place for anything that has to be done before destroying history.
2627
2627
2628 This is mostly useful for saving state that is in memory and waiting
2628 This is mostly useful for saving state that is in memory and waiting
2629 to be flushed when the current lock is released. Because a call to
2629 to be flushed when the current lock is released. Because a call to
2630 destroyed is imminent, the repo will be invalidated causing those
2630 destroyed is imminent, the repo will be invalidated causing those
2631 changes to stay in memory (waiting for the next unlock), or vanish
2631 changes to stay in memory (waiting for the next unlock), or vanish
2632 completely.
2632 completely.
2633 '''
2633 '''
2634 # When using the same lock to commit and strip, the phasecache is left
2634 # When using the same lock to commit and strip, the phasecache is left
2635 # dirty after committing. Then when we strip, the repo is invalidated,
2635 # dirty after committing. Then when we strip, the repo is invalidated,
2636 # causing those changes to disappear.
2636 # causing those changes to disappear.
2637 if '_phasecache' in vars(self):
2637 if '_phasecache' in vars(self):
2638 self._phasecache.write()
2638 self._phasecache.write()
2639
2639
2640 @unfilteredmethod
2640 @unfilteredmethod
2641 def destroyed(self):
2641 def destroyed(self):
2642 '''Inform the repository that nodes have been destroyed.
2642 '''Inform the repository that nodes have been destroyed.
2643 Intended for use by strip and rollback, so there's a common
2643 Intended for use by strip and rollback, so there's a common
2644 place for anything that has to be done after destroying history.
2644 place for anything that has to be done after destroying history.
2645 '''
2645 '''
2646 # When one tries to:
2646 # When one tries to:
2647 # 1) destroy nodes thus calling this method (e.g. strip)
2647 # 1) destroy nodes thus calling this method (e.g. strip)
2648 # 2) use phasecache somewhere (e.g. commit)
2648 # 2) use phasecache somewhere (e.g. commit)
2649 #
2649 #
2650 # then 2) will fail because the phasecache contains nodes that were
2650 # then 2) will fail because the phasecache contains nodes that were
2651 # removed. We can either remove phasecache from the filecache,
2651 # removed. We can either remove phasecache from the filecache,
2652 # causing it to reload next time it is accessed, or simply filter
2652 # causing it to reload next time it is accessed, or simply filter
2653 # the removed nodes now and write the updated cache.
2653 # the removed nodes now and write the updated cache.
2654 self._phasecache.filterunknown(self)
2654 self._phasecache.filterunknown(self)
2655 self._phasecache.write()
2655 self._phasecache.write()
2656
2656
2657 # refresh all repository caches
2657 # refresh all repository caches
2658 self.updatecaches()
2658 self.updatecaches()
2659
2659
2660 # Ensure the persistent tag cache is updated. Doing it now
2660 # Ensure the persistent tag cache is updated. Doing it now
2661 # means that the tag cache only has to worry about destroyed
2661 # means that the tag cache only has to worry about destroyed
2662 # heads immediately after a strip/rollback. That in turn
2662 # heads immediately after a strip/rollback. That in turn
2663 # guarantees that "cachetip == currenttip" (comparing both rev
2663 # guarantees that "cachetip == currenttip" (comparing both rev
2664 # and node) always means no nodes have been added or destroyed.
2664 # and node) always means no nodes have been added or destroyed.
2665
2665
2666 # XXX this is suboptimal when qrefresh'ing: we strip the current
2666 # XXX this is suboptimal when qrefresh'ing: we strip the current
2667 # head, refresh the tag cache, then immediately add a new head.
2667 # head, refresh the tag cache, then immediately add a new head.
2668 # But I think doing it this way is necessary for the "instant
2668 # But I think doing it this way is necessary for the "instant
2669 # tag cache retrieval" case to work.
2669 # tag cache retrieval" case to work.
2670 self.invalidate()
2670 self.invalidate()
2671
2671
2672 def status(self, node1='.', node2=None, match=None,
2672 def status(self, node1='.', node2=None, match=None,
2673 ignored=False, clean=False, unknown=False,
2673 ignored=False, clean=False, unknown=False,
2674 listsubrepos=False):
2674 listsubrepos=False):
2675 '''a convenience method that calls node1.status(node2)'''
2675 '''a convenience method that calls node1.status(node2)'''
2676 return self[node1].status(node2, match, ignored, clean, unknown,
2676 return self[node1].status(node2, match, ignored, clean, unknown,
2677 listsubrepos)
2677 listsubrepos)
2678
2678
2679 def addpostdsstatus(self, ps):
2679 def addpostdsstatus(self, ps):
2680 """Add a callback to run within the wlock, at the point at which status
2680 """Add a callback to run within the wlock, at the point at which status
2681 fixups happen.
2681 fixups happen.
2682
2682
2683 On status completion, callback(wctx, status) will be called with the
2683 On status completion, callback(wctx, status) will be called with the
2684 wlock held, unless the dirstate has changed from underneath or the wlock
2684 wlock held, unless the dirstate has changed from underneath or the wlock
2685 couldn't be grabbed.
2685 couldn't be grabbed.
2686
2686
2687 Callbacks should not capture and use a cached copy of the dirstate --
2687 Callbacks should not capture and use a cached copy of the dirstate --
2688 it might change in the meanwhile. Instead, they should access the
2688 it might change in the meanwhile. Instead, they should access the
2689 dirstate via wctx.repo().dirstate.
2689 dirstate via wctx.repo().dirstate.
2690
2690
2691 This list is emptied out after each status run -- extensions should
2691 This list is emptied out after each status run -- extensions should
2692 make sure it adds to this list each time dirstate.status is called.
2692 make sure it adds to this list each time dirstate.status is called.
2693 Extensions should also make sure they don't call this for statuses
2693 Extensions should also make sure they don't call this for statuses
2694 that don't involve the dirstate.
2694 that don't involve the dirstate.
2695 """
2695 """
2696
2696
2697 # The list is located here for uniqueness reasons -- it is actually
2697 # The list is located here for uniqueness reasons -- it is actually
2698 # managed by the workingctx, but that isn't unique per-repo.
2698 # managed by the workingctx, but that isn't unique per-repo.
2699 self._postdsstatus.append(ps)
2699 self._postdsstatus.append(ps)
2700
2700
2701 def postdsstatus(self):
2701 def postdsstatus(self):
2702 """Used by workingctx to get the list of post-dirstate-status hooks."""
2702 """Used by workingctx to get the list of post-dirstate-status hooks."""
2703 return self._postdsstatus
2703 return self._postdsstatus
2704
2704
2705 def clearpostdsstatus(self):
2705 def clearpostdsstatus(self):
2706 """Used by workingctx to clear post-dirstate-status hooks."""
2706 """Used by workingctx to clear post-dirstate-status hooks."""
2707 del self._postdsstatus[:]
2707 del self._postdsstatus[:]
2708
2708
2709 def heads(self, start=None):
2709 def heads(self, start=None):
2710 if start is None:
2710 if start is None:
2711 cl = self.changelog
2711 cl = self.changelog
2712 headrevs = reversed(cl.headrevs())
2712 headrevs = reversed(cl.headrevs())
2713 return [cl.node(rev) for rev in headrevs]
2713 return [cl.node(rev) for rev in headrevs]
2714
2714
2715 heads = self.changelog.heads(start)
2715 heads = self.changelog.heads(start)
2716 # sort the output in rev descending order
2716 # sort the output in rev descending order
2717 return sorted(heads, key=self.changelog.rev, reverse=True)
2717 return sorted(heads, key=self.changelog.rev, reverse=True)
2718
2718
2719 def branchheads(self, branch=None, start=None, closed=False):
2719 def branchheads(self, branch=None, start=None, closed=False):
2720 '''return a (possibly filtered) list of heads for the given branch
2720 '''return a (possibly filtered) list of heads for the given branch
2721
2721
2722 Heads are returned in topological order, from newest to oldest.
2722 Heads are returned in topological order, from newest to oldest.
2723 If branch is None, use the dirstate branch.
2723 If branch is None, use the dirstate branch.
2724 If start is not None, return only heads reachable from start.
2724 If start is not None, return only heads reachable from start.
2725 If closed is True, return heads that are marked as closed as well.
2725 If closed is True, return heads that are marked as closed as well.
2726 '''
2726 '''
2727 if branch is None:
2727 if branch is None:
2728 branch = self[None].branch()
2728 branch = self[None].branch()
2729 branches = self.branchmap()
2729 branches = self.branchmap()
2730 if branch not in branches:
2730 if branch not in branches:
2731 return []
2731 return []
2732 # the cache returns heads ordered lowest to highest
2732 # the cache returns heads ordered lowest to highest
2733 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
2733 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
2734 if start is not None:
2734 if start is not None:
2735 # filter out the heads that cannot be reached from startrev
2735 # filter out the heads that cannot be reached from startrev
2736 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
2736 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
2737 bheads = [h for h in bheads if h in fbheads]
2737 bheads = [h for h in bheads if h in fbheads]
2738 return bheads
2738 return bheads
2739
2739
2740 def branches(self, nodes):
2740 def branches(self, nodes):
2741 if not nodes:
2741 if not nodes:
2742 nodes = [self.changelog.tip()]
2742 nodes = [self.changelog.tip()]
2743 b = []
2743 b = []
2744 for n in nodes:
2744 for n in nodes:
2745 t = n
2745 t = n
2746 while True:
2746 while True:
2747 p = self.changelog.parents(n)
2747 p = self.changelog.parents(n)
2748 if p[1] != nullid or p[0] == nullid:
2748 if p[1] != nullid or p[0] == nullid:
2749 b.append((t, n, p[0], p[1]))
2749 b.append((t, n, p[0], p[1]))
2750 break
2750 break
2751 n = p[0]
2751 n = p[0]
2752 return b
2752 return b
2753
2753
2754 def between(self, pairs):
2754 def between(self, pairs):
2755 r = []
2755 r = []
2756
2756
2757 for top, bottom in pairs:
2757 for top, bottom in pairs:
2758 n, l, i = top, [], 0
2758 n, l, i = top, [], 0
2759 f = 1
2759 f = 1
2760
2760
2761 while n != bottom and n != nullid:
2761 while n != bottom and n != nullid:
2762 p = self.changelog.parents(n)[0]
2762 p = self.changelog.parents(n)[0]
2763 if i == f:
2763 if i == f:
2764 l.append(n)
2764 l.append(n)
2765 f = f * 2
2765 f = f * 2
2766 n = p
2766 n = p
2767 i += 1
2767 i += 1
2768
2768
2769 r.append(l)
2769 r.append(l)
2770
2770
2771 return r
2771 return r
2772
2772
2773 def checkpush(self, pushop):
2773 def checkpush(self, pushop):
2774 """Extensions can override this function if additional checks have
2774 """Extensions can override this function if additional checks have
2775 to be performed before pushing, or call it if they override push
2775 to be performed before pushing, or call it if they override push
2776 command.
2776 command.
2777 """
2777 """
2778
2778
2779 @unfilteredpropertycache
2779 @unfilteredpropertycache
2780 def prepushoutgoinghooks(self):
2780 def prepushoutgoinghooks(self):
2781 """Return util.hooks consists of a pushop with repo, remote, outgoing
2781 """Return util.hooks consists of a pushop with repo, remote, outgoing
2782 methods, which are called before pushing changesets.
2782 methods, which are called before pushing changesets.
2783 """
2783 """
2784 return util.hooks()
2784 return util.hooks()
2785
2785
2786 def pushkey(self, namespace, key, old, new):
2786 def pushkey(self, namespace, key, old, new):
2787 try:
2787 try:
2788 tr = self.currenttransaction()
2788 tr = self.currenttransaction()
2789 hookargs = {}
2789 hookargs = {}
2790 if tr is not None:
2790 if tr is not None:
2791 hookargs.update(tr.hookargs)
2791 hookargs.update(tr.hookargs)
2792 hookargs = pycompat.strkwargs(hookargs)
2792 hookargs = pycompat.strkwargs(hookargs)
2793 hookargs[r'namespace'] = namespace
2793 hookargs[r'namespace'] = namespace
2794 hookargs[r'key'] = key
2794 hookargs[r'key'] = key
2795 hookargs[r'old'] = old
2795 hookargs[r'old'] = old
2796 hookargs[r'new'] = new
2796 hookargs[r'new'] = new
2797 self.hook('prepushkey', throw=True, **hookargs)
2797 self.hook('prepushkey', throw=True, **hookargs)
2798 except error.HookAbort as exc:
2798 except error.HookAbort as exc:
2799 self.ui.write_err(_("pushkey-abort: %s\n") % exc)
2799 self.ui.write_err(_("pushkey-abort: %s\n") % exc)
2800 if exc.hint:
2800 if exc.hint:
2801 self.ui.write_err(_("(%s)\n") % exc.hint)
2801 self.ui.write_err(_("(%s)\n") % exc.hint)
2802 return False
2802 return False
2803 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key))
2803 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key))
2804 ret = pushkey.push(self, namespace, key, old, new)
2804 ret = pushkey.push(self, namespace, key, old, new)
2805 def runhook():
2805 def runhook():
2806 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new,
2806 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new,
2807 ret=ret)
2807 ret=ret)
2808 self._afterlock(runhook)
2808 self._afterlock(runhook)
2809 return ret
2809 return ret
2810
2810
2811 def listkeys(self, namespace):
2811 def listkeys(self, namespace):
2812 self.hook('prelistkeys', throw=True, namespace=namespace)
2812 self.hook('prelistkeys', throw=True, namespace=namespace)
2813 self.ui.debug('listing keys for "%s"\n' % namespace)
2813 self.ui.debug('listing keys for "%s"\n' % namespace)
2814 values = pushkey.list(self, namespace)
2814 values = pushkey.list(self, namespace)
2815 self.hook('listkeys', namespace=namespace, values=values)
2815 self.hook('listkeys', namespace=namespace, values=values)
2816 return values
2816 return values
2817
2817
2818 def debugwireargs(self, one, two, three=None, four=None, five=None):
2818 def debugwireargs(self, one, two, three=None, four=None, five=None):
2819 '''used to test argument passing over the wire'''
2819 '''used to test argument passing over the wire'''
2820 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
2820 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
2821 pycompat.bytestr(four),
2821 pycompat.bytestr(four),
2822 pycompat.bytestr(five))
2822 pycompat.bytestr(five))
2823
2823
2824 def savecommitmessage(self, text):
2824 def savecommitmessage(self, text):
2825 fp = self.vfs('last-message.txt', 'wb')
2825 fp = self.vfs('last-message.txt', 'wb')
2826 try:
2826 try:
2827 fp.write(text)
2827 fp.write(text)
2828 finally:
2828 finally:
2829 fp.close()
2829 fp.close()
2830 return self.pathto(fp.name[len(self.root) + 1:])
2830 return self.pathto(fp.name[len(self.root) + 1:])
2831
2831
2832 # used to avoid circular references so destructors work
2832 # used to avoid circular references so destructors work
2833 def aftertrans(files):
2833 def aftertrans(files):
2834 renamefiles = [tuple(t) for t in files]
2834 renamefiles = [tuple(t) for t in files]
2835 def a():
2835 def a():
2836 for vfs, src, dest in renamefiles:
2836 for vfs, src, dest in renamefiles:
2837 # if src and dest refer to a same file, vfs.rename is a no-op,
2837 # if src and dest refer to a same file, vfs.rename is a no-op,
2838 # leaving both src and dest on disk. delete dest to make sure
2838 # leaving both src and dest on disk. delete dest to make sure
2839 # the rename couldn't be such a no-op.
2839 # the rename couldn't be such a no-op.
2840 vfs.tryunlink(dest)
2840 vfs.tryunlink(dest)
2841 try:
2841 try:
2842 vfs.rename(src, dest)
2842 vfs.rename(src, dest)
2843 except OSError: # journal file does not yet exist
2843 except OSError: # journal file does not yet exist
2844 pass
2844 pass
2845 return a
2845 return a
2846
2846
2847 def undoname(fn):
2847 def undoname(fn):
2848 base, name = os.path.split(fn)
2848 base, name = os.path.split(fn)
2849 assert name.startswith('journal')
2849 assert name.startswith('journal')
2850 return os.path.join(base, name.replace('journal', 'undo', 1))
2850 return os.path.join(base, name.replace('journal', 'undo', 1))
2851
2851
2852 def instance(ui, path, create, intents=None, createopts=None):
2852 def instance(ui, path, create, intents=None, createopts=None):
2853 localpath = util.urllocalpath(path)
2853 localpath = util.urllocalpath(path)
2854 if create:
2854 if create:
2855 createrepository(ui, localpath, createopts=createopts)
2855 createrepository(ui, localpath, createopts=createopts)
2856
2856
2857 return makelocalrepository(ui, localpath, intents=intents)
2857 return makelocalrepository(ui, localpath, intents=intents)
2858
2858
2859 def islocal(path):
2859 def islocal(path):
2860 return True
2860 return True
2861
2861
2862 def defaultcreateopts(ui, createopts=None):
2862 def defaultcreateopts(ui, createopts=None):
2863 """Populate the default creation options for a repository.
2863 """Populate the default creation options for a repository.
2864
2864
2865 A dictionary of explicitly requested creation options can be passed
2865 A dictionary of explicitly requested creation options can be passed
2866 in. Missing keys will be populated.
2866 in. Missing keys will be populated.
2867 """
2867 """
2868 createopts = dict(createopts or {})
2868 createopts = dict(createopts or {})
2869
2869
2870 if 'backend' not in createopts:
2870 if 'backend' not in createopts:
2871 # experimental config: storage.new-repo-backend
2871 # experimental config: storage.new-repo-backend
2872 createopts['backend'] = ui.config('storage', 'new-repo-backend')
2872 createopts['backend'] = ui.config('storage', 'new-repo-backend')
2873
2873
2874 return createopts
2874 return createopts
2875
2875
2876 def newreporequirements(ui, createopts):
2876 def newreporequirements(ui, createopts):
2877 """Determine the set of requirements for a new local repository.
2877 """Determine the set of requirements for a new local repository.
2878
2878
2879 Extensions can wrap this function to specify custom requirements for
2879 Extensions can wrap this function to specify custom requirements for
2880 new repositories.
2880 new repositories.
2881 """
2881 """
2882 # If the repo is being created from a shared repository, we copy
2882 # If the repo is being created from a shared repository, we copy
2883 # its requirements.
2883 # its requirements.
2884 if 'sharedrepo' in createopts:
2884 if 'sharedrepo' in createopts:
2885 requirements = set(createopts['sharedrepo'].requirements)
2885 requirements = set(createopts['sharedrepo'].requirements)
2886 if createopts.get('sharedrelative'):
2886 if createopts.get('sharedrelative'):
2887 requirements.add('relshared')
2887 requirements.add('relshared')
2888 else:
2888 else:
2889 requirements.add('shared')
2889 requirements.add('shared')
2890
2890
2891 return requirements
2891 return requirements
2892
2892
2893 if 'backend' not in createopts:
2893 if 'backend' not in createopts:
2894 raise error.ProgrammingError('backend key not present in createopts; '
2894 raise error.ProgrammingError('backend key not present in createopts; '
2895 'was defaultcreateopts() called?')
2895 'was defaultcreateopts() called?')
2896
2896
2897 if createopts['backend'] != 'revlogv1':
2897 if createopts['backend'] != 'revlogv1':
2898 raise error.Abort(_('unable to determine repository requirements for '
2898 raise error.Abort(_('unable to determine repository requirements for '
2899 'storage backend: %s') % createopts['backend'])
2899 'storage backend: %s') % createopts['backend'])
2900
2900
2901 requirements = {'revlogv1'}
2901 requirements = {'revlogv1'}
2902 if ui.configbool('format', 'usestore'):
2902 if ui.configbool('format', 'usestore'):
2903 requirements.add('store')
2903 requirements.add('store')
2904 if ui.configbool('format', 'usefncache'):
2904 if ui.configbool('format', 'usefncache'):
2905 requirements.add('fncache')
2905 requirements.add('fncache')
2906 if ui.configbool('format', 'dotencode'):
2906 if ui.configbool('format', 'dotencode'):
2907 requirements.add('dotencode')
2907 requirements.add('dotencode')
2908
2908
2909 compengine = ui.config('experimental', 'format.compression')
2909 compengine = ui.config('experimental', 'format.compression')
2910 if compengine not in util.compengines:
2910 if compengine not in util.compengines:
2911 raise error.Abort(_('compression engine %s defined by '
2911 raise error.Abort(_('compression engine %s defined by '
2912 'experimental.format.compression not available') %
2912 'experimental.format.compression not available') %
2913 compengine,
2913 compengine,
2914 hint=_('run "hg debuginstall" to list available '
2914 hint=_('run "hg debuginstall" to list available '
2915 'compression engines'))
2915 'compression engines'))
2916
2916
2917 # zlib is the historical default and doesn't need an explicit requirement.
2917 # zlib is the historical default and doesn't need an explicit requirement.
2918 if compengine != 'zlib':
2918 if compengine != 'zlib':
2919 requirements.add('exp-compression-%s' % compengine)
2919 requirements.add('exp-compression-%s' % compengine)
2920
2920
2921 if scmutil.gdinitconfig(ui):
2921 if scmutil.gdinitconfig(ui):
2922 requirements.add('generaldelta')
2922 requirements.add('generaldelta')
2923 # experimental config: format.sparse-revlog
2924 if ui.configbool('format', 'sparse-revlog'):
2923 if ui.configbool('format', 'sparse-revlog'):
2925 requirements.add(SPARSEREVLOG_REQUIREMENT)
2924 requirements.add(SPARSEREVLOG_REQUIREMENT)
2926 if ui.configbool('experimental', 'treemanifest'):
2925 if ui.configbool('experimental', 'treemanifest'):
2927 requirements.add('treemanifest')
2926 requirements.add('treemanifest')
2928
2927
2929 revlogv2 = ui.config('experimental', 'revlogv2')
2928 revlogv2 = ui.config('experimental', 'revlogv2')
2930 if revlogv2 == 'enable-unstable-format-and-corrupt-my-data':
2929 if revlogv2 == 'enable-unstable-format-and-corrupt-my-data':
2931 requirements.remove('revlogv1')
2930 requirements.remove('revlogv1')
2932 # generaldelta is implied by revlogv2.
2931 # generaldelta is implied by revlogv2.
2933 requirements.discard('generaldelta')
2932 requirements.discard('generaldelta')
2934 requirements.add(REVLOGV2_REQUIREMENT)
2933 requirements.add(REVLOGV2_REQUIREMENT)
2935 # experimental config: format.internal-phase
2934 # experimental config: format.internal-phase
2936 if ui.configbool('format', 'internal-phase'):
2935 if ui.configbool('format', 'internal-phase'):
2937 requirements.add('internal-phase')
2936 requirements.add('internal-phase')
2938
2937
2939 if createopts.get('narrowfiles'):
2938 if createopts.get('narrowfiles'):
2940 requirements.add(repository.NARROW_REQUIREMENT)
2939 requirements.add(repository.NARROW_REQUIREMENT)
2941
2940
2942 if createopts.get('lfs'):
2941 if createopts.get('lfs'):
2943 requirements.add('lfs')
2942 requirements.add('lfs')
2944
2943
2945 return requirements
2944 return requirements
2946
2945
2947 def filterknowncreateopts(ui, createopts):
2946 def filterknowncreateopts(ui, createopts):
2948 """Filters a dict of repo creation options against options that are known.
2947 """Filters a dict of repo creation options against options that are known.
2949
2948
2950 Receives a dict of repo creation options and returns a dict of those
2949 Receives a dict of repo creation options and returns a dict of those
2951 options that we don't know how to handle.
2950 options that we don't know how to handle.
2952
2951
2953 This function is called as part of repository creation. If the
2952 This function is called as part of repository creation. If the
2954 returned dict contains any items, repository creation will not
2953 returned dict contains any items, repository creation will not
2955 be allowed, as it means there was a request to create a repository
2954 be allowed, as it means there was a request to create a repository
2956 with options not recognized by loaded code.
2955 with options not recognized by loaded code.
2957
2956
2958 Extensions can wrap this function to filter out creation options
2957 Extensions can wrap this function to filter out creation options
2959 they know how to handle.
2958 they know how to handle.
2960 """
2959 """
2961 known = {
2960 known = {
2962 'backend',
2961 'backend',
2963 'lfs',
2962 'lfs',
2964 'narrowfiles',
2963 'narrowfiles',
2965 'sharedrepo',
2964 'sharedrepo',
2966 'sharedrelative',
2965 'sharedrelative',
2967 'shareditems',
2966 'shareditems',
2968 'shallowfilestore',
2967 'shallowfilestore',
2969 }
2968 }
2970
2969
2971 return {k: v for k, v in createopts.items() if k not in known}
2970 return {k: v for k, v in createopts.items() if k not in known}
2972
2971
2973 def createrepository(ui, path, createopts=None):
2972 def createrepository(ui, path, createopts=None):
2974 """Create a new repository in a vfs.
2973 """Create a new repository in a vfs.
2975
2974
2976 ``path`` path to the new repo's working directory.
2975 ``path`` path to the new repo's working directory.
2977 ``createopts`` options for the new repository.
2976 ``createopts`` options for the new repository.
2978
2977
2979 The following keys for ``createopts`` are recognized:
2978 The following keys for ``createopts`` are recognized:
2980
2979
2981 backend
2980 backend
2982 The storage backend to use.
2981 The storage backend to use.
2983 lfs
2982 lfs
2984 Repository will be created with ``lfs`` requirement. The lfs extension
2983 Repository will be created with ``lfs`` requirement. The lfs extension
2985 will automatically be loaded when the repository is accessed.
2984 will automatically be loaded when the repository is accessed.
2986 narrowfiles
2985 narrowfiles
2987 Set up repository to support narrow file storage.
2986 Set up repository to support narrow file storage.
2988 sharedrepo
2987 sharedrepo
2989 Repository object from which storage should be shared.
2988 Repository object from which storage should be shared.
2990 sharedrelative
2989 sharedrelative
2991 Boolean indicating if the path to the shared repo should be
2990 Boolean indicating if the path to the shared repo should be
2992 stored as relative. By default, the pointer to the "parent" repo
2991 stored as relative. By default, the pointer to the "parent" repo
2993 is stored as an absolute path.
2992 is stored as an absolute path.
2994 shareditems
2993 shareditems
2995 Set of items to share to the new repository (in addition to storage).
2994 Set of items to share to the new repository (in addition to storage).
2996 shallowfilestore
2995 shallowfilestore
2997 Indicates that storage for files should be shallow (not all ancestor
2996 Indicates that storage for files should be shallow (not all ancestor
2998 revisions are known).
2997 revisions are known).
2999 """
2998 """
3000 createopts = defaultcreateopts(ui, createopts=createopts)
2999 createopts = defaultcreateopts(ui, createopts=createopts)
3001
3000
3002 unknownopts = filterknowncreateopts(ui, createopts)
3001 unknownopts = filterknowncreateopts(ui, createopts)
3003
3002
3004 if not isinstance(unknownopts, dict):
3003 if not isinstance(unknownopts, dict):
3005 raise error.ProgrammingError('filterknowncreateopts() did not return '
3004 raise error.ProgrammingError('filterknowncreateopts() did not return '
3006 'a dict')
3005 'a dict')
3007
3006
3008 if unknownopts:
3007 if unknownopts:
3009 raise error.Abort(_('unable to create repository because of unknown '
3008 raise error.Abort(_('unable to create repository because of unknown '
3010 'creation option: %s') %
3009 'creation option: %s') %
3011 ', '.join(sorted(unknownopts)),
3010 ', '.join(sorted(unknownopts)),
3012 hint=_('is a required extension not loaded?'))
3011 hint=_('is a required extension not loaded?'))
3013
3012
3014 requirements = newreporequirements(ui, createopts=createopts)
3013 requirements = newreporequirements(ui, createopts=createopts)
3015
3014
3016 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3015 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3017
3016
3018 hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg'))
3017 hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg'))
3019 if hgvfs.exists():
3018 if hgvfs.exists():
3020 raise error.RepoError(_('repository %s already exists') % path)
3019 raise error.RepoError(_('repository %s already exists') % path)
3021
3020
3022 if 'sharedrepo' in createopts:
3021 if 'sharedrepo' in createopts:
3023 sharedpath = createopts['sharedrepo'].sharedpath
3022 sharedpath = createopts['sharedrepo'].sharedpath
3024
3023
3025 if createopts.get('sharedrelative'):
3024 if createopts.get('sharedrelative'):
3026 try:
3025 try:
3027 sharedpath = os.path.relpath(sharedpath, hgvfs.base)
3026 sharedpath = os.path.relpath(sharedpath, hgvfs.base)
3028 except (IOError, ValueError) as e:
3027 except (IOError, ValueError) as e:
3029 # ValueError is raised on Windows if the drive letters differ
3028 # ValueError is raised on Windows if the drive letters differ
3030 # on each path.
3029 # on each path.
3031 raise error.Abort(_('cannot calculate relative path'),
3030 raise error.Abort(_('cannot calculate relative path'),
3032 hint=stringutil.forcebytestr(e))
3031 hint=stringutil.forcebytestr(e))
3033
3032
3034 if not wdirvfs.exists():
3033 if not wdirvfs.exists():
3035 wdirvfs.makedirs()
3034 wdirvfs.makedirs()
3036
3035
3037 hgvfs.makedir(notindexed=True)
3036 hgvfs.makedir(notindexed=True)
3038 if 'sharedrepo' not in createopts:
3037 if 'sharedrepo' not in createopts:
3039 hgvfs.mkdir(b'cache')
3038 hgvfs.mkdir(b'cache')
3040 hgvfs.mkdir(b'wcache')
3039 hgvfs.mkdir(b'wcache')
3041
3040
3042 if b'store' in requirements and 'sharedrepo' not in createopts:
3041 if b'store' in requirements and 'sharedrepo' not in createopts:
3043 hgvfs.mkdir(b'store')
3042 hgvfs.mkdir(b'store')
3044
3043
3045 # We create an invalid changelog outside the store so very old
3044 # We create an invalid changelog outside the store so very old
3046 # Mercurial versions (which didn't know about the requirements
3045 # Mercurial versions (which didn't know about the requirements
3047 # file) encounter an error on reading the changelog. This
3046 # file) encounter an error on reading the changelog. This
3048 # effectively locks out old clients and prevents them from
3047 # effectively locks out old clients and prevents them from
3049 # mucking with a repo in an unknown format.
3048 # mucking with a repo in an unknown format.
3050 #
3049 #
3051 # The revlog header has version 2, which won't be recognized by
3050 # The revlog header has version 2, which won't be recognized by
3052 # such old clients.
3051 # such old clients.
3053 hgvfs.append(b'00changelog.i',
3052 hgvfs.append(b'00changelog.i',
3054 b'\0\0\0\2 dummy changelog to prevent using the old repo '
3053 b'\0\0\0\2 dummy changelog to prevent using the old repo '
3055 b'layout')
3054 b'layout')
3056
3055
3057 scmutil.writerequires(hgvfs, requirements)
3056 scmutil.writerequires(hgvfs, requirements)
3058
3057
3059 # Write out file telling readers where to find the shared store.
3058 # Write out file telling readers where to find the shared store.
3060 if 'sharedrepo' in createopts:
3059 if 'sharedrepo' in createopts:
3061 hgvfs.write(b'sharedpath', sharedpath)
3060 hgvfs.write(b'sharedpath', sharedpath)
3062
3061
3063 if createopts.get('shareditems'):
3062 if createopts.get('shareditems'):
3064 shared = b'\n'.join(sorted(createopts['shareditems'])) + b'\n'
3063 shared = b'\n'.join(sorted(createopts['shareditems'])) + b'\n'
3065 hgvfs.write(b'shared', shared)
3064 hgvfs.write(b'shared', shared)
3066
3065
3067 def poisonrepository(repo):
3066 def poisonrepository(repo):
3068 """Poison a repository instance so it can no longer be used."""
3067 """Poison a repository instance so it can no longer be used."""
3069 # Perform any cleanup on the instance.
3068 # Perform any cleanup on the instance.
3070 repo.close()
3069 repo.close()
3071
3070
3072 # Our strategy is to replace the type of the object with one that
3071 # Our strategy is to replace the type of the object with one that
3073 # has all attribute lookups result in error.
3072 # has all attribute lookups result in error.
3074 #
3073 #
3075 # But we have to allow the close() method because some constructors
3074 # But we have to allow the close() method because some constructors
3076 # of repos call close() on repo references.
3075 # of repos call close() on repo references.
3077 class poisonedrepository(object):
3076 class poisonedrepository(object):
3078 def __getattribute__(self, item):
3077 def __getattribute__(self, item):
3079 if item == r'close':
3078 if item == r'close':
3080 return object.__getattribute__(self, item)
3079 return object.__getattribute__(self, item)
3081
3080
3082 raise error.ProgrammingError('repo instances should not be used '
3081 raise error.ProgrammingError('repo instances should not be used '
3083 'after unshare')
3082 'after unshare')
3084
3083
3085 def close(self):
3084 def close(self):
3086 pass
3085 pass
3087
3086
3088 # We may have a repoview, which intercepts __setattr__. So be sure
3087 # We may have a repoview, which intercepts __setattr__. So be sure
3089 # we operate at the lowest level possible.
3088 # we operate at the lowest level possible.
3090 object.__setattr__(repo, r'__class__', poisonedrepository)
3089 object.__setattr__(repo, r'__class__', poisonedrepository)
@@ -1,3826 +1,3828 b''
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'default-off', False, b'enable X'),
812 > (b'', b'default-off', False, b'enable X'),
813 > (b'', b'default-on', True, b'enable Y'),
813 > (b'', b'default-on', True, b'enable Y'),
814 > (b'', b'callableopt', func, b'adds foo'),
814 > (b'', b'callableopt', func, b'adds foo'),
815 > (b'', b'customopt', customopt(''), b'adds bar'),
815 > (b'', b'customopt', customopt(''), b'adds bar'),
816 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
816 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
817 > b'hg nohelp',
817 > b'hg nohelp',
818 > norepo=True)
818 > norepo=True)
819 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
819 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
820 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
820 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
821 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
821 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
822 > def nohelp(ui, *args, **kwargs):
822 > def nohelp(ui, *args, **kwargs):
823 > pass
823 > pass
824 >
824 >
825 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
825 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
826 > def hashelp(ui, *args, **kwargs):
826 > def hashelp(ui, *args, **kwargs):
827 > """Extension command's help"""
827 > """Extension command's help"""
828 > pass
828 > pass
829 >
829 >
830 > def uisetup(ui):
830 > def uisetup(ui):
831 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
831 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
832 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
832 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
833 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
833 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
834 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
834 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
835 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
835 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
836 >
836 >
837 > EOF
837 > EOF
838 $ echo '[extensions]' >> $HGRCPATH
838 $ echo '[extensions]' >> $HGRCPATH
839 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
839 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
840
840
841 Test for aliases
841 Test for aliases
842
842
843 $ hg help | grep hgalias
843 $ hg help | grep hgalias
844 hgalias My doc
844 hgalias My doc
845
845
846 $ hg help hgalias
846 $ hg help hgalias
847 hg hgalias [--remote]
847 hg hgalias [--remote]
848
848
849 alias for: hg summary
849 alias for: hg summary
850
850
851 My doc
851 My doc
852
852
853 defined by: helpext
853 defined by: helpext
854
854
855 options:
855 options:
856
856
857 --remote check for push and pull
857 --remote check for push and pull
858
858
859 (some details hidden, use --verbose to show complete help)
859 (some details hidden, use --verbose to show complete help)
860 $ hg help hgaliasnodoc
860 $ hg help hgaliasnodoc
861 hg hgaliasnodoc [--remote]
861 hg hgaliasnodoc [--remote]
862
862
863 alias for: hg summary
863 alias for: hg summary
864
864
865 summarize working directory state
865 summarize working directory state
866
866
867 This generates a brief summary of the working directory state, including
867 This generates a brief summary of the working directory state, including
868 parents, branch, commit status, phase and available updates.
868 parents, branch, commit status, phase and available updates.
869
869
870 With the --remote option, this will check the default paths for incoming
870 With the --remote option, this will check the default paths for incoming
871 and outgoing changes. This can be time-consuming.
871 and outgoing changes. This can be time-consuming.
872
872
873 Returns 0 on success.
873 Returns 0 on success.
874
874
875 defined by: helpext
875 defined by: helpext
876
876
877 options:
877 options:
878
878
879 --remote check for push and pull
879 --remote check for push and pull
880
880
881 (some details hidden, use --verbose to show complete help)
881 (some details hidden, use --verbose to show complete help)
882
882
883 $ hg help shellalias
883 $ hg help shellalias
884 hg shellalias
884 hg shellalias
885
885
886 shell alias for: echo hi
886 shell alias for: echo hi
887
887
888 (no help text available)
888 (no help text available)
889
889
890 defined by: helpext
890 defined by: helpext
891
891
892 (some details hidden, use --verbose to show complete help)
892 (some details hidden, use --verbose to show complete help)
893
893
894 Test command with no help text
894 Test command with no help text
895
895
896 $ hg help nohelp
896 $ hg help nohelp
897 hg nohelp
897 hg nohelp
898
898
899 (no help text available)
899 (no help text available)
900
900
901 options:
901 options:
902
902
903 --longdesc VALUE
903 --longdesc VALUE
904 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
904 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
905 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
905 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
906 -n -- normal desc
906 -n -- normal desc
907 --newline VALUE line1 line2
907 --newline VALUE line1 line2
908 --default-off enable X
908 --default-off enable X
909 --[no-]default-on enable Y (default: on)
909 --[no-]default-on enable Y (default: on)
910 --callableopt VALUE adds foo
910 --callableopt VALUE adds foo
911 --customopt VALUE adds bar
911 --customopt VALUE adds bar
912 --customopt-withdefault VALUE adds bar (default: foo)
912 --customopt-withdefault VALUE adds bar (default: foo)
913
913
914 (some details hidden, use --verbose to show complete help)
914 (some details hidden, use --verbose to show complete help)
915
915
916 Test that default list of commands includes extension commands that have help,
916 Test that default list of commands includes extension commands that have help,
917 but not those that don't, except in verbose mode, when a keyword is passed, or
917 but not those that don't, except in verbose mode, when a keyword is passed, or
918 when help about the extension is requested.
918 when help about the extension is requested.
919
919
920 #if no-extraextensions
920 #if no-extraextensions
921
921
922 $ hg help | grep hashelp
922 $ hg help | grep hashelp
923 hashelp Extension command's help
923 hashelp Extension command's help
924 $ hg help | grep nohelp
924 $ hg help | grep nohelp
925 [1]
925 [1]
926 $ hg help -v | grep nohelp
926 $ hg help -v | grep nohelp
927 nohelp (no help text available)
927 nohelp (no help text available)
928
928
929 $ hg help -k nohelp
929 $ hg help -k nohelp
930 Commands:
930 Commands:
931
931
932 nohelp hg nohelp
932 nohelp hg nohelp
933
933
934 Extension Commands:
934 Extension Commands:
935
935
936 nohelp (no help text available)
936 nohelp (no help text available)
937
937
938 $ hg help helpext
938 $ hg help helpext
939 helpext extension - no help text available
939 helpext extension - no help text available
940
940
941 list of commands:
941 list of commands:
942
942
943 hashelp Extension command's help
943 hashelp Extension command's help
944 nohelp (no help text available)
944 nohelp (no help text available)
945
945
946 (use 'hg help -v helpext' to show built-in aliases and global options)
946 (use 'hg help -v helpext' to show built-in aliases and global options)
947
947
948 #endif
948 #endif
949
949
950 Test list of internal help commands
950 Test list of internal help commands
951
951
952 $ hg help debug
952 $ hg help debug
953 debug commands (internal and unsupported):
953 debug commands (internal and unsupported):
954
954
955 debugancestor
955 debugancestor
956 find the ancestor revision of two revisions in a given index
956 find the ancestor revision of two revisions in a given index
957 debugapplystreamclonebundle
957 debugapplystreamclonebundle
958 apply a stream clone bundle file
958 apply a stream clone bundle file
959 debugbuilddag
959 debugbuilddag
960 builds a repo with a given DAG from scratch in the current
960 builds a repo with a given DAG from scratch in the current
961 empty repo
961 empty repo
962 debugbundle lists the contents of a bundle
962 debugbundle lists the contents of a bundle
963 debugcapabilities
963 debugcapabilities
964 lists the capabilities of a remote peer
964 lists the capabilities of a remote peer
965 debugcheckstate
965 debugcheckstate
966 validate the correctness of the current dirstate
966 validate the correctness of the current dirstate
967 debugcolor show available color, effects or style
967 debugcolor show available color, effects or style
968 debugcommands
968 debugcommands
969 list all available commands and options
969 list all available commands and options
970 debugcomplete
970 debugcomplete
971 returns the completion list associated with the given command
971 returns the completion list associated with the given command
972 debugcreatestreamclonebundle
972 debugcreatestreamclonebundle
973 create a stream clone bundle file
973 create a stream clone bundle file
974 debugdag format the changelog or an index DAG as a concise textual
974 debugdag format the changelog or an index DAG as a concise textual
975 description
975 description
976 debugdata dump the contents of a data file revision
976 debugdata dump the contents of a data file revision
977 debugdate parse and display a date
977 debugdate parse and display a date
978 debugdeltachain
978 debugdeltachain
979 dump information about delta chains in a revlog
979 dump information about delta chains in a revlog
980 debugdirstate
980 debugdirstate
981 show the contents of the current dirstate
981 show the contents of the current dirstate
982 debugdiscovery
982 debugdiscovery
983 runs the changeset discovery protocol in isolation
983 runs the changeset discovery protocol in isolation
984 debugdownload
984 debugdownload
985 download a resource using Mercurial logic and config
985 download a resource using Mercurial logic and config
986 debugextensions
986 debugextensions
987 show information about active extensions
987 show information about active extensions
988 debugfileset parse and apply a fileset specification
988 debugfileset parse and apply a fileset specification
989 debugformat display format information about the current repository
989 debugformat display format information about the current repository
990 debugfsinfo show information detected about current filesystem
990 debugfsinfo show information detected about current filesystem
991 debuggetbundle
991 debuggetbundle
992 retrieves a bundle from a repo
992 retrieves a bundle from a repo
993 debugignore display the combined ignore pattern and information about
993 debugignore display the combined ignore pattern and information about
994 ignored files
994 ignored files
995 debugindex dump index data for a storage primitive
995 debugindex dump index data for a storage primitive
996 debugindexdot
996 debugindexdot
997 dump an index DAG as a graphviz dot file
997 dump an index DAG as a graphviz dot file
998 debugindexstats
998 debugindexstats
999 show stats related to the changelog index
999 show stats related to the changelog index
1000 debuginstall test Mercurial installation
1000 debuginstall test Mercurial installation
1001 debugknown test whether node ids are known to a repo
1001 debugknown test whether node ids are known to a repo
1002 debuglocks show or modify state of locks
1002 debuglocks show or modify state of locks
1003 debugmanifestfulltextcache
1003 debugmanifestfulltextcache
1004 show, clear or amend the contents of the manifest fulltext
1004 show, clear or amend the contents of the manifest fulltext
1005 cache
1005 cache
1006 debugmergestate
1006 debugmergestate
1007 print merge state
1007 print merge state
1008 debugnamecomplete
1008 debugnamecomplete
1009 complete "names" - tags, open branch names, bookmark names
1009 complete "names" - tags, open branch names, bookmark names
1010 debugobsolete
1010 debugobsolete
1011 create arbitrary obsolete marker
1011 create arbitrary obsolete marker
1012 debugoptADV (no help text available)
1012 debugoptADV (no help text available)
1013 debugoptDEP (no help text available)
1013 debugoptDEP (no help text available)
1014 debugoptEXP (no help text available)
1014 debugoptEXP (no help text available)
1015 debugpathcomplete
1015 debugpathcomplete
1016 complete part or all of a tracked path
1016 complete part or all of a tracked path
1017 debugpeer establish a connection to a peer repository
1017 debugpeer establish a connection to a peer repository
1018 debugpickmergetool
1018 debugpickmergetool
1019 examine which merge tool is chosen for specified file
1019 examine which merge tool is chosen for specified file
1020 debugpushkey access the pushkey key/value protocol
1020 debugpushkey access the pushkey key/value protocol
1021 debugpvec (no help text available)
1021 debugpvec (no help text available)
1022 debugrebuilddirstate
1022 debugrebuilddirstate
1023 rebuild the dirstate as it would look like for the given
1023 rebuild the dirstate as it would look like for the given
1024 revision
1024 revision
1025 debugrebuildfncache
1025 debugrebuildfncache
1026 rebuild the fncache file
1026 rebuild the fncache file
1027 debugrename dump rename information
1027 debugrename dump rename information
1028 debugrevlog show data and statistics about a revlog
1028 debugrevlog show data and statistics about a revlog
1029 debugrevlogindex
1029 debugrevlogindex
1030 dump the contents of a revlog index
1030 dump the contents of a revlog index
1031 debugrevspec parse and apply a revision specification
1031 debugrevspec parse and apply a revision specification
1032 debugserve run a server with advanced settings
1032 debugserve run a server with advanced settings
1033 debugsetparents
1033 debugsetparents
1034 manually set the parents of the current working directory
1034 manually set the parents of the current working directory
1035 debugssl test a secure connection to a server
1035 debugssl test a secure connection to a server
1036 debugsub (no help text available)
1036 debugsub (no help text available)
1037 debugsuccessorssets
1037 debugsuccessorssets
1038 show set of successors for revision
1038 show set of successors for revision
1039 debugtemplate
1039 debugtemplate
1040 parse and apply a template
1040 parse and apply a template
1041 debuguigetpass
1041 debuguigetpass
1042 show prompt to type password
1042 show prompt to type password
1043 debuguiprompt
1043 debuguiprompt
1044 show plain prompt
1044 show plain prompt
1045 debugupdatecaches
1045 debugupdatecaches
1046 warm all known caches in the repository
1046 warm all known caches in the repository
1047 debugupgraderepo
1047 debugupgraderepo
1048 upgrade a repository to use different features
1048 upgrade a repository to use different features
1049 debugwalk show how files match on given patterns
1049 debugwalk show how files match on given patterns
1050 debugwhyunstable
1050 debugwhyunstable
1051 explain instabilities of a changeset
1051 explain instabilities of a changeset
1052 debugwireargs
1052 debugwireargs
1053 (no help text available)
1053 (no help text available)
1054 debugwireproto
1054 debugwireproto
1055 send wire protocol commands to a server
1055 send wire protocol commands to a server
1056
1056
1057 (use 'hg help -v debug' to show built-in aliases and global options)
1057 (use 'hg help -v debug' to show built-in aliases and global options)
1058
1058
1059 internals topic renders index of available sub-topics
1059 internals topic renders index of available sub-topics
1060
1060
1061 $ hg help internals
1061 $ hg help internals
1062 Technical implementation topics
1062 Technical implementation topics
1063 """""""""""""""""""""""""""""""
1063 """""""""""""""""""""""""""""""
1064
1064
1065 To access a subtopic, use "hg help internals.{subtopic-name}"
1065 To access a subtopic, use "hg help internals.{subtopic-name}"
1066
1066
1067 bundle2 Bundle2
1067 bundle2 Bundle2
1068 bundles Bundles
1068 bundles Bundles
1069 cbor CBOR
1069 cbor CBOR
1070 censor Censor
1070 censor Censor
1071 changegroups Changegroups
1071 changegroups Changegroups
1072 config Config Registrar
1072 config Config Registrar
1073 extensions Extension API
1073 extensions Extension API
1074 requirements Repository Requirements
1074 requirements Repository Requirements
1075 revlogs Revision Logs
1075 revlogs Revision Logs
1076 wireprotocol Wire Protocol
1076 wireprotocol Wire Protocol
1077 wireprotocolrpc
1077 wireprotocolrpc
1078 Wire Protocol RPC
1078 Wire Protocol RPC
1079 wireprotocolv2
1079 wireprotocolv2
1080 Wire Protocol Version 2
1080 Wire Protocol Version 2
1081
1081
1082 sub-topics can be accessed
1082 sub-topics can be accessed
1083
1083
1084 $ hg help internals.changegroups
1084 $ hg help internals.changegroups
1085 Changegroups
1085 Changegroups
1086 """"""""""""
1086 """"""""""""
1087
1087
1088 Changegroups are representations of repository revlog data, specifically
1088 Changegroups are representations of repository revlog data, specifically
1089 the changelog data, root/flat manifest data, treemanifest data, and
1089 the changelog data, root/flat manifest data, treemanifest data, and
1090 filelogs.
1090 filelogs.
1091
1091
1092 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1092 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1093 level, versions "1" and "2" are almost exactly the same, with the only
1093 level, versions "1" and "2" are almost exactly the same, with the only
1094 difference being an additional item in the *delta header*. Version "3"
1094 difference being an additional item in the *delta header*. Version "3"
1095 adds support for storage flags in the *delta header* and optionally
1095 adds support for storage flags in the *delta header* and optionally
1096 exchanging treemanifests (enabled by setting an option on the
1096 exchanging treemanifests (enabled by setting an option on the
1097 "changegroup" part in the bundle2).
1097 "changegroup" part in the bundle2).
1098
1098
1099 Changegroups when not exchanging treemanifests consist of 3 logical
1099 Changegroups when not exchanging treemanifests consist of 3 logical
1100 segments:
1100 segments:
1101
1101
1102 +---------------------------------+
1102 +---------------------------------+
1103 | | | |
1103 | | | |
1104 | changeset | manifest | filelogs |
1104 | changeset | manifest | filelogs |
1105 | | | |
1105 | | | |
1106 | | | |
1106 | | | |
1107 +---------------------------------+
1107 +---------------------------------+
1108
1108
1109 When exchanging treemanifests, there are 4 logical segments:
1109 When exchanging treemanifests, there are 4 logical segments:
1110
1110
1111 +-------------------------------------------------+
1111 +-------------------------------------------------+
1112 | | | | |
1112 | | | | |
1113 | changeset | root | treemanifests | filelogs |
1113 | changeset | root | treemanifests | filelogs |
1114 | | manifest | | |
1114 | | manifest | | |
1115 | | | | |
1115 | | | | |
1116 +-------------------------------------------------+
1116 +-------------------------------------------------+
1117
1117
1118 The principle building block of each segment is a *chunk*. A *chunk* is a
1118 The principle building block of each segment is a *chunk*. A *chunk* is a
1119 framed piece of data:
1119 framed piece of data:
1120
1120
1121 +---------------------------------------+
1121 +---------------------------------------+
1122 | | |
1122 | | |
1123 | length | data |
1123 | length | data |
1124 | (4 bytes) | (<length - 4> bytes) |
1124 | (4 bytes) | (<length - 4> bytes) |
1125 | | |
1125 | | |
1126 +---------------------------------------+
1126 +---------------------------------------+
1127
1127
1128 All integers are big-endian signed integers. Each chunk starts with a
1128 All integers are big-endian signed integers. Each chunk starts with a
1129 32-bit integer indicating the length of the entire chunk (including the
1129 32-bit integer indicating the length of the entire chunk (including the
1130 length field itself).
1130 length field itself).
1131
1131
1132 There is a special case chunk that has a value of 0 for the length
1132 There is a special case chunk that has a value of 0 for the length
1133 ("0x00000000"). We call this an *empty chunk*.
1133 ("0x00000000"). We call this an *empty chunk*.
1134
1134
1135 Delta Groups
1135 Delta Groups
1136 ============
1136 ============
1137
1137
1138 A *delta group* expresses the content of a revlog as a series of deltas,
1138 A *delta group* expresses the content of a revlog as a series of deltas,
1139 or patches against previous revisions.
1139 or patches against previous revisions.
1140
1140
1141 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1141 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1142 to signal the end of the delta group:
1142 to signal the end of the delta group:
1143
1143
1144 +------------------------------------------------------------------------+
1144 +------------------------------------------------------------------------+
1145 | | | | | |
1145 | | | | | |
1146 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1146 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1147 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1147 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1148 | | | | | |
1148 | | | | | |
1149 +------------------------------------------------------------------------+
1149 +------------------------------------------------------------------------+
1150
1150
1151 Each *chunk*'s data consists of the following:
1151 Each *chunk*'s data consists of the following:
1152
1152
1153 +---------------------------------------+
1153 +---------------------------------------+
1154 | | |
1154 | | |
1155 | delta header | delta data |
1155 | delta header | delta data |
1156 | (various by version) | (various) |
1156 | (various by version) | (various) |
1157 | | |
1157 | | |
1158 +---------------------------------------+
1158 +---------------------------------------+
1159
1159
1160 The *delta data* is a series of *delta*s that describe a diff from an
1160 The *delta data* is a series of *delta*s that describe a diff from an
1161 existing entry (either that the recipient already has, or previously
1161 existing entry (either that the recipient already has, or previously
1162 specified in the bundle/changegroup).
1162 specified in the bundle/changegroup).
1163
1163
1164 The *delta header* is different between versions "1", "2", and "3" of the
1164 The *delta header* is different between versions "1", "2", and "3" of the
1165 changegroup format.
1165 changegroup format.
1166
1166
1167 Version 1 (headerlen=80):
1167 Version 1 (headerlen=80):
1168
1168
1169 +------------------------------------------------------+
1169 +------------------------------------------------------+
1170 | | | | |
1170 | | | | |
1171 | node | p1 node | p2 node | link node |
1171 | node | p1 node | p2 node | link node |
1172 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1172 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1173 | | | | |
1173 | | | | |
1174 +------------------------------------------------------+
1174 +------------------------------------------------------+
1175
1175
1176 Version 2 (headerlen=100):
1176 Version 2 (headerlen=100):
1177
1177
1178 +------------------------------------------------------------------+
1178 +------------------------------------------------------------------+
1179 | | | | | |
1179 | | | | | |
1180 | node | p1 node | p2 node | base node | link node |
1180 | node | p1 node | p2 node | base node | link node |
1181 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1181 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1182 | | | | | |
1182 | | | | | |
1183 +------------------------------------------------------------------+
1183 +------------------------------------------------------------------+
1184
1184
1185 Version 3 (headerlen=102):
1185 Version 3 (headerlen=102):
1186
1186
1187 +------------------------------------------------------------------------------+
1187 +------------------------------------------------------------------------------+
1188 | | | | | | |
1188 | | | | | | |
1189 | node | p1 node | p2 node | base node | link node | flags |
1189 | node | p1 node | p2 node | base node | link node | flags |
1190 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1190 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1191 | | | | | | |
1191 | | | | | | |
1192 +------------------------------------------------------------------------------+
1192 +------------------------------------------------------------------------------+
1193
1193
1194 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1194 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1195 contain a series of *delta*s, densely packed (no separators). These deltas
1195 contain a series of *delta*s, densely packed (no separators). These deltas
1196 describe a diff from an existing entry (either that the recipient already
1196 describe a diff from an existing entry (either that the recipient already
1197 has, or previously specified in the bundle/changegroup). The format is
1197 has, or previously specified in the bundle/changegroup). The format is
1198 described more fully in "hg help internals.bdiff", but briefly:
1198 described more fully in "hg help internals.bdiff", but briefly:
1199
1199
1200 +---------------------------------------------------------------+
1200 +---------------------------------------------------------------+
1201 | | | | |
1201 | | | | |
1202 | start offset | end offset | new length | content |
1202 | start offset | end offset | new length | content |
1203 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1203 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1204 | | | | |
1204 | | | | |
1205 +---------------------------------------------------------------+
1205 +---------------------------------------------------------------+
1206
1206
1207 Please note that the length field in the delta data does *not* include
1207 Please note that the length field in the delta data does *not* include
1208 itself.
1208 itself.
1209
1209
1210 In version 1, the delta is always applied against the previous node from
1210 In version 1, the delta is always applied against the previous node from
1211 the changegroup or the first parent if this is the first entry in the
1211 the changegroup or the first parent if this is the first entry in the
1212 changegroup.
1212 changegroup.
1213
1213
1214 In version 2 and up, the delta base node is encoded in the entry in the
1214 In version 2 and up, the delta base node is encoded in the entry in the
1215 changegroup. This allows the delta to be expressed against any parent,
1215 changegroup. This allows the delta to be expressed against any parent,
1216 which can result in smaller deltas and more efficient encoding of data.
1216 which can result in smaller deltas and more efficient encoding of data.
1217
1217
1218 The *flags* field holds bitwise flags affecting the processing of revision
1218 The *flags* field holds bitwise flags affecting the processing of revision
1219 data. The following flags are defined:
1219 data. The following flags are defined:
1220
1220
1221 32768
1221 32768
1222 Censored revision. The revision's fulltext has been replaced by censor
1222 Censored revision. The revision's fulltext has been replaced by censor
1223 metadata. May only occur on file revisions.
1223 metadata. May only occur on file revisions.
1224
1224
1225 16384
1225 16384
1226 Ellipsis revision. Revision hash does not match data (likely due to
1226 Ellipsis revision. Revision hash does not match data (likely due to
1227 rewritten parents).
1227 rewritten parents).
1228
1228
1229 8192
1229 8192
1230 Externally stored. The revision fulltext contains "key:value" "\n"
1230 Externally stored. The revision fulltext contains "key:value" "\n"
1231 delimited metadata defining an object stored elsewhere. Used by the LFS
1231 delimited metadata defining an object stored elsewhere. Used by the LFS
1232 extension.
1232 extension.
1233
1233
1234 For historical reasons, the integer values are identical to revlog version
1234 For historical reasons, the integer values are identical to revlog version
1235 1 per-revision storage flags and correspond to bits being set in this
1235 1 per-revision storage flags and correspond to bits being set in this
1236 2-byte field. Bits were allocated starting from the most-significant bit,
1236 2-byte field. Bits were allocated starting from the most-significant bit,
1237 hence the reverse ordering and allocation of these flags.
1237 hence the reverse ordering and allocation of these flags.
1238
1238
1239 Changeset Segment
1239 Changeset Segment
1240 =================
1240 =================
1241
1241
1242 The *changeset segment* consists of a single *delta group* holding
1242 The *changeset segment* consists of a single *delta group* holding
1243 changelog data. The *empty chunk* at the end of the *delta group* denotes
1243 changelog data. The *empty chunk* at the end of the *delta group* denotes
1244 the boundary to the *manifest segment*.
1244 the boundary to the *manifest segment*.
1245
1245
1246 Manifest Segment
1246 Manifest Segment
1247 ================
1247 ================
1248
1248
1249 The *manifest segment* consists of a single *delta group* holding manifest
1249 The *manifest segment* consists of a single *delta group* holding manifest
1250 data. If treemanifests are in use, it contains only the manifest for the
1250 data. If treemanifests are in use, it contains only the manifest for the
1251 root directory of the repository. Otherwise, it contains the entire
1251 root directory of the repository. Otherwise, it contains the entire
1252 manifest data. The *empty chunk* at the end of the *delta group* denotes
1252 manifest data. The *empty chunk* at the end of the *delta group* denotes
1253 the boundary to the next segment (either the *treemanifests segment* or
1253 the boundary to the next segment (either the *treemanifests segment* or
1254 the *filelogs segment*, depending on version and the request options).
1254 the *filelogs segment*, depending on version and the request options).
1255
1255
1256 Treemanifests Segment
1256 Treemanifests Segment
1257 ---------------------
1257 ---------------------
1258
1258
1259 The *treemanifests segment* only exists in changegroup version "3", and
1259 The *treemanifests segment* only exists in changegroup version "3", and
1260 only if the 'treemanifest' param is part of the bundle2 changegroup part
1260 only if the 'treemanifest' param is part of the bundle2 changegroup part
1261 (it is not possible to use changegroup version 3 outside of bundle2).
1261 (it is not possible to use changegroup version 3 outside of bundle2).
1262 Aside from the filenames in the *treemanifests segment* containing a
1262 Aside from the filenames in the *treemanifests segment* containing a
1263 trailing "/" character, it behaves identically to the *filelogs segment*
1263 trailing "/" character, it behaves identically to the *filelogs segment*
1264 (see below). The final sub-segment is followed by an *empty chunk*
1264 (see below). The final sub-segment is followed by an *empty chunk*
1265 (logically, a sub-segment with filename size 0). This denotes the boundary
1265 (logically, a sub-segment with filename size 0). This denotes the boundary
1266 to the *filelogs segment*.
1266 to the *filelogs segment*.
1267
1267
1268 Filelogs Segment
1268 Filelogs Segment
1269 ================
1269 ================
1270
1270
1271 The *filelogs segment* consists of multiple sub-segments, each
1271 The *filelogs segment* consists of multiple sub-segments, each
1272 corresponding to an individual file whose data is being described:
1272 corresponding to an individual file whose data is being described:
1273
1273
1274 +--------------------------------------------------+
1274 +--------------------------------------------------+
1275 | | | | | |
1275 | | | | | |
1276 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1276 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1277 | | | | | (4 bytes) |
1277 | | | | | (4 bytes) |
1278 | | | | | |
1278 | | | | | |
1279 +--------------------------------------------------+
1279 +--------------------------------------------------+
1280
1280
1281 The final filelog sub-segment is followed by an *empty chunk* (logically,
1281 The final filelog sub-segment is followed by an *empty chunk* (logically,
1282 a sub-segment with filename size 0). This denotes the end of the segment
1282 a sub-segment with filename size 0). This denotes the end of the segment
1283 and of the overall changegroup.
1283 and of the overall changegroup.
1284
1284
1285 Each filelog sub-segment consists of the following:
1285 Each filelog sub-segment consists of the following:
1286
1286
1287 +------------------------------------------------------+
1287 +------------------------------------------------------+
1288 | | | |
1288 | | | |
1289 | filename length | filename | delta group |
1289 | filename length | filename | delta group |
1290 | (4 bytes) | (<length - 4> bytes) | (various) |
1290 | (4 bytes) | (<length - 4> bytes) | (various) |
1291 | | | |
1291 | | | |
1292 +------------------------------------------------------+
1292 +------------------------------------------------------+
1293
1293
1294 That is, a *chunk* consisting of the filename (not terminated or padded)
1294 That is, a *chunk* consisting of the filename (not terminated or padded)
1295 followed by N chunks constituting the *delta group* for this file. The
1295 followed by N chunks constituting the *delta group* for this file. The
1296 *empty chunk* at the end of each *delta group* denotes the boundary to the
1296 *empty chunk* at the end of each *delta group* denotes the boundary to the
1297 next filelog sub-segment.
1297 next filelog sub-segment.
1298
1298
1299 test advanced, deprecated and experimental options are hidden in command help
1299 test advanced, deprecated and experimental options are hidden in command help
1300 $ hg help debugoptADV
1300 $ hg help debugoptADV
1301 hg debugoptADV
1301 hg debugoptADV
1302
1302
1303 (no help text available)
1303 (no help text available)
1304
1304
1305 options:
1305 options:
1306
1306
1307 (some details hidden, use --verbose to show complete help)
1307 (some details hidden, use --verbose to show complete help)
1308 $ hg help debugoptDEP
1308 $ hg help debugoptDEP
1309 hg debugoptDEP
1309 hg debugoptDEP
1310
1310
1311 (no help text available)
1311 (no help text available)
1312
1312
1313 options:
1313 options:
1314
1314
1315 (some details hidden, use --verbose to show complete help)
1315 (some details hidden, use --verbose to show complete help)
1316
1316
1317 $ hg help debugoptEXP
1317 $ hg help debugoptEXP
1318 hg debugoptEXP
1318 hg debugoptEXP
1319
1319
1320 (no help text available)
1320 (no help text available)
1321
1321
1322 options:
1322 options:
1323
1323
1324 (some details hidden, use --verbose to show complete help)
1324 (some details hidden, use --verbose to show complete help)
1325
1325
1326 test advanced, deprecated and experimental options are shown with -v
1326 test advanced, deprecated and experimental options are shown with -v
1327 $ hg help -v debugoptADV | grep aopt
1327 $ hg help -v debugoptADV | grep aopt
1328 --aopt option is (ADVANCED)
1328 --aopt option is (ADVANCED)
1329 $ hg help -v debugoptDEP | grep dopt
1329 $ hg help -v debugoptDEP | grep dopt
1330 --dopt option is (DEPRECATED)
1330 --dopt option is (DEPRECATED)
1331 $ hg help -v debugoptEXP | grep eopt
1331 $ hg help -v debugoptEXP | grep eopt
1332 --eopt option is (EXPERIMENTAL)
1332 --eopt option is (EXPERIMENTAL)
1333
1333
1334 #if gettext
1334 #if gettext
1335 test deprecated option is hidden with translation with untranslated description
1335 test deprecated option is hidden with translation with untranslated description
1336 (use many globy for not failing on changed transaction)
1336 (use many globy for not failing on changed transaction)
1337 $ LANGUAGE=sv hg help debugoptDEP
1337 $ LANGUAGE=sv hg help debugoptDEP
1338 hg debugoptDEP
1338 hg debugoptDEP
1339
1339
1340 (*) (glob)
1340 (*) (glob)
1341
1341
1342 options:
1342 options:
1343
1343
1344 (some details hidden, use --verbose to show complete help)
1344 (some details hidden, use --verbose to show complete help)
1345 #endif
1345 #endif
1346
1346
1347 Test commands that collide with topics (issue4240)
1347 Test commands that collide with topics (issue4240)
1348
1348
1349 $ hg config -hq
1349 $ hg config -hq
1350 hg config [-u] [NAME]...
1350 hg config [-u] [NAME]...
1351
1351
1352 show combined config settings from all hgrc files
1352 show combined config settings from all hgrc files
1353 $ hg showconfig -hq
1353 $ hg showconfig -hq
1354 hg config [-u] [NAME]...
1354 hg config [-u] [NAME]...
1355
1355
1356 show combined config settings from all hgrc files
1356 show combined config settings from all hgrc files
1357
1357
1358 Test a help topic
1358 Test a help topic
1359
1359
1360 $ hg help dates
1360 $ hg help dates
1361 Date Formats
1361 Date Formats
1362 """"""""""""
1362 """"""""""""
1363
1363
1364 Some commands allow the user to specify a date, e.g.:
1364 Some commands allow the user to specify a date, e.g.:
1365
1365
1366 - backout, commit, import, tag: Specify the commit date.
1366 - backout, commit, import, tag: Specify the commit date.
1367 - log, revert, update: Select revision(s) by date.
1367 - log, revert, update: Select revision(s) by date.
1368
1368
1369 Many date formats are valid. Here are some examples:
1369 Many date formats are valid. Here are some examples:
1370
1370
1371 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1371 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1372 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1372 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1373 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1373 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1374 - "Dec 6" (midnight)
1374 - "Dec 6" (midnight)
1375 - "13:18" (today assumed)
1375 - "13:18" (today assumed)
1376 - "3:39" (3:39AM assumed)
1376 - "3:39" (3:39AM assumed)
1377 - "3:39pm" (15:39)
1377 - "3:39pm" (15:39)
1378 - "2006-12-06 13:18:29" (ISO 8601 format)
1378 - "2006-12-06 13:18:29" (ISO 8601 format)
1379 - "2006-12-6 13:18"
1379 - "2006-12-6 13:18"
1380 - "2006-12-6"
1380 - "2006-12-6"
1381 - "12-6"
1381 - "12-6"
1382 - "12/6"
1382 - "12/6"
1383 - "12/6/6" (Dec 6 2006)
1383 - "12/6/6" (Dec 6 2006)
1384 - "today" (midnight)
1384 - "today" (midnight)
1385 - "yesterday" (midnight)
1385 - "yesterday" (midnight)
1386 - "now" - right now
1386 - "now" - right now
1387
1387
1388 Lastly, there is Mercurial's internal format:
1388 Lastly, there is Mercurial's internal format:
1389
1389
1390 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1390 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1391
1391
1392 This is the internal representation format for dates. The first number is
1392 This is the internal representation format for dates. The first number is
1393 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1393 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1394 is the offset of the local timezone, in seconds west of UTC (negative if
1394 is the offset of the local timezone, in seconds west of UTC (negative if
1395 the timezone is east of UTC).
1395 the timezone is east of UTC).
1396
1396
1397 The log command also accepts date ranges:
1397 The log command also accepts date ranges:
1398
1398
1399 - "<DATE" - at or before a given date/time
1399 - "<DATE" - at or before a given date/time
1400 - ">DATE" - on or after a given date/time
1400 - ">DATE" - on or after a given date/time
1401 - "DATE to DATE" - a date range, inclusive
1401 - "DATE to DATE" - a date range, inclusive
1402 - "-DAYS" - within a given number of days of today
1402 - "-DAYS" - within a given number of days of today
1403
1403
1404 Test repeated config section name
1404 Test repeated config section name
1405
1405
1406 $ hg help config.host
1406 $ hg help config.host
1407 "http_proxy.host"
1407 "http_proxy.host"
1408 Host name and (optional) port of the proxy server, for example
1408 Host name and (optional) port of the proxy server, for example
1409 "myproxy:8000".
1409 "myproxy:8000".
1410
1410
1411 "smtp.host"
1411 "smtp.host"
1412 Host name of mail server, e.g. "mail.example.com".
1412 Host name of mail server, e.g. "mail.example.com".
1413
1413
1414
1414
1415 Test section name with dot
1415 Test section name with dot
1416
1416
1417 $ hg help config.ui.username
1417 $ hg help config.ui.username
1418 "ui.username"
1418 "ui.username"
1419 The committer of a changeset created when running "commit". Typically
1419 The committer of a changeset created when running "commit". Typically
1420 a person's name and email address, e.g. "Fred Widget
1420 a person's name and email address, e.g. "Fred Widget
1421 <fred@example.com>". Environment variables in the username are
1421 <fred@example.com>". Environment variables in the username are
1422 expanded.
1422 expanded.
1423
1423
1424 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1424 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1425 empty, e.g. if the system admin set "username =" in the system hgrc,
1425 empty, e.g. if the system admin set "username =" in the system hgrc,
1426 it has to be specified manually or in a different hgrc file)
1426 it has to be specified manually or in a different hgrc file)
1427
1427
1428
1428
1429 $ hg help config.annotate.git
1429 $ hg help config.annotate.git
1430 abort: help section not found: config.annotate.git
1430 abort: help section not found: config.annotate.git
1431 [255]
1431 [255]
1432
1432
1433 $ hg help config.update.check
1433 $ hg help config.update.check
1434 "commands.update.check"
1434 "commands.update.check"
1435 Determines what level of checking 'hg update' will perform before
1435 Determines what level of checking 'hg update' will perform before
1436 moving to a destination revision. Valid values are "abort", "none",
1436 moving to a destination revision. Valid values are "abort", "none",
1437 "linear", and "noconflict". "abort" always fails if the working
1437 "linear", and "noconflict". "abort" always fails if the working
1438 directory has uncommitted changes. "none" performs no checking, and
1438 directory has uncommitted changes. "none" performs no checking, and
1439 may result in a merge with uncommitted changes. "linear" allows any
1439 may result in a merge with uncommitted changes. "linear" allows any
1440 update as long as it follows a straight line in the revision history,
1440 update as long as it follows a straight line in the revision history,
1441 and may trigger a merge with uncommitted changes. "noconflict" will
1441 and may trigger a merge with uncommitted changes. "noconflict" will
1442 allow any update which would not trigger a merge with uncommitted
1442 allow any update which would not trigger a merge with uncommitted
1443 changes, if any are present. (default: "linear")
1443 changes, if any are present. (default: "linear")
1444
1444
1445
1445
1446 $ hg help config.commands.update.check
1446 $ hg help config.commands.update.check
1447 "commands.update.check"
1447 "commands.update.check"
1448 Determines what level of checking 'hg update' will perform before
1448 Determines what level of checking 'hg update' will perform before
1449 moving to a destination revision. Valid values are "abort", "none",
1449 moving to a destination revision. Valid values are "abort", "none",
1450 "linear", and "noconflict". "abort" always fails if the working
1450 "linear", and "noconflict". "abort" always fails if the working
1451 directory has uncommitted changes. "none" performs no checking, and
1451 directory has uncommitted changes. "none" performs no checking, and
1452 may result in a merge with uncommitted changes. "linear" allows any
1452 may result in a merge with uncommitted changes. "linear" allows any
1453 update as long as it follows a straight line in the revision history,
1453 update as long as it follows a straight line in the revision history,
1454 and may trigger a merge with uncommitted changes. "noconflict" will
1454 and may trigger a merge with uncommitted changes. "noconflict" will
1455 allow any update which would not trigger a merge with uncommitted
1455 allow any update which would not trigger a merge with uncommitted
1456 changes, if any are present. (default: "linear")
1456 changes, if any are present. (default: "linear")
1457
1457
1458
1458
1459 $ hg help config.ommands.update.check
1459 $ hg help config.ommands.update.check
1460 abort: help section not found: config.ommands.update.check
1460 abort: help section not found: config.ommands.update.check
1461 [255]
1461 [255]
1462
1462
1463 Unrelated trailing paragraphs shouldn't be included
1463 Unrelated trailing paragraphs shouldn't be included
1464
1464
1465 $ hg help config.extramsg | grep '^$'
1465 $ hg help config.extramsg | grep '^$'
1466
1466
1467
1467
1468 Test capitalized section name
1468 Test capitalized section name
1469
1469
1470 $ hg help scripting.HGPLAIN > /dev/null
1470 $ hg help scripting.HGPLAIN > /dev/null
1471
1471
1472 Help subsection:
1472 Help subsection:
1473
1473
1474 $ hg help config.charsets |grep "Email example:" > /dev/null
1474 $ hg help config.charsets |grep "Email example:" > /dev/null
1475 [1]
1475 [1]
1476
1476
1477 Show nested definitions
1477 Show nested definitions
1478 ("profiling.type"[break]"ls"[break]"stat"[break])
1478 ("profiling.type"[break]"ls"[break]"stat"[break])
1479
1479
1480 $ hg help config.type | egrep '^$'|wc -l
1480 $ hg help config.type | egrep '^$'|wc -l
1481 \s*3 (re)
1481 \s*3 (re)
1482
1482
1483 $ hg help config.profiling.type.ls
1483 $ hg help config.profiling.type.ls
1484 "profiling.type.ls"
1484 "profiling.type.ls"
1485 Use Python's built-in instrumenting profiler. This profiler works on
1485 Use Python's built-in instrumenting profiler. This profiler works on
1486 all platforms, but each line number it reports is the first line of
1486 all platforms, but each line number it reports is the first line of
1487 a function. This restriction makes it difficult to identify the
1487 a function. This restriction makes it difficult to identify the
1488 expensive parts of a non-trivial function.
1488 expensive parts of a non-trivial function.
1489
1489
1490
1490
1491 Separate sections from subsections
1491 Separate sections from subsections
1492
1492
1493 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1493 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1494 "format"
1494 "format"
1495 --------
1495 --------
1496
1496
1497 "usegeneraldelta"
1497 "usegeneraldelta"
1498
1498
1499 "dotencode"
1499 "dotencode"
1500
1500
1501 "usefncache"
1501 "usefncache"
1502
1502
1503 "usestore"
1503 "usestore"
1504
1504
1505 "sparse-revlog"
1506
1505 "profiling"
1507 "profiling"
1506 -----------
1508 -----------
1507
1509
1508 "format"
1510 "format"
1509
1511
1510 "progress"
1512 "progress"
1511 ----------
1513 ----------
1512
1514
1513 "format"
1515 "format"
1514
1516
1515
1517
1516 Last item in help config.*:
1518 Last item in help config.*:
1517
1519
1518 $ hg help config.`hg help config|grep '^ "'| \
1520 $ hg help config.`hg help config|grep '^ "'| \
1519 > tail -1|sed 's![ "]*!!g'`| \
1521 > tail -1|sed 's![ "]*!!g'`| \
1520 > grep 'hg help -c config' > /dev/null
1522 > grep 'hg help -c config' > /dev/null
1521 [1]
1523 [1]
1522
1524
1523 note to use help -c for general hg help config:
1525 note to use help -c for general hg help config:
1524
1526
1525 $ hg help config |grep 'hg help -c config' > /dev/null
1527 $ hg help config |grep 'hg help -c config' > /dev/null
1526
1528
1527 Test templating help
1529 Test templating help
1528
1530
1529 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1531 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1530 desc String. The text of the changeset description.
1532 desc String. The text of the changeset description.
1531 diffstat String. Statistics of changes with the following format:
1533 diffstat String. Statistics of changes with the following format:
1532 firstline Any text. Returns the first line of text.
1534 firstline Any text. Returns the first line of text.
1533 nonempty Any text. Returns '(none)' if the string is empty.
1535 nonempty Any text. Returns '(none)' if the string is empty.
1534
1536
1535 Test deprecated items
1537 Test deprecated items
1536
1538
1537 $ hg help -v templating | grep currentbookmark
1539 $ hg help -v templating | grep currentbookmark
1538 currentbookmark
1540 currentbookmark
1539 $ hg help templating | (grep currentbookmark || true)
1541 $ hg help templating | (grep currentbookmark || true)
1540
1542
1541 Test help hooks
1543 Test help hooks
1542
1544
1543 $ cat > helphook1.py <<EOF
1545 $ cat > helphook1.py <<EOF
1544 > from mercurial import help
1546 > from mercurial import help
1545 >
1547 >
1546 > def rewrite(ui, topic, doc):
1548 > def rewrite(ui, topic, doc):
1547 > return doc + b'\nhelphook1\n'
1549 > return doc + b'\nhelphook1\n'
1548 >
1550 >
1549 > def extsetup(ui):
1551 > def extsetup(ui):
1550 > help.addtopichook(b'revisions', rewrite)
1552 > help.addtopichook(b'revisions', rewrite)
1551 > EOF
1553 > EOF
1552 $ cat > helphook2.py <<EOF
1554 $ cat > helphook2.py <<EOF
1553 > from mercurial import help
1555 > from mercurial import help
1554 >
1556 >
1555 > def rewrite(ui, topic, doc):
1557 > def rewrite(ui, topic, doc):
1556 > return doc + b'\nhelphook2\n'
1558 > return doc + b'\nhelphook2\n'
1557 >
1559 >
1558 > def extsetup(ui):
1560 > def extsetup(ui):
1559 > help.addtopichook(b'revisions', rewrite)
1561 > help.addtopichook(b'revisions', rewrite)
1560 > EOF
1562 > EOF
1561 $ echo '[extensions]' >> $HGRCPATH
1563 $ echo '[extensions]' >> $HGRCPATH
1562 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1564 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1563 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1565 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1564 $ hg help revsets | grep helphook
1566 $ hg help revsets | grep helphook
1565 helphook1
1567 helphook1
1566 helphook2
1568 helphook2
1567
1569
1568 help -c should only show debug --debug
1570 help -c should only show debug --debug
1569
1571
1570 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1572 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1571 [1]
1573 [1]
1572
1574
1573 help -c should only show deprecated for -v
1575 help -c should only show deprecated for -v
1574
1576
1575 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1577 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1576 [1]
1578 [1]
1577
1579
1578 Test -s / --system
1580 Test -s / --system
1579
1581
1580 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1582 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1581 > wc -l | sed -e 's/ //g'
1583 > wc -l | sed -e 's/ //g'
1582 0
1584 0
1583 $ hg help config.files --system unix | grep 'USER' | \
1585 $ hg help config.files --system unix | grep 'USER' | \
1584 > wc -l | sed -e 's/ //g'
1586 > wc -l | sed -e 's/ //g'
1585 0
1587 0
1586
1588
1587 Test -e / -c / -k combinations
1589 Test -e / -c / -k combinations
1588
1590
1589 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1591 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1590 Commands:
1592 Commands:
1591 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1593 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1592 Extensions:
1594 Extensions:
1593 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1595 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1594 Topics:
1596 Topics:
1595 Commands:
1597 Commands:
1596 Extensions:
1598 Extensions:
1597 Extension Commands:
1599 Extension Commands:
1598 $ hg help -c schemes
1600 $ hg help -c schemes
1599 abort: no such help topic: schemes
1601 abort: no such help topic: schemes
1600 (try 'hg help --keyword schemes')
1602 (try 'hg help --keyword schemes')
1601 [255]
1603 [255]
1602 $ hg help -e schemes |head -1
1604 $ hg help -e schemes |head -1
1603 schemes extension - extend schemes with shortcuts to repository swarms
1605 schemes extension - extend schemes with shortcuts to repository swarms
1604 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1606 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1605 Commands:
1607 Commands:
1606 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1608 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1607 Extensions:
1609 Extensions:
1608 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1610 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1609 Extensions:
1611 Extensions:
1610 Commands:
1612 Commands:
1611 $ hg help -c commit > /dev/null
1613 $ hg help -c commit > /dev/null
1612 $ hg help -e -c commit > /dev/null
1614 $ hg help -e -c commit > /dev/null
1613 $ hg help -e commit
1615 $ hg help -e commit
1614 abort: no such help topic: commit
1616 abort: no such help topic: commit
1615 (try 'hg help --keyword commit')
1617 (try 'hg help --keyword commit')
1616 [255]
1618 [255]
1617
1619
1618 Test keyword search help
1620 Test keyword search help
1619
1621
1620 $ cat > prefixedname.py <<EOF
1622 $ cat > prefixedname.py <<EOF
1621 > '''matched against word "clone"
1623 > '''matched against word "clone"
1622 > '''
1624 > '''
1623 > EOF
1625 > EOF
1624 $ echo '[extensions]' >> $HGRCPATH
1626 $ echo '[extensions]' >> $HGRCPATH
1625 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1627 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1626 $ hg help -k clone
1628 $ hg help -k clone
1627 Topics:
1629 Topics:
1628
1630
1629 config Configuration Files
1631 config Configuration Files
1630 extensions Using Additional Features
1632 extensions Using Additional Features
1631 glossary Glossary
1633 glossary Glossary
1632 phases Working with Phases
1634 phases Working with Phases
1633 subrepos Subrepositories
1635 subrepos Subrepositories
1634 urls URL Paths
1636 urls URL Paths
1635
1637
1636 Commands:
1638 Commands:
1637
1639
1638 bookmarks create a new bookmark or list existing bookmarks
1640 bookmarks create a new bookmark or list existing bookmarks
1639 clone make a copy of an existing repository
1641 clone make a copy of an existing repository
1640 paths show aliases for remote repositories
1642 paths show aliases for remote repositories
1641 pull pull changes from the specified source
1643 pull pull changes from the specified source
1642 update update working directory (or switch revisions)
1644 update update working directory (or switch revisions)
1643
1645
1644 Extensions:
1646 Extensions:
1645
1647
1646 clonebundles advertise pre-generated bundles to seed clones
1648 clonebundles advertise pre-generated bundles to seed clones
1647 narrow create clones which fetch history data for subset of files
1649 narrow create clones which fetch history data for subset of files
1648 (EXPERIMENTAL)
1650 (EXPERIMENTAL)
1649 prefixedname matched against word "clone"
1651 prefixedname matched against word "clone"
1650 relink recreates hardlinks between repository clones
1652 relink recreates hardlinks between repository clones
1651
1653
1652 Extension Commands:
1654 Extension Commands:
1653
1655
1654 qclone clone main and patch repository at same time
1656 qclone clone main and patch repository at same time
1655
1657
1656 Test unfound topic
1658 Test unfound topic
1657
1659
1658 $ hg help nonexistingtopicthatwillneverexisteverever
1660 $ hg help nonexistingtopicthatwillneverexisteverever
1659 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1661 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1660 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1662 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1661 [255]
1663 [255]
1662
1664
1663 Test unfound keyword
1665 Test unfound keyword
1664
1666
1665 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1667 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1666 abort: no matches
1668 abort: no matches
1667 (try 'hg help' for a list of topics)
1669 (try 'hg help' for a list of topics)
1668 [255]
1670 [255]
1669
1671
1670 Test omit indicating for help
1672 Test omit indicating for help
1671
1673
1672 $ cat > addverboseitems.py <<EOF
1674 $ cat > addverboseitems.py <<EOF
1673 > '''extension to test omit indicating.
1675 > '''extension to test omit indicating.
1674 >
1676 >
1675 > This paragraph is never omitted (for extension)
1677 > This paragraph is never omitted (for extension)
1676 >
1678 >
1677 > .. container:: verbose
1679 > .. container:: verbose
1678 >
1680 >
1679 > This paragraph is omitted,
1681 > This paragraph is omitted,
1680 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1682 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1681 >
1683 >
1682 > This paragraph is never omitted, too (for extension)
1684 > This paragraph is never omitted, too (for extension)
1683 > '''
1685 > '''
1684 > from __future__ import absolute_import
1686 > from __future__ import absolute_import
1685 > from mercurial import commands, help
1687 > from mercurial import commands, help
1686 > testtopic = b"""This paragraph is never omitted (for topic).
1688 > testtopic = b"""This paragraph is never omitted (for topic).
1687 >
1689 >
1688 > .. container:: verbose
1690 > .. container:: verbose
1689 >
1691 >
1690 > This paragraph is omitted,
1692 > This paragraph is omitted,
1691 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1693 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1692 >
1694 >
1693 > This paragraph is never omitted, too (for topic)
1695 > This paragraph is never omitted, too (for topic)
1694 > """
1696 > """
1695 > def extsetup(ui):
1697 > def extsetup(ui):
1696 > help.helptable.append(([b"topic-containing-verbose"],
1698 > help.helptable.append(([b"topic-containing-verbose"],
1697 > b"This is the topic to test omit indicating.",
1699 > b"This is the topic to test omit indicating.",
1698 > lambda ui: testtopic))
1700 > lambda ui: testtopic))
1699 > EOF
1701 > EOF
1700 $ echo '[extensions]' >> $HGRCPATH
1702 $ echo '[extensions]' >> $HGRCPATH
1701 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1703 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1702 $ hg help addverboseitems
1704 $ hg help addverboseitems
1703 addverboseitems extension - extension to test omit indicating.
1705 addverboseitems extension - extension to test omit indicating.
1704
1706
1705 This paragraph is never omitted (for extension)
1707 This paragraph is never omitted (for extension)
1706
1708
1707 This paragraph is never omitted, too (for extension)
1709 This paragraph is never omitted, too (for extension)
1708
1710
1709 (some details hidden, use --verbose to show complete help)
1711 (some details hidden, use --verbose to show complete help)
1710
1712
1711 no commands defined
1713 no commands defined
1712 $ hg help -v addverboseitems
1714 $ hg help -v addverboseitems
1713 addverboseitems extension - extension to test omit indicating.
1715 addverboseitems extension - extension to test omit indicating.
1714
1716
1715 This paragraph is never omitted (for extension)
1717 This paragraph is never omitted (for extension)
1716
1718
1717 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1719 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1718 extension)
1720 extension)
1719
1721
1720 This paragraph is never omitted, too (for extension)
1722 This paragraph is never omitted, too (for extension)
1721
1723
1722 no commands defined
1724 no commands defined
1723 $ hg help topic-containing-verbose
1725 $ hg help topic-containing-verbose
1724 This is the topic to test omit indicating.
1726 This is the topic to test omit indicating.
1725 """"""""""""""""""""""""""""""""""""""""""
1727 """"""""""""""""""""""""""""""""""""""""""
1726
1728
1727 This paragraph is never omitted (for topic).
1729 This paragraph is never omitted (for topic).
1728
1730
1729 This paragraph is never omitted, too (for topic)
1731 This paragraph is never omitted, too (for topic)
1730
1732
1731 (some details hidden, use --verbose to show complete help)
1733 (some details hidden, use --verbose to show complete help)
1732 $ hg help -v topic-containing-verbose
1734 $ hg help -v topic-containing-verbose
1733 This is the topic to test omit indicating.
1735 This is the topic to test omit indicating.
1734 """"""""""""""""""""""""""""""""""""""""""
1736 """"""""""""""""""""""""""""""""""""""""""
1735
1737
1736 This paragraph is never omitted (for topic).
1738 This paragraph is never omitted (for topic).
1737
1739
1738 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1740 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1739 topic)
1741 topic)
1740
1742
1741 This paragraph is never omitted, too (for topic)
1743 This paragraph is never omitted, too (for topic)
1742
1744
1743 Test section lookup
1745 Test section lookup
1744
1746
1745 $ hg help revset.merge
1747 $ hg help revset.merge
1746 "merge()"
1748 "merge()"
1747 Changeset is a merge changeset.
1749 Changeset is a merge changeset.
1748
1750
1749 $ hg help glossary.dag
1751 $ hg help glossary.dag
1750 DAG
1752 DAG
1751 The repository of changesets of a distributed version control system
1753 The repository of changesets of a distributed version control system
1752 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1754 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1753 of nodes and edges, where nodes correspond to changesets and edges
1755 of nodes and edges, where nodes correspond to changesets and edges
1754 imply a parent -> child relation. This graph can be visualized by
1756 imply a parent -> child relation. This graph can be visualized by
1755 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1757 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1756 limited by the requirement for children to have at most two parents.
1758 limited by the requirement for children to have at most two parents.
1757
1759
1758
1760
1759 $ hg help hgrc.paths
1761 $ hg help hgrc.paths
1760 "paths"
1762 "paths"
1761 -------
1763 -------
1762
1764
1763 Assigns symbolic names and behavior to repositories.
1765 Assigns symbolic names and behavior to repositories.
1764
1766
1765 Options are symbolic names defining the URL or directory that is the
1767 Options are symbolic names defining the URL or directory that is the
1766 location of the repository. Example:
1768 location of the repository. Example:
1767
1769
1768 [paths]
1770 [paths]
1769 my_server = https://example.com/my_repo
1771 my_server = https://example.com/my_repo
1770 local_path = /home/me/repo
1772 local_path = /home/me/repo
1771
1773
1772 These symbolic names can be used from the command line. To pull from
1774 These symbolic names can be used from the command line. To pull from
1773 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1775 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1774 local_path'.
1776 local_path'.
1775
1777
1776 Options containing colons (":") denote sub-options that can influence
1778 Options containing colons (":") denote sub-options that can influence
1777 behavior for that specific path. Example:
1779 behavior for that specific path. Example:
1778
1780
1779 [paths]
1781 [paths]
1780 my_server = https://example.com/my_path
1782 my_server = https://example.com/my_path
1781 my_server:pushurl = ssh://example.com/my_path
1783 my_server:pushurl = ssh://example.com/my_path
1782
1784
1783 The following sub-options can be defined:
1785 The following sub-options can be defined:
1784
1786
1785 "pushurl"
1787 "pushurl"
1786 The URL to use for push operations. If not defined, the location
1788 The URL to use for push operations. If not defined, the location
1787 defined by the path's main entry is used.
1789 defined by the path's main entry is used.
1788
1790
1789 "pushrev"
1791 "pushrev"
1790 A revset defining which revisions to push by default.
1792 A revset defining which revisions to push by default.
1791
1793
1792 When 'hg push' is executed without a "-r" argument, the revset defined
1794 When 'hg push' is executed without a "-r" argument, the revset defined
1793 by this sub-option is evaluated to determine what to push.
1795 by this sub-option is evaluated to determine what to push.
1794
1796
1795 For example, a value of "." will push the working directory's revision
1797 For example, a value of "." will push the working directory's revision
1796 by default.
1798 by default.
1797
1799
1798 Revsets specifying bookmarks will not result in the bookmark being
1800 Revsets specifying bookmarks will not result in the bookmark being
1799 pushed.
1801 pushed.
1800
1802
1801 The following special named paths exist:
1803 The following special named paths exist:
1802
1804
1803 "default"
1805 "default"
1804 The URL or directory to use when no source or remote is specified.
1806 The URL or directory to use when no source or remote is specified.
1805
1807
1806 'hg clone' will automatically define this path to the location the
1808 'hg clone' will automatically define this path to the location the
1807 repository was cloned from.
1809 repository was cloned from.
1808
1810
1809 "default-push"
1811 "default-push"
1810 (deprecated) The URL or directory for the default 'hg push' location.
1812 (deprecated) The URL or directory for the default 'hg push' location.
1811 "default:pushurl" should be used instead.
1813 "default:pushurl" should be used instead.
1812
1814
1813 $ hg help glossary.mcguffin
1815 $ hg help glossary.mcguffin
1814 abort: help section not found: glossary.mcguffin
1816 abort: help section not found: glossary.mcguffin
1815 [255]
1817 [255]
1816
1818
1817 $ hg help glossary.mc.guffin
1819 $ hg help glossary.mc.guffin
1818 abort: help section not found: glossary.mc.guffin
1820 abort: help section not found: glossary.mc.guffin
1819 [255]
1821 [255]
1820
1822
1821 $ hg help template.files
1823 $ hg help template.files
1822 files List of strings. All files modified, added, or removed by
1824 files List of strings. All files modified, added, or removed by
1823 this changeset.
1825 this changeset.
1824 files(pattern)
1826 files(pattern)
1825 All files of the current changeset matching the pattern. See
1827 All files of the current changeset matching the pattern. See
1826 'hg help patterns'.
1828 'hg help patterns'.
1827
1829
1828 Test section lookup by translated message
1830 Test section lookup by translated message
1829
1831
1830 str.lower() instead of encoding.lower(str) on translated message might
1832 str.lower() instead of encoding.lower(str) on translated message might
1831 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1833 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1832 as the second or later byte of multi-byte character.
1834 as the second or later byte of multi-byte character.
1833
1835
1834 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1836 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1835 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1837 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1836 replacement makes message meaningless.
1838 replacement makes message meaningless.
1837
1839
1838 This tests that section lookup by translated string isn't broken by
1840 This tests that section lookup by translated string isn't broken by
1839 such str.lower().
1841 such str.lower().
1840
1842
1841 $ "$PYTHON" <<EOF
1843 $ "$PYTHON" <<EOF
1842 > def escape(s):
1844 > def escape(s):
1843 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1845 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1844 > # translation of "record" in ja_JP.cp932
1846 > # translation of "record" in ja_JP.cp932
1845 > upper = b"\x8bL\x98^"
1847 > upper = b"\x8bL\x98^"
1846 > # str.lower()-ed section name should be treated as different one
1848 > # str.lower()-ed section name should be treated as different one
1847 > lower = b"\x8bl\x98^"
1849 > lower = b"\x8bl\x98^"
1848 > with open('ambiguous.py', 'wb') as fp:
1850 > with open('ambiguous.py', 'wb') as fp:
1849 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1851 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1850 > u'''summary of extension
1852 > u'''summary of extension
1851 >
1853 >
1852 > %s
1854 > %s
1853 > ----
1855 > ----
1854 >
1856 >
1855 > Upper name should show only this message
1857 > Upper name should show only this message
1856 >
1858 >
1857 > %s
1859 > %s
1858 > ----
1860 > ----
1859 >
1861 >
1860 > Lower name should show only this message
1862 > Lower name should show only this message
1861 >
1863 >
1862 > subsequent section
1864 > subsequent section
1863 > ------------------
1865 > ------------------
1864 >
1866 >
1865 > This should be hidden at 'hg help ambiguous' with section name.
1867 > This should be hidden at 'hg help ambiguous' with section name.
1866 > '''
1868 > '''
1867 > """ % (escape(upper), escape(lower)))
1869 > """ % (escape(upper), escape(lower)))
1868 > EOF
1870 > EOF
1869
1871
1870 $ cat >> $HGRCPATH <<EOF
1872 $ cat >> $HGRCPATH <<EOF
1871 > [extensions]
1873 > [extensions]
1872 > ambiguous = ./ambiguous.py
1874 > ambiguous = ./ambiguous.py
1873 > EOF
1875 > EOF
1874
1876
1875 $ "$PYTHON" <<EOF | sh
1877 $ "$PYTHON" <<EOF | sh
1876 > from mercurial import pycompat
1878 > from mercurial import pycompat
1877 > upper = b"\x8bL\x98^"
1879 > upper = b"\x8bL\x98^"
1878 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1880 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1879 > EOF
1881 > EOF
1880 \x8bL\x98^ (esc)
1882 \x8bL\x98^ (esc)
1881 ----
1883 ----
1882
1884
1883 Upper name should show only this message
1885 Upper name should show only this message
1884
1886
1885
1887
1886 $ "$PYTHON" <<EOF | sh
1888 $ "$PYTHON" <<EOF | sh
1887 > from mercurial import pycompat
1889 > from mercurial import pycompat
1888 > lower = b"\x8bl\x98^"
1890 > lower = b"\x8bl\x98^"
1889 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1891 > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1890 > EOF
1892 > EOF
1891 \x8bl\x98^ (esc)
1893 \x8bl\x98^ (esc)
1892 ----
1894 ----
1893
1895
1894 Lower name should show only this message
1896 Lower name should show only this message
1895
1897
1896
1898
1897 $ cat >> $HGRCPATH <<EOF
1899 $ cat >> $HGRCPATH <<EOF
1898 > [extensions]
1900 > [extensions]
1899 > ambiguous = !
1901 > ambiguous = !
1900 > EOF
1902 > EOF
1901
1903
1902 Show help content of disabled extensions
1904 Show help content of disabled extensions
1903
1905
1904 $ cat >> $HGRCPATH <<EOF
1906 $ cat >> $HGRCPATH <<EOF
1905 > [extensions]
1907 > [extensions]
1906 > ambiguous = !./ambiguous.py
1908 > ambiguous = !./ambiguous.py
1907 > EOF
1909 > EOF
1908 $ hg help -e ambiguous
1910 $ hg help -e ambiguous
1909 ambiguous extension - (no help text available)
1911 ambiguous extension - (no help text available)
1910
1912
1911 (use 'hg help extensions' for information on enabling extensions)
1913 (use 'hg help extensions' for information on enabling extensions)
1912
1914
1913 Test dynamic list of merge tools only shows up once
1915 Test dynamic list of merge tools only shows up once
1914 $ hg help merge-tools
1916 $ hg help merge-tools
1915 Merge Tools
1917 Merge Tools
1916 """""""""""
1918 """""""""""
1917
1919
1918 To merge files Mercurial uses merge tools.
1920 To merge files Mercurial uses merge tools.
1919
1921
1920 A merge tool combines two different versions of a file into a merged file.
1922 A merge tool combines two different versions of a file into a merged file.
1921 Merge tools are given the two files and the greatest common ancestor of
1923 Merge tools are given the two files and the greatest common ancestor of
1922 the two file versions, so they can determine the changes made on both
1924 the two file versions, so they can determine the changes made on both
1923 branches.
1925 branches.
1924
1926
1925 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1927 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1926 backout' and in several extensions.
1928 backout' and in several extensions.
1927
1929
1928 Usually, the merge tool tries to automatically reconcile the files by
1930 Usually, the merge tool tries to automatically reconcile the files by
1929 combining all non-overlapping changes that occurred separately in the two
1931 combining all non-overlapping changes that occurred separately in the two
1930 different evolutions of the same initial base file. Furthermore, some
1932 different evolutions of the same initial base file. Furthermore, some
1931 interactive merge programs make it easier to manually resolve conflicting
1933 interactive merge programs make it easier to manually resolve conflicting
1932 merges, either in a graphical way, or by inserting some conflict markers.
1934 merges, either in a graphical way, or by inserting some conflict markers.
1933 Mercurial does not include any interactive merge programs but relies on
1935 Mercurial does not include any interactive merge programs but relies on
1934 external tools for that.
1936 external tools for that.
1935
1937
1936 Available merge tools
1938 Available merge tools
1937 =====================
1939 =====================
1938
1940
1939 External merge tools and their properties are configured in the merge-
1941 External merge tools and their properties are configured in the merge-
1940 tools configuration section - see hgrc(5) - but they can often just be
1942 tools configuration section - see hgrc(5) - but they can often just be
1941 named by their executable.
1943 named by their executable.
1942
1944
1943 A merge tool is generally usable if its executable can be found on the
1945 A merge tool is generally usable if its executable can be found on the
1944 system and if it can handle the merge. The executable is found if it is an
1946 system and if it can handle the merge. The executable is found if it is an
1945 absolute or relative executable path or the name of an application in the
1947 absolute or relative executable path or the name of an application in the
1946 executable search path. The tool is assumed to be able to handle the merge
1948 executable search path. The tool is assumed to be able to handle the merge
1947 if it can handle symlinks if the file is a symlink, if it can handle
1949 if it can handle symlinks if the file is a symlink, if it can handle
1948 binary files if the file is binary, and if a GUI is available if the tool
1950 binary files if the file is binary, and if a GUI is available if the tool
1949 requires a GUI.
1951 requires a GUI.
1950
1952
1951 There are some internal merge tools which can be used. The internal merge
1953 There are some internal merge tools which can be used. The internal merge
1952 tools are:
1954 tools are:
1953
1955
1954 ":dump"
1956 ":dump"
1955 Creates three versions of the files to merge, containing the contents of
1957 Creates three versions of the files to merge, containing the contents of
1956 local, other and base. These files can then be used to perform a merge
1958 local, other and base. These files can then be used to perform a merge
1957 manually. If the file to be merged is named "a.txt", these files will
1959 manually. If the file to be merged is named "a.txt", these files will
1958 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1960 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1959 they will be placed in the same directory as "a.txt".
1961 they will be placed in the same directory as "a.txt".
1960
1962
1961 This implies premerge. Therefore, files aren't dumped, if premerge runs
1963 This implies premerge. Therefore, files aren't dumped, if premerge runs
1962 successfully. Use :forcedump to forcibly write files out.
1964 successfully. Use :forcedump to forcibly write files out.
1963
1965
1964 (actual capabilities: binary, symlink)
1966 (actual capabilities: binary, symlink)
1965
1967
1966 ":fail"
1968 ":fail"
1967 Rather than attempting to merge files that were modified on both
1969 Rather than attempting to merge files that were modified on both
1968 branches, it marks them as unresolved. The resolve command must be used
1970 branches, it marks them as unresolved. The resolve command must be used
1969 to resolve these conflicts.
1971 to resolve these conflicts.
1970
1972
1971 (actual capabilities: binary, symlink)
1973 (actual capabilities: binary, symlink)
1972
1974
1973 ":forcedump"
1975 ":forcedump"
1974 Creates three versions of the files as same as :dump, but omits
1976 Creates three versions of the files as same as :dump, but omits
1975 premerge.
1977 premerge.
1976
1978
1977 (actual capabilities: binary, symlink)
1979 (actual capabilities: binary, symlink)
1978
1980
1979 ":local"
1981 ":local"
1980 Uses the local 'p1()' version of files as the merged version.
1982 Uses the local 'p1()' version of files as the merged version.
1981
1983
1982 (actual capabilities: binary, symlink)
1984 (actual capabilities: binary, symlink)
1983
1985
1984 ":merge"
1986 ":merge"
1985 Uses the internal non-interactive simple merge algorithm for merging
1987 Uses the internal non-interactive simple merge algorithm for merging
1986 files. It will fail if there are any conflicts and leave markers in the
1988 files. It will fail if there are any conflicts and leave markers in the
1987 partially merged file. Markers will have two sections, one for each side
1989 partially merged file. Markers will have two sections, one for each side
1988 of merge.
1990 of merge.
1989
1991
1990 ":merge-local"
1992 ":merge-local"
1991 Like :merge, but resolve all conflicts non-interactively in favor of the
1993 Like :merge, but resolve all conflicts non-interactively in favor of the
1992 local 'p1()' changes.
1994 local 'p1()' changes.
1993
1995
1994 ":merge-other"
1996 ":merge-other"
1995 Like :merge, but resolve all conflicts non-interactively in favor of the
1997 Like :merge, but resolve all conflicts non-interactively in favor of the
1996 other 'p2()' changes.
1998 other 'p2()' changes.
1997
1999
1998 ":merge3"
2000 ":merge3"
1999 Uses the internal non-interactive simple merge algorithm for merging
2001 Uses the internal non-interactive simple merge algorithm for merging
2000 files. It will fail if there are any conflicts and leave markers in the
2002 files. It will fail if there are any conflicts and leave markers in the
2001 partially merged file. Marker will have three sections, one from each
2003 partially merged file. Marker will have three sections, one from each
2002 side of the merge and one for the base content.
2004 side of the merge and one for the base content.
2003
2005
2004 ":other"
2006 ":other"
2005 Uses the other 'p2()' version of files as the merged version.
2007 Uses the other 'p2()' version of files as the merged version.
2006
2008
2007 (actual capabilities: binary, symlink)
2009 (actual capabilities: binary, symlink)
2008
2010
2009 ":prompt"
2011 ":prompt"
2010 Asks the user which of the local 'p1()' or the other 'p2()' version to
2012 Asks the user which of the local 'p1()' or the other 'p2()' version to
2011 keep as the merged version.
2013 keep as the merged version.
2012
2014
2013 (actual capabilities: binary, symlink)
2015 (actual capabilities: binary, symlink)
2014
2016
2015 ":tagmerge"
2017 ":tagmerge"
2016 Uses the internal tag merge algorithm (experimental).
2018 Uses the internal tag merge algorithm (experimental).
2017
2019
2018 ":union"
2020 ":union"
2019 Uses the internal non-interactive simple merge algorithm for merging
2021 Uses the internal non-interactive simple merge algorithm for merging
2020 files. It will use both left and right sides for conflict regions. No
2022 files. It will use both left and right sides for conflict regions. No
2021 markers are inserted.
2023 markers are inserted.
2022
2024
2023 Internal tools are always available and do not require a GUI but will by
2025 Internal tools are always available and do not require a GUI but will by
2024 default not handle symlinks or binary files. See next section for detail
2026 default not handle symlinks or binary files. See next section for detail
2025 about "actual capabilities" described above.
2027 about "actual capabilities" described above.
2026
2028
2027 Choosing a merge tool
2029 Choosing a merge tool
2028 =====================
2030 =====================
2029
2031
2030 Mercurial uses these rules when deciding which merge tool to use:
2032 Mercurial uses these rules when deciding which merge tool to use:
2031
2033
2032 1. If a tool has been specified with the --tool option to merge or
2034 1. If a tool has been specified with the --tool option to merge or
2033 resolve, it is used. If it is the name of a tool in the merge-tools
2035 resolve, it is used. If it is the name of a tool in the merge-tools
2034 configuration, its configuration is used. Otherwise the specified tool
2036 configuration, its configuration is used. Otherwise the specified tool
2035 must be executable by the shell.
2037 must be executable by the shell.
2036 2. If the "HGMERGE" environment variable is present, its value is used and
2038 2. If the "HGMERGE" environment variable is present, its value is used and
2037 must be executable by the shell.
2039 must be executable by the shell.
2038 3. If the filename of the file to be merged matches any of the patterns in
2040 3. If the filename of the file to be merged matches any of the patterns in
2039 the merge-patterns configuration section, the first usable merge tool
2041 the merge-patterns configuration section, the first usable merge tool
2040 corresponding to a matching pattern is used.
2042 corresponding to a matching pattern is used.
2041 4. If ui.merge is set it will be considered next. If the value is not the
2043 4. If ui.merge is set it will be considered next. If the value is not the
2042 name of a configured tool, the specified value is used and must be
2044 name of a configured tool, the specified value is used and must be
2043 executable by the shell. Otherwise the named tool is used if it is
2045 executable by the shell. Otherwise the named tool is used if it is
2044 usable.
2046 usable.
2045 5. If any usable merge tools are present in the merge-tools configuration
2047 5. If any usable merge tools are present in the merge-tools configuration
2046 section, the one with the highest priority is used.
2048 section, the one with the highest priority is used.
2047 6. If a program named "hgmerge" can be found on the system, it is used -
2049 6. If a program named "hgmerge" can be found on the system, it is used -
2048 but it will by default not be used for symlinks and binary files.
2050 but it will by default not be used for symlinks and binary files.
2049 7. If the file to be merged is not binary and is not a symlink, then
2051 7. If the file to be merged is not binary and is not a symlink, then
2050 internal ":merge" is used.
2052 internal ":merge" is used.
2051 8. Otherwise, ":prompt" is used.
2053 8. Otherwise, ":prompt" is used.
2052
2054
2053 For historical reason, Mercurial treats merge tools as below while
2055 For historical reason, Mercurial treats merge tools as below while
2054 examining rules above.
2056 examining rules above.
2055
2057
2056 step specified via binary symlink
2058 step specified via binary symlink
2057 ----------------------------------
2059 ----------------------------------
2058 1. --tool o/o o/o
2060 1. --tool o/o o/o
2059 2. HGMERGE o/o o/o
2061 2. HGMERGE o/o o/o
2060 3. merge-patterns o/o(*) x/?(*)
2062 3. merge-patterns o/o(*) x/?(*)
2061 4. ui.merge x/?(*) x/?(*)
2063 4. ui.merge x/?(*) x/?(*)
2062
2064
2063 Each capability column indicates Mercurial behavior for internal/external
2065 Each capability column indicates Mercurial behavior for internal/external
2064 merge tools at examining each rule.
2066 merge tools at examining each rule.
2065
2067
2066 - "o": "assume that a tool has capability"
2068 - "o": "assume that a tool has capability"
2067 - "x": "assume that a tool does not have capability"
2069 - "x": "assume that a tool does not have capability"
2068 - "?": "check actual capability of a tool"
2070 - "?": "check actual capability of a tool"
2069
2071
2070 If "merge.strict-capability-check" configuration is true, Mercurial checks
2072 If "merge.strict-capability-check" configuration is true, Mercurial checks
2071 capabilities of merge tools strictly in (*) cases above (= each capability
2073 capabilities of merge tools strictly in (*) cases above (= each capability
2072 column becomes "?/?"). It is false by default for backward compatibility.
2074 column becomes "?/?"). It is false by default for backward compatibility.
2073
2075
2074 Note:
2076 Note:
2075 After selecting a merge program, Mercurial will by default attempt to
2077 After selecting a merge program, Mercurial will by default attempt to
2076 merge the files using a simple merge algorithm first. Only if it
2078 merge the files using a simple merge algorithm first. Only if it
2077 doesn't succeed because of conflicting changes will Mercurial actually
2079 doesn't succeed because of conflicting changes will Mercurial actually
2078 execute the merge program. Whether to use the simple merge algorithm
2080 execute the merge program. Whether to use the simple merge algorithm
2079 first can be controlled by the premerge setting of the merge tool.
2081 first can be controlled by the premerge setting of the merge tool.
2080 Premerge is enabled by default unless the file is binary or a symlink.
2082 Premerge is enabled by default unless the file is binary or a symlink.
2081
2083
2082 See the merge-tools and ui sections of hgrc(5) for details on the
2084 See the merge-tools and ui sections of hgrc(5) for details on the
2083 configuration of merge tools.
2085 configuration of merge tools.
2084
2086
2085 Compression engines listed in `hg help bundlespec`
2087 Compression engines listed in `hg help bundlespec`
2086
2088
2087 $ hg help bundlespec | grep gzip
2089 $ hg help bundlespec | grep gzip
2088 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2090 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2089 An algorithm that produces smaller bundles than "gzip".
2091 An algorithm that produces smaller bundles than "gzip".
2090 This engine will likely produce smaller bundles than "gzip" but will be
2092 This engine will likely produce smaller bundles than "gzip" but will be
2091 "gzip"
2093 "gzip"
2092 better compression than "gzip". It also frequently yields better (?)
2094 better compression than "gzip". It also frequently yields better (?)
2093
2095
2094 Test usage of section marks in help documents
2096 Test usage of section marks in help documents
2095
2097
2096 $ cd "$TESTDIR"/../doc
2098 $ cd "$TESTDIR"/../doc
2097 $ "$PYTHON" check-seclevel.py
2099 $ "$PYTHON" check-seclevel.py
2098 $ cd $TESTTMP
2100 $ cd $TESTTMP
2099
2101
2100 #if serve
2102 #if serve
2101
2103
2102 Test the help pages in hgweb.
2104 Test the help pages in hgweb.
2103
2105
2104 Dish up an empty repo; serve it cold.
2106 Dish up an empty repo; serve it cold.
2105
2107
2106 $ hg init "$TESTTMP/test"
2108 $ hg init "$TESTTMP/test"
2107 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2109 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2108 $ cat hg.pid >> $DAEMON_PIDS
2110 $ cat hg.pid >> $DAEMON_PIDS
2109
2111
2110 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2112 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2111 200 Script output follows
2113 200 Script output follows
2112
2114
2113 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2115 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2114 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2116 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2115 <head>
2117 <head>
2116 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2118 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2117 <meta name="robots" content="index, nofollow" />
2119 <meta name="robots" content="index, nofollow" />
2118 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2120 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2119 <script type="text/javascript" src="/static/mercurial.js"></script>
2121 <script type="text/javascript" src="/static/mercurial.js"></script>
2120
2122
2121 <title>Help: Index</title>
2123 <title>Help: Index</title>
2122 </head>
2124 </head>
2123 <body>
2125 <body>
2124
2126
2125 <div class="container">
2127 <div class="container">
2126 <div class="menu">
2128 <div class="menu">
2127 <div class="logo">
2129 <div class="logo">
2128 <a href="https://mercurial-scm.org/">
2130 <a href="https://mercurial-scm.org/">
2129 <img src="/static/hglogo.png" alt="mercurial" /></a>
2131 <img src="/static/hglogo.png" alt="mercurial" /></a>
2130 </div>
2132 </div>
2131 <ul>
2133 <ul>
2132 <li><a href="/shortlog">log</a></li>
2134 <li><a href="/shortlog">log</a></li>
2133 <li><a href="/graph">graph</a></li>
2135 <li><a href="/graph">graph</a></li>
2134 <li><a href="/tags">tags</a></li>
2136 <li><a href="/tags">tags</a></li>
2135 <li><a href="/bookmarks">bookmarks</a></li>
2137 <li><a href="/bookmarks">bookmarks</a></li>
2136 <li><a href="/branches">branches</a></li>
2138 <li><a href="/branches">branches</a></li>
2137 </ul>
2139 </ul>
2138 <ul>
2140 <ul>
2139 <li class="active">help</li>
2141 <li class="active">help</li>
2140 </ul>
2142 </ul>
2141 </div>
2143 </div>
2142
2144
2143 <div class="main">
2145 <div class="main">
2144 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2146 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2145
2147
2146 <form class="search" action="/log">
2148 <form class="search" action="/log">
2147
2149
2148 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2150 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2149 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2151 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2150 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2152 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2151 </form>
2153 </form>
2152 <table class="bigtable">
2154 <table class="bigtable">
2153 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2155 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2154
2156
2155 <tr><td>
2157 <tr><td>
2156 <a href="/help/bundlespec">
2158 <a href="/help/bundlespec">
2157 bundlespec
2159 bundlespec
2158 </a>
2160 </a>
2159 </td><td>
2161 </td><td>
2160 Bundle File Formats
2162 Bundle File Formats
2161 </td></tr>
2163 </td></tr>
2162 <tr><td>
2164 <tr><td>
2163 <a href="/help/color">
2165 <a href="/help/color">
2164 color
2166 color
2165 </a>
2167 </a>
2166 </td><td>
2168 </td><td>
2167 Colorizing Outputs
2169 Colorizing Outputs
2168 </td></tr>
2170 </td></tr>
2169 <tr><td>
2171 <tr><td>
2170 <a href="/help/config">
2172 <a href="/help/config">
2171 config
2173 config
2172 </a>
2174 </a>
2173 </td><td>
2175 </td><td>
2174 Configuration Files
2176 Configuration Files
2175 </td></tr>
2177 </td></tr>
2176 <tr><td>
2178 <tr><td>
2177 <a href="/help/dates">
2179 <a href="/help/dates">
2178 dates
2180 dates
2179 </a>
2181 </a>
2180 </td><td>
2182 </td><td>
2181 Date Formats
2183 Date Formats
2182 </td></tr>
2184 </td></tr>
2183 <tr><td>
2185 <tr><td>
2184 <a href="/help/deprecated">
2186 <a href="/help/deprecated">
2185 deprecated
2187 deprecated
2186 </a>
2188 </a>
2187 </td><td>
2189 </td><td>
2188 Deprecated Features
2190 Deprecated Features
2189 </td></tr>
2191 </td></tr>
2190 <tr><td>
2192 <tr><td>
2191 <a href="/help/diffs">
2193 <a href="/help/diffs">
2192 diffs
2194 diffs
2193 </a>
2195 </a>
2194 </td><td>
2196 </td><td>
2195 Diff Formats
2197 Diff Formats
2196 </td></tr>
2198 </td></tr>
2197 <tr><td>
2199 <tr><td>
2198 <a href="/help/environment">
2200 <a href="/help/environment">
2199 environment
2201 environment
2200 </a>
2202 </a>
2201 </td><td>
2203 </td><td>
2202 Environment Variables
2204 Environment Variables
2203 </td></tr>
2205 </td></tr>
2204 <tr><td>
2206 <tr><td>
2205 <a href="/help/extensions">
2207 <a href="/help/extensions">
2206 extensions
2208 extensions
2207 </a>
2209 </a>
2208 </td><td>
2210 </td><td>
2209 Using Additional Features
2211 Using Additional Features
2210 </td></tr>
2212 </td></tr>
2211 <tr><td>
2213 <tr><td>
2212 <a href="/help/filesets">
2214 <a href="/help/filesets">
2213 filesets
2215 filesets
2214 </a>
2216 </a>
2215 </td><td>
2217 </td><td>
2216 Specifying File Sets
2218 Specifying File Sets
2217 </td></tr>
2219 </td></tr>
2218 <tr><td>
2220 <tr><td>
2219 <a href="/help/flags">
2221 <a href="/help/flags">
2220 flags
2222 flags
2221 </a>
2223 </a>
2222 </td><td>
2224 </td><td>
2223 Command-line flags
2225 Command-line flags
2224 </td></tr>
2226 </td></tr>
2225 <tr><td>
2227 <tr><td>
2226 <a href="/help/glossary">
2228 <a href="/help/glossary">
2227 glossary
2229 glossary
2228 </a>
2230 </a>
2229 </td><td>
2231 </td><td>
2230 Glossary
2232 Glossary
2231 </td></tr>
2233 </td></tr>
2232 <tr><td>
2234 <tr><td>
2233 <a href="/help/hgignore">
2235 <a href="/help/hgignore">
2234 hgignore
2236 hgignore
2235 </a>
2237 </a>
2236 </td><td>
2238 </td><td>
2237 Syntax for Mercurial Ignore Files
2239 Syntax for Mercurial Ignore Files
2238 </td></tr>
2240 </td></tr>
2239 <tr><td>
2241 <tr><td>
2240 <a href="/help/hgweb">
2242 <a href="/help/hgweb">
2241 hgweb
2243 hgweb
2242 </a>
2244 </a>
2243 </td><td>
2245 </td><td>
2244 Configuring hgweb
2246 Configuring hgweb
2245 </td></tr>
2247 </td></tr>
2246 <tr><td>
2248 <tr><td>
2247 <a href="/help/internals">
2249 <a href="/help/internals">
2248 internals
2250 internals
2249 </a>
2251 </a>
2250 </td><td>
2252 </td><td>
2251 Technical implementation topics
2253 Technical implementation topics
2252 </td></tr>
2254 </td></tr>
2253 <tr><td>
2255 <tr><td>
2254 <a href="/help/merge-tools">
2256 <a href="/help/merge-tools">
2255 merge-tools
2257 merge-tools
2256 </a>
2258 </a>
2257 </td><td>
2259 </td><td>
2258 Merge Tools
2260 Merge Tools
2259 </td></tr>
2261 </td></tr>
2260 <tr><td>
2262 <tr><td>
2261 <a href="/help/pager">
2263 <a href="/help/pager">
2262 pager
2264 pager
2263 </a>
2265 </a>
2264 </td><td>
2266 </td><td>
2265 Pager Support
2267 Pager Support
2266 </td></tr>
2268 </td></tr>
2267 <tr><td>
2269 <tr><td>
2268 <a href="/help/patterns">
2270 <a href="/help/patterns">
2269 patterns
2271 patterns
2270 </a>
2272 </a>
2271 </td><td>
2273 </td><td>
2272 File Name Patterns
2274 File Name Patterns
2273 </td></tr>
2275 </td></tr>
2274 <tr><td>
2276 <tr><td>
2275 <a href="/help/phases">
2277 <a href="/help/phases">
2276 phases
2278 phases
2277 </a>
2279 </a>
2278 </td><td>
2280 </td><td>
2279 Working with Phases
2281 Working with Phases
2280 </td></tr>
2282 </td></tr>
2281 <tr><td>
2283 <tr><td>
2282 <a href="/help/revisions">
2284 <a href="/help/revisions">
2283 revisions
2285 revisions
2284 </a>
2286 </a>
2285 </td><td>
2287 </td><td>
2286 Specifying Revisions
2288 Specifying Revisions
2287 </td></tr>
2289 </td></tr>
2288 <tr><td>
2290 <tr><td>
2289 <a href="/help/scripting">
2291 <a href="/help/scripting">
2290 scripting
2292 scripting
2291 </a>
2293 </a>
2292 </td><td>
2294 </td><td>
2293 Using Mercurial from scripts and automation
2295 Using Mercurial from scripts and automation
2294 </td></tr>
2296 </td></tr>
2295 <tr><td>
2297 <tr><td>
2296 <a href="/help/subrepos">
2298 <a href="/help/subrepos">
2297 subrepos
2299 subrepos
2298 </a>
2300 </a>
2299 </td><td>
2301 </td><td>
2300 Subrepositories
2302 Subrepositories
2301 </td></tr>
2303 </td></tr>
2302 <tr><td>
2304 <tr><td>
2303 <a href="/help/templating">
2305 <a href="/help/templating">
2304 templating
2306 templating
2305 </a>
2307 </a>
2306 </td><td>
2308 </td><td>
2307 Template Usage
2309 Template Usage
2308 </td></tr>
2310 </td></tr>
2309 <tr><td>
2311 <tr><td>
2310 <a href="/help/urls">
2312 <a href="/help/urls">
2311 urls
2313 urls
2312 </a>
2314 </a>
2313 </td><td>
2315 </td><td>
2314 URL Paths
2316 URL Paths
2315 </td></tr>
2317 </td></tr>
2316 <tr><td>
2318 <tr><td>
2317 <a href="/help/topic-containing-verbose">
2319 <a href="/help/topic-containing-verbose">
2318 topic-containing-verbose
2320 topic-containing-verbose
2319 </a>
2321 </a>
2320 </td><td>
2322 </td><td>
2321 This is the topic to test omit indicating.
2323 This is the topic to test omit indicating.
2322 </td></tr>
2324 </td></tr>
2323
2325
2324
2326
2325 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2327 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2326
2328
2327 <tr><td>
2329 <tr><td>
2328 <a href="/help/add">
2330 <a href="/help/add">
2329 add
2331 add
2330 </a>
2332 </a>
2331 </td><td>
2333 </td><td>
2332 add the specified files on the next commit
2334 add the specified files on the next commit
2333 </td></tr>
2335 </td></tr>
2334 <tr><td>
2336 <tr><td>
2335 <a href="/help/annotate">
2337 <a href="/help/annotate">
2336 annotate
2338 annotate
2337 </a>
2339 </a>
2338 </td><td>
2340 </td><td>
2339 show changeset information by line for each file
2341 show changeset information by line for each file
2340 </td></tr>
2342 </td></tr>
2341 <tr><td>
2343 <tr><td>
2342 <a href="/help/clone">
2344 <a href="/help/clone">
2343 clone
2345 clone
2344 </a>
2346 </a>
2345 </td><td>
2347 </td><td>
2346 make a copy of an existing repository
2348 make a copy of an existing repository
2347 </td></tr>
2349 </td></tr>
2348 <tr><td>
2350 <tr><td>
2349 <a href="/help/commit">
2351 <a href="/help/commit">
2350 commit
2352 commit
2351 </a>
2353 </a>
2352 </td><td>
2354 </td><td>
2353 commit the specified files or all outstanding changes
2355 commit the specified files or all outstanding changes
2354 </td></tr>
2356 </td></tr>
2355 <tr><td>
2357 <tr><td>
2356 <a href="/help/diff">
2358 <a href="/help/diff">
2357 diff
2359 diff
2358 </a>
2360 </a>
2359 </td><td>
2361 </td><td>
2360 diff repository (or selected files)
2362 diff repository (or selected files)
2361 </td></tr>
2363 </td></tr>
2362 <tr><td>
2364 <tr><td>
2363 <a href="/help/export">
2365 <a href="/help/export">
2364 export
2366 export
2365 </a>
2367 </a>
2366 </td><td>
2368 </td><td>
2367 dump the header and diffs for one or more changesets
2369 dump the header and diffs for one or more changesets
2368 </td></tr>
2370 </td></tr>
2369 <tr><td>
2371 <tr><td>
2370 <a href="/help/forget">
2372 <a href="/help/forget">
2371 forget
2373 forget
2372 </a>
2374 </a>
2373 </td><td>
2375 </td><td>
2374 forget the specified files on the next commit
2376 forget the specified files on the next commit
2375 </td></tr>
2377 </td></tr>
2376 <tr><td>
2378 <tr><td>
2377 <a href="/help/init">
2379 <a href="/help/init">
2378 init
2380 init
2379 </a>
2381 </a>
2380 </td><td>
2382 </td><td>
2381 create a new repository in the given directory
2383 create a new repository in the given directory
2382 </td></tr>
2384 </td></tr>
2383 <tr><td>
2385 <tr><td>
2384 <a href="/help/log">
2386 <a href="/help/log">
2385 log
2387 log
2386 </a>
2388 </a>
2387 </td><td>
2389 </td><td>
2388 show revision history of entire repository or files
2390 show revision history of entire repository or files
2389 </td></tr>
2391 </td></tr>
2390 <tr><td>
2392 <tr><td>
2391 <a href="/help/merge">
2393 <a href="/help/merge">
2392 merge
2394 merge
2393 </a>
2395 </a>
2394 </td><td>
2396 </td><td>
2395 merge another revision into working directory
2397 merge another revision into working directory
2396 </td></tr>
2398 </td></tr>
2397 <tr><td>
2399 <tr><td>
2398 <a href="/help/pull">
2400 <a href="/help/pull">
2399 pull
2401 pull
2400 </a>
2402 </a>
2401 </td><td>
2403 </td><td>
2402 pull changes from the specified source
2404 pull changes from the specified source
2403 </td></tr>
2405 </td></tr>
2404 <tr><td>
2406 <tr><td>
2405 <a href="/help/push">
2407 <a href="/help/push">
2406 push
2408 push
2407 </a>
2409 </a>
2408 </td><td>
2410 </td><td>
2409 push changes to the specified destination
2411 push changes to the specified destination
2410 </td></tr>
2412 </td></tr>
2411 <tr><td>
2413 <tr><td>
2412 <a href="/help/remove">
2414 <a href="/help/remove">
2413 remove
2415 remove
2414 </a>
2416 </a>
2415 </td><td>
2417 </td><td>
2416 remove the specified files on the next commit
2418 remove the specified files on the next commit
2417 </td></tr>
2419 </td></tr>
2418 <tr><td>
2420 <tr><td>
2419 <a href="/help/serve">
2421 <a href="/help/serve">
2420 serve
2422 serve
2421 </a>
2423 </a>
2422 </td><td>
2424 </td><td>
2423 start stand-alone webserver
2425 start stand-alone webserver
2424 </td></tr>
2426 </td></tr>
2425 <tr><td>
2427 <tr><td>
2426 <a href="/help/status">
2428 <a href="/help/status">
2427 status
2429 status
2428 </a>
2430 </a>
2429 </td><td>
2431 </td><td>
2430 show changed files in the working directory
2432 show changed files in the working directory
2431 </td></tr>
2433 </td></tr>
2432 <tr><td>
2434 <tr><td>
2433 <a href="/help/summary">
2435 <a href="/help/summary">
2434 summary
2436 summary
2435 </a>
2437 </a>
2436 </td><td>
2438 </td><td>
2437 summarize working directory state
2439 summarize working directory state
2438 </td></tr>
2440 </td></tr>
2439 <tr><td>
2441 <tr><td>
2440 <a href="/help/update">
2442 <a href="/help/update">
2441 update
2443 update
2442 </a>
2444 </a>
2443 </td><td>
2445 </td><td>
2444 update working directory (or switch revisions)
2446 update working directory (or switch revisions)
2445 </td></tr>
2447 </td></tr>
2446
2448
2447
2449
2448
2450
2449 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2451 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2450
2452
2451 <tr><td>
2453 <tr><td>
2452 <a href="/help/addremove">
2454 <a href="/help/addremove">
2453 addremove
2455 addremove
2454 </a>
2456 </a>
2455 </td><td>
2457 </td><td>
2456 add all new files, delete all missing files
2458 add all new files, delete all missing files
2457 </td></tr>
2459 </td></tr>
2458 <tr><td>
2460 <tr><td>
2459 <a href="/help/archive">
2461 <a href="/help/archive">
2460 archive
2462 archive
2461 </a>
2463 </a>
2462 </td><td>
2464 </td><td>
2463 create an unversioned archive of a repository revision
2465 create an unversioned archive of a repository revision
2464 </td></tr>
2466 </td></tr>
2465 <tr><td>
2467 <tr><td>
2466 <a href="/help/backout">
2468 <a href="/help/backout">
2467 backout
2469 backout
2468 </a>
2470 </a>
2469 </td><td>
2471 </td><td>
2470 reverse effect of earlier changeset
2472 reverse effect of earlier changeset
2471 </td></tr>
2473 </td></tr>
2472 <tr><td>
2474 <tr><td>
2473 <a href="/help/bisect">
2475 <a href="/help/bisect">
2474 bisect
2476 bisect
2475 </a>
2477 </a>
2476 </td><td>
2478 </td><td>
2477 subdivision search of changesets
2479 subdivision search of changesets
2478 </td></tr>
2480 </td></tr>
2479 <tr><td>
2481 <tr><td>
2480 <a href="/help/bookmarks">
2482 <a href="/help/bookmarks">
2481 bookmarks
2483 bookmarks
2482 </a>
2484 </a>
2483 </td><td>
2485 </td><td>
2484 create a new bookmark or list existing bookmarks
2486 create a new bookmark or list existing bookmarks
2485 </td></tr>
2487 </td></tr>
2486 <tr><td>
2488 <tr><td>
2487 <a href="/help/branch">
2489 <a href="/help/branch">
2488 branch
2490 branch
2489 </a>
2491 </a>
2490 </td><td>
2492 </td><td>
2491 set or show the current branch name
2493 set or show the current branch name
2492 </td></tr>
2494 </td></tr>
2493 <tr><td>
2495 <tr><td>
2494 <a href="/help/branches">
2496 <a href="/help/branches">
2495 branches
2497 branches
2496 </a>
2498 </a>
2497 </td><td>
2499 </td><td>
2498 list repository named branches
2500 list repository named branches
2499 </td></tr>
2501 </td></tr>
2500 <tr><td>
2502 <tr><td>
2501 <a href="/help/bundle">
2503 <a href="/help/bundle">
2502 bundle
2504 bundle
2503 </a>
2505 </a>
2504 </td><td>
2506 </td><td>
2505 create a bundle file
2507 create a bundle file
2506 </td></tr>
2508 </td></tr>
2507 <tr><td>
2509 <tr><td>
2508 <a href="/help/cat">
2510 <a href="/help/cat">
2509 cat
2511 cat
2510 </a>
2512 </a>
2511 </td><td>
2513 </td><td>
2512 output the current or given revision of files
2514 output the current or given revision of files
2513 </td></tr>
2515 </td></tr>
2514 <tr><td>
2516 <tr><td>
2515 <a href="/help/config">
2517 <a href="/help/config">
2516 config
2518 config
2517 </a>
2519 </a>
2518 </td><td>
2520 </td><td>
2519 show combined config settings from all hgrc files
2521 show combined config settings from all hgrc files
2520 </td></tr>
2522 </td></tr>
2521 <tr><td>
2523 <tr><td>
2522 <a href="/help/copy">
2524 <a href="/help/copy">
2523 copy
2525 copy
2524 </a>
2526 </a>
2525 </td><td>
2527 </td><td>
2526 mark files as copied for the next commit
2528 mark files as copied for the next commit
2527 </td></tr>
2529 </td></tr>
2528 <tr><td>
2530 <tr><td>
2529 <a href="/help/files">
2531 <a href="/help/files">
2530 files
2532 files
2531 </a>
2533 </a>
2532 </td><td>
2534 </td><td>
2533 list tracked files
2535 list tracked files
2534 </td></tr>
2536 </td></tr>
2535 <tr><td>
2537 <tr><td>
2536 <a href="/help/graft">
2538 <a href="/help/graft">
2537 graft
2539 graft
2538 </a>
2540 </a>
2539 </td><td>
2541 </td><td>
2540 copy changes from other branches onto the current branch
2542 copy changes from other branches onto the current branch
2541 </td></tr>
2543 </td></tr>
2542 <tr><td>
2544 <tr><td>
2543 <a href="/help/grep">
2545 <a href="/help/grep">
2544 grep
2546 grep
2545 </a>
2547 </a>
2546 </td><td>
2548 </td><td>
2547 search revision history for a pattern in specified files
2549 search revision history for a pattern in specified files
2548 </td></tr>
2550 </td></tr>
2549 <tr><td>
2551 <tr><td>
2550 <a href="/help/hashelp">
2552 <a href="/help/hashelp">
2551 hashelp
2553 hashelp
2552 </a>
2554 </a>
2553 </td><td>
2555 </td><td>
2554 Extension command's help
2556 Extension command's help
2555 </td></tr>
2557 </td></tr>
2556 <tr><td>
2558 <tr><td>
2557 <a href="/help/heads">
2559 <a href="/help/heads">
2558 heads
2560 heads
2559 </a>
2561 </a>
2560 </td><td>
2562 </td><td>
2561 show branch heads
2563 show branch heads
2562 </td></tr>
2564 </td></tr>
2563 <tr><td>
2565 <tr><td>
2564 <a href="/help/help">
2566 <a href="/help/help">
2565 help
2567 help
2566 </a>
2568 </a>
2567 </td><td>
2569 </td><td>
2568 show help for a given topic or a help overview
2570 show help for a given topic or a help overview
2569 </td></tr>
2571 </td></tr>
2570 <tr><td>
2572 <tr><td>
2571 <a href="/help/hgalias">
2573 <a href="/help/hgalias">
2572 hgalias
2574 hgalias
2573 </a>
2575 </a>
2574 </td><td>
2576 </td><td>
2575 My doc
2577 My doc
2576 </td></tr>
2578 </td></tr>
2577 <tr><td>
2579 <tr><td>
2578 <a href="/help/hgaliasnodoc">
2580 <a href="/help/hgaliasnodoc">
2579 hgaliasnodoc
2581 hgaliasnodoc
2580 </a>
2582 </a>
2581 </td><td>
2583 </td><td>
2582 summarize working directory state
2584 summarize working directory state
2583 </td></tr>
2585 </td></tr>
2584 <tr><td>
2586 <tr><td>
2585 <a href="/help/identify">
2587 <a href="/help/identify">
2586 identify
2588 identify
2587 </a>
2589 </a>
2588 </td><td>
2590 </td><td>
2589 identify the working directory or specified revision
2591 identify the working directory or specified revision
2590 </td></tr>
2592 </td></tr>
2591 <tr><td>
2593 <tr><td>
2592 <a href="/help/import">
2594 <a href="/help/import">
2593 import
2595 import
2594 </a>
2596 </a>
2595 </td><td>
2597 </td><td>
2596 import an ordered set of patches
2598 import an ordered set of patches
2597 </td></tr>
2599 </td></tr>
2598 <tr><td>
2600 <tr><td>
2599 <a href="/help/incoming">
2601 <a href="/help/incoming">
2600 incoming
2602 incoming
2601 </a>
2603 </a>
2602 </td><td>
2604 </td><td>
2603 show new changesets found in source
2605 show new changesets found in source
2604 </td></tr>
2606 </td></tr>
2605 <tr><td>
2607 <tr><td>
2606 <a href="/help/manifest">
2608 <a href="/help/manifest">
2607 manifest
2609 manifest
2608 </a>
2610 </a>
2609 </td><td>
2611 </td><td>
2610 output the current or given revision of the project manifest
2612 output the current or given revision of the project manifest
2611 </td></tr>
2613 </td></tr>
2612 <tr><td>
2614 <tr><td>
2613 <a href="/help/nohelp">
2615 <a href="/help/nohelp">
2614 nohelp
2616 nohelp
2615 </a>
2617 </a>
2616 </td><td>
2618 </td><td>
2617 (no help text available)
2619 (no help text available)
2618 </td></tr>
2620 </td></tr>
2619 <tr><td>
2621 <tr><td>
2620 <a href="/help/outgoing">
2622 <a href="/help/outgoing">
2621 outgoing
2623 outgoing
2622 </a>
2624 </a>
2623 </td><td>
2625 </td><td>
2624 show changesets not found in the destination
2626 show changesets not found in the destination
2625 </td></tr>
2627 </td></tr>
2626 <tr><td>
2628 <tr><td>
2627 <a href="/help/paths">
2629 <a href="/help/paths">
2628 paths
2630 paths
2629 </a>
2631 </a>
2630 </td><td>
2632 </td><td>
2631 show aliases for remote repositories
2633 show aliases for remote repositories
2632 </td></tr>
2634 </td></tr>
2633 <tr><td>
2635 <tr><td>
2634 <a href="/help/phase">
2636 <a href="/help/phase">
2635 phase
2637 phase
2636 </a>
2638 </a>
2637 </td><td>
2639 </td><td>
2638 set or show the current phase name
2640 set or show the current phase name
2639 </td></tr>
2641 </td></tr>
2640 <tr><td>
2642 <tr><td>
2641 <a href="/help/recover">
2643 <a href="/help/recover">
2642 recover
2644 recover
2643 </a>
2645 </a>
2644 </td><td>
2646 </td><td>
2645 roll back an interrupted transaction
2647 roll back an interrupted transaction
2646 </td></tr>
2648 </td></tr>
2647 <tr><td>
2649 <tr><td>
2648 <a href="/help/rename">
2650 <a href="/help/rename">
2649 rename
2651 rename
2650 </a>
2652 </a>
2651 </td><td>
2653 </td><td>
2652 rename files; equivalent of copy + remove
2654 rename files; equivalent of copy + remove
2653 </td></tr>
2655 </td></tr>
2654 <tr><td>
2656 <tr><td>
2655 <a href="/help/resolve">
2657 <a href="/help/resolve">
2656 resolve
2658 resolve
2657 </a>
2659 </a>
2658 </td><td>
2660 </td><td>
2659 redo merges or set/view the merge status of files
2661 redo merges or set/view the merge status of files
2660 </td></tr>
2662 </td></tr>
2661 <tr><td>
2663 <tr><td>
2662 <a href="/help/revert">
2664 <a href="/help/revert">
2663 revert
2665 revert
2664 </a>
2666 </a>
2665 </td><td>
2667 </td><td>
2666 restore files to their checkout state
2668 restore files to their checkout state
2667 </td></tr>
2669 </td></tr>
2668 <tr><td>
2670 <tr><td>
2669 <a href="/help/root">
2671 <a href="/help/root">
2670 root
2672 root
2671 </a>
2673 </a>
2672 </td><td>
2674 </td><td>
2673 print the root (top) of the current working directory
2675 print the root (top) of the current working directory
2674 </td></tr>
2676 </td></tr>
2675 <tr><td>
2677 <tr><td>
2676 <a href="/help/shellalias">
2678 <a href="/help/shellalias">
2677 shellalias
2679 shellalias
2678 </a>
2680 </a>
2679 </td><td>
2681 </td><td>
2680 (no help text available)
2682 (no help text available)
2681 </td></tr>
2683 </td></tr>
2682 <tr><td>
2684 <tr><td>
2683 <a href="/help/tag">
2685 <a href="/help/tag">
2684 tag
2686 tag
2685 </a>
2687 </a>
2686 </td><td>
2688 </td><td>
2687 add one or more tags for the current or given revision
2689 add one or more tags for the current or given revision
2688 </td></tr>
2690 </td></tr>
2689 <tr><td>
2691 <tr><td>
2690 <a href="/help/tags">
2692 <a href="/help/tags">
2691 tags
2693 tags
2692 </a>
2694 </a>
2693 </td><td>
2695 </td><td>
2694 list repository tags
2696 list repository tags
2695 </td></tr>
2697 </td></tr>
2696 <tr><td>
2698 <tr><td>
2697 <a href="/help/unbundle">
2699 <a href="/help/unbundle">
2698 unbundle
2700 unbundle
2699 </a>
2701 </a>
2700 </td><td>
2702 </td><td>
2701 apply one or more bundle files
2703 apply one or more bundle files
2702 </td></tr>
2704 </td></tr>
2703 <tr><td>
2705 <tr><td>
2704 <a href="/help/verify">
2706 <a href="/help/verify">
2705 verify
2707 verify
2706 </a>
2708 </a>
2707 </td><td>
2709 </td><td>
2708 verify the integrity of the repository
2710 verify the integrity of the repository
2709 </td></tr>
2711 </td></tr>
2710 <tr><td>
2712 <tr><td>
2711 <a href="/help/version">
2713 <a href="/help/version">
2712 version
2714 version
2713 </a>
2715 </a>
2714 </td><td>
2716 </td><td>
2715 output version and copyright information
2717 output version and copyright information
2716 </td></tr>
2718 </td></tr>
2717
2719
2718
2720
2719 </table>
2721 </table>
2720 </div>
2722 </div>
2721 </div>
2723 </div>
2722
2724
2723
2725
2724
2726
2725 </body>
2727 </body>
2726 </html>
2728 </html>
2727
2729
2728
2730
2729 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2731 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2730 200 Script output follows
2732 200 Script output follows
2731
2733
2732 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2734 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2733 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2735 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2734 <head>
2736 <head>
2735 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2737 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2736 <meta name="robots" content="index, nofollow" />
2738 <meta name="robots" content="index, nofollow" />
2737 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2739 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2738 <script type="text/javascript" src="/static/mercurial.js"></script>
2740 <script type="text/javascript" src="/static/mercurial.js"></script>
2739
2741
2740 <title>Help: add</title>
2742 <title>Help: add</title>
2741 </head>
2743 </head>
2742 <body>
2744 <body>
2743
2745
2744 <div class="container">
2746 <div class="container">
2745 <div class="menu">
2747 <div class="menu">
2746 <div class="logo">
2748 <div class="logo">
2747 <a href="https://mercurial-scm.org/">
2749 <a href="https://mercurial-scm.org/">
2748 <img src="/static/hglogo.png" alt="mercurial" /></a>
2750 <img src="/static/hglogo.png" alt="mercurial" /></a>
2749 </div>
2751 </div>
2750 <ul>
2752 <ul>
2751 <li><a href="/shortlog">log</a></li>
2753 <li><a href="/shortlog">log</a></li>
2752 <li><a href="/graph">graph</a></li>
2754 <li><a href="/graph">graph</a></li>
2753 <li><a href="/tags">tags</a></li>
2755 <li><a href="/tags">tags</a></li>
2754 <li><a href="/bookmarks">bookmarks</a></li>
2756 <li><a href="/bookmarks">bookmarks</a></li>
2755 <li><a href="/branches">branches</a></li>
2757 <li><a href="/branches">branches</a></li>
2756 </ul>
2758 </ul>
2757 <ul>
2759 <ul>
2758 <li class="active"><a href="/help">help</a></li>
2760 <li class="active"><a href="/help">help</a></li>
2759 </ul>
2761 </ul>
2760 </div>
2762 </div>
2761
2763
2762 <div class="main">
2764 <div class="main">
2763 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2765 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2764 <h3>Help: add</h3>
2766 <h3>Help: add</h3>
2765
2767
2766 <form class="search" action="/log">
2768 <form class="search" action="/log">
2767
2769
2768 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2770 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2769 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2771 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2770 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2772 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2771 </form>
2773 </form>
2772 <div id="doc">
2774 <div id="doc">
2773 <p>
2775 <p>
2774 hg add [OPTION]... [FILE]...
2776 hg add [OPTION]... [FILE]...
2775 </p>
2777 </p>
2776 <p>
2778 <p>
2777 add the specified files on the next commit
2779 add the specified files on the next commit
2778 </p>
2780 </p>
2779 <p>
2781 <p>
2780 Schedule files to be version controlled and added to the
2782 Schedule files to be version controlled and added to the
2781 repository.
2783 repository.
2782 </p>
2784 </p>
2783 <p>
2785 <p>
2784 The files will be added to the repository at the next commit. To
2786 The files will be added to the repository at the next commit. To
2785 undo an add before that, see 'hg forget'.
2787 undo an add before that, see 'hg forget'.
2786 </p>
2788 </p>
2787 <p>
2789 <p>
2788 If no names are given, add all files to the repository (except
2790 If no names are given, add all files to the repository (except
2789 files matching &quot;.hgignore&quot;).
2791 files matching &quot;.hgignore&quot;).
2790 </p>
2792 </p>
2791 <p>
2793 <p>
2792 Examples:
2794 Examples:
2793 </p>
2795 </p>
2794 <ul>
2796 <ul>
2795 <li> New (unknown) files are added automatically by 'hg add':
2797 <li> New (unknown) files are added automatically by 'hg add':
2796 <pre>
2798 <pre>
2797 \$ ls (re)
2799 \$ ls (re)
2798 foo.c
2800 foo.c
2799 \$ hg status (re)
2801 \$ hg status (re)
2800 ? foo.c
2802 ? foo.c
2801 \$ hg add (re)
2803 \$ hg add (re)
2802 adding foo.c
2804 adding foo.c
2803 \$ hg status (re)
2805 \$ hg status (re)
2804 A foo.c
2806 A foo.c
2805 </pre>
2807 </pre>
2806 <li> Specific files to be added can be specified:
2808 <li> Specific files to be added can be specified:
2807 <pre>
2809 <pre>
2808 \$ ls (re)
2810 \$ ls (re)
2809 bar.c foo.c
2811 bar.c foo.c
2810 \$ hg status (re)
2812 \$ hg status (re)
2811 ? bar.c
2813 ? bar.c
2812 ? foo.c
2814 ? foo.c
2813 \$ hg add bar.c (re)
2815 \$ hg add bar.c (re)
2814 \$ hg status (re)
2816 \$ hg status (re)
2815 A bar.c
2817 A bar.c
2816 ? foo.c
2818 ? foo.c
2817 </pre>
2819 </pre>
2818 </ul>
2820 </ul>
2819 <p>
2821 <p>
2820 Returns 0 if all files are successfully added.
2822 Returns 0 if all files are successfully added.
2821 </p>
2823 </p>
2822 <p>
2824 <p>
2823 options ([+] can be repeated):
2825 options ([+] can be repeated):
2824 </p>
2826 </p>
2825 <table>
2827 <table>
2826 <tr><td>-I</td>
2828 <tr><td>-I</td>
2827 <td>--include PATTERN [+]</td>
2829 <td>--include PATTERN [+]</td>
2828 <td>include names matching the given patterns</td></tr>
2830 <td>include names matching the given patterns</td></tr>
2829 <tr><td>-X</td>
2831 <tr><td>-X</td>
2830 <td>--exclude PATTERN [+]</td>
2832 <td>--exclude PATTERN [+]</td>
2831 <td>exclude names matching the given patterns</td></tr>
2833 <td>exclude names matching the given patterns</td></tr>
2832 <tr><td>-S</td>
2834 <tr><td>-S</td>
2833 <td>--subrepos</td>
2835 <td>--subrepos</td>
2834 <td>recurse into subrepositories</td></tr>
2836 <td>recurse into subrepositories</td></tr>
2835 <tr><td>-n</td>
2837 <tr><td>-n</td>
2836 <td>--dry-run</td>
2838 <td>--dry-run</td>
2837 <td>do not perform actions, just print output</td></tr>
2839 <td>do not perform actions, just print output</td></tr>
2838 </table>
2840 </table>
2839 <p>
2841 <p>
2840 global options ([+] can be repeated):
2842 global options ([+] can be repeated):
2841 </p>
2843 </p>
2842 <table>
2844 <table>
2843 <tr><td>-R</td>
2845 <tr><td>-R</td>
2844 <td>--repository REPO</td>
2846 <td>--repository REPO</td>
2845 <td>repository root directory or name of overlay bundle file</td></tr>
2847 <td>repository root directory or name of overlay bundle file</td></tr>
2846 <tr><td></td>
2848 <tr><td></td>
2847 <td>--cwd DIR</td>
2849 <td>--cwd DIR</td>
2848 <td>change working directory</td></tr>
2850 <td>change working directory</td></tr>
2849 <tr><td>-y</td>
2851 <tr><td>-y</td>
2850 <td>--noninteractive</td>
2852 <td>--noninteractive</td>
2851 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2853 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2852 <tr><td>-q</td>
2854 <tr><td>-q</td>
2853 <td>--quiet</td>
2855 <td>--quiet</td>
2854 <td>suppress output</td></tr>
2856 <td>suppress output</td></tr>
2855 <tr><td>-v</td>
2857 <tr><td>-v</td>
2856 <td>--verbose</td>
2858 <td>--verbose</td>
2857 <td>enable additional output</td></tr>
2859 <td>enable additional output</td></tr>
2858 <tr><td></td>
2860 <tr><td></td>
2859 <td>--color TYPE</td>
2861 <td>--color TYPE</td>
2860 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2862 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2861 <tr><td></td>
2863 <tr><td></td>
2862 <td>--config CONFIG [+]</td>
2864 <td>--config CONFIG [+]</td>
2863 <td>set/override config option (use 'section.name=value')</td></tr>
2865 <td>set/override config option (use 'section.name=value')</td></tr>
2864 <tr><td></td>
2866 <tr><td></td>
2865 <td>--debug</td>
2867 <td>--debug</td>
2866 <td>enable debugging output</td></tr>
2868 <td>enable debugging output</td></tr>
2867 <tr><td></td>
2869 <tr><td></td>
2868 <td>--debugger</td>
2870 <td>--debugger</td>
2869 <td>start debugger</td></tr>
2871 <td>start debugger</td></tr>
2870 <tr><td></td>
2872 <tr><td></td>
2871 <td>--encoding ENCODE</td>
2873 <td>--encoding ENCODE</td>
2872 <td>set the charset encoding (default: ascii)</td></tr>
2874 <td>set the charset encoding (default: ascii)</td></tr>
2873 <tr><td></td>
2875 <tr><td></td>
2874 <td>--encodingmode MODE</td>
2876 <td>--encodingmode MODE</td>
2875 <td>set the charset encoding mode (default: strict)</td></tr>
2877 <td>set the charset encoding mode (default: strict)</td></tr>
2876 <tr><td></td>
2878 <tr><td></td>
2877 <td>--traceback</td>
2879 <td>--traceback</td>
2878 <td>always print a traceback on exception</td></tr>
2880 <td>always print a traceback on exception</td></tr>
2879 <tr><td></td>
2881 <tr><td></td>
2880 <td>--time</td>
2882 <td>--time</td>
2881 <td>time how long the command takes</td></tr>
2883 <td>time how long the command takes</td></tr>
2882 <tr><td></td>
2884 <tr><td></td>
2883 <td>--profile</td>
2885 <td>--profile</td>
2884 <td>print command execution profile</td></tr>
2886 <td>print command execution profile</td></tr>
2885 <tr><td></td>
2887 <tr><td></td>
2886 <td>--version</td>
2888 <td>--version</td>
2887 <td>output version information and exit</td></tr>
2889 <td>output version information and exit</td></tr>
2888 <tr><td>-h</td>
2890 <tr><td>-h</td>
2889 <td>--help</td>
2891 <td>--help</td>
2890 <td>display help and exit</td></tr>
2892 <td>display help and exit</td></tr>
2891 <tr><td></td>
2893 <tr><td></td>
2892 <td>--hidden</td>
2894 <td>--hidden</td>
2893 <td>consider hidden changesets</td></tr>
2895 <td>consider hidden changesets</td></tr>
2894 <tr><td></td>
2896 <tr><td></td>
2895 <td>--pager TYPE</td>
2897 <td>--pager TYPE</td>
2896 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2898 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2897 </table>
2899 </table>
2898
2900
2899 </div>
2901 </div>
2900 </div>
2902 </div>
2901 </div>
2903 </div>
2902
2904
2903
2905
2904
2906
2905 </body>
2907 </body>
2906 </html>
2908 </html>
2907
2909
2908
2910
2909 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2911 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2910 200 Script output follows
2912 200 Script output follows
2911
2913
2912 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2914 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2913 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2915 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2914 <head>
2916 <head>
2915 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2917 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2916 <meta name="robots" content="index, nofollow" />
2918 <meta name="robots" content="index, nofollow" />
2917 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2919 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2918 <script type="text/javascript" src="/static/mercurial.js"></script>
2920 <script type="text/javascript" src="/static/mercurial.js"></script>
2919
2921
2920 <title>Help: remove</title>
2922 <title>Help: remove</title>
2921 </head>
2923 </head>
2922 <body>
2924 <body>
2923
2925
2924 <div class="container">
2926 <div class="container">
2925 <div class="menu">
2927 <div class="menu">
2926 <div class="logo">
2928 <div class="logo">
2927 <a href="https://mercurial-scm.org/">
2929 <a href="https://mercurial-scm.org/">
2928 <img src="/static/hglogo.png" alt="mercurial" /></a>
2930 <img src="/static/hglogo.png" alt="mercurial" /></a>
2929 </div>
2931 </div>
2930 <ul>
2932 <ul>
2931 <li><a href="/shortlog">log</a></li>
2933 <li><a href="/shortlog">log</a></li>
2932 <li><a href="/graph">graph</a></li>
2934 <li><a href="/graph">graph</a></li>
2933 <li><a href="/tags">tags</a></li>
2935 <li><a href="/tags">tags</a></li>
2934 <li><a href="/bookmarks">bookmarks</a></li>
2936 <li><a href="/bookmarks">bookmarks</a></li>
2935 <li><a href="/branches">branches</a></li>
2937 <li><a href="/branches">branches</a></li>
2936 </ul>
2938 </ul>
2937 <ul>
2939 <ul>
2938 <li class="active"><a href="/help">help</a></li>
2940 <li class="active"><a href="/help">help</a></li>
2939 </ul>
2941 </ul>
2940 </div>
2942 </div>
2941
2943
2942 <div class="main">
2944 <div class="main">
2943 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2945 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2944 <h3>Help: remove</h3>
2946 <h3>Help: remove</h3>
2945
2947
2946 <form class="search" action="/log">
2948 <form class="search" action="/log">
2947
2949
2948 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2950 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2949 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2951 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2950 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2952 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2951 </form>
2953 </form>
2952 <div id="doc">
2954 <div id="doc">
2953 <p>
2955 <p>
2954 hg remove [OPTION]... FILE...
2956 hg remove [OPTION]... FILE...
2955 </p>
2957 </p>
2956 <p>
2958 <p>
2957 aliases: rm
2959 aliases: rm
2958 </p>
2960 </p>
2959 <p>
2961 <p>
2960 remove the specified files on the next commit
2962 remove the specified files on the next commit
2961 </p>
2963 </p>
2962 <p>
2964 <p>
2963 Schedule the indicated files for removal from the current branch.
2965 Schedule the indicated files for removal from the current branch.
2964 </p>
2966 </p>
2965 <p>
2967 <p>
2966 This command schedules the files to be removed at the next commit.
2968 This command schedules the files to be removed at the next commit.
2967 To undo a remove before that, see 'hg revert'. To undo added
2969 To undo a remove before that, see 'hg revert'. To undo added
2968 files, see 'hg forget'.
2970 files, see 'hg forget'.
2969 </p>
2971 </p>
2970 <p>
2972 <p>
2971 -A/--after can be used to remove only files that have already
2973 -A/--after can be used to remove only files that have already
2972 been deleted, -f/--force can be used to force deletion, and -Af
2974 been deleted, -f/--force can be used to force deletion, and -Af
2973 can be used to remove files from the next revision without
2975 can be used to remove files from the next revision without
2974 deleting them from the working directory.
2976 deleting them from the working directory.
2975 </p>
2977 </p>
2976 <p>
2978 <p>
2977 The following table details the behavior of remove for different
2979 The following table details the behavior of remove for different
2978 file states (columns) and option combinations (rows). The file
2980 file states (columns) and option combinations (rows). The file
2979 states are Added [A], Clean [C], Modified [M] and Missing [!]
2981 states are Added [A], Clean [C], Modified [M] and Missing [!]
2980 (as reported by 'hg status'). The actions are Warn, Remove
2982 (as reported by 'hg status'). The actions are Warn, Remove
2981 (from branch) and Delete (from disk):
2983 (from branch) and Delete (from disk):
2982 </p>
2984 </p>
2983 <table>
2985 <table>
2984 <tr><td>opt/state</td>
2986 <tr><td>opt/state</td>
2985 <td>A</td>
2987 <td>A</td>
2986 <td>C</td>
2988 <td>C</td>
2987 <td>M</td>
2989 <td>M</td>
2988 <td>!</td></tr>
2990 <td>!</td></tr>
2989 <tr><td>none</td>
2991 <tr><td>none</td>
2990 <td>W</td>
2992 <td>W</td>
2991 <td>RD</td>
2993 <td>RD</td>
2992 <td>W</td>
2994 <td>W</td>
2993 <td>R</td></tr>
2995 <td>R</td></tr>
2994 <tr><td>-f</td>
2996 <tr><td>-f</td>
2995 <td>R</td>
2997 <td>R</td>
2996 <td>RD</td>
2998 <td>RD</td>
2997 <td>RD</td>
2999 <td>RD</td>
2998 <td>R</td></tr>
3000 <td>R</td></tr>
2999 <tr><td>-A</td>
3001 <tr><td>-A</td>
3000 <td>W</td>
3002 <td>W</td>
3001 <td>W</td>
3003 <td>W</td>
3002 <td>W</td>
3004 <td>W</td>
3003 <td>R</td></tr>
3005 <td>R</td></tr>
3004 <tr><td>-Af</td>
3006 <tr><td>-Af</td>
3005 <td>R</td>
3007 <td>R</td>
3006 <td>R</td>
3008 <td>R</td>
3007 <td>R</td>
3009 <td>R</td>
3008 <td>R</td></tr>
3010 <td>R</td></tr>
3009 </table>
3011 </table>
3010 <p>
3012 <p>
3011 <b>Note:</b>
3013 <b>Note:</b>
3012 </p>
3014 </p>
3013 <p>
3015 <p>
3014 'hg remove' never deletes files in Added [A] state from the
3016 'hg remove' never deletes files in Added [A] state from the
3015 working directory, not even if &quot;--force&quot; is specified.
3017 working directory, not even if &quot;--force&quot; is specified.
3016 </p>
3018 </p>
3017 <p>
3019 <p>
3018 Returns 0 on success, 1 if any warnings encountered.
3020 Returns 0 on success, 1 if any warnings encountered.
3019 </p>
3021 </p>
3020 <p>
3022 <p>
3021 options ([+] can be repeated):
3023 options ([+] can be repeated):
3022 </p>
3024 </p>
3023 <table>
3025 <table>
3024 <tr><td>-A</td>
3026 <tr><td>-A</td>
3025 <td>--after</td>
3027 <td>--after</td>
3026 <td>record delete for missing files</td></tr>
3028 <td>record delete for missing files</td></tr>
3027 <tr><td>-f</td>
3029 <tr><td>-f</td>
3028 <td>--force</td>
3030 <td>--force</td>
3029 <td>forget added files, delete modified files</td></tr>
3031 <td>forget added files, delete modified files</td></tr>
3030 <tr><td>-S</td>
3032 <tr><td>-S</td>
3031 <td>--subrepos</td>
3033 <td>--subrepos</td>
3032 <td>recurse into subrepositories</td></tr>
3034 <td>recurse into subrepositories</td></tr>
3033 <tr><td>-I</td>
3035 <tr><td>-I</td>
3034 <td>--include PATTERN [+]</td>
3036 <td>--include PATTERN [+]</td>
3035 <td>include names matching the given patterns</td></tr>
3037 <td>include names matching the given patterns</td></tr>
3036 <tr><td>-X</td>
3038 <tr><td>-X</td>
3037 <td>--exclude PATTERN [+]</td>
3039 <td>--exclude PATTERN [+]</td>
3038 <td>exclude names matching the given patterns</td></tr>
3040 <td>exclude names matching the given patterns</td></tr>
3039 <tr><td>-n</td>
3041 <tr><td>-n</td>
3040 <td>--dry-run</td>
3042 <td>--dry-run</td>
3041 <td>do not perform actions, just print output</td></tr>
3043 <td>do not perform actions, just print output</td></tr>
3042 </table>
3044 </table>
3043 <p>
3045 <p>
3044 global options ([+] can be repeated):
3046 global options ([+] can be repeated):
3045 </p>
3047 </p>
3046 <table>
3048 <table>
3047 <tr><td>-R</td>
3049 <tr><td>-R</td>
3048 <td>--repository REPO</td>
3050 <td>--repository REPO</td>
3049 <td>repository root directory or name of overlay bundle file</td></tr>
3051 <td>repository root directory or name of overlay bundle file</td></tr>
3050 <tr><td></td>
3052 <tr><td></td>
3051 <td>--cwd DIR</td>
3053 <td>--cwd DIR</td>
3052 <td>change working directory</td></tr>
3054 <td>change working directory</td></tr>
3053 <tr><td>-y</td>
3055 <tr><td>-y</td>
3054 <td>--noninteractive</td>
3056 <td>--noninteractive</td>
3055 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3057 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3056 <tr><td>-q</td>
3058 <tr><td>-q</td>
3057 <td>--quiet</td>
3059 <td>--quiet</td>
3058 <td>suppress output</td></tr>
3060 <td>suppress output</td></tr>
3059 <tr><td>-v</td>
3061 <tr><td>-v</td>
3060 <td>--verbose</td>
3062 <td>--verbose</td>
3061 <td>enable additional output</td></tr>
3063 <td>enable additional output</td></tr>
3062 <tr><td></td>
3064 <tr><td></td>
3063 <td>--color TYPE</td>
3065 <td>--color TYPE</td>
3064 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3066 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3065 <tr><td></td>
3067 <tr><td></td>
3066 <td>--config CONFIG [+]</td>
3068 <td>--config CONFIG [+]</td>
3067 <td>set/override config option (use 'section.name=value')</td></tr>
3069 <td>set/override config option (use 'section.name=value')</td></tr>
3068 <tr><td></td>
3070 <tr><td></td>
3069 <td>--debug</td>
3071 <td>--debug</td>
3070 <td>enable debugging output</td></tr>
3072 <td>enable debugging output</td></tr>
3071 <tr><td></td>
3073 <tr><td></td>
3072 <td>--debugger</td>
3074 <td>--debugger</td>
3073 <td>start debugger</td></tr>
3075 <td>start debugger</td></tr>
3074 <tr><td></td>
3076 <tr><td></td>
3075 <td>--encoding ENCODE</td>
3077 <td>--encoding ENCODE</td>
3076 <td>set the charset encoding (default: ascii)</td></tr>
3078 <td>set the charset encoding (default: ascii)</td></tr>
3077 <tr><td></td>
3079 <tr><td></td>
3078 <td>--encodingmode MODE</td>
3080 <td>--encodingmode MODE</td>
3079 <td>set the charset encoding mode (default: strict)</td></tr>
3081 <td>set the charset encoding mode (default: strict)</td></tr>
3080 <tr><td></td>
3082 <tr><td></td>
3081 <td>--traceback</td>
3083 <td>--traceback</td>
3082 <td>always print a traceback on exception</td></tr>
3084 <td>always print a traceback on exception</td></tr>
3083 <tr><td></td>
3085 <tr><td></td>
3084 <td>--time</td>
3086 <td>--time</td>
3085 <td>time how long the command takes</td></tr>
3087 <td>time how long the command takes</td></tr>
3086 <tr><td></td>
3088 <tr><td></td>
3087 <td>--profile</td>
3089 <td>--profile</td>
3088 <td>print command execution profile</td></tr>
3090 <td>print command execution profile</td></tr>
3089 <tr><td></td>
3091 <tr><td></td>
3090 <td>--version</td>
3092 <td>--version</td>
3091 <td>output version information and exit</td></tr>
3093 <td>output version information and exit</td></tr>
3092 <tr><td>-h</td>
3094 <tr><td>-h</td>
3093 <td>--help</td>
3095 <td>--help</td>
3094 <td>display help and exit</td></tr>
3096 <td>display help and exit</td></tr>
3095 <tr><td></td>
3097 <tr><td></td>
3096 <td>--hidden</td>
3098 <td>--hidden</td>
3097 <td>consider hidden changesets</td></tr>
3099 <td>consider hidden changesets</td></tr>
3098 <tr><td></td>
3100 <tr><td></td>
3099 <td>--pager TYPE</td>
3101 <td>--pager TYPE</td>
3100 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3102 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3101 </table>
3103 </table>
3102
3104
3103 </div>
3105 </div>
3104 </div>
3106 </div>
3105 </div>
3107 </div>
3106
3108
3107
3109
3108
3110
3109 </body>
3111 </body>
3110 </html>
3112 </html>
3111
3113
3112
3114
3113 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3115 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3114 200 Script output follows
3116 200 Script output follows
3115
3117
3116 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3118 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3117 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3119 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3118 <head>
3120 <head>
3119 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3121 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3120 <meta name="robots" content="index, nofollow" />
3122 <meta name="robots" content="index, nofollow" />
3121 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3123 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3122 <script type="text/javascript" src="/static/mercurial.js"></script>
3124 <script type="text/javascript" src="/static/mercurial.js"></script>
3123
3125
3124 <title>Help: dates</title>
3126 <title>Help: dates</title>
3125 </head>
3127 </head>
3126 <body>
3128 <body>
3127
3129
3128 <div class="container">
3130 <div class="container">
3129 <div class="menu">
3131 <div class="menu">
3130 <div class="logo">
3132 <div class="logo">
3131 <a href="https://mercurial-scm.org/">
3133 <a href="https://mercurial-scm.org/">
3132 <img src="/static/hglogo.png" alt="mercurial" /></a>
3134 <img src="/static/hglogo.png" alt="mercurial" /></a>
3133 </div>
3135 </div>
3134 <ul>
3136 <ul>
3135 <li><a href="/shortlog">log</a></li>
3137 <li><a href="/shortlog">log</a></li>
3136 <li><a href="/graph">graph</a></li>
3138 <li><a href="/graph">graph</a></li>
3137 <li><a href="/tags">tags</a></li>
3139 <li><a href="/tags">tags</a></li>
3138 <li><a href="/bookmarks">bookmarks</a></li>
3140 <li><a href="/bookmarks">bookmarks</a></li>
3139 <li><a href="/branches">branches</a></li>
3141 <li><a href="/branches">branches</a></li>
3140 </ul>
3142 </ul>
3141 <ul>
3143 <ul>
3142 <li class="active"><a href="/help">help</a></li>
3144 <li class="active"><a href="/help">help</a></li>
3143 </ul>
3145 </ul>
3144 </div>
3146 </div>
3145
3147
3146 <div class="main">
3148 <div class="main">
3147 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3149 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3148 <h3>Help: dates</h3>
3150 <h3>Help: dates</h3>
3149
3151
3150 <form class="search" action="/log">
3152 <form class="search" action="/log">
3151
3153
3152 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3154 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3153 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3155 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3154 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3156 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3155 </form>
3157 </form>
3156 <div id="doc">
3158 <div id="doc">
3157 <h1>Date Formats</h1>
3159 <h1>Date Formats</h1>
3158 <p>
3160 <p>
3159 Some commands allow the user to specify a date, e.g.:
3161 Some commands allow the user to specify a date, e.g.:
3160 </p>
3162 </p>
3161 <ul>
3163 <ul>
3162 <li> backout, commit, import, tag: Specify the commit date.
3164 <li> backout, commit, import, tag: Specify the commit date.
3163 <li> log, revert, update: Select revision(s) by date.
3165 <li> log, revert, update: Select revision(s) by date.
3164 </ul>
3166 </ul>
3165 <p>
3167 <p>
3166 Many date formats are valid. Here are some examples:
3168 Many date formats are valid. Here are some examples:
3167 </p>
3169 </p>
3168 <ul>
3170 <ul>
3169 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3171 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3170 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3172 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3171 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3173 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3172 <li> &quot;Dec 6&quot; (midnight)
3174 <li> &quot;Dec 6&quot; (midnight)
3173 <li> &quot;13:18&quot; (today assumed)
3175 <li> &quot;13:18&quot; (today assumed)
3174 <li> &quot;3:39&quot; (3:39AM assumed)
3176 <li> &quot;3:39&quot; (3:39AM assumed)
3175 <li> &quot;3:39pm&quot; (15:39)
3177 <li> &quot;3:39pm&quot; (15:39)
3176 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3178 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3177 <li> &quot;2006-12-6 13:18&quot;
3179 <li> &quot;2006-12-6 13:18&quot;
3178 <li> &quot;2006-12-6&quot;
3180 <li> &quot;2006-12-6&quot;
3179 <li> &quot;12-6&quot;
3181 <li> &quot;12-6&quot;
3180 <li> &quot;12/6&quot;
3182 <li> &quot;12/6&quot;
3181 <li> &quot;12/6/6&quot; (Dec 6 2006)
3183 <li> &quot;12/6/6&quot; (Dec 6 2006)
3182 <li> &quot;today&quot; (midnight)
3184 <li> &quot;today&quot; (midnight)
3183 <li> &quot;yesterday&quot; (midnight)
3185 <li> &quot;yesterday&quot; (midnight)
3184 <li> &quot;now&quot; - right now
3186 <li> &quot;now&quot; - right now
3185 </ul>
3187 </ul>
3186 <p>
3188 <p>
3187 Lastly, there is Mercurial's internal format:
3189 Lastly, there is Mercurial's internal format:
3188 </p>
3190 </p>
3189 <ul>
3191 <ul>
3190 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3192 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3191 </ul>
3193 </ul>
3192 <p>
3194 <p>
3193 This is the internal representation format for dates. The first number
3195 This is the internal representation format for dates. The first number
3194 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3196 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3195 second is the offset of the local timezone, in seconds west of UTC
3197 second is the offset of the local timezone, in seconds west of UTC
3196 (negative if the timezone is east of UTC).
3198 (negative if the timezone is east of UTC).
3197 </p>
3199 </p>
3198 <p>
3200 <p>
3199 The log command also accepts date ranges:
3201 The log command also accepts date ranges:
3200 </p>
3202 </p>
3201 <ul>
3203 <ul>
3202 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3204 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3203 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3205 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3204 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3206 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3205 <li> &quot;-DAYS&quot; - within a given number of days of today
3207 <li> &quot;-DAYS&quot; - within a given number of days of today
3206 </ul>
3208 </ul>
3207
3209
3208 </div>
3210 </div>
3209 </div>
3211 </div>
3210 </div>
3212 </div>
3211
3213
3212
3214
3213
3215
3214 </body>
3216 </body>
3215 </html>
3217 </html>
3216
3218
3217
3219
3218 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3220 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3219 200 Script output follows
3221 200 Script output follows
3220
3222
3221 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3223 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3222 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3224 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3223 <head>
3225 <head>
3224 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3226 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3225 <meta name="robots" content="index, nofollow" />
3227 <meta name="robots" content="index, nofollow" />
3226 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3228 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3227 <script type="text/javascript" src="/static/mercurial.js"></script>
3229 <script type="text/javascript" src="/static/mercurial.js"></script>
3228
3230
3229 <title>Help: pager</title>
3231 <title>Help: pager</title>
3230 </head>
3232 </head>
3231 <body>
3233 <body>
3232
3234
3233 <div class="container">
3235 <div class="container">
3234 <div class="menu">
3236 <div class="menu">
3235 <div class="logo">
3237 <div class="logo">
3236 <a href="https://mercurial-scm.org/">
3238 <a href="https://mercurial-scm.org/">
3237 <img src="/static/hglogo.png" alt="mercurial" /></a>
3239 <img src="/static/hglogo.png" alt="mercurial" /></a>
3238 </div>
3240 </div>
3239 <ul>
3241 <ul>
3240 <li><a href="/shortlog">log</a></li>
3242 <li><a href="/shortlog">log</a></li>
3241 <li><a href="/graph">graph</a></li>
3243 <li><a href="/graph">graph</a></li>
3242 <li><a href="/tags">tags</a></li>
3244 <li><a href="/tags">tags</a></li>
3243 <li><a href="/bookmarks">bookmarks</a></li>
3245 <li><a href="/bookmarks">bookmarks</a></li>
3244 <li><a href="/branches">branches</a></li>
3246 <li><a href="/branches">branches</a></li>
3245 </ul>
3247 </ul>
3246 <ul>
3248 <ul>
3247 <li class="active"><a href="/help">help</a></li>
3249 <li class="active"><a href="/help">help</a></li>
3248 </ul>
3250 </ul>
3249 </div>
3251 </div>
3250
3252
3251 <div class="main">
3253 <div class="main">
3252 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3254 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3253 <h3>Help: pager</h3>
3255 <h3>Help: pager</h3>
3254
3256
3255 <form class="search" action="/log">
3257 <form class="search" action="/log">
3256
3258
3257 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3259 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3258 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3260 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3259 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3261 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3260 </form>
3262 </form>
3261 <div id="doc">
3263 <div id="doc">
3262 <h1>Pager Support</h1>
3264 <h1>Pager Support</h1>
3263 <p>
3265 <p>
3264 Some Mercurial commands can produce a lot of output, and Mercurial will
3266 Some Mercurial commands can produce a lot of output, and Mercurial will
3265 attempt to use a pager to make those commands more pleasant.
3267 attempt to use a pager to make those commands more pleasant.
3266 </p>
3268 </p>
3267 <p>
3269 <p>
3268 To set the pager that should be used, set the application variable:
3270 To set the pager that should be used, set the application variable:
3269 </p>
3271 </p>
3270 <pre>
3272 <pre>
3271 [pager]
3273 [pager]
3272 pager = less -FRX
3274 pager = less -FRX
3273 </pre>
3275 </pre>
3274 <p>
3276 <p>
3275 If no pager is set in the user or repository configuration, Mercurial uses the
3277 If no pager is set in the user or repository configuration, Mercurial uses the
3276 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3278 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3277 or system configuration is used. If none of these are set, a default pager will
3279 or system configuration is used. If none of these are set, a default pager will
3278 be used, typically 'less' on Unix and 'more' on Windows.
3280 be used, typically 'less' on Unix and 'more' on Windows.
3279 </p>
3281 </p>
3280 <p>
3282 <p>
3281 You can disable the pager for certain commands by adding them to the
3283 You can disable the pager for certain commands by adding them to the
3282 pager.ignore list:
3284 pager.ignore list:
3283 </p>
3285 </p>
3284 <pre>
3286 <pre>
3285 [pager]
3287 [pager]
3286 ignore = version, help, update
3288 ignore = version, help, update
3287 </pre>
3289 </pre>
3288 <p>
3290 <p>
3289 To ignore global commands like 'hg version' or 'hg help', you have
3291 To ignore global commands like 'hg version' or 'hg help', you have
3290 to specify them in your user configuration file.
3292 to specify them in your user configuration file.
3291 </p>
3293 </p>
3292 <p>
3294 <p>
3293 To control whether the pager is used at all for an individual command,
3295 To control whether the pager is used at all for an individual command,
3294 you can use --pager=&lt;value&gt;:
3296 you can use --pager=&lt;value&gt;:
3295 </p>
3297 </p>
3296 <ul>
3298 <ul>
3297 <li> use as needed: 'auto'.
3299 <li> use as needed: 'auto'.
3298 <li> require the pager: 'yes' or 'on'.
3300 <li> require the pager: 'yes' or 'on'.
3299 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3301 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3300 </ul>
3302 </ul>
3301 <p>
3303 <p>
3302 To globally turn off all attempts to use a pager, set:
3304 To globally turn off all attempts to use a pager, set:
3303 </p>
3305 </p>
3304 <pre>
3306 <pre>
3305 [ui]
3307 [ui]
3306 paginate = never
3308 paginate = never
3307 </pre>
3309 </pre>
3308 <p>
3310 <p>
3309 which will prevent the pager from running.
3311 which will prevent the pager from running.
3310 </p>
3312 </p>
3311
3313
3312 </div>
3314 </div>
3313 </div>
3315 </div>
3314 </div>
3316 </div>
3315
3317
3316
3318
3317
3319
3318 </body>
3320 </body>
3319 </html>
3321 </html>
3320
3322
3321
3323
3322 Sub-topic indexes rendered properly
3324 Sub-topic indexes rendered properly
3323
3325
3324 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3326 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3325 200 Script output follows
3327 200 Script output follows
3326
3328
3327 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3329 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3328 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3330 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3329 <head>
3331 <head>
3330 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3332 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3331 <meta name="robots" content="index, nofollow" />
3333 <meta name="robots" content="index, nofollow" />
3332 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3334 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3333 <script type="text/javascript" src="/static/mercurial.js"></script>
3335 <script type="text/javascript" src="/static/mercurial.js"></script>
3334
3336
3335 <title>Help: internals</title>
3337 <title>Help: internals</title>
3336 </head>
3338 </head>
3337 <body>
3339 <body>
3338
3340
3339 <div class="container">
3341 <div class="container">
3340 <div class="menu">
3342 <div class="menu">
3341 <div class="logo">
3343 <div class="logo">
3342 <a href="https://mercurial-scm.org/">
3344 <a href="https://mercurial-scm.org/">
3343 <img src="/static/hglogo.png" alt="mercurial" /></a>
3345 <img src="/static/hglogo.png" alt="mercurial" /></a>
3344 </div>
3346 </div>
3345 <ul>
3347 <ul>
3346 <li><a href="/shortlog">log</a></li>
3348 <li><a href="/shortlog">log</a></li>
3347 <li><a href="/graph">graph</a></li>
3349 <li><a href="/graph">graph</a></li>
3348 <li><a href="/tags">tags</a></li>
3350 <li><a href="/tags">tags</a></li>
3349 <li><a href="/bookmarks">bookmarks</a></li>
3351 <li><a href="/bookmarks">bookmarks</a></li>
3350 <li><a href="/branches">branches</a></li>
3352 <li><a href="/branches">branches</a></li>
3351 </ul>
3353 </ul>
3352 <ul>
3354 <ul>
3353 <li><a href="/help">help</a></li>
3355 <li><a href="/help">help</a></li>
3354 </ul>
3356 </ul>
3355 </div>
3357 </div>
3356
3358
3357 <div class="main">
3359 <div class="main">
3358 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3360 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3359
3361
3360 <form class="search" action="/log">
3362 <form class="search" action="/log">
3361
3363
3362 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3364 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3363 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3365 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3364 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3366 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3365 </form>
3367 </form>
3366 <table class="bigtable">
3368 <table class="bigtable">
3367 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3369 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3368
3370
3369 <tr><td>
3371 <tr><td>
3370 <a href="/help/internals.bundle2">
3372 <a href="/help/internals.bundle2">
3371 bundle2
3373 bundle2
3372 </a>
3374 </a>
3373 </td><td>
3375 </td><td>
3374 Bundle2
3376 Bundle2
3375 </td></tr>
3377 </td></tr>
3376 <tr><td>
3378 <tr><td>
3377 <a href="/help/internals.bundles">
3379 <a href="/help/internals.bundles">
3378 bundles
3380 bundles
3379 </a>
3381 </a>
3380 </td><td>
3382 </td><td>
3381 Bundles
3383 Bundles
3382 </td></tr>
3384 </td></tr>
3383 <tr><td>
3385 <tr><td>
3384 <a href="/help/internals.cbor">
3386 <a href="/help/internals.cbor">
3385 cbor
3387 cbor
3386 </a>
3388 </a>
3387 </td><td>
3389 </td><td>
3388 CBOR
3390 CBOR
3389 </td></tr>
3391 </td></tr>
3390 <tr><td>
3392 <tr><td>
3391 <a href="/help/internals.censor">
3393 <a href="/help/internals.censor">
3392 censor
3394 censor
3393 </a>
3395 </a>
3394 </td><td>
3396 </td><td>
3395 Censor
3397 Censor
3396 </td></tr>
3398 </td></tr>
3397 <tr><td>
3399 <tr><td>
3398 <a href="/help/internals.changegroups">
3400 <a href="/help/internals.changegroups">
3399 changegroups
3401 changegroups
3400 </a>
3402 </a>
3401 </td><td>
3403 </td><td>
3402 Changegroups
3404 Changegroups
3403 </td></tr>
3405 </td></tr>
3404 <tr><td>
3406 <tr><td>
3405 <a href="/help/internals.config">
3407 <a href="/help/internals.config">
3406 config
3408 config
3407 </a>
3409 </a>
3408 </td><td>
3410 </td><td>
3409 Config Registrar
3411 Config Registrar
3410 </td></tr>
3412 </td></tr>
3411 <tr><td>
3413 <tr><td>
3412 <a href="/help/internals.extensions">
3414 <a href="/help/internals.extensions">
3413 extensions
3415 extensions
3414 </a>
3416 </a>
3415 </td><td>
3417 </td><td>
3416 Extension API
3418 Extension API
3417 </td></tr>
3419 </td></tr>
3418 <tr><td>
3420 <tr><td>
3419 <a href="/help/internals.requirements">
3421 <a href="/help/internals.requirements">
3420 requirements
3422 requirements
3421 </a>
3423 </a>
3422 </td><td>
3424 </td><td>
3423 Repository Requirements
3425 Repository Requirements
3424 </td></tr>
3426 </td></tr>
3425 <tr><td>
3427 <tr><td>
3426 <a href="/help/internals.revlogs">
3428 <a href="/help/internals.revlogs">
3427 revlogs
3429 revlogs
3428 </a>
3430 </a>
3429 </td><td>
3431 </td><td>
3430 Revision Logs
3432 Revision Logs
3431 </td></tr>
3433 </td></tr>
3432 <tr><td>
3434 <tr><td>
3433 <a href="/help/internals.wireprotocol">
3435 <a href="/help/internals.wireprotocol">
3434 wireprotocol
3436 wireprotocol
3435 </a>
3437 </a>
3436 </td><td>
3438 </td><td>
3437 Wire Protocol
3439 Wire Protocol
3438 </td></tr>
3440 </td></tr>
3439 <tr><td>
3441 <tr><td>
3440 <a href="/help/internals.wireprotocolrpc">
3442 <a href="/help/internals.wireprotocolrpc">
3441 wireprotocolrpc
3443 wireprotocolrpc
3442 </a>
3444 </a>
3443 </td><td>
3445 </td><td>
3444 Wire Protocol RPC
3446 Wire Protocol RPC
3445 </td></tr>
3447 </td></tr>
3446 <tr><td>
3448 <tr><td>
3447 <a href="/help/internals.wireprotocolv2">
3449 <a href="/help/internals.wireprotocolv2">
3448 wireprotocolv2
3450 wireprotocolv2
3449 </a>
3451 </a>
3450 </td><td>
3452 </td><td>
3451 Wire Protocol Version 2
3453 Wire Protocol Version 2
3452 </td></tr>
3454 </td></tr>
3453
3455
3454
3456
3455
3457
3456
3458
3457
3459
3458 </table>
3460 </table>
3459 </div>
3461 </div>
3460 </div>
3462 </div>
3461
3463
3462
3464
3463
3465
3464 </body>
3466 </body>
3465 </html>
3467 </html>
3466
3468
3467
3469
3468 Sub-topic topics rendered properly
3470 Sub-topic topics rendered properly
3469
3471
3470 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3472 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3471 200 Script output follows
3473 200 Script output follows
3472
3474
3473 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3475 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3474 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3476 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3475 <head>
3477 <head>
3476 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3478 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3477 <meta name="robots" content="index, nofollow" />
3479 <meta name="robots" content="index, nofollow" />
3478 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3480 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3479 <script type="text/javascript" src="/static/mercurial.js"></script>
3481 <script type="text/javascript" src="/static/mercurial.js"></script>
3480
3482
3481 <title>Help: internals.changegroups</title>
3483 <title>Help: internals.changegroups</title>
3482 </head>
3484 </head>
3483 <body>
3485 <body>
3484
3486
3485 <div class="container">
3487 <div class="container">
3486 <div class="menu">
3488 <div class="menu">
3487 <div class="logo">
3489 <div class="logo">
3488 <a href="https://mercurial-scm.org/">
3490 <a href="https://mercurial-scm.org/">
3489 <img src="/static/hglogo.png" alt="mercurial" /></a>
3491 <img src="/static/hglogo.png" alt="mercurial" /></a>
3490 </div>
3492 </div>
3491 <ul>
3493 <ul>
3492 <li><a href="/shortlog">log</a></li>
3494 <li><a href="/shortlog">log</a></li>
3493 <li><a href="/graph">graph</a></li>
3495 <li><a href="/graph">graph</a></li>
3494 <li><a href="/tags">tags</a></li>
3496 <li><a href="/tags">tags</a></li>
3495 <li><a href="/bookmarks">bookmarks</a></li>
3497 <li><a href="/bookmarks">bookmarks</a></li>
3496 <li><a href="/branches">branches</a></li>
3498 <li><a href="/branches">branches</a></li>
3497 </ul>
3499 </ul>
3498 <ul>
3500 <ul>
3499 <li class="active"><a href="/help">help</a></li>
3501 <li class="active"><a href="/help">help</a></li>
3500 </ul>
3502 </ul>
3501 </div>
3503 </div>
3502
3504
3503 <div class="main">
3505 <div class="main">
3504 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3506 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3505 <h3>Help: internals.changegroups</h3>
3507 <h3>Help: internals.changegroups</h3>
3506
3508
3507 <form class="search" action="/log">
3509 <form class="search" action="/log">
3508
3510
3509 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3511 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3510 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3512 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3511 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3513 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3512 </form>
3514 </form>
3513 <div id="doc">
3515 <div id="doc">
3514 <h1>Changegroups</h1>
3516 <h1>Changegroups</h1>
3515 <p>
3517 <p>
3516 Changegroups are representations of repository revlog data, specifically
3518 Changegroups are representations of repository revlog data, specifically
3517 the changelog data, root/flat manifest data, treemanifest data, and
3519 the changelog data, root/flat manifest data, treemanifest data, and
3518 filelogs.
3520 filelogs.
3519 </p>
3521 </p>
3520 <p>
3522 <p>
3521 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3523 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3522 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3524 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3523 only difference being an additional item in the *delta header*. Version
3525 only difference being an additional item in the *delta header*. Version
3524 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3526 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3525 exchanging treemanifests (enabled by setting an option on the
3527 exchanging treemanifests (enabled by setting an option on the
3526 &quot;changegroup&quot; part in the bundle2).
3528 &quot;changegroup&quot; part in the bundle2).
3527 </p>
3529 </p>
3528 <p>
3530 <p>
3529 Changegroups when not exchanging treemanifests consist of 3 logical
3531 Changegroups when not exchanging treemanifests consist of 3 logical
3530 segments:
3532 segments:
3531 </p>
3533 </p>
3532 <pre>
3534 <pre>
3533 +---------------------------------+
3535 +---------------------------------+
3534 | | | |
3536 | | | |
3535 | changeset | manifest | filelogs |
3537 | changeset | manifest | filelogs |
3536 | | | |
3538 | | | |
3537 | | | |
3539 | | | |
3538 +---------------------------------+
3540 +---------------------------------+
3539 </pre>
3541 </pre>
3540 <p>
3542 <p>
3541 When exchanging treemanifests, there are 4 logical segments:
3543 When exchanging treemanifests, there are 4 logical segments:
3542 </p>
3544 </p>
3543 <pre>
3545 <pre>
3544 +-------------------------------------------------+
3546 +-------------------------------------------------+
3545 | | | | |
3547 | | | | |
3546 | changeset | root | treemanifests | filelogs |
3548 | changeset | root | treemanifests | filelogs |
3547 | | manifest | | |
3549 | | manifest | | |
3548 | | | | |
3550 | | | | |
3549 +-------------------------------------------------+
3551 +-------------------------------------------------+
3550 </pre>
3552 </pre>
3551 <p>
3553 <p>
3552 The principle building block of each segment is a *chunk*. A *chunk*
3554 The principle building block of each segment is a *chunk*. A *chunk*
3553 is a framed piece of data:
3555 is a framed piece of data:
3554 </p>
3556 </p>
3555 <pre>
3557 <pre>
3556 +---------------------------------------+
3558 +---------------------------------------+
3557 | | |
3559 | | |
3558 | length | data |
3560 | length | data |
3559 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3561 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3560 | | |
3562 | | |
3561 +---------------------------------------+
3563 +---------------------------------------+
3562 </pre>
3564 </pre>
3563 <p>
3565 <p>
3564 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3566 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3565 integer indicating the length of the entire chunk (including the length field
3567 integer indicating the length of the entire chunk (including the length field
3566 itself).
3568 itself).
3567 </p>
3569 </p>
3568 <p>
3570 <p>
3569 There is a special case chunk that has a value of 0 for the length
3571 There is a special case chunk that has a value of 0 for the length
3570 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3572 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3571 </p>
3573 </p>
3572 <h2>Delta Groups</h2>
3574 <h2>Delta Groups</h2>
3573 <p>
3575 <p>
3574 A *delta group* expresses the content of a revlog as a series of deltas,
3576 A *delta group* expresses the content of a revlog as a series of deltas,
3575 or patches against previous revisions.
3577 or patches against previous revisions.
3576 </p>
3578 </p>
3577 <p>
3579 <p>
3578 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3580 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3579 to signal the end of the delta group:
3581 to signal the end of the delta group:
3580 </p>
3582 </p>
3581 <pre>
3583 <pre>
3582 +------------------------------------------------------------------------+
3584 +------------------------------------------------------------------------+
3583 | | | | | |
3585 | | | | | |
3584 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3586 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3585 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3587 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3586 | | | | | |
3588 | | | | | |
3587 +------------------------------------------------------------------------+
3589 +------------------------------------------------------------------------+
3588 </pre>
3590 </pre>
3589 <p>
3591 <p>
3590 Each *chunk*'s data consists of the following:
3592 Each *chunk*'s data consists of the following:
3591 </p>
3593 </p>
3592 <pre>
3594 <pre>
3593 +---------------------------------------+
3595 +---------------------------------------+
3594 | | |
3596 | | |
3595 | delta header | delta data |
3597 | delta header | delta data |
3596 | (various by version) | (various) |
3598 | (various by version) | (various) |
3597 | | |
3599 | | |
3598 +---------------------------------------+
3600 +---------------------------------------+
3599 </pre>
3601 </pre>
3600 <p>
3602 <p>
3601 The *delta data* is a series of *delta*s that describe a diff from an existing
3603 The *delta data* is a series of *delta*s that describe a diff from an existing
3602 entry (either that the recipient already has, or previously specified in the
3604 entry (either that the recipient already has, or previously specified in the
3603 bundle/changegroup).
3605 bundle/changegroup).
3604 </p>
3606 </p>
3605 <p>
3607 <p>
3606 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3608 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3607 &quot;3&quot; of the changegroup format.
3609 &quot;3&quot; of the changegroup format.
3608 </p>
3610 </p>
3609 <p>
3611 <p>
3610 Version 1 (headerlen=80):
3612 Version 1 (headerlen=80):
3611 </p>
3613 </p>
3612 <pre>
3614 <pre>
3613 +------------------------------------------------------+
3615 +------------------------------------------------------+
3614 | | | | |
3616 | | | | |
3615 | node | p1 node | p2 node | link node |
3617 | node | p1 node | p2 node | link node |
3616 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3618 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3617 | | | | |
3619 | | | | |
3618 +------------------------------------------------------+
3620 +------------------------------------------------------+
3619 </pre>
3621 </pre>
3620 <p>
3622 <p>
3621 Version 2 (headerlen=100):
3623 Version 2 (headerlen=100):
3622 </p>
3624 </p>
3623 <pre>
3625 <pre>
3624 +------------------------------------------------------------------+
3626 +------------------------------------------------------------------+
3625 | | | | | |
3627 | | | | | |
3626 | node | p1 node | p2 node | base node | link node |
3628 | node | p1 node | p2 node | base node | link node |
3627 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3629 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3628 | | | | | |
3630 | | | | | |
3629 +------------------------------------------------------------------+
3631 +------------------------------------------------------------------+
3630 </pre>
3632 </pre>
3631 <p>
3633 <p>
3632 Version 3 (headerlen=102):
3634 Version 3 (headerlen=102):
3633 </p>
3635 </p>
3634 <pre>
3636 <pre>
3635 +------------------------------------------------------------------------------+
3637 +------------------------------------------------------------------------------+
3636 | | | | | | |
3638 | | | | | | |
3637 | node | p1 node | p2 node | base node | link node | flags |
3639 | node | p1 node | p2 node | base node | link node | flags |
3638 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3640 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3639 | | | | | | |
3641 | | | | | | |
3640 +------------------------------------------------------------------------------+
3642 +------------------------------------------------------------------------------+
3641 </pre>
3643 </pre>
3642 <p>
3644 <p>
3643 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3645 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3644 series of *delta*s, densely packed (no separators). These deltas describe a diff
3646 series of *delta*s, densely packed (no separators). These deltas describe a diff
3645 from an existing entry (either that the recipient already has, or previously
3647 from an existing entry (either that the recipient already has, or previously
3646 specified in the bundle/changegroup). The format is described more fully in
3648 specified in the bundle/changegroup). The format is described more fully in
3647 &quot;hg help internals.bdiff&quot;, but briefly:
3649 &quot;hg help internals.bdiff&quot;, but briefly:
3648 </p>
3650 </p>
3649 <pre>
3651 <pre>
3650 +---------------------------------------------------------------+
3652 +---------------------------------------------------------------+
3651 | | | | |
3653 | | | | |
3652 | start offset | end offset | new length | content |
3654 | start offset | end offset | new length | content |
3653 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3655 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3654 | | | | |
3656 | | | | |
3655 +---------------------------------------------------------------+
3657 +---------------------------------------------------------------+
3656 </pre>
3658 </pre>
3657 <p>
3659 <p>
3658 Please note that the length field in the delta data does *not* include itself.
3660 Please note that the length field in the delta data does *not* include itself.
3659 </p>
3661 </p>
3660 <p>
3662 <p>
3661 In version 1, the delta is always applied against the previous node from
3663 In version 1, the delta is always applied against the previous node from
3662 the changegroup or the first parent if this is the first entry in the
3664 the changegroup or the first parent if this is the first entry in the
3663 changegroup.
3665 changegroup.
3664 </p>
3666 </p>
3665 <p>
3667 <p>
3666 In version 2 and up, the delta base node is encoded in the entry in the
3668 In version 2 and up, the delta base node is encoded in the entry in the
3667 changegroup. This allows the delta to be expressed against any parent,
3669 changegroup. This allows the delta to be expressed against any parent,
3668 which can result in smaller deltas and more efficient encoding of data.
3670 which can result in smaller deltas and more efficient encoding of data.
3669 </p>
3671 </p>
3670 <p>
3672 <p>
3671 The *flags* field holds bitwise flags affecting the processing of revision
3673 The *flags* field holds bitwise flags affecting the processing of revision
3672 data. The following flags are defined:
3674 data. The following flags are defined:
3673 </p>
3675 </p>
3674 <dl>
3676 <dl>
3675 <dt>32768
3677 <dt>32768
3676 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3678 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3677 <dt>16384
3679 <dt>16384
3678 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3680 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3679 <dt>8192
3681 <dt>8192
3680 <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.
3682 <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.
3681 </dl>
3683 </dl>
3682 <p>
3684 <p>
3683 For historical reasons, the integer values are identical to revlog version 1
3685 For historical reasons, the integer values are identical to revlog version 1
3684 per-revision storage flags and correspond to bits being set in this 2-byte
3686 per-revision storage flags and correspond to bits being set in this 2-byte
3685 field. Bits were allocated starting from the most-significant bit, hence the
3687 field. Bits were allocated starting from the most-significant bit, hence the
3686 reverse ordering and allocation of these flags.
3688 reverse ordering and allocation of these flags.
3687 </p>
3689 </p>
3688 <h2>Changeset Segment</h2>
3690 <h2>Changeset Segment</h2>
3689 <p>
3691 <p>
3690 The *changeset segment* consists of a single *delta group* holding
3692 The *changeset segment* consists of a single *delta group* holding
3691 changelog data. The *empty chunk* at the end of the *delta group* denotes
3693 changelog data. The *empty chunk* at the end of the *delta group* denotes
3692 the boundary to the *manifest segment*.
3694 the boundary to the *manifest segment*.
3693 </p>
3695 </p>
3694 <h2>Manifest Segment</h2>
3696 <h2>Manifest Segment</h2>
3695 <p>
3697 <p>
3696 The *manifest segment* consists of a single *delta group* holding manifest
3698 The *manifest segment* consists of a single *delta group* holding manifest
3697 data. If treemanifests are in use, it contains only the manifest for the
3699 data. If treemanifests are in use, it contains only the manifest for the
3698 root directory of the repository. Otherwise, it contains the entire
3700 root directory of the repository. Otherwise, it contains the entire
3699 manifest data. The *empty chunk* at the end of the *delta group* denotes
3701 manifest data. The *empty chunk* at the end of the *delta group* denotes
3700 the boundary to the next segment (either the *treemanifests segment* or the
3702 the boundary to the next segment (either the *treemanifests segment* or the
3701 *filelogs segment*, depending on version and the request options).
3703 *filelogs segment*, depending on version and the request options).
3702 </p>
3704 </p>
3703 <h3>Treemanifests Segment</h3>
3705 <h3>Treemanifests Segment</h3>
3704 <p>
3706 <p>
3705 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3707 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3706 only if the 'treemanifest' param is part of the bundle2 changegroup part
3708 only if the 'treemanifest' param is part of the bundle2 changegroup part
3707 (it is not possible to use changegroup version 3 outside of bundle2).
3709 (it is not possible to use changegroup version 3 outside of bundle2).
3708 Aside from the filenames in the *treemanifests segment* containing a
3710 Aside from the filenames in the *treemanifests segment* containing a
3709 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3711 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3710 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3712 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3711 a sub-segment with filename size 0). This denotes the boundary to the
3713 a sub-segment with filename size 0). This denotes the boundary to the
3712 *filelogs segment*.
3714 *filelogs segment*.
3713 </p>
3715 </p>
3714 <h2>Filelogs Segment</h2>
3716 <h2>Filelogs Segment</h2>
3715 <p>
3717 <p>
3716 The *filelogs segment* consists of multiple sub-segments, each
3718 The *filelogs segment* consists of multiple sub-segments, each
3717 corresponding to an individual file whose data is being described:
3719 corresponding to an individual file whose data is being described:
3718 </p>
3720 </p>
3719 <pre>
3721 <pre>
3720 +--------------------------------------------------+
3722 +--------------------------------------------------+
3721 | | | | | |
3723 | | | | | |
3722 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3724 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3723 | | | | | (4 bytes) |
3725 | | | | | (4 bytes) |
3724 | | | | | |
3726 | | | | | |
3725 +--------------------------------------------------+
3727 +--------------------------------------------------+
3726 </pre>
3728 </pre>
3727 <p>
3729 <p>
3728 The final filelog sub-segment is followed by an *empty chunk* (logically,
3730 The final filelog sub-segment is followed by an *empty chunk* (logically,
3729 a sub-segment with filename size 0). This denotes the end of the segment
3731 a sub-segment with filename size 0). This denotes the end of the segment
3730 and of the overall changegroup.
3732 and of the overall changegroup.
3731 </p>
3733 </p>
3732 <p>
3734 <p>
3733 Each filelog sub-segment consists of the following:
3735 Each filelog sub-segment consists of the following:
3734 </p>
3736 </p>
3735 <pre>
3737 <pre>
3736 +------------------------------------------------------+
3738 +------------------------------------------------------+
3737 | | | |
3739 | | | |
3738 | filename length | filename | delta group |
3740 | filename length | filename | delta group |
3739 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3741 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3740 | | | |
3742 | | | |
3741 +------------------------------------------------------+
3743 +------------------------------------------------------+
3742 </pre>
3744 </pre>
3743 <p>
3745 <p>
3744 That is, a *chunk* consisting of the filename (not terminated or padded)
3746 That is, a *chunk* consisting of the filename (not terminated or padded)
3745 followed by N chunks constituting the *delta group* for this file. The
3747 followed by N chunks constituting the *delta group* for this file. The
3746 *empty chunk* at the end of each *delta group* denotes the boundary to the
3748 *empty chunk* at the end of each *delta group* denotes the boundary to the
3747 next filelog sub-segment.
3749 next filelog sub-segment.
3748 </p>
3750 </p>
3749
3751
3750 </div>
3752 </div>
3751 </div>
3753 </div>
3752 </div>
3754 </div>
3753
3755
3754
3756
3755
3757
3756 </body>
3758 </body>
3757 </html>
3759 </html>
3758
3760
3759
3761
3760 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3762 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3761 404 Not Found
3763 404 Not Found
3762
3764
3763 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3765 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3764 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3766 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3765 <head>
3767 <head>
3766 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3768 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3767 <meta name="robots" content="index, nofollow" />
3769 <meta name="robots" content="index, nofollow" />
3768 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3770 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3769 <script type="text/javascript" src="/static/mercurial.js"></script>
3771 <script type="text/javascript" src="/static/mercurial.js"></script>
3770
3772
3771 <title>test: error</title>
3773 <title>test: error</title>
3772 </head>
3774 </head>
3773 <body>
3775 <body>
3774
3776
3775 <div class="container">
3777 <div class="container">
3776 <div class="menu">
3778 <div class="menu">
3777 <div class="logo">
3779 <div class="logo">
3778 <a href="https://mercurial-scm.org/">
3780 <a href="https://mercurial-scm.org/">
3779 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3781 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3780 </div>
3782 </div>
3781 <ul>
3783 <ul>
3782 <li><a href="/shortlog">log</a></li>
3784 <li><a href="/shortlog">log</a></li>
3783 <li><a href="/graph">graph</a></li>
3785 <li><a href="/graph">graph</a></li>
3784 <li><a href="/tags">tags</a></li>
3786 <li><a href="/tags">tags</a></li>
3785 <li><a href="/bookmarks">bookmarks</a></li>
3787 <li><a href="/bookmarks">bookmarks</a></li>
3786 <li><a href="/branches">branches</a></li>
3788 <li><a href="/branches">branches</a></li>
3787 </ul>
3789 </ul>
3788 <ul>
3790 <ul>
3789 <li><a href="/help">help</a></li>
3791 <li><a href="/help">help</a></li>
3790 </ul>
3792 </ul>
3791 </div>
3793 </div>
3792
3794
3793 <div class="main">
3795 <div class="main">
3794
3796
3795 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3797 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3796 <h3>error</h3>
3798 <h3>error</h3>
3797
3799
3798
3800
3799 <form class="search" action="/log">
3801 <form class="search" action="/log">
3800
3802
3801 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3803 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3802 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3804 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3803 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3805 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3804 </form>
3806 </form>
3805
3807
3806 <div class="description">
3808 <div class="description">
3807 <p>
3809 <p>
3808 An error occurred while processing your request:
3810 An error occurred while processing your request:
3809 </p>
3811 </p>
3810 <p>
3812 <p>
3811 Not Found
3813 Not Found
3812 </p>
3814 </p>
3813 </div>
3815 </div>
3814 </div>
3816 </div>
3815 </div>
3817 </div>
3816
3818
3817
3819
3818
3820
3819 </body>
3821 </body>
3820 </html>
3822 </html>
3821
3823
3822 [1]
3824 [1]
3823
3825
3824 $ killdaemons.py
3826 $ killdaemons.py
3825
3827
3826 #endif
3828 #endif
General Comments 0
You need to be logged in to leave comments. Login now