Show More
@@ -1,1810 +1,1814 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 | The configuration files use a simple ini-file format. A configuration |
|
4 | The configuration files use a simple ini-file format. A configuration | |
5 | file consists of sections, led by a ``[section]`` header and followed |
|
5 | file consists of sections, led by a ``[section]`` header and followed | |
6 | by ``name = value`` entries:: |
|
6 | by ``name = value`` entries:: | |
7 |
|
7 | |||
8 | [ui] |
|
8 | [ui] | |
9 | username = Firstname Lastname <firstname.lastname@example.net> |
|
9 | username = Firstname Lastname <firstname.lastname@example.net> | |
10 | verbose = True |
|
10 | verbose = True | |
11 |
|
11 | |||
12 | The above entries will be referred to as ``ui.username`` and |
|
12 | The above entries will be referred to as ``ui.username`` and | |
13 | ``ui.verbose``, respectively. See the Syntax section below. |
|
13 | ``ui.verbose``, respectively. See the Syntax section below. | |
14 |
|
14 | |||
15 | Files |
|
15 | Files | |
16 | ===== |
|
16 | ===== | |
17 |
|
17 | |||
18 | Mercurial reads configuration data from several files, if they exist. |
|
18 | Mercurial reads configuration data from several files, if they exist. | |
19 | These files do not exist by default and you will have to create the |
|
19 | These files do not exist by default and you will have to create the | |
20 | appropriate configuration files yourself: global configuration like |
|
20 | appropriate configuration files yourself: global configuration like | |
21 | the username setting is typically put into |
|
21 | the username setting is typically put into | |
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local | |
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
24 |
|
24 | |||
25 | The names of these files depend on the system on which Mercurial is |
|
25 | The names of these files depend on the system on which Mercurial is | |
26 | installed. ``*.rc`` files from a single directory are read in |
|
26 | installed. ``*.rc`` files from a single directory are read in | |
27 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
27 | alphabetical order, later ones overriding earlier ones. Where multiple | |
28 | paths are given below, settings from earlier paths override later |
|
28 | paths are given below, settings from earlier paths override later | |
29 | ones. |
|
29 | ones. | |
30 |
|
30 | |||
31 | .. container:: verbose.unix |
|
31 | .. container:: verbose.unix | |
32 |
|
32 | |||
33 | On Unix, the following files are consulted: |
|
33 | On Unix, the following files are consulted: | |
34 |
|
34 | |||
35 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
35 | - ``<repo>/.hg/hgrc`` (per-repository) | |
36 | - ``$HOME/.hgrc`` (per-user) |
|
36 | - ``$HOME/.hgrc`` (per-user) | |
37 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
37 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) | |
38 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
38 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) | |
39 | - ``/etc/mercurial/hgrc`` (per-system) |
|
39 | - ``/etc/mercurial/hgrc`` (per-system) | |
40 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
40 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) | |
41 | - ``<internal>/default.d/*.rc`` (defaults) |
|
41 | - ``<internal>/default.d/*.rc`` (defaults) | |
42 |
|
42 | |||
43 | .. container:: verbose.windows |
|
43 | .. container:: verbose.windows | |
44 |
|
44 | |||
45 | On Windows, the following files are consulted: |
|
45 | On Windows, the following files are consulted: | |
46 |
|
46 | |||
47 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
47 | - ``<repo>/.hg/hgrc`` (per-repository) | |
48 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
48 | - ``%USERPROFILE%\.hgrc`` (per-user) | |
49 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
49 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) | |
50 | - ``%HOME%\.hgrc`` (per-user) |
|
50 | - ``%HOME%\.hgrc`` (per-user) | |
51 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
51 | - ``%HOME%\Mercurial.ini`` (per-user) | |
52 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
52 | - ``<install-dir>\Mercurial.ini`` (per-installation) | |
53 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
53 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) | |
54 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
54 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) | |
55 | - ``<internal>/default.d/*.rc`` (defaults) |
|
55 | - ``<internal>/default.d/*.rc`` (defaults) | |
56 |
|
56 | |||
57 | .. note:: |
|
57 | .. note:: | |
58 |
|
58 | |||
59 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
59 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
60 | is used when running 32-bit Python on 64-bit Windows. |
|
60 | is used when running 32-bit Python on 64-bit Windows. | |
61 |
|
61 | |||
62 | .. container:: verbose.plan9 |
|
62 | .. container:: verbose.plan9 | |
63 |
|
63 | |||
64 | On Plan9, the following files are consulted: |
|
64 | On Plan9, the following files are consulted: | |
65 |
|
65 | |||
66 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
66 | - ``<repo>/.hg/hgrc`` (per-repository) | |
67 | - ``$home/lib/hgrc`` (per-user) |
|
67 | - ``$home/lib/hgrc`` (per-user) | |
68 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
68 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) | |
69 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
69 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) | |
70 | - ``/lib/mercurial/hgrc`` (per-system) |
|
70 | - ``/lib/mercurial/hgrc`` (per-system) | |
71 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
71 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) | |
72 | - ``<internal>/default.d/*.rc`` (defaults) |
|
72 | - ``<internal>/default.d/*.rc`` (defaults) | |
73 |
|
73 | |||
74 | Per-repository configuration options only apply in a |
|
74 | Per-repository configuration options only apply in a | |
75 | particular repository. This file is not version-controlled, and |
|
75 | particular repository. This file is not version-controlled, and | |
76 | will not get transferred during a "clone" operation. Options in |
|
76 | will not get transferred during a "clone" operation. Options in | |
77 | this file override options in all other configuration files. On |
|
77 | this file override options in all other configuration files. On | |
78 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
78 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
79 | belong to a trusted user or to a trusted group. See the documentation |
|
79 | belong to a trusted user or to a trusted group. See the documentation | |
80 | for the ``[trusted]`` section below for more details. |
|
80 | for the ``[trusted]`` section below for more details. | |
81 |
|
81 | |||
82 | Per-user configuration file(s) are for the user running Mercurial. On |
|
82 | Per-user configuration file(s) are for the user running Mercurial. On | |
83 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
83 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
84 | files apply to all Mercurial commands executed by this user in any |
|
84 | files apply to all Mercurial commands executed by this user in any | |
85 | directory. Options in these files override per-system and per-installation |
|
85 | directory. Options in these files override per-system and per-installation | |
86 | options. |
|
86 | options. | |
87 |
|
87 | |||
88 | Per-installation configuration files are searched for in the |
|
88 | Per-installation configuration files are searched for in the | |
89 | directory where Mercurial is installed. ``<install-root>`` is the |
|
89 | directory where Mercurial is installed. ``<install-root>`` is the | |
90 | parent directory of the **hg** executable (or symlink) being run. For |
|
90 | parent directory of the **hg** executable (or symlink) being run. For | |
91 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
91 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
92 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
92 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
93 | to all Mercurial commands executed by any user in any directory. |
|
93 | to all Mercurial commands executed by any user in any directory. | |
94 |
|
94 | |||
95 | Per-installation configuration files are for the system on |
|
95 | Per-installation configuration files are for the system on | |
96 | which Mercurial is running. Options in these files apply to all |
|
96 | which Mercurial is running. Options in these files apply to all | |
97 | Mercurial commands executed by any user in any directory. Registry |
|
97 | Mercurial commands executed by any user in any directory. Registry | |
98 | keys contain PATH-like strings, every part of which must reference |
|
98 | keys contain PATH-like strings, every part of which must reference | |
99 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
99 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
100 | be read. Mercurial checks each of these locations in the specified |
|
100 | be read. Mercurial checks each of these locations in the specified | |
101 | order until one or more configuration files are detected. |
|
101 | order until one or more configuration files are detected. | |
102 |
|
102 | |||
103 | Per-system configuration files are for the system on which Mercurial |
|
103 | Per-system configuration files are for the system on which Mercurial | |
104 | is running. Options in these files apply to all Mercurial commands |
|
104 | is running. Options in these files apply to all Mercurial commands | |
105 | executed by any user in any directory. Options in these files |
|
105 | executed by any user in any directory. Options in these files | |
106 | override per-installation options. |
|
106 | override per-installation options. | |
107 |
|
107 | |||
108 | Mercurial comes with some default configuration. The default configuration |
|
108 | Mercurial comes with some default configuration. The default configuration | |
109 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
109 | files are installed with Mercurial and will be overwritten on upgrades. Default | |
110 | configuration files should never be edited by users or administrators but can |
|
110 | configuration files should never be edited by users or administrators but can | |
111 | be overridden in other configuration files. So far the directory only contains |
|
111 | be overridden in other configuration files. So far the directory only contains | |
112 | merge tool configuration but packagers can also put other default configuration |
|
112 | merge tool configuration but packagers can also put other default configuration | |
113 | there. |
|
113 | there. | |
114 |
|
114 | |||
115 | Syntax |
|
115 | Syntax | |
116 | ====== |
|
116 | ====== | |
117 |
|
117 | |||
118 | A configuration file consists of sections, led by a ``[section]`` header |
|
118 | A configuration file consists of sections, led by a ``[section]`` header | |
119 | and followed by ``name = value`` entries (sometimes called |
|
119 | and followed by ``name = value`` entries (sometimes called | |
120 | ``configuration keys``):: |
|
120 | ``configuration keys``):: | |
121 |
|
121 | |||
122 | [spam] |
|
122 | [spam] | |
123 | eggs=ham |
|
123 | eggs=ham | |
124 | green= |
|
124 | green= | |
125 | eggs |
|
125 | eggs | |
126 |
|
126 | |||
127 | Each line contains one entry. If the lines that follow are indented, |
|
127 | Each line contains one entry. If the lines that follow are indented, | |
128 | they are treated as continuations of that entry. Leading whitespace is |
|
128 | they are treated as continuations of that entry. Leading whitespace is | |
129 | removed from values. Empty lines are skipped. Lines beginning with |
|
129 | removed from values. Empty lines are skipped. Lines beginning with | |
130 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
130 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
131 |
|
131 | |||
132 | Configuration keys can be set multiple times, in which case Mercurial |
|
132 | Configuration keys can be set multiple times, in which case Mercurial | |
133 | will use the value that was configured last. As an example:: |
|
133 | will use the value that was configured last. As an example:: | |
134 |
|
134 | |||
135 | [spam] |
|
135 | [spam] | |
136 | eggs=large |
|
136 | eggs=large | |
137 | ham=serrano |
|
137 | ham=serrano | |
138 | eggs=small |
|
138 | eggs=small | |
139 |
|
139 | |||
140 | This would set the configuration key named ``eggs`` to ``small``. |
|
140 | This would set the configuration key named ``eggs`` to ``small``. | |
141 |
|
141 | |||
142 | It is also possible to define a section multiple times. A section can |
|
142 | It is also possible to define a section multiple times. A section can | |
143 | be redefined on the same and/or on different configuration files. For |
|
143 | be redefined on the same and/or on different configuration files. For | |
144 | example:: |
|
144 | example:: | |
145 |
|
145 | |||
146 | [foo] |
|
146 | [foo] | |
147 | eggs=large |
|
147 | eggs=large | |
148 | ham=serrano |
|
148 | ham=serrano | |
149 | eggs=small |
|
149 | eggs=small | |
150 |
|
150 | |||
151 | [bar] |
|
151 | [bar] | |
152 | eggs=ham |
|
152 | eggs=ham | |
153 | green= |
|
153 | green= | |
154 | eggs |
|
154 | eggs | |
155 |
|
155 | |||
156 | [foo] |
|
156 | [foo] | |
157 | ham=prosciutto |
|
157 | ham=prosciutto | |
158 | eggs=medium |
|
158 | eggs=medium | |
159 | bread=toasted |
|
159 | bread=toasted | |
160 |
|
160 | |||
161 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
161 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
162 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
162 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
163 | respectively. As you can see there only thing that matters is the last |
|
163 | respectively. As you can see there only thing that matters is the last | |
164 | value that was set for each of the configuration keys. |
|
164 | value that was set for each of the configuration keys. | |
165 |
|
165 | |||
166 | If a configuration key is set multiple times in different |
|
166 | If a configuration key is set multiple times in different | |
167 | configuration files the final value will depend on the order in which |
|
167 | configuration files the final value will depend on the order in which | |
168 | the different configuration files are read, with settings from earlier |
|
168 | the different configuration files are read, with settings from earlier | |
169 | paths overriding later ones as described on the ``Files`` section |
|
169 | paths overriding later ones as described on the ``Files`` section | |
170 | above. |
|
170 | above. | |
171 |
|
171 | |||
172 | A line of the form ``%include file`` will include ``file`` into the |
|
172 | A line of the form ``%include file`` will include ``file`` into the | |
173 | current configuration file. The inclusion is recursive, which means |
|
173 | current configuration file. The inclusion is recursive, which means | |
174 | that included files can include other files. Filenames are relative to |
|
174 | that included files can include other files. Filenames are relative to | |
175 | the configuration file in which the ``%include`` directive is found. |
|
175 | the configuration file in which the ``%include`` directive is found. | |
176 | Environment variables and ``~user`` constructs are expanded in |
|
176 | Environment variables and ``~user`` constructs are expanded in | |
177 | ``file``. This lets you do something like:: |
|
177 | ``file``. This lets you do something like:: | |
178 |
|
178 | |||
179 | %include ~/.hgrc.d/$HOST.rc |
|
179 | %include ~/.hgrc.d/$HOST.rc | |
180 |
|
180 | |||
181 | to include a different configuration file on each computer you use. |
|
181 | to include a different configuration file on each computer you use. | |
182 |
|
182 | |||
183 | A line with ``%unset name`` will remove ``name`` from the current |
|
183 | A line with ``%unset name`` will remove ``name`` from the current | |
184 | section, if it has been set previously. |
|
184 | section, if it has been set previously. | |
185 |
|
185 | |||
186 | The values are either free-form text strings, lists of text strings, |
|
186 | The values are either free-form text strings, lists of text strings, | |
187 | or Boolean values. Boolean values can be set to true using any of "1", |
|
187 | or Boolean values. Boolean values can be set to true using any of "1", | |
188 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
188 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
189 | (all case insensitive). |
|
189 | (all case insensitive). | |
190 |
|
190 | |||
191 | List values are separated by whitespace or comma, except when values are |
|
191 | List values are separated by whitespace or comma, except when values are | |
192 | placed in double quotation marks:: |
|
192 | placed in double quotation marks:: | |
193 |
|
193 | |||
194 | allow_read = "John Doe, PhD", brian, betty |
|
194 | allow_read = "John Doe, PhD", brian, betty | |
195 |
|
195 | |||
196 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
196 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
197 | quotation marks at the beginning of a word is counted as a quotation |
|
197 | quotation marks at the beginning of a word is counted as a quotation | |
198 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
198 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
199 |
|
199 | |||
200 | Sections |
|
200 | Sections | |
201 | ======== |
|
201 | ======== | |
202 |
|
202 | |||
203 | This section describes the different sections that may appear in a |
|
203 | This section describes the different sections that may appear in a | |
204 | Mercurial configuration file, the purpose of each section, its possible |
|
204 | Mercurial configuration file, the purpose of each section, its possible | |
205 | keys, and their possible values. |
|
205 | keys, and their possible values. | |
206 |
|
206 | |||
207 | ``alias`` |
|
207 | ``alias`` | |
208 | --------- |
|
208 | --------- | |
209 |
|
209 | |||
210 | Defines command aliases. |
|
210 | Defines command aliases. | |
211 | Aliases allow you to define your own commands in terms of other |
|
211 | Aliases allow you to define your own commands in terms of other | |
212 | commands (or aliases), optionally including arguments. Positional |
|
212 | commands (or aliases), optionally including arguments. Positional | |
213 | arguments in the form of ``$1``, ``$2``, etc in the alias definition |
|
213 | arguments in the form of ``$1``, ``$2``, etc in the alias definition | |
214 | are expanded by Mercurial before execution. Positional arguments not |
|
214 | are expanded by Mercurial before execution. Positional arguments not | |
215 | already used by ``$N`` in the definition are put at the end of the |
|
215 | already used by ``$N`` in the definition are put at the end of the | |
216 | command to be executed. |
|
216 | command to be executed. | |
217 |
|
217 | |||
218 | Alias definitions consist of lines of the form:: |
|
218 | Alias definitions consist of lines of the form:: | |
219 |
|
219 | |||
220 | <alias> = <command> [<argument>]... |
|
220 | <alias> = <command> [<argument>]... | |
221 |
|
221 | |||
222 | For example, this definition:: |
|
222 | For example, this definition:: | |
223 |
|
223 | |||
224 | latest = log --limit 5 |
|
224 | latest = log --limit 5 | |
225 |
|
225 | |||
226 | creates a new command ``latest`` that shows only the five most recent |
|
226 | creates a new command ``latest`` that shows only the five most recent | |
227 | changesets. You can define subsequent aliases using earlier ones:: |
|
227 | changesets. You can define subsequent aliases using earlier ones:: | |
228 |
|
228 | |||
229 | stable5 = latest -b stable |
|
229 | stable5 = latest -b stable | |
230 |
|
230 | |||
231 | .. note:: |
|
231 | .. note:: | |
232 |
|
232 | |||
233 | It is possible to create aliases with the same names as |
|
233 | It is possible to create aliases with the same names as | |
234 | existing commands, which will then override the original |
|
234 | existing commands, which will then override the original | |
235 | definitions. This is almost always a bad idea! |
|
235 | definitions. This is almost always a bad idea! | |
236 |
|
236 | |||
237 | An alias can start with an exclamation point (``!``) to make it a |
|
237 | An alias can start with an exclamation point (``!``) to make it a | |
238 | shell alias. A shell alias is executed with the shell and will let you |
|
238 | shell alias. A shell alias is executed with the shell and will let you | |
239 | run arbitrary commands. As an example, :: |
|
239 | run arbitrary commands. As an example, :: | |
240 |
|
240 | |||
241 | echo = !echo $@ |
|
241 | echo = !echo $@ | |
242 |
|
242 | |||
243 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
243 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
244 | terminal. A better example might be:: |
|
244 | terminal. A better example might be:: | |
245 |
|
245 | |||
246 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
246 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
247 |
|
247 | |||
248 | which will make ``hg purge`` delete all unknown files in the |
|
248 | which will make ``hg purge`` delete all unknown files in the | |
249 | repository in the same manner as the purge extension. |
|
249 | repository in the same manner as the purge extension. | |
250 |
|
250 | |||
251 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
251 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
252 | expand to the command arguments. Unmatched arguments are |
|
252 | expand to the command arguments. Unmatched arguments are | |
253 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
253 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
254 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
254 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
255 | arguments quoted individually and separated by a space. These expansions |
|
255 | arguments quoted individually and separated by a space. These expansions | |
256 | happen before the command is passed to the shell. |
|
256 | happen before the command is passed to the shell. | |
257 |
|
257 | |||
258 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
258 | Shell aliases are executed in an environment where ``$HG`` expands to | |
259 | the path of the Mercurial that was used to execute the alias. This is |
|
259 | the path of the Mercurial that was used to execute the alias. This is | |
260 | useful when you want to call further Mercurial commands in a shell |
|
260 | useful when you want to call further Mercurial commands in a shell | |
261 | alias, as was done above for the purge alias. In addition, |
|
261 | alias, as was done above for the purge alias. In addition, | |
262 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
262 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
263 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
263 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
264 |
|
264 | |||
265 | .. note:: |
|
265 | .. note:: | |
266 |
|
266 | |||
267 | Some global configuration options such as ``-R`` are |
|
267 | Some global configuration options such as ``-R`` are | |
268 | processed before shell aliases and will thus not be passed to |
|
268 | processed before shell aliases and will thus not be passed to | |
269 | aliases. |
|
269 | aliases. | |
270 |
|
270 | |||
271 |
|
271 | |||
272 | ``annotate`` |
|
272 | ``annotate`` | |
273 | ------------ |
|
273 | ------------ | |
274 |
|
274 | |||
275 | Settings used when displaying file annotations. All values are |
|
275 | Settings used when displaying file annotations. All values are | |
276 | Booleans and default to False. See ``diff`` section for related |
|
276 | Booleans and default to False. See ``diff`` section for related | |
277 | options for the diff command. |
|
277 | options for the diff command. | |
278 |
|
278 | |||
279 | ``ignorews`` |
|
279 | ``ignorews`` | |
280 | Ignore white space when comparing lines. |
|
280 | Ignore white space when comparing lines. | |
281 |
|
281 | |||
282 | ``ignorewsamount`` |
|
282 | ``ignorewsamount`` | |
283 | Ignore changes in the amount of white space. |
|
283 | Ignore changes in the amount of white space. | |
284 |
|
284 | |||
285 | ``ignoreblanklines`` |
|
285 | ``ignoreblanklines`` | |
286 | Ignore changes whose lines are all blank. |
|
286 | Ignore changes whose lines are all blank. | |
287 |
|
287 | |||
288 |
|
288 | |||
289 | ``auth`` |
|
289 | ``auth`` | |
290 | -------- |
|
290 | -------- | |
291 |
|
291 | |||
292 | Authentication credentials for HTTP authentication. This section |
|
292 | Authentication credentials for HTTP authentication. This section | |
293 | allows you to store usernames and passwords for use when logging |
|
293 | allows you to store usernames and passwords for use when logging | |
294 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
294 | *into* HTTP servers. See the ``[web]`` configuration section if | |
295 | you want to configure *who* can login to your HTTP server. |
|
295 | you want to configure *who* can login to your HTTP server. | |
296 |
|
296 | |||
297 | Each line has the following format:: |
|
297 | Each line has the following format:: | |
298 |
|
298 | |||
299 | <name>.<argument> = <value> |
|
299 | <name>.<argument> = <value> | |
300 |
|
300 | |||
301 | where ``<name>`` is used to group arguments into authentication |
|
301 | where ``<name>`` is used to group arguments into authentication | |
302 | entries. Example:: |
|
302 | entries. Example:: | |
303 |
|
303 | |||
304 | foo.prefix = hg.intevation.org/mercurial |
|
304 | foo.prefix = hg.intevation.org/mercurial | |
305 | foo.username = foo |
|
305 | foo.username = foo | |
306 | foo.password = bar |
|
306 | foo.password = bar | |
307 | foo.schemes = http https |
|
307 | foo.schemes = http https | |
308 |
|
308 | |||
309 | bar.prefix = secure.example.org |
|
309 | bar.prefix = secure.example.org | |
310 | bar.key = path/to/file.key |
|
310 | bar.key = path/to/file.key | |
311 | bar.cert = path/to/file.cert |
|
311 | bar.cert = path/to/file.cert | |
312 | bar.schemes = https |
|
312 | bar.schemes = https | |
313 |
|
313 | |||
314 | Supported arguments: |
|
314 | Supported arguments: | |
315 |
|
315 | |||
316 | ``prefix`` |
|
316 | ``prefix`` | |
317 | Either ``*`` or a URI prefix with or without the scheme part. |
|
317 | Either ``*`` or a URI prefix with or without the scheme part. | |
318 | The authentication entry with the longest matching prefix is used |
|
318 | The authentication entry with the longest matching prefix is used | |
319 | (where ``*`` matches everything and counts as a match of length |
|
319 | (where ``*`` matches everything and counts as a match of length | |
320 | 1). If the prefix doesn't include a scheme, the match is performed |
|
320 | 1). If the prefix doesn't include a scheme, the match is performed | |
321 | against the URI with its scheme stripped as well, and the schemes |
|
321 | against the URI with its scheme stripped as well, and the schemes | |
322 | argument, q.v., is then subsequently consulted. |
|
322 | argument, q.v., is then subsequently consulted. | |
323 |
|
323 | |||
324 | ``username`` |
|
324 | ``username`` | |
325 | Optional. Username to authenticate with. If not given, and the |
|
325 | Optional. Username to authenticate with. If not given, and the | |
326 | remote site requires basic or digest authentication, the user will |
|
326 | remote site requires basic or digest authentication, the user will | |
327 | be prompted for it. Environment variables are expanded in the |
|
327 | be prompted for it. Environment variables are expanded in the | |
328 | username letting you do ``foo.username = $USER``. If the URI |
|
328 | username letting you do ``foo.username = $USER``. If the URI | |
329 | includes a username, only ``[auth]`` entries with a matching |
|
329 | includes a username, only ``[auth]`` entries with a matching | |
330 | username or without a username will be considered. |
|
330 | username or without a username will be considered. | |
331 |
|
331 | |||
332 | ``password`` |
|
332 | ``password`` | |
333 | Optional. Password to authenticate with. If not given, and the |
|
333 | Optional. Password to authenticate with. If not given, and the | |
334 | remote site requires basic or digest authentication, the user |
|
334 | remote site requires basic or digest authentication, the user | |
335 | will be prompted for it. |
|
335 | will be prompted for it. | |
336 |
|
336 | |||
337 | ``key`` |
|
337 | ``key`` | |
338 | Optional. PEM encoded client certificate key file. Environment |
|
338 | Optional. PEM encoded client certificate key file. Environment | |
339 | variables are expanded in the filename. |
|
339 | variables are expanded in the filename. | |
340 |
|
340 | |||
341 | ``cert`` |
|
341 | ``cert`` | |
342 | Optional. PEM encoded client certificate chain file. Environment |
|
342 | Optional. PEM encoded client certificate chain file. Environment | |
343 | variables are expanded in the filename. |
|
343 | variables are expanded in the filename. | |
344 |
|
344 | |||
345 | ``schemes`` |
|
345 | ``schemes`` | |
346 | Optional. Space separated list of URI schemes to use this |
|
346 | Optional. Space separated list of URI schemes to use this | |
347 | authentication entry with. Only used if the prefix doesn't include |
|
347 | authentication entry with. Only used if the prefix doesn't include | |
348 | a scheme. Supported schemes are http and https. They will match |
|
348 | a scheme. Supported schemes are http and https. They will match | |
349 | static-http and static-https respectively, as well. |
|
349 | static-http and static-https respectively, as well. | |
350 | Default: https. |
|
350 | Default: https. | |
351 |
|
351 | |||
352 | If no suitable authentication entry is found, the user is prompted |
|
352 | If no suitable authentication entry is found, the user is prompted | |
353 | for credentials as usual if required by the remote. |
|
353 | for credentials as usual if required by the remote. | |
354 |
|
354 | |||
355 |
|
355 | |||
356 | ``committemplate`` |
|
356 | ``committemplate`` | |
357 | ------------------ |
|
357 | ------------------ | |
358 |
|
358 | |||
359 | ``changeset`` configuration in this section is used as the template to |
|
359 | ``changeset`` configuration in this section is used as the template to | |
360 | customize the text shown in the editor when committing. |
|
360 | customize the text shown in the editor when committing. | |
361 |
|
361 | |||
362 | In addition to pre-defined template keywords, commit log specific one |
|
362 | In addition to pre-defined template keywords, commit log specific one | |
363 | below can be used for customization: |
|
363 | below can be used for customization: | |
364 |
|
364 | |||
365 | ``extramsg`` |
|
365 | ``extramsg`` | |
366 | String: Extra message (typically 'Leave message empty to abort |
|
366 | String: Extra message (typically 'Leave message empty to abort | |
367 | commit.'). This may be changed by some commands or extensions. |
|
367 | commit.'). This may be changed by some commands or extensions. | |
368 |
|
368 | |||
369 | For example, the template configuration below shows as same text as |
|
369 | For example, the template configuration below shows as same text as | |
370 | one shown by default:: |
|
370 | one shown by default:: | |
371 |
|
371 | |||
372 | [committemplate] |
|
372 | [committemplate] | |
373 | changeset = {desc}\n\n |
|
373 | changeset = {desc}\n\n | |
374 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
374 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
375 | HG: {extramsg} |
|
375 | HG: {extramsg} | |
376 | HG: -- |
|
376 | HG: -- | |
377 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
377 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
378 | "HG: branch merge\n") |
|
378 | "HG: branch merge\n") | |
379 | }HG: branch '{branch}'\n{if(activebookmark, |
|
379 | }HG: branch '{branch}'\n{if(activebookmark, | |
380 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
380 | "HG: bookmark '{activebookmark}'\n") }{subrepos % | |
381 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
381 | "HG: subrepo {subrepo}\n" }{file_adds % | |
382 | "HG: added {file}\n" }{file_mods % |
|
382 | "HG: added {file}\n" }{file_mods % | |
383 | "HG: changed {file}\n" }{file_dels % |
|
383 | "HG: changed {file}\n" }{file_dels % | |
384 | "HG: removed {file}\n" }{if(files, "", |
|
384 | "HG: removed {file}\n" }{if(files, "", | |
385 | "HG: no files changed\n")} |
|
385 | "HG: no files changed\n")} | |
386 |
|
386 | |||
387 | .. note:: |
|
387 | .. note:: | |
388 |
|
388 | |||
389 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
389 | For some problematic encodings (see :hg:`help win32mbcs` for | |
390 | detail), this customization should be configured carefully, to |
|
390 | detail), this customization should be configured carefully, to | |
391 | avoid showing broken characters. |
|
391 | avoid showing broken characters. | |
392 |
|
392 | |||
393 | For example, if multibyte character ending with backslash (0x5c) is |
|
393 | For example, if multibyte character ending with backslash (0x5c) is | |
394 | followed by ASCII character 'n' in the customized template, |
|
394 | followed by ASCII character 'n' in the customized template, | |
395 | sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
395 | sequence of backslash and 'n' is treated as line-feed unexpectedly | |
396 | (and multibyte character is broken, too). |
|
396 | (and multibyte character is broken, too). | |
397 |
|
397 | |||
398 | Customized template is used for commands below (``--edit`` may be |
|
398 | Customized template is used for commands below (``--edit`` may be | |
399 | required): |
|
399 | required): | |
400 |
|
400 | |||
401 | - :hg:`backout` |
|
401 | - :hg:`backout` | |
402 | - :hg:`commit` |
|
402 | - :hg:`commit` | |
403 | - :hg:`fetch` (for merge commit only) |
|
403 | - :hg:`fetch` (for merge commit only) | |
404 | - :hg:`graft` |
|
404 | - :hg:`graft` | |
405 | - :hg:`histedit` |
|
405 | - :hg:`histedit` | |
406 | - :hg:`import` |
|
406 | - :hg:`import` | |
407 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
407 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
408 | - :hg:`rebase` |
|
408 | - :hg:`rebase` | |
409 | - :hg:`shelve` |
|
409 | - :hg:`shelve` | |
410 | - :hg:`sign` |
|
410 | - :hg:`sign` | |
411 | - :hg:`tag` |
|
411 | - :hg:`tag` | |
412 | - :hg:`transplant` |
|
412 | - :hg:`transplant` | |
413 |
|
413 | |||
414 | Configuring items below instead of ``changeset`` allows showing |
|
414 | Configuring items below instead of ``changeset`` allows showing | |
415 | customized message only for specific actions, or showing different |
|
415 | customized message only for specific actions, or showing different | |
416 | messages for each action. |
|
416 | messages for each action. | |
417 |
|
417 | |||
418 | - ``changeset.backout`` for :hg:`backout` |
|
418 | - ``changeset.backout`` for :hg:`backout` | |
419 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
419 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges | |
420 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
420 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other | |
421 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
421 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges | |
422 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
422 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other | |
423 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
423 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
424 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
424 | - ``changeset.gpg.sign`` for :hg:`sign` | |
425 | - ``changeset.graft`` for :hg:`graft` |
|
425 | - ``changeset.graft`` for :hg:`graft` | |
426 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
426 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
427 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
427 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
428 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
428 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
429 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
429 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
430 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
430 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
431 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
431 | - ``changeset.import.normal.merge`` for :hg:`import` on merges | |
432 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
432 | - ``changeset.import.normal.normal`` for :hg:`import` on other | |
433 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
433 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
434 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
434 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
435 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
435 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
436 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
436 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
437 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
437 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges | |
438 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
438 | - ``changeset.rebase.normal`` for :hg:`rebase` on other | |
439 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
439 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
440 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
440 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
441 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
441 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
442 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
442 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges | |
443 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
443 | - ``changeset.transplant.normal`` for :hg:`transplant` on other | |
444 |
|
444 | |||
445 | These dot-separated lists of names are treated as hierarchical ones. |
|
445 | These dot-separated lists of names are treated as hierarchical ones. | |
446 | For example, ``changeset.tag.remove`` customizes the commit message |
|
446 | For example, ``changeset.tag.remove`` customizes the commit message | |
447 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
447 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
448 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
448 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
449 |
|
449 | |||
450 | At the external editor invocation for committing, corresponding |
|
450 | At the external editor invocation for committing, corresponding | |
451 | dot-separated list of names without ``changeset.`` prefix |
|
451 | dot-separated list of names without ``changeset.`` prefix | |
452 | (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable. |
|
452 | (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable. | |
453 |
|
453 | |||
454 | In this section, items other than ``changeset`` can be referred from |
|
454 | In this section, items other than ``changeset`` can be referred from | |
455 | others. For example, the configuration to list committed files up |
|
455 | others. For example, the configuration to list committed files up | |
456 | below can be referred as ``{listupfiles}``:: |
|
456 | below can be referred as ``{listupfiles}``:: | |
457 |
|
457 | |||
458 | [committemplate] |
|
458 | [committemplate] | |
459 | listupfiles = {file_adds % |
|
459 | listupfiles = {file_adds % | |
460 | "HG: added {file}\n" }{file_mods % |
|
460 | "HG: added {file}\n" }{file_mods % | |
461 | "HG: changed {file}\n" }{file_dels % |
|
461 | "HG: changed {file}\n" }{file_dels % | |
462 | "HG: removed {file}\n" }{if(files, "", |
|
462 | "HG: removed {file}\n" }{if(files, "", | |
463 | "HG: no files changed\n")} |
|
463 | "HG: no files changed\n")} | |
464 |
|
464 | |||
465 | ``decode/encode`` |
|
465 | ``decode/encode`` | |
466 | ----------------- |
|
466 | ----------------- | |
467 |
|
467 | |||
468 | Filters for transforming files on checkout/checkin. This would |
|
468 | Filters for transforming files on checkout/checkin. This would | |
469 | typically be used for newline processing or other |
|
469 | typically be used for newline processing or other | |
470 | localization/canonicalization of files. |
|
470 | localization/canonicalization of files. | |
471 |
|
471 | |||
472 | Filters consist of a filter pattern followed by a filter command. |
|
472 | Filters consist of a filter pattern followed by a filter command. | |
473 | Filter patterns are globs by default, rooted at the repository root. |
|
473 | Filter patterns are globs by default, rooted at the repository root. | |
474 | For example, to match any file ending in ``.txt`` in the root |
|
474 | For example, to match any file ending in ``.txt`` in the root | |
475 | directory only, use the pattern ``*.txt``. To match any file ending |
|
475 | directory only, use the pattern ``*.txt``. To match any file ending | |
476 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
476 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
477 | For each file only the first matching filter applies. |
|
477 | For each file only the first matching filter applies. | |
478 |
|
478 | |||
479 | The filter command can start with a specifier, either ``pipe:`` or |
|
479 | The filter command can start with a specifier, either ``pipe:`` or | |
480 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
480 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
481 |
|
481 | |||
482 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
482 | A ``pipe:`` command must accept data on stdin and return the transformed | |
483 | data on stdout. |
|
483 | data on stdout. | |
484 |
|
484 | |||
485 | Pipe example:: |
|
485 | Pipe example:: | |
486 |
|
486 | |||
487 | [encode] |
|
487 | [encode] | |
488 | # uncompress gzip files on checkin to improve delta compression |
|
488 | # uncompress gzip files on checkin to improve delta compression | |
489 | # note: not necessarily a good idea, just an example |
|
489 | # note: not necessarily a good idea, just an example | |
490 | *.gz = pipe: gunzip |
|
490 | *.gz = pipe: gunzip | |
491 |
|
491 | |||
492 | [decode] |
|
492 | [decode] | |
493 | # recompress gzip files when writing them to the working dir (we |
|
493 | # recompress gzip files when writing them to the working dir (we | |
494 | # can safely omit "pipe:", because it's the default) |
|
494 | # can safely omit "pipe:", because it's the default) | |
495 | *.gz = gzip |
|
495 | *.gz = gzip | |
496 |
|
496 | |||
497 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
497 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
498 | with the name of a temporary file that contains the data to be |
|
498 | with the name of a temporary file that contains the data to be | |
499 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
499 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
500 | of an empty temporary file, where the filtered data must be written by |
|
500 | of an empty temporary file, where the filtered data must be written by | |
501 | the command. |
|
501 | the command. | |
502 |
|
502 | |||
503 | .. note:: |
|
503 | .. note:: | |
504 |
|
504 | |||
505 | The tempfile mechanism is recommended for Windows systems, |
|
505 | The tempfile mechanism is recommended for Windows systems, | |
506 | where the standard shell I/O redirection operators often have |
|
506 | where the standard shell I/O redirection operators often have | |
507 | strange effects and may corrupt the contents of your files. |
|
507 | strange effects and may corrupt the contents of your files. | |
508 |
|
508 | |||
509 | This filter mechanism is used internally by the ``eol`` extension to |
|
509 | This filter mechanism is used internally by the ``eol`` extension to | |
510 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
510 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
511 | format. We suggest you use the ``eol`` extension for convenience. |
|
511 | format. We suggest you use the ``eol`` extension for convenience. | |
512 |
|
512 | |||
513 |
|
513 | |||
514 | ``defaults`` |
|
514 | ``defaults`` | |
515 | ------------ |
|
515 | ------------ | |
516 |
|
516 | |||
517 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
517 | (defaults are deprecated. Don't use them. Use aliases instead) | |
518 |
|
518 | |||
519 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
519 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
520 | default options/arguments to pass to the specified commands. |
|
520 | default options/arguments to pass to the specified commands. | |
521 |
|
521 | |||
522 | The following example makes :hg:`log` run in verbose mode, and |
|
522 | The following example makes :hg:`log` run in verbose mode, and | |
523 | :hg:`status` show only the modified files, by default:: |
|
523 | :hg:`status` show only the modified files, by default:: | |
524 |
|
524 | |||
525 | [defaults] |
|
525 | [defaults] | |
526 | log = -v |
|
526 | log = -v | |
527 | status = -m |
|
527 | status = -m | |
528 |
|
528 | |||
529 | The actual commands, instead of their aliases, must be used when |
|
529 | The actual commands, instead of their aliases, must be used when | |
530 | defining command defaults. The command defaults will also be applied |
|
530 | defining command defaults. The command defaults will also be applied | |
531 | to the aliases of the commands defined. |
|
531 | to the aliases of the commands defined. | |
532 |
|
532 | |||
533 |
|
533 | |||
534 | ``diff`` |
|
534 | ``diff`` | |
535 | -------- |
|
535 | -------- | |
536 |
|
536 | |||
537 | Settings used when displaying diffs. Everything except for ``unified`` |
|
537 | Settings used when displaying diffs. Everything except for ``unified`` | |
538 | is a Boolean and defaults to False. See ``annotate`` section for |
|
538 | is a Boolean and defaults to False. See ``annotate`` section for | |
539 | related options for the annotate command. |
|
539 | related options for the annotate command. | |
540 |
|
540 | |||
541 | ``git`` |
|
541 | ``git`` | |
542 | Use git extended diff format. |
|
542 | Use git extended diff format. | |
543 |
|
543 | |||
544 | ``nobinary`` |
|
544 | ``nobinary`` | |
545 | Omit git binary patches. |
|
545 | Omit git binary patches. | |
546 |
|
546 | |||
547 | ``nodates`` |
|
547 | ``nodates`` | |
548 | Don't include dates in diff headers. |
|
548 | Don't include dates in diff headers. | |
549 |
|
549 | |||
550 | ``noprefix`` |
|
550 | ``noprefix`` | |
551 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
551 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. | |
552 |
|
552 | |||
553 | ``showfunc`` |
|
553 | ``showfunc`` | |
554 | Show which function each change is in. |
|
554 | Show which function each change is in. | |
555 |
|
555 | |||
556 | ``ignorews`` |
|
556 | ``ignorews`` | |
557 | Ignore white space when comparing lines. |
|
557 | Ignore white space when comparing lines. | |
558 |
|
558 | |||
559 | ``ignorewsamount`` |
|
559 | ``ignorewsamount`` | |
560 | Ignore changes in the amount of white space. |
|
560 | Ignore changes in the amount of white space. | |
561 |
|
561 | |||
562 | ``ignoreblanklines`` |
|
562 | ``ignoreblanklines`` | |
563 | Ignore changes whose lines are all blank. |
|
563 | Ignore changes whose lines are all blank. | |
564 |
|
564 | |||
565 | ``unified`` |
|
565 | ``unified`` | |
566 | Number of lines of context to show. |
|
566 | Number of lines of context to show. | |
567 |
|
567 | |||
568 | ``email`` |
|
568 | ``email`` | |
569 | --------- |
|
569 | --------- | |
570 |
|
570 | |||
571 | Settings for extensions that send email messages. |
|
571 | Settings for extensions that send email messages. | |
572 |
|
572 | |||
573 | ``from`` |
|
573 | ``from`` | |
574 | Optional. Email address to use in "From" header and SMTP envelope |
|
574 | Optional. Email address to use in "From" header and SMTP envelope | |
575 | of outgoing messages. |
|
575 | of outgoing messages. | |
576 |
|
576 | |||
577 | ``to`` |
|
577 | ``to`` | |
578 | Optional. Comma-separated list of recipients' email addresses. |
|
578 | Optional. Comma-separated list of recipients' email addresses. | |
579 |
|
579 | |||
580 | ``cc`` |
|
580 | ``cc`` | |
581 | Optional. Comma-separated list of carbon copy recipients' |
|
581 | Optional. Comma-separated list of carbon copy recipients' | |
582 | email addresses. |
|
582 | email addresses. | |
583 |
|
583 | |||
584 | ``bcc`` |
|
584 | ``bcc`` | |
585 | Optional. Comma-separated list of blind carbon copy recipients' |
|
585 | Optional. Comma-separated list of blind carbon copy recipients' | |
586 | email addresses. |
|
586 | email addresses. | |
587 |
|
587 | |||
588 | ``method`` |
|
588 | ``method`` | |
589 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
589 | Optional. Method to use to send email messages. If value is ``smtp`` | |
590 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
590 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
591 | Otherwise, use as name of program to run that acts like sendmail |
|
591 | Otherwise, use as name of program to run that acts like sendmail | |
592 | (takes ``-f`` option for sender, list of recipients on command line, |
|
592 | (takes ``-f`` option for sender, list of recipients on command line, | |
593 | message on stdin). Normally, setting this to ``sendmail`` or |
|
593 | message on stdin). Normally, setting this to ``sendmail`` or | |
594 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
594 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
595 |
|
595 | |||
596 | ``charsets`` |
|
596 | ``charsets`` | |
597 | Optional. Comma-separated list of character sets considered |
|
597 | Optional. Comma-separated list of character sets considered | |
598 | convenient for recipients. Addresses, headers, and parts not |
|
598 | convenient for recipients. Addresses, headers, and parts not | |
599 | containing patches of outgoing messages will be encoded in the |
|
599 | containing patches of outgoing messages will be encoded in the | |
600 | first character set to which conversion from local encoding |
|
600 | first character set to which conversion from local encoding | |
601 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
601 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
602 | conversion fails, the text in question is sent as is. Defaults to |
|
602 | conversion fails, the text in question is sent as is. Defaults to | |
603 | empty (explicit) list. |
|
603 | empty (explicit) list. | |
604 |
|
604 | |||
605 | Order of outgoing email character sets: |
|
605 | Order of outgoing email character sets: | |
606 |
|
606 | |||
607 | 1. ``us-ascii``: always first, regardless of settings |
|
607 | 1. ``us-ascii``: always first, regardless of settings | |
608 | 2. ``email.charsets``: in order given by user |
|
608 | 2. ``email.charsets``: in order given by user | |
609 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
609 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
610 | 4. ``$HGENCODING``: if not in email.charsets |
|
610 | 4. ``$HGENCODING``: if not in email.charsets | |
611 | 5. ``utf-8``: always last, regardless of settings |
|
611 | 5. ``utf-8``: always last, regardless of settings | |
612 |
|
612 | |||
613 | Email example:: |
|
613 | Email example:: | |
614 |
|
614 | |||
615 | [email] |
|
615 | [email] | |
616 | from = Joseph User <joe.user@example.com> |
|
616 | from = Joseph User <joe.user@example.com> | |
617 | method = /usr/sbin/sendmail |
|
617 | method = /usr/sbin/sendmail | |
618 | # charsets for western Europeans |
|
618 | # charsets for western Europeans | |
619 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
619 | # us-ascii, utf-8 omitted, as they are tried first and last | |
620 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
620 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
621 |
|
621 | |||
622 |
|
622 | |||
623 | ``extensions`` |
|
623 | ``extensions`` | |
624 | -------------- |
|
624 | -------------- | |
625 |
|
625 | |||
626 | Mercurial has an extension mechanism for adding new features. To |
|
626 | Mercurial has an extension mechanism for adding new features. To | |
627 | enable an extension, create an entry for it in this section. |
|
627 | enable an extension, create an entry for it in this section. | |
628 |
|
628 | |||
629 | If you know that the extension is already in Python's search path, |
|
629 | If you know that the extension is already in Python's search path, | |
630 | you can give the name of the module, followed by ``=``, with nothing |
|
630 | you can give the name of the module, followed by ``=``, with nothing | |
631 | after the ``=``. |
|
631 | after the ``=``. | |
632 |
|
632 | |||
633 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
633 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
634 | the path to the ``.py`` file (including the file name extension) that |
|
634 | the path to the ``.py`` file (including the file name extension) that | |
635 | defines the extension. |
|
635 | defines the extension. | |
636 |
|
636 | |||
637 | To explicitly disable an extension that is enabled in an hgrc of |
|
637 | To explicitly disable an extension that is enabled in an hgrc of | |
638 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
638 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
639 | or ``foo = !`` when path is not supplied. |
|
639 | or ``foo = !`` when path is not supplied. | |
640 |
|
640 | |||
641 | Example for ``~/.hgrc``:: |
|
641 | Example for ``~/.hgrc``:: | |
642 |
|
642 | |||
643 | [extensions] |
|
643 | [extensions] | |
644 | # (the color extension will get loaded from Mercurial's path) |
|
644 | # (the color extension will get loaded from Mercurial's path) | |
645 | color = |
|
645 | color = | |
646 | # (this extension will get loaded from the file specified) |
|
646 | # (this extension will get loaded from the file specified) | |
647 | myfeature = ~/.hgext/myfeature.py |
|
647 | myfeature = ~/.hgext/myfeature.py | |
648 |
|
648 | |||
649 |
|
649 | |||
650 | ``format`` |
|
650 | ``format`` | |
651 | ---------- |
|
651 | ---------- | |
652 |
|
652 | |||
653 | ``usestore`` |
|
653 | ``usestore`` | |
654 | Enable or disable the "store" repository format which improves |
|
654 | Enable or disable the "store" repository format which improves | |
655 | compatibility with systems that fold case or otherwise mangle |
|
655 | compatibility with systems that fold case or otherwise mangle | |
656 | filenames. Enabled by default. Disabling this option will allow |
|
656 | filenames. Enabled by default. Disabling this option will allow | |
657 | you to store longer filenames in some situations at the expense of |
|
657 | you to store longer filenames in some situations at the expense of | |
658 | compatibility and ensures that the on-disk format of newly created |
|
658 | compatibility and ensures that the on-disk format of newly created | |
659 | repositories will be compatible with Mercurial before version 0.9.4. |
|
659 | repositories will be compatible with Mercurial before version 0.9.4. | |
660 |
|
660 | |||
661 | ``usefncache`` |
|
661 | ``usefncache`` | |
662 | Enable or disable the "fncache" repository format which enhances |
|
662 | Enable or disable the "fncache" repository format which enhances | |
663 | the "store" repository format (which has to be enabled to use |
|
663 | the "store" repository format (which has to be enabled to use | |
664 | fncache) to allow longer filenames and avoids using Windows |
|
664 | fncache) to allow longer filenames and avoids using Windows | |
665 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
665 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
666 | option ensures that the on-disk format of newly created |
|
666 | option ensures that the on-disk format of newly created | |
667 | repositories will be compatible with Mercurial before version 1.1. |
|
667 | repositories will be compatible with Mercurial before version 1.1. | |
668 |
|
668 | |||
669 | ``dotencode`` |
|
669 | ``dotencode`` | |
670 | Enable or disable the "dotencode" repository format which enhances |
|
670 | Enable or disable the "dotencode" repository format which enhances | |
671 | the "fncache" repository format (which has to be enabled to use |
|
671 | the "fncache" repository format (which has to be enabled to use | |
672 | dotencode) to avoid issues with filenames starting with ._ on |
|
672 | dotencode) to avoid issues with filenames starting with ._ on | |
673 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
673 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
674 | option ensures that the on-disk format of newly created |
|
674 | option ensures that the on-disk format of newly created | |
675 | repositories will be compatible with Mercurial before version 1.7. |
|
675 | repositories will be compatible with Mercurial before version 1.7. | |
676 |
|
676 | |||
677 | ``graph`` |
|
677 | ``graph`` | |
678 | --------- |
|
678 | --------- | |
679 |
|
679 | |||
680 | Web graph view configuration. This section let you change graph |
|
680 | Web graph view configuration. This section let you change graph | |
681 | elements display properties by branches, for instance to make the |
|
681 | elements display properties by branches, for instance to make the | |
682 | ``default`` branch stand out. |
|
682 | ``default`` branch stand out. | |
683 |
|
683 | |||
684 | Each line has the following format:: |
|
684 | Each line has the following format:: | |
685 |
|
685 | |||
686 | <branch>.<argument> = <value> |
|
686 | <branch>.<argument> = <value> | |
687 |
|
687 | |||
688 | where ``<branch>`` is the name of the branch being |
|
688 | where ``<branch>`` is the name of the branch being | |
689 | customized. Example:: |
|
689 | customized. Example:: | |
690 |
|
690 | |||
691 | [graph] |
|
691 | [graph] | |
692 | # 2px width |
|
692 | # 2px width | |
693 | default.width = 2 |
|
693 | default.width = 2 | |
694 | # red color |
|
694 | # red color | |
695 | default.color = FF0000 |
|
695 | default.color = FF0000 | |
696 |
|
696 | |||
697 | Supported arguments: |
|
697 | Supported arguments: | |
698 |
|
698 | |||
699 | ``width`` |
|
699 | ``width`` | |
700 | Set branch edges width in pixels. |
|
700 | Set branch edges width in pixels. | |
701 |
|
701 | |||
702 | ``color`` |
|
702 | ``color`` | |
703 | Set branch edges color in hexadecimal RGB notation. |
|
703 | Set branch edges color in hexadecimal RGB notation. | |
704 |
|
704 | |||
705 | ``hooks`` |
|
705 | ``hooks`` | |
706 | --------- |
|
706 | --------- | |
707 |
|
707 | |||
708 | Commands or Python functions that get automatically executed by |
|
708 | Commands or Python functions that get automatically executed by | |
709 | various actions such as starting or finishing a commit. Multiple |
|
709 | various actions such as starting or finishing a commit. Multiple | |
710 | hooks can be run for the same action by appending a suffix to the |
|
710 | hooks can be run for the same action by appending a suffix to the | |
711 | action. Overriding a site-wide hook can be done by changing its |
|
711 | action. Overriding a site-wide hook can be done by changing its | |
712 | value or setting it to an empty string. Hooks can be prioritized |
|
712 | value or setting it to an empty string. Hooks can be prioritized | |
713 | by adding a prefix of ``priority`` to the hook name on a new line |
|
713 | by adding a prefix of ``priority`` to the hook name on a new line | |
714 | and setting the priority. The default priority is 0 if |
|
714 | and setting the priority. The default priority is 0 if | |
715 | not specified. |
|
715 | not specified. | |
716 |
|
716 | |||
717 | Example ``.hg/hgrc``:: |
|
717 | Example ``.hg/hgrc``:: | |
718 |
|
718 | |||
719 | [hooks] |
|
719 | [hooks] | |
720 | # update working directory after adding changesets |
|
720 | # update working directory after adding changesets | |
721 | changegroup.update = hg update |
|
721 | changegroup.update = hg update | |
722 | # do not use the site-wide hook |
|
722 | # do not use the site-wide hook | |
723 | incoming = |
|
723 | incoming = | |
724 | incoming.email = /my/email/hook |
|
724 | incoming.email = /my/email/hook | |
725 | incoming.autobuild = /my/build/hook |
|
725 | incoming.autobuild = /my/build/hook | |
726 | # force autobuild hook to run before other incoming hooks |
|
726 | # force autobuild hook to run before other incoming hooks | |
727 | priority.incoming.autobuild = 1 |
|
727 | priority.incoming.autobuild = 1 | |
728 |
|
728 | |||
729 | Most hooks are run with environment variables set that give useful |
|
729 | Most hooks are run with environment variables set that give useful | |
730 | additional information. For each hook below, the environment |
|
730 | additional information. For each hook below, the environment | |
731 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
731 | variables it is passed are listed with names of the form ``$HG_foo``. | |
732 |
|
732 | |||
733 | ``changegroup`` |
|
733 | ``changegroup`` | |
734 | Run after a changegroup has been added via push, pull or unbundle. |
|
734 | Run after a changegroup has been added via push, pull or unbundle. | |
735 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
735 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
736 | changes came is in ``$HG_URL``. |
|
736 | changes came is in ``$HG_URL``. | |
737 |
|
737 | |||
738 | ``commit`` |
|
738 | ``commit`` | |
739 | Run after a changeset has been created in the local repository. ID |
|
739 | Run after a changeset has been created in the local repository. ID | |
740 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
740 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
741 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
741 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
742 |
|
742 | |||
743 | ``incoming`` |
|
743 | ``incoming`` | |
744 | Run after a changeset has been pulled, pushed, or unbundled into |
|
744 | Run after a changeset has been pulled, pushed, or unbundled into | |
745 | the local repository. The ID of the newly arrived changeset is in |
|
745 | the local repository. The ID of the newly arrived changeset is in | |
746 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
746 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
747 |
|
747 | |||
748 | ``outgoing`` |
|
748 | ``outgoing`` | |
749 | Run after sending changes from local repository to another. ID of |
|
749 | Run after sending changes from local repository to another. ID of | |
750 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
750 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
751 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
751 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
752 |
|
752 | |||
753 | ``post-<command>`` |
|
753 | ``post-<command>`` | |
754 | Run after successful invocations of the associated command. The |
|
754 | Run after successful invocations of the associated command. The | |
755 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
755 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
756 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
756 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
757 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
757 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
758 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
758 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
759 | dictionary of options (with unspecified options set to their defaults). |
|
759 | dictionary of options (with unspecified options set to their defaults). | |
760 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
760 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
761 |
|
761 | |||
762 | ``pre-<command>`` |
|
762 | ``pre-<command>`` | |
763 | Run before executing the associated command. The contents of the |
|
763 | Run before executing the associated command. The contents of the | |
764 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
764 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
765 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
765 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
766 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
766 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
767 | is a dictionary of options (with unspecified options set to their |
|
767 | is a dictionary of options (with unspecified options set to their | |
768 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
768 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
769 | failure, the command doesn't execute and Mercurial returns the failure |
|
769 | failure, the command doesn't execute and Mercurial returns the failure | |
770 | code. |
|
770 | code. | |
771 |
|
771 | |||
772 | ``prechangegroup`` |
|
772 | ``prechangegroup`` | |
773 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
773 | Run before a changegroup is added via push, pull or unbundle. Exit | |
774 | status 0 allows the changegroup to proceed. Non-zero status will |
|
774 | status 0 allows the changegroup to proceed. Non-zero status will | |
775 | cause the push, pull or unbundle to fail. URL from which changes |
|
775 | cause the push, pull or unbundle to fail. URL from which changes | |
776 | will come is in ``$HG_URL``. |
|
776 | will come is in ``$HG_URL``. | |
777 |
|
777 | |||
778 | ``precommit`` |
|
778 | ``precommit`` | |
779 | Run before starting a local commit. Exit status 0 allows the |
|
779 | Run before starting a local commit. Exit status 0 allows the | |
780 | commit to proceed. Non-zero status will cause the commit to fail. |
|
780 | commit to proceed. Non-zero status will cause the commit to fail. | |
781 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
781 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
782 |
|
782 | |||
783 | ``prelistkeys`` |
|
783 | ``prelistkeys`` | |
784 | Run before listing pushkeys (like bookmarks) in the |
|
784 | Run before listing pushkeys (like bookmarks) in the | |
785 | repository. Non-zero status will cause failure. The key namespace is |
|
785 | repository. Non-zero status will cause failure. The key namespace is | |
786 | in ``$HG_NAMESPACE``. |
|
786 | in ``$HG_NAMESPACE``. | |
787 |
|
787 | |||
788 | ``preoutgoing`` |
|
788 | ``preoutgoing`` | |
789 | Run before collecting changes to send from the local repository to |
|
789 | Run before collecting changes to send from the local repository to | |
790 | another. Non-zero status will cause failure. This lets you prevent |
|
790 | another. Non-zero status will cause failure. This lets you prevent | |
791 | pull over HTTP or SSH. Also prevents against local pull, push |
|
791 | pull over HTTP or SSH. Also prevents against local pull, push | |
792 | (outbound) or bundle commands, but not effective, since you can |
|
792 | (outbound) or bundle commands, but not effective, since you can | |
793 | just copy files instead then. Source of operation is in |
|
793 | just copy files instead then. Source of operation is in | |
794 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
794 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
795 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
795 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
796 | is happening on behalf of repository on same system. |
|
796 | is happening on behalf of repository on same system. | |
797 |
|
797 | |||
798 | ``prepushkey`` |
|
798 | ``prepushkey`` | |
799 | Run before a pushkey (like a bookmark) is added to the |
|
799 | Run before a pushkey (like a bookmark) is added to the | |
800 | repository. Non-zero status will cause the key to be rejected. The |
|
800 | repository. Non-zero status will cause the key to be rejected. The | |
801 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
801 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
802 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
802 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
803 | ``$HG_NEW``. |
|
803 | ``$HG_NEW``. | |
804 |
|
804 | |||
805 | ``pretag`` |
|
805 | ``pretag`` | |
806 | Run before creating a tag. Exit status 0 allows the tag to be |
|
806 | Run before creating a tag. Exit status 0 allows the tag to be | |
807 | created. Non-zero status will cause the tag to fail. ID of |
|
807 | created. Non-zero status will cause the tag to fail. ID of | |
808 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
808 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
809 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
809 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
810 |
|
810 | |||
811 | ``pretxnopen`` |
|
811 | ``pretxnopen`` | |
812 | Run before any new repository transaction is open. The reason for the |
|
812 | Run before any new repository transaction is open. The reason for the | |
813 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the |
|
813 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the | |
814 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
814 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the | |
815 | transaction from being opened. |
|
815 | transaction from being opened. | |
816 |
|
816 | |||
817 | ``pretxnclose`` |
|
817 | ``pretxnclose`` | |
818 | Run right before the transaction is actually finalized. Any |
|
818 | Run right before the transaction is actually finalized. Any | |
819 | repository change will be visible to the hook program. This lets you |
|
819 | repository change will be visible to the hook program. This lets you | |
820 | validate the transaction content or change it. Exit status 0 allows |
|
820 | validate the transaction content or change it. Exit status 0 allows | |
821 | the commit to proceed. Non-zero status will cause the transaction to |
|
821 | the commit to proceed. Non-zero status will cause the transaction to | |
822 | be rolled back. The reason for the transaction opening will be in |
|
822 | be rolled back. The reason for the transaction opening will be in | |
823 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in |
|
823 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in | |
824 | ``HG_TXNID``. The rest of the available data will vary according the |
|
824 | ``HG_TXNID``. The rest of the available data will vary according the | |
825 | transaction type. New changesets will add ``$HG_NODE`` (id of the |
|
825 | transaction type. New changesets will add ``$HG_NODE`` (id of the | |
826 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, |
|
826 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, | |
827 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and |
|
827 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and | |
828 | ``HG_PHASES_MOVED`` to ``1``, etc. |
|
828 | ``HG_PHASES_MOVED`` to ``1``, etc. | |
829 |
|
829 | |||
830 | ``txnclose`` |
|
830 | ``txnclose`` | |
831 | Run after any repository transaction has been committed. At this |
|
831 | Run after any repository transaction has been committed. At this | |
832 | point, the transaction can no longer be rolled back. The hook will run |
|
832 | point, the transaction can no longer be rolled back. The hook will run | |
833 | after the lock is released. See ``pretxnclose`` docs for details about |
|
833 | after the lock is released. See ``pretxnclose`` docs for details about | |
834 | available variables. |
|
834 | available variables. | |
835 |
|
835 | |||
836 | ``txnabort`` |
|
836 | ``txnabort`` | |
837 | Run when a transaction is aborted. See ``pretxnclose`` docs for details about |
|
837 | Run when a transaction is aborted. See ``pretxnclose`` docs for details about | |
838 | available variables. |
|
838 | available variables. | |
839 |
|
839 | |||
840 | ``pretxnchangegroup`` |
|
840 | ``pretxnchangegroup`` | |
841 | Run after a changegroup has been added via push, pull or unbundle, |
|
841 | Run after a changegroup has been added via push, pull or unbundle, | |
842 | but before the transaction has been committed. Changegroup is |
|
842 | but before the transaction has been committed. Changegroup is | |
843 | visible to hook program. This lets you validate incoming changes |
|
843 | visible to hook program. This lets you validate incoming changes | |
844 | before accepting them. Passed the ID of the first new changeset in |
|
844 | before accepting them. Passed the ID of the first new changeset in | |
845 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
845 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
846 | status will cause the transaction to be rolled back and the push, |
|
846 | status will cause the transaction to be rolled back and the push, | |
847 | pull or unbundle will fail. URL that was source of changes is in |
|
847 | pull or unbundle will fail. URL that was source of changes is in | |
848 | ``$HG_URL``. |
|
848 | ``$HG_URL``. | |
849 |
|
849 | |||
850 | ``pretxncommit`` |
|
850 | ``pretxncommit`` | |
851 | Run after a changeset has been created but the transaction not yet |
|
851 | Run after a changeset has been created but the transaction not yet | |
852 | committed. Changeset is visible to hook program. This lets you |
|
852 | committed. Changeset is visible to hook program. This lets you | |
853 | validate commit message and changes. Exit status 0 allows the |
|
853 | validate commit message and changes. Exit status 0 allows the | |
854 | commit to proceed. Non-zero status will cause the transaction to |
|
854 | commit to proceed. Non-zero status will cause the transaction to | |
855 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
855 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
856 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
856 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
857 |
|
857 | |||
858 | ``preupdate`` |
|
858 | ``preupdate`` | |
859 | Run before updating the working directory. Exit status 0 allows |
|
859 | Run before updating the working directory. Exit status 0 allows | |
860 | the update to proceed. Non-zero status will prevent the update. |
|
860 | the update to proceed. Non-zero status will prevent the update. | |
861 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
861 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
862 | of second new parent is in ``$HG_PARENT2``. |
|
862 | of second new parent is in ``$HG_PARENT2``. | |
863 |
|
863 | |||
864 | ``listkeys`` |
|
864 | ``listkeys`` | |
865 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
865 | Run after listing pushkeys (like bookmarks) in the repository. The | |
866 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
866 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
867 | dictionary containing the keys and values. |
|
867 | dictionary containing the keys and values. | |
868 |
|
868 | |||
869 | ``pushkey`` |
|
869 | ``pushkey`` | |
870 | Run after a pushkey (like a bookmark) is added to the |
|
870 | Run after a pushkey (like a bookmark) is added to the | |
871 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
871 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
872 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
872 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
873 | value is in ``$HG_NEW``. |
|
873 | value is in ``$HG_NEW``. | |
874 |
|
874 | |||
875 | ``tag`` |
|
875 | ``tag`` | |
876 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
876 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
877 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
877 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
878 | repository if ``$HG_LOCAL=0``. |
|
878 | repository if ``$HG_LOCAL=0``. | |
879 |
|
879 | |||
880 | ``update`` |
|
880 | ``update`` | |
881 | Run after updating the working directory. Changeset ID of first |
|
881 | Run after updating the working directory. Changeset ID of first | |
882 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
882 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
883 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
883 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
884 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
884 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
885 |
|
885 | |||
886 | .. note:: |
|
886 | .. note:: | |
887 |
|
887 | |||
888 | It is generally better to use standard hooks rather than the |
|
888 | It is generally better to use standard hooks rather than the | |
889 | generic pre- and post- command hooks as they are guaranteed to be |
|
889 | generic pre- and post- command hooks as they are guaranteed to be | |
890 | called in the appropriate contexts for influencing transactions. |
|
890 | called in the appropriate contexts for influencing transactions. | |
891 | Also, hooks like "commit" will be called in all contexts that |
|
891 | Also, hooks like "commit" will be called in all contexts that | |
892 | generate a commit (e.g. tag) and not just the commit command. |
|
892 | generate a commit (e.g. tag) and not just the commit command. | |
893 |
|
893 | |||
894 | .. note:: |
|
894 | .. note:: | |
895 |
|
895 | |||
896 | Environment variables with empty values may not be passed to |
|
896 | Environment variables with empty values may not be passed to | |
897 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
897 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
898 | will have an empty value under Unix-like platforms for non-merge |
|
898 | will have an empty value under Unix-like platforms for non-merge | |
899 | changesets, while it will not be available at all under Windows. |
|
899 | changesets, while it will not be available at all under Windows. | |
900 |
|
900 | |||
901 | The syntax for Python hooks is as follows:: |
|
901 | The syntax for Python hooks is as follows:: | |
902 |
|
902 | |||
903 | hookname = python:modulename.submodule.callable |
|
903 | hookname = python:modulename.submodule.callable | |
904 | hookname = python:/path/to/python/module.py:callable |
|
904 | hookname = python:/path/to/python/module.py:callable | |
905 |
|
905 | |||
906 | Python hooks are run within the Mercurial process. Each hook is |
|
906 | Python hooks are run within the Mercurial process. Each hook is | |
907 | called with at least three keyword arguments: a ui object (keyword |
|
907 | called with at least three keyword arguments: a ui object (keyword | |
908 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
908 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
909 | keyword that tells what kind of hook is used. Arguments listed as |
|
909 | keyword that tells what kind of hook is used. Arguments listed as | |
910 | environment variables above are passed as keyword arguments, with no |
|
910 | environment variables above are passed as keyword arguments, with no | |
911 | ``HG_`` prefix, and names in lower case. |
|
911 | ``HG_`` prefix, and names in lower case. | |
912 |
|
912 | |||
913 | If a Python hook returns a "true" value or raises an exception, this |
|
913 | If a Python hook returns a "true" value or raises an exception, this | |
914 | is treated as a failure. |
|
914 | is treated as a failure. | |
915 |
|
915 | |||
916 |
|
916 | |||
917 | ``hostfingerprints`` |
|
917 | ``hostfingerprints`` | |
918 | -------------------- |
|
918 | -------------------- | |
919 |
|
919 | |||
920 | Fingerprints of the certificates of known HTTPS servers. |
|
920 | Fingerprints of the certificates of known HTTPS servers. | |
921 | A HTTPS connection to a server with a fingerprint configured here will |
|
921 | A HTTPS connection to a server with a fingerprint configured here will | |
922 | only succeed if the servers certificate matches the fingerprint. |
|
922 | only succeed if the servers certificate matches the fingerprint. | |
923 | This is very similar to how ssh known hosts works. |
|
923 | This is very similar to how ssh known hosts works. | |
924 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
924 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
925 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
925 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
926 |
|
926 | |||
927 | For example:: |
|
927 | For example:: | |
928 |
|
928 | |||
929 | [hostfingerprints] |
|
929 | [hostfingerprints] | |
930 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 |
|
930 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 | |
931 |
|
931 | |||
932 | This feature is only supported when using Python 2.6 or later. |
|
932 | This feature is only supported when using Python 2.6 or later. | |
933 |
|
933 | |||
934 |
|
934 | |||
935 | ``http_proxy`` |
|
935 | ``http_proxy`` | |
936 | -------------- |
|
936 | -------------- | |
937 |
|
937 | |||
938 | Used to access web-based Mercurial repositories through a HTTP |
|
938 | Used to access web-based Mercurial repositories through a HTTP | |
939 | proxy. |
|
939 | proxy. | |
940 |
|
940 | |||
941 | ``host`` |
|
941 | ``host`` | |
942 | Host name and (optional) port of the proxy server, for example |
|
942 | Host name and (optional) port of the proxy server, for example | |
943 | "myproxy:8000". |
|
943 | "myproxy:8000". | |
944 |
|
944 | |||
945 | ``no`` |
|
945 | ``no`` | |
946 | Optional. Comma-separated list of host names that should bypass |
|
946 | Optional. Comma-separated list of host names that should bypass | |
947 | the proxy. |
|
947 | the proxy. | |
948 |
|
948 | |||
949 | ``passwd`` |
|
949 | ``passwd`` | |
950 | Optional. Password to authenticate with at the proxy server. |
|
950 | Optional. Password to authenticate with at the proxy server. | |
951 |
|
951 | |||
952 | ``user`` |
|
952 | ``user`` | |
953 | Optional. User name to authenticate with at the proxy server. |
|
953 | Optional. User name to authenticate with at the proxy server. | |
954 |
|
954 | |||
955 | ``always`` |
|
955 | ``always`` | |
956 | Optional. Always use the proxy, even for localhost and any entries |
|
956 | Optional. Always use the proxy, even for localhost and any entries | |
957 | in ``http_proxy.no``. True or False. Default: False. |
|
957 | in ``http_proxy.no``. True or False. Default: False. | |
958 |
|
958 | |||
959 | ``merge-patterns`` |
|
959 | ``merge-patterns`` | |
960 | ------------------ |
|
960 | ------------------ | |
961 |
|
961 | |||
962 | This section specifies merge tools to associate with particular file |
|
962 | This section specifies merge tools to associate with particular file | |
963 | patterns. Tools matched here will take precedence over the default |
|
963 | patterns. Tools matched here will take precedence over the default | |
964 | merge tool. Patterns are globs by default, rooted at the repository |
|
964 | merge tool. Patterns are globs by default, rooted at the repository | |
965 | root. |
|
965 | root. | |
966 |
|
966 | |||
967 | Example:: |
|
967 | Example:: | |
968 |
|
968 | |||
969 | [merge-patterns] |
|
969 | [merge-patterns] | |
970 | **.c = kdiff3 |
|
970 | **.c = kdiff3 | |
971 | **.jpg = myimgmerge |
|
971 | **.jpg = myimgmerge | |
972 |
|
972 | |||
973 | ``merge-tools`` |
|
973 | ``merge-tools`` | |
974 | --------------- |
|
974 | --------------- | |
975 |
|
975 | |||
976 | This section configures external merge tools to use for file-level |
|
976 | This section configures external merge tools to use for file-level | |
977 | merges. This section has likely been preconfigured at install time. |
|
977 | merges. This section has likely been preconfigured at install time. | |
978 | Use :hg:`config merge-tools` to check the existing configuration. |
|
978 | Use :hg:`config merge-tools` to check the existing configuration. | |
979 | Also see :hg:`help merge-tools` for more details. |
|
979 | Also see :hg:`help merge-tools` for more details. | |
980 |
|
980 | |||
981 | Example ``~/.hgrc``:: |
|
981 | Example ``~/.hgrc``:: | |
982 |
|
982 | |||
983 | [merge-tools] |
|
983 | [merge-tools] | |
984 | # Override stock tool location |
|
984 | # Override stock tool location | |
985 | kdiff3.executable = ~/bin/kdiff3 |
|
985 | kdiff3.executable = ~/bin/kdiff3 | |
986 | # Specify command line |
|
986 | # Specify command line | |
987 | kdiff3.args = $base $local $other -o $output |
|
987 | kdiff3.args = $base $local $other -o $output | |
988 | # Give higher priority |
|
988 | # Give higher priority | |
989 | kdiff3.priority = 1 |
|
989 | kdiff3.priority = 1 | |
990 |
|
990 | |||
991 | # Changing the priority of preconfigured tool |
|
991 | # Changing the priority of preconfigured tool | |
992 | vimdiff.priority = 0 |
|
992 | vimdiff.priority = 0 | |
993 |
|
993 | |||
994 | # Define new tool |
|
994 | # Define new tool | |
995 | myHtmlTool.args = -m $local $other $base $output |
|
995 | myHtmlTool.args = -m $local $other $base $output | |
996 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
996 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
997 | myHtmlTool.priority = 1 |
|
997 | myHtmlTool.priority = 1 | |
998 |
|
998 | |||
999 | Supported arguments: |
|
999 | Supported arguments: | |
1000 |
|
1000 | |||
1001 | ``priority`` |
|
1001 | ``priority`` | |
1002 | The priority in which to evaluate this tool. |
|
1002 | The priority in which to evaluate this tool. | |
1003 | Default: 0. |
|
1003 | Default: 0. | |
1004 |
|
1004 | |||
1005 | ``executable`` |
|
1005 | ``executable`` | |
1006 | Either just the name of the executable or its pathname. On Windows, |
|
1006 | Either just the name of the executable or its pathname. On Windows, | |
1007 | the path can use environment variables with ${ProgramFiles} syntax. |
|
1007 | the path can use environment variables with ${ProgramFiles} syntax. | |
1008 | Default: the tool name. |
|
1008 | Default: the tool name. | |
1009 |
|
1009 | |||
1010 | ``args`` |
|
1010 | ``args`` | |
1011 | The arguments to pass to the tool executable. You can refer to the |
|
1011 | The arguments to pass to the tool executable. You can refer to the | |
1012 | files being merged as well as the output file through these |
|
1012 | files being merged as well as the output file through these | |
1013 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1013 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning | |
1014 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1014 | of ``$local`` and ``$other`` can vary depending on which action is being | |
1015 | performed. During and update or merge, ``$local`` represents the original |
|
1015 | performed. During and update or merge, ``$local`` represents the original | |
1016 | state of the file, while ``$other`` represents the commit you are updating |
|
1016 | state of the file, while ``$other`` represents the commit you are updating | |
1017 | to or the commit you are merging with. During a rebase ``$local`` |
|
1017 | to or the commit you are merging with. During a rebase ``$local`` | |
1018 | represents the destination of the rebase, and ``$other`` represents the |
|
1018 | represents the destination of the rebase, and ``$other`` represents the | |
1019 | commit being rebased. |
|
1019 | commit being rebased. | |
1020 | Default: ``$local $base $other`` |
|
1020 | Default: ``$local $base $other`` | |
1021 |
|
1021 | |||
1022 | ``premerge`` |
|
1022 | ``premerge`` | |
1023 | Attempt to run internal non-interactive 3-way merge tool before |
|
1023 | Attempt to run internal non-interactive 3-way merge tool before | |
1024 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1024 | launching external tool. Options are ``true``, ``false``, ``keep`` or | |
1025 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1025 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the | |
1026 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1026 | premerge fails. The ``keep-merge3`` will do the same but include information | |
1027 | about the base of the merge in the marker (see internal :merge3 in |
|
1027 | about the base of the merge in the marker (see internal :merge3 in | |
1028 | :hg:`help merge-tools`). |
|
1028 | :hg:`help merge-tools`). | |
1029 | Default: True |
|
1029 | Default: True | |
1030 |
|
1030 | |||
1031 | ``binary`` |
|
1031 | ``binary`` | |
1032 | This tool can merge binary files. Defaults to False, unless tool |
|
1032 | This tool can merge binary files. Defaults to False, unless tool | |
1033 | was selected by file pattern match. |
|
1033 | was selected by file pattern match. | |
1034 |
|
1034 | |||
1035 | ``symlink`` |
|
1035 | ``symlink`` | |
1036 | This tool can merge symlinks. Defaults to False, even if tool was |
|
1036 | This tool can merge symlinks. Defaults to False, even if tool was | |
1037 | selected by file pattern match. |
|
1037 | selected by file pattern match. | |
1038 |
|
1038 | |||
1039 | ``check`` |
|
1039 | ``check`` | |
1040 | A list of merge success-checking options: |
|
1040 | A list of merge success-checking options: | |
1041 |
|
1041 | |||
1042 | ``changed`` |
|
1042 | ``changed`` | |
1043 | Ask whether merge was successful when the merged file shows no changes. |
|
1043 | Ask whether merge was successful when the merged file shows no changes. | |
1044 | ``conflicts`` |
|
1044 | ``conflicts`` | |
1045 | Check whether there are conflicts even though the tool reported success. |
|
1045 | Check whether there are conflicts even though the tool reported success. | |
1046 | ``prompt`` |
|
1046 | ``prompt`` | |
1047 | Always prompt for merge success, regardless of success reported by tool. |
|
1047 | Always prompt for merge success, regardless of success reported by tool. | |
1048 |
|
1048 | |||
1049 | ``fixeol`` |
|
1049 | ``fixeol`` | |
1050 | Attempt to fix up EOL changes caused by the merge tool. |
|
1050 | Attempt to fix up EOL changes caused by the merge tool. | |
1051 | Default: False |
|
1051 | Default: False | |
1052 |
|
1052 | |||
1053 | ``gui`` |
|
1053 | ``gui`` | |
1054 | This tool requires a graphical interface to run. Default: False |
|
1054 | This tool requires a graphical interface to run. Default: False | |
1055 |
|
1055 | |||
1056 | ``regkey`` |
|
1056 | ``regkey`` | |
1057 | Windows registry key which describes install location of this |
|
1057 | Windows registry key which describes install location of this | |
1058 | tool. Mercurial will search for this key first under |
|
1058 | tool. Mercurial will search for this key first under | |
1059 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1059 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
1060 | Default: None |
|
1060 | Default: None | |
1061 |
|
1061 | |||
1062 | ``regkeyalt`` |
|
1062 | ``regkeyalt`` | |
1063 | An alternate Windows registry key to try if the first key is not |
|
1063 | An alternate Windows registry key to try if the first key is not | |
1064 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1064 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
1065 | semantics of the primary key. The most common use for this key |
|
1065 | semantics of the primary key. The most common use for this key | |
1066 | is to search for 32bit applications on 64bit operating systems. |
|
1066 | is to search for 32bit applications on 64bit operating systems. | |
1067 | Default: None |
|
1067 | Default: None | |
1068 |
|
1068 | |||
1069 | ``regname`` |
|
1069 | ``regname`` | |
1070 | Name of value to read from specified registry key. Defaults to the |
|
1070 | Name of value to read from specified registry key. Defaults to the | |
1071 | unnamed (default) value. |
|
1071 | unnamed (default) value. | |
1072 |
|
1072 | |||
1073 | ``regappend`` |
|
1073 | ``regappend`` | |
1074 | String to append to the value read from the registry, typically |
|
1074 | String to append to the value read from the registry, typically | |
1075 | the executable name of the tool. |
|
1075 | the executable name of the tool. | |
1076 | Default: None |
|
1076 | Default: None | |
1077 |
|
1077 | |||
1078 |
|
1078 | |||
1079 | ``patch`` |
|
1079 | ``patch`` | |
1080 | --------- |
|
1080 | --------- | |
1081 |
|
1081 | |||
1082 | Settings used when applying patches, for instance through the 'import' |
|
1082 | Settings used when applying patches, for instance through the 'import' | |
1083 | command or with Mercurial Queues extension. |
|
1083 | command or with Mercurial Queues extension. | |
1084 |
|
1084 | |||
1085 | ``eol`` |
|
1085 | ``eol`` | |
1086 | When set to 'strict' patch content and patched files end of lines |
|
1086 | When set to 'strict' patch content and patched files end of lines | |
1087 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1087 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1088 | lines are ignored when patching and the result line endings are |
|
1088 | lines are ignored when patching and the result line endings are | |
1089 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1089 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1090 | ``auto``, end of lines are again ignored while patching but line |
|
1090 | ``auto``, end of lines are again ignored while patching but line | |
1091 | endings in patched files are normalized to their original setting |
|
1091 | endings in patched files are normalized to their original setting | |
1092 | on a per-file basis. If target file does not exist or has no end |
|
1092 | on a per-file basis. If target file does not exist or has no end | |
1093 | of line, patch line endings are preserved. |
|
1093 | of line, patch line endings are preserved. | |
1094 | Default: strict. |
|
1094 | Default: strict. | |
1095 |
|
1095 | |||
1096 | ``fuzz`` |
|
1096 | ``fuzz`` | |
1097 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1097 | The number of lines of 'fuzz' to allow when applying patches. This | |
1098 | controls how much context the patcher is allowed to ignore when |
|
1098 | controls how much context the patcher is allowed to ignore when | |
1099 | trying to apply a patch. |
|
1099 | trying to apply a patch. | |
1100 | Default: 2 |
|
1100 | Default: 2 | |
1101 |
|
1101 | |||
1102 | ``paths`` |
|
1102 | ``paths`` | |
1103 | --------- |
|
1103 | --------- | |
1104 |
|
1104 | |||
1105 | Assigns symbolic names to repositories. The left side is the |
|
1105 | Assigns symbolic names to repositories. The left side is the | |
1106 | symbolic name, and the right gives the directory or URL that is the |
|
1106 | symbolic name, and the right gives the directory or URL that is the | |
1107 | location of the repository. Default paths can be declared by setting |
|
1107 | location of the repository. Default paths can be declared by setting | |
1108 | the following entries. |
|
1108 | the following entries. | |
1109 |
|
1109 | |||
1110 | ``default`` |
|
1110 | ``default`` | |
1111 | Directory or URL to use when pulling if no source is specified. |
|
1111 | Directory or URL to use when pulling if no source is specified. | |
1112 | Default is set to repository from which the current repository was |
|
1112 | Default is set to repository from which the current repository was | |
1113 | cloned. |
|
1113 | cloned. | |
1114 |
|
1114 | |||
1115 | ``default-push`` |
|
1115 | ``default-push`` | |
1116 | Optional. Directory or URL to use when pushing if no destination |
|
1116 | Optional. Directory or URL to use when pushing if no destination | |
1117 | is specified. |
|
1117 | is specified. | |
1118 |
|
1118 | |||
1119 | Custom paths can be defined by assigning the path to a name that later can be |
|
1119 | Custom paths can be defined by assigning the path to a name that later can be | |
1120 | used from the command line. Example:: |
|
1120 | used from the command line. Example:: | |
1121 |
|
1121 | |||
1122 | [paths] |
|
1122 | [paths] | |
1123 | my_path = http://example.com/path |
|
1123 | my_path = http://example.com/path | |
1124 |
|
1124 | |||
1125 | To push to the path defined in ``my_path`` run the command:: |
|
1125 | To push to the path defined in ``my_path`` run the command:: | |
1126 |
|
1126 | |||
1127 | hg push my_path |
|
1127 | hg push my_path | |
1128 |
|
1128 | |||
1129 |
|
1129 | |||
1130 | ``phases`` |
|
1130 | ``phases`` | |
1131 | ---------- |
|
1131 | ---------- | |
1132 |
|
1132 | |||
1133 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1133 | Specifies default handling of phases. See :hg:`help phases` for more | |
1134 | information about working with phases. |
|
1134 | information about working with phases. | |
1135 |
|
1135 | |||
1136 | ``publish`` |
|
1136 | ``publish`` | |
1137 | Controls draft phase behavior when working as a server. When true, |
|
1137 | Controls draft phase behavior when working as a server. When true, | |
1138 | pushed changesets are set to public in both client and server and |
|
1138 | pushed changesets are set to public in both client and server and | |
1139 | pulled or cloned changesets are set to public in the client. |
|
1139 | pulled or cloned changesets are set to public in the client. | |
1140 | Default: True |
|
1140 | Default: True | |
1141 |
|
1141 | |||
1142 | ``new-commit`` |
|
1142 | ``new-commit`` | |
1143 | Phase of newly-created commits. |
|
1143 | Phase of newly-created commits. | |
1144 | Default: draft |
|
1144 | Default: draft | |
1145 |
|
1145 | |||
1146 | ``checksubrepos`` |
|
1146 | ``checksubrepos`` | |
1147 | Check the phase of the current revision of each subrepository. Allowed |
|
1147 | Check the phase of the current revision of each subrepository. Allowed | |
1148 | values are "ignore", "follow" and "abort". For settings other than |
|
1148 | values are "ignore", "follow" and "abort". For settings other than | |
1149 | "ignore", the phase of the current revision of each subrepository is |
|
1149 | "ignore", the phase of the current revision of each subrepository is | |
1150 | checked before committing the parent repository. If any of those phases is |
|
1150 | checked before committing the parent repository. If any of those phases is | |
1151 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1151 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1152 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1152 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1153 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1153 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1154 | used for the parent repository commit (if set to "follow"). |
|
1154 | used for the parent repository commit (if set to "follow"). | |
1155 | Default: "follow" |
|
1155 | Default: "follow" | |
1156 |
|
1156 | |||
1157 |
|
1157 | |||
1158 | ``profiling`` |
|
1158 | ``profiling`` | |
1159 | ------------- |
|
1159 | ------------- | |
1160 |
|
1160 | |||
1161 | Specifies profiling type, format, and file output. Two profilers are |
|
1161 | Specifies profiling type, format, and file output. Two profilers are | |
1162 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1162 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1163 | profiler (named ``stat``). |
|
1163 | profiler (named ``stat``). | |
1164 |
|
1164 | |||
1165 | In this section description, 'profiling data' stands for the raw data |
|
1165 | In this section description, 'profiling data' stands for the raw data | |
1166 | collected during profiling, while 'profiling report' stands for a |
|
1166 | collected during profiling, while 'profiling report' stands for a | |
1167 | statistical text report generated from the profiling data. The |
|
1167 | statistical text report generated from the profiling data. The | |
1168 | profiling is done using lsprof. |
|
1168 | profiling is done using lsprof. | |
1169 |
|
1169 | |||
1170 | ``type`` |
|
1170 | ``type`` | |
1171 | The type of profiler to use. |
|
1171 | The type of profiler to use. | |
1172 | Default: ls. |
|
1172 | Default: ls. | |
1173 |
|
1173 | |||
1174 | ``ls`` |
|
1174 | ``ls`` | |
1175 | Use Python's built-in instrumenting profiler. This profiler |
|
1175 | Use Python's built-in instrumenting profiler. This profiler | |
1176 | works on all platforms, but each line number it reports is the |
|
1176 | works on all platforms, but each line number it reports is the | |
1177 | first line of a function. This restriction makes it difficult to |
|
1177 | first line of a function. This restriction makes it difficult to | |
1178 | identify the expensive parts of a non-trivial function. |
|
1178 | identify the expensive parts of a non-trivial function. | |
1179 | ``stat`` |
|
1179 | ``stat`` | |
1180 | Use a third-party statistical profiler, statprof. This profiler |
|
1180 | Use a third-party statistical profiler, statprof. This profiler | |
1181 | currently runs only on Unix systems, and is most useful for |
|
1181 | currently runs only on Unix systems, and is most useful for | |
1182 | profiling commands that run for longer than about 0.1 seconds. |
|
1182 | profiling commands that run for longer than about 0.1 seconds. | |
1183 |
|
1183 | |||
1184 | ``format`` |
|
1184 | ``format`` | |
1185 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1185 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1186 | Default: text. |
|
1186 | Default: text. | |
1187 |
|
1187 | |||
1188 | ``text`` |
|
1188 | ``text`` | |
1189 | Generate a profiling report. When saving to a file, it should be |
|
1189 | Generate a profiling report. When saving to a file, it should be | |
1190 | noted that only the report is saved, and the profiling data is |
|
1190 | noted that only the report is saved, and the profiling data is | |
1191 | not kept. |
|
1191 | not kept. | |
1192 | ``kcachegrind`` |
|
1192 | ``kcachegrind`` | |
1193 | Format profiling data for kcachegrind use: when saving to a |
|
1193 | Format profiling data for kcachegrind use: when saving to a | |
1194 | file, the generated file can directly be loaded into |
|
1194 | file, the generated file can directly be loaded into | |
1195 | kcachegrind. |
|
1195 | kcachegrind. | |
1196 |
|
1196 | |||
1197 | ``frequency`` |
|
1197 | ``frequency`` | |
1198 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1198 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1199 | Default: 1000. |
|
1199 | Default: 1000. | |
1200 |
|
1200 | |||
1201 | ``output`` |
|
1201 | ``output`` | |
1202 | File path where profiling data or report should be saved. If the |
|
1202 | File path where profiling data or report should be saved. If the | |
1203 | file exists, it is replaced. Default: None, data is printed on |
|
1203 | file exists, it is replaced. Default: None, data is printed on | |
1204 | stderr |
|
1204 | stderr | |
1205 |
|
1205 | |||
1206 | ``sort`` |
|
1206 | ``sort`` | |
1207 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1207 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1208 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1208 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1209 | ``inlinetime``. |
|
1209 | ``inlinetime``. | |
1210 | Default: inlinetime. |
|
1210 | Default: inlinetime. | |
1211 |
|
1211 | |||
1212 | ``limit`` |
|
1212 | ``limit`` | |
1213 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1213 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1214 | Default: 30. |
|
1214 | Default: 30. | |
1215 |
|
1215 | |||
1216 | ``nested`` |
|
1216 | ``nested`` | |
1217 | Show at most this number of lines of drill-down info after each main entry. |
|
1217 | Show at most this number of lines of drill-down info after each main entry. | |
1218 | This can help explain the difference between Total and Inline. |
|
1218 | This can help explain the difference between Total and Inline. | |
1219 | Specific to the ``ls`` instrumenting profiler. |
|
1219 | Specific to the ``ls`` instrumenting profiler. | |
1220 | Default: 5. |
|
1220 | Default: 5. | |
1221 |
|
1221 | |||
1222 | ``progress`` |
|
1222 | ``progress`` | |
1223 | ------------ |
|
1223 | ------------ | |
1224 |
|
1224 | |||
1225 | Mercurial commands can draw progress bars that are as informative as |
|
1225 | Mercurial commands can draw progress bars that are as informative as | |
1226 | possible. Some progress bars only offer indeterminate information, while others |
|
1226 | possible. Some progress bars only offer indeterminate information, while others | |
1227 | have a definite end point. |
|
1227 | have a definite end point. | |
1228 |
|
1228 | |||
1229 | ``delay`` |
|
1229 | ``delay`` | |
1230 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1230 | Number of seconds (float) before showing the progress bar. (default: 3) | |
1231 |
|
1231 | |||
1232 | ``changedelay`` |
|
1232 | ``changedelay`` | |
1233 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1233 | Minimum delay before showing a new topic. When set to less than 3 * refresh, | |
1234 | that value will be used instead. (default: 1) |
|
1234 | that value will be used instead. (default: 1) | |
1235 |
|
1235 | |||
1236 | ``refresh`` |
|
1236 | ``refresh`` | |
1237 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1237 | Time in seconds between refreshes of the progress bar. (default: 0.1) | |
1238 |
|
1238 | |||
1239 | ``format`` |
|
1239 | ``format`` | |
1240 | Format of the progress bar. |
|
1240 | Format of the progress bar. | |
1241 |
|
1241 | |||
1242 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1242 | Valid entries for the format field are ``topic``, ``bar``, ``number``, | |
1243 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 |
|
1243 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 | |
1244 | characters of the item, but this can be changed by adding either ``-<num>`` |
|
1244 | characters of the item, but this can be changed by adding either ``-<num>`` | |
1245 | which would take the last num characters, or ``+<num>`` for the first num |
|
1245 | which would take the last num characters, or ``+<num>`` for the first num | |
1246 | characters. |
|
1246 | characters. | |
1247 |
|
1247 | |||
1248 | (default: Topic bar number estimate) |
|
1248 | (default: Topic bar number estimate) | |
1249 |
|
1249 | |||
1250 | ``width`` |
|
1250 | ``width`` | |
1251 | If set, the maximum width of the progress information (that is, min(width, |
|
1251 | If set, the maximum width of the progress information (that is, min(width, | |
1252 | term width) will be used) |
|
1252 | term width) will be used) | |
1253 |
|
1253 | |||
1254 | ``clear-complete`` |
|
1254 | ``clear-complete`` | |
1255 | clear the progress bar after it's done (default to True) |
|
1255 | clear the progress bar after it's done (default to True) | |
1256 |
|
1256 | |||
1257 | ``disable`` |
|
1257 | ``disable`` | |
1258 | If true, don't show a progress bar |
|
1258 | If true, don't show a progress bar | |
1259 |
|
1259 | |||
1260 | ``assume-tty`` |
|
1260 | ``assume-tty`` | |
1261 | If true, ALWAYS show a progress bar, unless disable is given |
|
1261 | If true, ALWAYS show a progress bar, unless disable is given | |
1262 |
|
1262 | |||
1263 | ``revsetalias`` |
|
1263 | ``revsetalias`` | |
1264 | --------------- |
|
1264 | --------------- | |
1265 |
|
1265 | |||
1266 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1266 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1267 |
|
1267 | |||
1268 | ``server`` |
|
1268 | ``server`` | |
1269 | ---------- |
|
1269 | ---------- | |
1270 |
|
1270 | |||
1271 | Controls generic server settings. |
|
1271 | Controls generic server settings. | |
1272 |
|
1272 | |||
1273 | ``uncompressed`` |
|
1273 | ``uncompressed`` | |
1274 | Whether to allow clients to clone a repository using the |
|
1274 | Whether to allow clients to clone a repository using the | |
1275 | uncompressed streaming protocol. This transfers about 40% more |
|
1275 | uncompressed streaming protocol. This transfers about 40% more | |
1276 | data than a regular clone, but uses less memory and CPU on both |
|
1276 | data than a regular clone, but uses less memory and CPU on both | |
1277 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1277 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1278 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1278 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1279 | regular clone. Over most WAN connections (anything slower than |
|
1279 | regular clone. Over most WAN connections (anything slower than | |
1280 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1280 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1281 | extra data transfer overhead. This mode will also temporarily hold |
|
1281 | extra data transfer overhead. This mode will also temporarily hold | |
1282 | the write lock while determining what data to transfer. |
|
1282 | the write lock while determining what data to transfer. | |
1283 | Default is True. |
|
1283 | Default is True. | |
1284 |
|
1284 | |||
1285 | ``preferuncompressed`` |
|
1285 | ``preferuncompressed`` | |
1286 | When set, clients will try to use the uncompressed streaming |
|
1286 | When set, clients will try to use the uncompressed streaming | |
1287 | protocol. Default is False. |
|
1287 | protocol. Default is False. | |
1288 |
|
1288 | |||
1289 | ``validate`` |
|
1289 | ``validate`` | |
1290 | Whether to validate the completeness of pushed changesets by |
|
1290 | Whether to validate the completeness of pushed changesets by | |
1291 | checking that all new file revisions specified in manifests are |
|
1291 | checking that all new file revisions specified in manifests are | |
1292 | present. Default is False. |
|
1292 | present. Default is False. | |
1293 |
|
1293 | |||
|
1294 | ``maxhttpheaderlen`` | |||
|
1295 | Instruct HTTP clients not to send request headers longer than this | |||
|
1296 | many bytes. Default is 1024. | |||
|
1297 | ||||
1294 | ``smtp`` |
|
1298 | ``smtp`` | |
1295 | -------- |
|
1299 | -------- | |
1296 |
|
1300 | |||
1297 | Configuration for extensions that need to send email messages. |
|
1301 | Configuration for extensions that need to send email messages. | |
1298 |
|
1302 | |||
1299 | ``host`` |
|
1303 | ``host`` | |
1300 | Host name of mail server, e.g. "mail.example.com". |
|
1304 | Host name of mail server, e.g. "mail.example.com". | |
1301 |
|
1305 | |||
1302 | ``port`` |
|
1306 | ``port`` | |
1303 | Optional. Port to connect to on mail server. Default: 465 (if |
|
1307 | Optional. Port to connect to on mail server. Default: 465 (if | |
1304 | ``tls`` is smtps) or 25 (otherwise). |
|
1308 | ``tls`` is smtps) or 25 (otherwise). | |
1305 |
|
1309 | |||
1306 | ``tls`` |
|
1310 | ``tls`` | |
1307 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1311 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1308 | smtps or none. Default: none. |
|
1312 | smtps or none. Default: none. | |
1309 |
|
1313 | |||
1310 | ``verifycert`` |
|
1314 | ``verifycert`` | |
1311 | Optional. Verification for the certificate of mail server, when |
|
1315 | Optional. Verification for the certificate of mail server, when | |
1312 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1316 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1313 | "strict" or "loose", the certificate is verified as same as the |
|
1317 | "strict" or "loose", the certificate is verified as same as the | |
1314 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1318 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1315 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1319 | ``[web] cacerts`` also). For "strict", sending email is also | |
1316 | aborted, if there is no configuration for mail server in |
|
1320 | aborted, if there is no configuration for mail server in | |
1317 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1321 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1318 | :hg:`email` overwrites this as "loose". Default: "strict". |
|
1322 | :hg:`email` overwrites this as "loose". Default: "strict". | |
1319 |
|
1323 | |||
1320 | ``username`` |
|
1324 | ``username`` | |
1321 | Optional. User name for authenticating with the SMTP server. |
|
1325 | Optional. User name for authenticating with the SMTP server. | |
1322 | Default: none. |
|
1326 | Default: none. | |
1323 |
|
1327 | |||
1324 | ``password`` |
|
1328 | ``password`` | |
1325 | Optional. Password for authenticating with the SMTP server. If not |
|
1329 | Optional. Password for authenticating with the SMTP server. If not | |
1326 | specified, interactive sessions will prompt the user for a |
|
1330 | specified, interactive sessions will prompt the user for a | |
1327 | password; non-interactive sessions will fail. Default: none. |
|
1331 | password; non-interactive sessions will fail. Default: none. | |
1328 |
|
1332 | |||
1329 | ``local_hostname`` |
|
1333 | ``local_hostname`` | |
1330 | Optional. It's the hostname that the sender can use to identify |
|
1334 | Optional. It's the hostname that the sender can use to identify | |
1331 | itself to the MTA. |
|
1335 | itself to the MTA. | |
1332 |
|
1336 | |||
1333 |
|
1337 | |||
1334 | ``subpaths`` |
|
1338 | ``subpaths`` | |
1335 | ------------ |
|
1339 | ------------ | |
1336 |
|
1340 | |||
1337 | Subrepository source URLs can go stale if a remote server changes name |
|
1341 | Subrepository source URLs can go stale if a remote server changes name | |
1338 | or becomes temporarily unavailable. This section lets you define |
|
1342 | or becomes temporarily unavailable. This section lets you define | |
1339 | rewrite rules of the form:: |
|
1343 | rewrite rules of the form:: | |
1340 |
|
1344 | |||
1341 | <pattern> = <replacement> |
|
1345 | <pattern> = <replacement> | |
1342 |
|
1346 | |||
1343 | where ``pattern`` is a regular expression matching a subrepository |
|
1347 | where ``pattern`` is a regular expression matching a subrepository | |
1344 | source URL and ``replacement`` is the replacement string used to |
|
1348 | source URL and ``replacement`` is the replacement string used to | |
1345 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1349 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1346 | ``replacements``. For instance:: |
|
1350 | ``replacements``. For instance:: | |
1347 |
|
1351 | |||
1348 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1352 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1349 |
|
1353 | |||
1350 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1354 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1351 |
|
1355 | |||
1352 | Relative subrepository paths are first made absolute, and the |
|
1356 | Relative subrepository paths are first made absolute, and the | |
1353 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1357 | rewrite rules are then applied on the full (absolute) path. The rules | |
1354 | are applied in definition order. |
|
1358 | are applied in definition order. | |
1355 |
|
1359 | |||
1356 | ``trusted`` |
|
1360 | ``trusted`` | |
1357 | ----------- |
|
1361 | ----------- | |
1358 |
|
1362 | |||
1359 | Mercurial will not use the settings in the |
|
1363 | Mercurial will not use the settings in the | |
1360 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1364 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1361 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1365 | user or to a trusted group, as various hgrc features allow arbitrary | |
1362 | commands to be run. This issue is often encountered when configuring |
|
1366 | commands to be run. This issue is often encountered when configuring | |
1363 | hooks or extensions for shared repositories or servers. However, |
|
1367 | hooks or extensions for shared repositories or servers. However, | |
1364 | the web interface will use some safe settings from the ``[web]`` |
|
1368 | the web interface will use some safe settings from the ``[web]`` | |
1365 | section. |
|
1369 | section. | |
1366 |
|
1370 | |||
1367 | This section specifies what users and groups are trusted. The |
|
1371 | This section specifies what users and groups are trusted. The | |
1368 | current user is always trusted. To trust everybody, list a user or a |
|
1372 | current user is always trusted. To trust everybody, list a user or a | |
1369 | group with name ``*``. These settings must be placed in an |
|
1373 | group with name ``*``. These settings must be placed in an | |
1370 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1374 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1371 | user or service running Mercurial. |
|
1375 | user or service running Mercurial. | |
1372 |
|
1376 | |||
1373 | ``users`` |
|
1377 | ``users`` | |
1374 | Comma-separated list of trusted users. |
|
1378 | Comma-separated list of trusted users. | |
1375 |
|
1379 | |||
1376 | ``groups`` |
|
1380 | ``groups`` | |
1377 | Comma-separated list of trusted groups. |
|
1381 | Comma-separated list of trusted groups. | |
1378 |
|
1382 | |||
1379 |
|
1383 | |||
1380 | ``ui`` |
|
1384 | ``ui`` | |
1381 | ------ |
|
1385 | ------ | |
1382 |
|
1386 | |||
1383 | User interface controls. |
|
1387 | User interface controls. | |
1384 |
|
1388 | |||
1385 | ``archivemeta`` |
|
1389 | ``archivemeta`` | |
1386 | Whether to include the .hg_archival.txt file containing meta data |
|
1390 | Whether to include the .hg_archival.txt file containing meta data | |
1387 | (hashes for the repository base and for tip) in archives created |
|
1391 | (hashes for the repository base and for tip) in archives created | |
1388 | by the :hg:`archive` command or downloaded via hgweb. |
|
1392 | by the :hg:`archive` command or downloaded via hgweb. | |
1389 | Default is True. |
|
1393 | Default is True. | |
1390 |
|
1394 | |||
1391 | ``askusername`` |
|
1395 | ``askusername`` | |
1392 | Whether to prompt for a username when committing. If True, and |
|
1396 | Whether to prompt for a username when committing. If True, and | |
1393 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1397 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1394 | be prompted to enter a username. If no username is entered, the |
|
1398 | be prompted to enter a username. If no username is entered, the | |
1395 | default ``USER@HOST`` is used instead. |
|
1399 | default ``USER@HOST`` is used instead. | |
1396 | Default is False. |
|
1400 | Default is False. | |
1397 |
|
1401 | |||
1398 | ``commitsubrepos`` |
|
1402 | ``commitsubrepos`` | |
1399 | Whether to commit modified subrepositories when committing the |
|
1403 | Whether to commit modified subrepositories when committing the | |
1400 | parent repository. If False and one subrepository has uncommitted |
|
1404 | parent repository. If False and one subrepository has uncommitted | |
1401 | changes, abort the commit. |
|
1405 | changes, abort the commit. | |
1402 | Default is False. |
|
1406 | Default is False. | |
1403 |
|
1407 | |||
1404 | ``debug`` |
|
1408 | ``debug`` | |
1405 | Print debugging information. True or False. Default is False. |
|
1409 | Print debugging information. True or False. Default is False. | |
1406 |
|
1410 | |||
1407 | ``editor`` |
|
1411 | ``editor`` | |
1408 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
1412 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
1409 |
|
1413 | |||
1410 | ``fallbackencoding`` |
|
1414 | ``fallbackencoding`` | |
1411 | Encoding to try if it's not possible to decode the changelog using |
|
1415 | Encoding to try if it's not possible to decode the changelog using | |
1412 | UTF-8. Default is ISO-8859-1. |
|
1416 | UTF-8. Default is ISO-8859-1. | |
1413 |
|
1417 | |||
1414 | ``ignore`` |
|
1418 | ``ignore`` | |
1415 | A file to read per-user ignore patterns from. This file should be |
|
1419 | A file to read per-user ignore patterns from. This file should be | |
1416 | in the same format as a repository-wide .hgignore file. Filenames |
|
1420 | in the same format as a repository-wide .hgignore file. Filenames | |
1417 | are relative to the repository root. This option supports hook syntax, |
|
1421 | are relative to the repository root. This option supports hook syntax, | |
1418 | so if you want to specify multiple ignore files, you can do so by |
|
1422 | so if you want to specify multiple ignore files, you can do so by | |
1419 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
1423 | setting something like ``ignore.other = ~/.hgignore2``. For details | |
1420 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
1424 | of the ignore file format, see the ``hgignore(5)`` man page. | |
1421 |
|
1425 | |||
1422 | ``interactive`` |
|
1426 | ``interactive`` | |
1423 | Allow to prompt the user. True or False. Default is True. |
|
1427 | Allow to prompt the user. True or False. Default is True. | |
1424 |
|
1428 | |||
1425 | ``logtemplate`` |
|
1429 | ``logtemplate`` | |
1426 | Template string for commands that print changesets. |
|
1430 | Template string for commands that print changesets. | |
1427 |
|
1431 | |||
1428 | ``merge`` |
|
1432 | ``merge`` | |
1429 | The conflict resolution program to use during a manual merge. |
|
1433 | The conflict resolution program to use during a manual merge. | |
1430 | For more information on merge tools see :hg:`help merge-tools`. |
|
1434 | For more information on merge tools see :hg:`help merge-tools`. | |
1431 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1435 | For configuring merge tools see the ``[merge-tools]`` section. | |
1432 |
|
1436 | |||
1433 | ``mergemarkers`` |
|
1437 | ``mergemarkers`` | |
1434 | Sets the merge conflict marker label styling. The ``detailed`` |
|
1438 | Sets the merge conflict marker label styling. The ``detailed`` | |
1435 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
1439 | style uses the ``mergemarkertemplate`` setting to style the labels. | |
1436 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
1440 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
1437 | One of ``basic`` or ``detailed``. |
|
1441 | One of ``basic`` or ``detailed``. | |
1438 | Default is ``basic``. |
|
1442 | Default is ``basic``. | |
1439 |
|
1443 | |||
1440 | ``mergemarkertemplate`` |
|
1444 | ``mergemarkertemplate`` | |
1441 | The template used to print the commit description next to each conflict |
|
1445 | The template used to print the commit description next to each conflict | |
1442 | marker during merge conflicts. See :hg:`help templates` for the template |
|
1446 | marker during merge conflicts. See :hg:`help templates` for the template | |
1443 | format. |
|
1447 | format. | |
1444 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
1448 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
1445 | the first line of the commit description. |
|
1449 | the first line of the commit description. | |
1446 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
1450 | If you use non-ASCII characters in names for tags, branches, bookmarks, | |
1447 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
1451 | authors, and/or commit descriptions, you must pay attention to encodings of | |
1448 | managed files. At template expansion, non-ASCII characters use the encoding |
|
1452 | managed files. At template expansion, non-ASCII characters use the encoding | |
1449 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
1453 | specified by the ``--encoding`` global option, ``HGENCODING`` or other | |
1450 | environment variables that govern your locale. If the encoding of the merge |
|
1454 | environment variables that govern your locale. If the encoding of the merge | |
1451 | markers is different from the encoding of the merged files, |
|
1455 | markers is different from the encoding of the merged files, | |
1452 | serious problems may occur. |
|
1456 | serious problems may occur. | |
1453 |
|
1457 | |||
1454 | ``patch`` |
|
1458 | ``patch`` | |
1455 | An optional external tool that ``hg import`` and some extensions |
|
1459 | An optional external tool that ``hg import`` and some extensions | |
1456 | will use for applying patches. By default Mercurial uses an |
|
1460 | will use for applying patches. By default Mercurial uses an | |
1457 | internal patch utility. The external tool must work as the common |
|
1461 | internal patch utility. The external tool must work as the common | |
1458 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
1462 | Unix ``patch`` program. In particular, it must accept a ``-p`` | |
1459 | argument to strip patch headers, a ``-d`` argument to specify the |
|
1463 | argument to strip patch headers, a ``-d`` argument to specify the | |
1460 | current directory, a file name to patch, and a patch file to take |
|
1464 | current directory, a file name to patch, and a patch file to take | |
1461 | from stdin. |
|
1465 | from stdin. | |
1462 |
|
1466 | |||
1463 | It is possible to specify a patch tool together with extra |
|
1467 | It is possible to specify a patch tool together with extra | |
1464 | arguments. For example, setting this option to ``patch --merge`` |
|
1468 | arguments. For example, setting this option to ``patch --merge`` | |
1465 | will use the ``patch`` program with its 2-way merge option. |
|
1469 | will use the ``patch`` program with its 2-way merge option. | |
1466 |
|
1470 | |||
1467 | ``portablefilenames`` |
|
1471 | ``portablefilenames`` | |
1468 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1472 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1469 | Default is ``warn``. |
|
1473 | Default is ``warn``. | |
1470 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1474 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1471 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1475 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1472 | with a name that can't be created on Windows because it contains reserved |
|
1476 | with a name that can't be created on Windows because it contains reserved | |
1473 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1477 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1474 | collision with an existing file). |
|
1478 | collision with an existing file). | |
1475 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1479 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1476 | If set to ``abort``, the command is aborted. |
|
1480 | If set to ``abort``, the command is aborted. | |
1477 | On Windows, this configuration option is ignored and the command aborted. |
|
1481 | On Windows, this configuration option is ignored and the command aborted. | |
1478 |
|
1482 | |||
1479 | ``quiet`` |
|
1483 | ``quiet`` | |
1480 | Reduce the amount of output printed. True or False. Default is False. |
|
1484 | Reduce the amount of output printed. True or False. Default is False. | |
1481 |
|
1485 | |||
1482 | ``remotecmd`` |
|
1486 | ``remotecmd`` | |
1483 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
1487 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
1484 |
|
1488 | |||
1485 | ``report_untrusted`` |
|
1489 | ``report_untrusted`` | |
1486 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1490 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1487 | trusted user or group. True or False. Default is True. |
|
1491 | trusted user or group. True or False. Default is True. | |
1488 |
|
1492 | |||
1489 | ``slash`` |
|
1493 | ``slash`` | |
1490 | Display paths using a slash (``/``) as the path separator. This |
|
1494 | Display paths using a slash (``/``) as the path separator. This | |
1491 | only makes a difference on systems where the default path |
|
1495 | only makes a difference on systems where the default path | |
1492 | separator is not the slash character (e.g. Windows uses the |
|
1496 | separator is not the slash character (e.g. Windows uses the | |
1493 | backslash character (``\``)). |
|
1497 | backslash character (``\``)). | |
1494 | Default is False. |
|
1498 | Default is False. | |
1495 |
|
1499 | |||
1496 | ``statuscopies`` |
|
1500 | ``statuscopies`` | |
1497 | Display copies in the status command. |
|
1501 | Display copies in the status command. | |
1498 |
|
1502 | |||
1499 | ``ssh`` |
|
1503 | ``ssh`` | |
1500 | command to use for SSH connections. Default is ``ssh``. |
|
1504 | command to use for SSH connections. Default is ``ssh``. | |
1501 |
|
1505 | |||
1502 | ``strict`` |
|
1506 | ``strict`` | |
1503 | Require exact command names, instead of allowing unambiguous |
|
1507 | Require exact command names, instead of allowing unambiguous | |
1504 | abbreviations. True or False. Default is False. |
|
1508 | abbreviations. True or False. Default is False. | |
1505 |
|
1509 | |||
1506 | ``style`` |
|
1510 | ``style`` | |
1507 | Name of style to use for command output. |
|
1511 | Name of style to use for command output. | |
1508 |
|
1512 | |||
1509 | ``timeout`` |
|
1513 | ``timeout`` | |
1510 | The timeout used when a lock is held (in seconds), a negative value |
|
1514 | The timeout used when a lock is held (in seconds), a negative value | |
1511 | means no timeout. Default is 600. |
|
1515 | means no timeout. Default is 600. | |
1512 |
|
1516 | |||
1513 | ``traceback`` |
|
1517 | ``traceback`` | |
1514 | Mercurial always prints a traceback when an unknown exception |
|
1518 | Mercurial always prints a traceback when an unknown exception | |
1515 | occurs. Setting this to True will make Mercurial print a traceback |
|
1519 | occurs. Setting this to True will make Mercurial print a traceback | |
1516 | on all exceptions, even those recognized by Mercurial (such as |
|
1520 | on all exceptions, even those recognized by Mercurial (such as | |
1517 | IOError or MemoryError). Default is False. |
|
1521 | IOError or MemoryError). Default is False. | |
1518 |
|
1522 | |||
1519 | ``username`` |
|
1523 | ``username`` | |
1520 | The committer of a changeset created when running "commit". |
|
1524 | The committer of a changeset created when running "commit". | |
1521 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1525 | Typically a person's name and email address, e.g. ``Fred Widget | |
1522 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
1526 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
1523 | the username in hgrc is empty, it has to be specified manually or |
|
1527 | the username in hgrc is empty, it has to be specified manually or | |
1524 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
1528 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
1525 | ``username =`` in the system hgrc). Environment variables in the |
|
1529 | ``username =`` in the system hgrc). Environment variables in the | |
1526 | username are expanded. |
|
1530 | username are expanded. | |
1527 |
|
1531 | |||
1528 | ``verbose`` |
|
1532 | ``verbose`` | |
1529 | Increase the amount of output printed. True or False. Default is False. |
|
1533 | Increase the amount of output printed. True or False. Default is False. | |
1530 |
|
1534 | |||
1531 |
|
1535 | |||
1532 | ``web`` |
|
1536 | ``web`` | |
1533 | ------- |
|
1537 | ------- | |
1534 |
|
1538 | |||
1535 | Web interface configuration. The settings in this section apply to |
|
1539 | Web interface configuration. The settings in this section apply to | |
1536 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1540 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1537 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1541 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1538 | and WSGI). |
|
1542 | and WSGI). | |
1539 |
|
1543 | |||
1540 | The Mercurial webserver does no authentication (it does not prompt for |
|
1544 | The Mercurial webserver does no authentication (it does not prompt for | |
1541 | usernames and passwords to validate *who* users are), but it does do |
|
1545 | usernames and passwords to validate *who* users are), but it does do | |
1542 | authorization (it grants or denies access for *authenticated users* |
|
1546 | authorization (it grants or denies access for *authenticated users* | |
1543 | based on settings in this section). You must either configure your |
|
1547 | based on settings in this section). You must either configure your | |
1544 | webserver to do authentication for you, or disable the authorization |
|
1548 | webserver to do authentication for you, or disable the authorization | |
1545 | checks. |
|
1549 | checks. | |
1546 |
|
1550 | |||
1547 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1551 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1548 | you want it to accept pushes from anybody, you can use the following |
|
1552 | you want it to accept pushes from anybody, you can use the following | |
1549 | command line:: |
|
1553 | command line:: | |
1550 |
|
1554 | |||
1551 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1555 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1552 |
|
1556 | |||
1553 | Note that this will allow anybody to push anything to the server and |
|
1557 | Note that this will allow anybody to push anything to the server and | |
1554 | that this should not be used for public servers. |
|
1558 | that this should not be used for public servers. | |
1555 |
|
1559 | |||
1556 | The full set of options is: |
|
1560 | The full set of options is: | |
1557 |
|
1561 | |||
1558 | ``accesslog`` |
|
1562 | ``accesslog`` | |
1559 | Where to output the access log. Default is stdout. |
|
1563 | Where to output the access log. Default is stdout. | |
1560 |
|
1564 | |||
1561 | ``address`` |
|
1565 | ``address`` | |
1562 | Interface address to bind to. Default is all. |
|
1566 | Interface address to bind to. Default is all. | |
1563 |
|
1567 | |||
1564 | ``allow_archive`` |
|
1568 | ``allow_archive`` | |
1565 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1569 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1566 | Default is empty. |
|
1570 | Default is empty. | |
1567 |
|
1571 | |||
1568 | ``allowbz2`` |
|
1572 | ``allowbz2`` | |
1569 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1573 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1570 | revisions. |
|
1574 | revisions. | |
1571 | Default is False. |
|
1575 | Default is False. | |
1572 |
|
1576 | |||
1573 | ``allowgz`` |
|
1577 | ``allowgz`` | |
1574 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1578 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1575 | revisions. |
|
1579 | revisions. | |
1576 | Default is False. |
|
1580 | Default is False. | |
1577 |
|
1581 | |||
1578 | ``allowpull`` |
|
1582 | ``allowpull`` | |
1579 | Whether to allow pulling from the repository. Default is True. |
|
1583 | Whether to allow pulling from the repository. Default is True. | |
1580 |
|
1584 | |||
1581 | ``allow_push`` |
|
1585 | ``allow_push`` | |
1582 | Whether to allow pushing to the repository. If empty or not set, |
|
1586 | Whether to allow pushing to the repository. If empty or not set, | |
1583 | push is not allowed. If the special value ``*``, any remote user can |
|
1587 | push is not allowed. If the special value ``*``, any remote user can | |
1584 | push, including unauthenticated users. Otherwise, the remote user |
|
1588 | push, including unauthenticated users. Otherwise, the remote user | |
1585 | must have been authenticated, and the authenticated user name must |
|
1589 | must have been authenticated, and the authenticated user name must | |
1586 | be present in this list. The contents of the allow_push list are |
|
1590 | be present in this list. The contents of the allow_push list are | |
1587 | examined after the deny_push list. |
|
1591 | examined after the deny_push list. | |
1588 |
|
1592 | |||
1589 | ``allow_read`` |
|
1593 | ``allow_read`` | |
1590 | If the user has not already been denied repository access due to |
|
1594 | If the user has not already been denied repository access due to | |
1591 | the contents of deny_read, this list determines whether to grant |
|
1595 | the contents of deny_read, this list determines whether to grant | |
1592 | repository access to the user. If this list is not empty, and the |
|
1596 | repository access to the user. If this list is not empty, and the | |
1593 | user is unauthenticated or not present in the list, then access is |
|
1597 | user is unauthenticated or not present in the list, then access is | |
1594 | denied for the user. If the list is empty or not set, then access |
|
1598 | denied for the user. If the list is empty or not set, then access | |
1595 | is permitted to all users by default. Setting allow_read to the |
|
1599 | is permitted to all users by default. Setting allow_read to the | |
1596 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1600 | special value ``*`` is equivalent to it not being set (i.e. access | |
1597 | is permitted to all users). The contents of the allow_read list are |
|
1601 | is permitted to all users). The contents of the allow_read list are | |
1598 | examined after the deny_read list. |
|
1602 | examined after the deny_read list. | |
1599 |
|
1603 | |||
1600 | ``allowzip`` |
|
1604 | ``allowzip`` | |
1601 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1605 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1602 | revisions. Default is False. This feature creates temporary files. |
|
1606 | revisions. Default is False. This feature creates temporary files. | |
1603 |
|
1607 | |||
1604 | ``archivesubrepos`` |
|
1608 | ``archivesubrepos`` | |
1605 | Whether to recurse into subrepositories when archiving. Default is |
|
1609 | Whether to recurse into subrepositories when archiving. Default is | |
1606 | False. |
|
1610 | False. | |
1607 |
|
1611 | |||
1608 | ``baseurl`` |
|
1612 | ``baseurl`` | |
1609 | Base URL to use when publishing URLs in other locations, so |
|
1613 | Base URL to use when publishing URLs in other locations, so | |
1610 | third-party tools like email notification hooks can construct |
|
1614 | third-party tools like email notification hooks can construct | |
1611 | URLs. Example: ``http://hgserver/repos/``. |
|
1615 | URLs. Example: ``http://hgserver/repos/``. | |
1612 |
|
1616 | |||
1613 | ``cacerts`` |
|
1617 | ``cacerts`` | |
1614 | Path to file containing a list of PEM encoded certificate |
|
1618 | Path to file containing a list of PEM encoded certificate | |
1615 | authority certificates. Environment variables and ``~user`` |
|
1619 | authority certificates. Environment variables and ``~user`` | |
1616 | constructs are expanded in the filename. If specified on the |
|
1620 | constructs are expanded in the filename. If specified on the | |
1617 | client, then it will verify the identity of remote HTTPS servers |
|
1621 | client, then it will verify the identity of remote HTTPS servers | |
1618 | with these certificates. |
|
1622 | with these certificates. | |
1619 |
|
1623 | |||
1620 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1624 | This feature is only supported when using Python 2.6 or later. If you wish | |
1621 | to use it with earlier versions of Python, install the backported |
|
1625 | to use it with earlier versions of Python, install the backported | |
1622 | version of the ssl library that is available from |
|
1626 | version of the ssl library that is available from | |
1623 | ``http://pypi.python.org``. |
|
1627 | ``http://pypi.python.org``. | |
1624 |
|
1628 | |||
1625 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1629 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1626 | command line. |
|
1630 | command line. | |
1627 |
|
1631 | |||
1628 | You can use OpenSSL's CA certificate file if your platform has |
|
1632 | You can use OpenSSL's CA certificate file if your platform has | |
1629 | one. On most Linux systems this will be |
|
1633 | one. On most Linux systems this will be | |
1630 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1634 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1631 | generate this file manually. The form must be as follows:: |
|
1635 | generate this file manually. The form must be as follows:: | |
1632 |
|
1636 | |||
1633 | -----BEGIN CERTIFICATE----- |
|
1637 | -----BEGIN CERTIFICATE----- | |
1634 | ... (certificate in base64 PEM encoding) ... |
|
1638 | ... (certificate in base64 PEM encoding) ... | |
1635 | -----END CERTIFICATE----- |
|
1639 | -----END CERTIFICATE----- | |
1636 | -----BEGIN CERTIFICATE----- |
|
1640 | -----BEGIN CERTIFICATE----- | |
1637 | ... (certificate in base64 PEM encoding) ... |
|
1641 | ... (certificate in base64 PEM encoding) ... | |
1638 | -----END CERTIFICATE----- |
|
1642 | -----END CERTIFICATE----- | |
1639 |
|
1643 | |||
1640 | ``cache`` |
|
1644 | ``cache`` | |
1641 | Whether to support caching in hgweb. Defaults to True. |
|
1645 | Whether to support caching in hgweb. Defaults to True. | |
1642 |
|
1646 | |||
1643 | ``collapse`` |
|
1647 | ``collapse`` | |
1644 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1648 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1645 | a single level alongside repositories in the current path. With |
|
1649 | a single level alongside repositories in the current path. With | |
1646 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1650 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1647 | the current path are grouped behind navigable directory entries that |
|
1651 | the current path are grouped behind navigable directory entries that | |
1648 | lead to the locations of these repositories. In effect, this setting |
|
1652 | lead to the locations of these repositories. In effect, this setting | |
1649 | collapses each collection of repositories found within a subdirectory |
|
1653 | collapses each collection of repositories found within a subdirectory | |
1650 | into a single entry for that subdirectory. Default is False. |
|
1654 | into a single entry for that subdirectory. Default is False. | |
1651 |
|
1655 | |||
1652 | ``comparisoncontext`` |
|
1656 | ``comparisoncontext`` | |
1653 | Number of lines of context to show in side-by-side file comparison. If |
|
1657 | Number of lines of context to show in side-by-side file comparison. If | |
1654 | negative or the value ``full``, whole files are shown. Default is 5. |
|
1658 | negative or the value ``full``, whole files are shown. Default is 5. | |
1655 | This setting can be overridden by a ``context`` request parameter to the |
|
1659 | This setting can be overridden by a ``context`` request parameter to the | |
1656 | ``comparison`` command, taking the same values. |
|
1660 | ``comparison`` command, taking the same values. | |
1657 |
|
1661 | |||
1658 | ``contact`` |
|
1662 | ``contact`` | |
1659 | Name or email address of the person in charge of the repository. |
|
1663 | Name or email address of the person in charge of the repository. | |
1660 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1664 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
1661 |
|
1665 | |||
1662 | ``deny_push`` |
|
1666 | ``deny_push`` | |
1663 | Whether to deny pushing to the repository. If empty or not set, |
|
1667 | Whether to deny pushing to the repository. If empty or not set, | |
1664 | push is not denied. If the special value ``*``, all remote users are |
|
1668 | push is not denied. If the special value ``*``, all remote users are | |
1665 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1669 | denied push. Otherwise, unauthenticated users are all denied, and | |
1666 | any authenticated user name present in this list is also denied. The |
|
1670 | any authenticated user name present in this list is also denied. The | |
1667 | contents of the deny_push list are examined before the allow_push list. |
|
1671 | contents of the deny_push list are examined before the allow_push list. | |
1668 |
|
1672 | |||
1669 | ``deny_read`` |
|
1673 | ``deny_read`` | |
1670 | Whether to deny reading/viewing of the repository. If this list is |
|
1674 | Whether to deny reading/viewing of the repository. If this list is | |
1671 | not empty, unauthenticated users are all denied, and any |
|
1675 | not empty, unauthenticated users are all denied, and any | |
1672 | authenticated user name present in this list is also denied access to |
|
1676 | authenticated user name present in this list is also denied access to | |
1673 | the repository. If set to the special value ``*``, all remote users |
|
1677 | the repository. If set to the special value ``*``, all remote users | |
1674 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1678 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1675 | the determination of repository access depends on the presence and |
|
1679 | the determination of repository access depends on the presence and | |
1676 | content of the allow_read list (see description). If both |
|
1680 | content of the allow_read list (see description). If both | |
1677 | deny_read and allow_read are empty or not set, then access is |
|
1681 | deny_read and allow_read are empty or not set, then access is | |
1678 | permitted to all users by default. If the repository is being |
|
1682 | permitted to all users by default. If the repository is being | |
1679 | served via hgwebdir, denied users will not be able to see it in |
|
1683 | served via hgwebdir, denied users will not be able to see it in | |
1680 | the list of repositories. The contents of the deny_read list have |
|
1684 | the list of repositories. The contents of the deny_read list have | |
1681 | priority over (are examined before) the contents of the allow_read |
|
1685 | priority over (are examined before) the contents of the allow_read | |
1682 | list. |
|
1686 | list. | |
1683 |
|
1687 | |||
1684 | ``descend`` |
|
1688 | ``descend`` | |
1685 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1689 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1686 | directly in the current path will be shown (other repositories are still |
|
1690 | directly in the current path will be shown (other repositories are still | |
1687 | available from the index corresponding to their containing path). |
|
1691 | available from the index corresponding to their containing path). | |
1688 |
|
1692 | |||
1689 | ``description`` |
|
1693 | ``description`` | |
1690 | Textual description of the repository's purpose or contents. |
|
1694 | Textual description of the repository's purpose or contents. | |
1691 | Default is "unknown". |
|
1695 | Default is "unknown". | |
1692 |
|
1696 | |||
1693 | ``encoding`` |
|
1697 | ``encoding`` | |
1694 | Character encoding name. Default is the current locale charset. |
|
1698 | Character encoding name. Default is the current locale charset. | |
1695 | Example: "UTF-8" |
|
1699 | Example: "UTF-8" | |
1696 |
|
1700 | |||
1697 | ``errorlog`` |
|
1701 | ``errorlog`` | |
1698 | Where to output the error log. Default is stderr. |
|
1702 | Where to output the error log. Default is stderr. | |
1699 |
|
1703 | |||
1700 | ``guessmime`` |
|
1704 | ``guessmime`` | |
1701 | Control MIME types for raw download of file content. |
|
1705 | Control MIME types for raw download of file content. | |
1702 | Set to True to let hgweb guess the content type from the file |
|
1706 | Set to True to let hgweb guess the content type from the file | |
1703 | extension. This will serve HTML files as ``text/html`` and might |
|
1707 | extension. This will serve HTML files as ``text/html`` and might | |
1704 | allow cross-site scripting attacks when serving untrusted |
|
1708 | allow cross-site scripting attacks when serving untrusted | |
1705 | repositories. Default is False. |
|
1709 | repositories. Default is False. | |
1706 |
|
1710 | |||
1707 | ``hidden`` |
|
1711 | ``hidden`` | |
1708 | Whether to hide the repository in the hgwebdir index. |
|
1712 | Whether to hide the repository in the hgwebdir index. | |
1709 | Default is False. |
|
1713 | Default is False. | |
1710 |
|
1714 | |||
1711 | ``ipv6`` |
|
1715 | ``ipv6`` | |
1712 | Whether to use IPv6. Default is False. |
|
1716 | Whether to use IPv6. Default is False. | |
1713 |
|
1717 | |||
1714 | ``logoimg`` |
|
1718 | ``logoimg`` | |
1715 | File name of the logo image that some templates display on each page. |
|
1719 | File name of the logo image that some templates display on each page. | |
1716 | The file name is relative to ``staticurl``. That is, the full path to |
|
1720 | The file name is relative to ``staticurl``. That is, the full path to | |
1717 | the logo image is "staticurl/logoimg". |
|
1721 | the logo image is "staticurl/logoimg". | |
1718 | If unset, ``hglogo.png`` will be used. |
|
1722 | If unset, ``hglogo.png`` will be used. | |
1719 |
|
1723 | |||
1720 | ``logourl`` |
|
1724 | ``logourl`` | |
1721 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1725 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` | |
1722 | will be used. |
|
1726 | will be used. | |
1723 |
|
1727 | |||
1724 | ``maxchanges`` |
|
1728 | ``maxchanges`` | |
1725 | Maximum number of changes to list on the changelog. Default is 10. |
|
1729 | Maximum number of changes to list on the changelog. Default is 10. | |
1726 |
|
1730 | |||
1727 | ``maxfiles`` |
|
1731 | ``maxfiles`` | |
1728 | Maximum number of files to list per changeset. Default is 10. |
|
1732 | Maximum number of files to list per changeset. Default is 10. | |
1729 |
|
1733 | |||
1730 | ``maxshortchanges`` |
|
1734 | ``maxshortchanges`` | |
1731 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1735 | Maximum number of changes to list on the shortlog, graph or filelog | |
1732 | pages. Default is 60. |
|
1736 | pages. Default is 60. | |
1733 |
|
1737 | |||
1734 | ``name`` |
|
1738 | ``name`` | |
1735 | Repository name to use in the web interface. Default is current |
|
1739 | Repository name to use in the web interface. Default is current | |
1736 | working directory. |
|
1740 | working directory. | |
1737 |
|
1741 | |||
1738 | ``port`` |
|
1742 | ``port`` | |
1739 | Port to listen on. Default is 8000. |
|
1743 | Port to listen on. Default is 8000. | |
1740 |
|
1744 | |||
1741 | ``prefix`` |
|
1745 | ``prefix`` | |
1742 | Prefix path to serve from. Default is '' (server root). |
|
1746 | Prefix path to serve from. Default is '' (server root). | |
1743 |
|
1747 | |||
1744 | ``push_ssl`` |
|
1748 | ``push_ssl`` | |
1745 | Whether to require that inbound pushes be transported over SSL to |
|
1749 | Whether to require that inbound pushes be transported over SSL to | |
1746 | prevent password sniffing. Default is True. |
|
1750 | prevent password sniffing. Default is True. | |
1747 |
|
1751 | |||
1748 | ``staticurl`` |
|
1752 | ``staticurl`` | |
1749 | Base URL to use for static files. If unset, static files (e.g. the |
|
1753 | Base URL to use for static files. If unset, static files (e.g. the | |
1750 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1754 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1751 | this setting to serve them directly with the HTTP server. |
|
1755 | this setting to serve them directly with the HTTP server. | |
1752 | Example: ``http://hgserver/static/``. |
|
1756 | Example: ``http://hgserver/static/``. | |
1753 |
|
1757 | |||
1754 | ``stripes`` |
|
1758 | ``stripes`` | |
1755 | How many lines a "zebra stripe" should span in multi-line output. |
|
1759 | How many lines a "zebra stripe" should span in multi-line output. | |
1756 | Default is 1; set to 0 to disable. |
|
1760 | Default is 1; set to 0 to disable. | |
1757 |
|
1761 | |||
1758 | ``style`` |
|
1762 | ``style`` | |
1759 | Which template map style to use. The available options are the names of |
|
1763 | Which template map style to use. The available options are the names of | |
1760 | subdirectories in the HTML templates path. Default is ``paper``. |
|
1764 | subdirectories in the HTML templates path. Default is ``paper``. | |
1761 | Example: ``monoblue`` |
|
1765 | Example: ``monoblue`` | |
1762 |
|
1766 | |||
1763 | ``templates`` |
|
1767 | ``templates`` | |
1764 | Where to find the HTML templates. The default path to the HTML templates |
|
1768 | Where to find the HTML templates. The default path to the HTML templates | |
1765 | can be obtained from ``hg debuginstall``. |
|
1769 | can be obtained from ``hg debuginstall``. | |
1766 |
|
1770 | |||
1767 | ``websub`` |
|
1771 | ``websub`` | |
1768 | ---------- |
|
1772 | ---------- | |
1769 |
|
1773 | |||
1770 | Web substitution filter definition. You can use this section to |
|
1774 | Web substitution filter definition. You can use this section to | |
1771 | define a set of regular expression substitution patterns which |
|
1775 | define a set of regular expression substitution patterns which | |
1772 | let you automatically modify the hgweb server output. |
|
1776 | let you automatically modify the hgweb server output. | |
1773 |
|
1777 | |||
1774 | The default hgweb templates only apply these substitution patterns |
|
1778 | The default hgweb templates only apply these substitution patterns | |
1775 | on the revision description fields. You can apply them anywhere |
|
1779 | on the revision description fields. You can apply them anywhere | |
1776 | you want when you create your own templates by adding calls to the |
|
1780 | you want when you create your own templates by adding calls to the | |
1777 | "websub" filter (usually after calling the "escape" filter). |
|
1781 | "websub" filter (usually after calling the "escape" filter). | |
1778 |
|
1782 | |||
1779 | This can be used, for example, to convert issue references to links |
|
1783 | This can be used, for example, to convert issue references to links | |
1780 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1784 | to your issue tracker, or to convert "markdown-like" syntax into | |
1781 | HTML (see the examples below). |
|
1785 | HTML (see the examples below). | |
1782 |
|
1786 | |||
1783 | Each entry in this section names a substitution filter. |
|
1787 | Each entry in this section names a substitution filter. | |
1784 | The value of each entry defines the substitution expression itself. |
|
1788 | The value of each entry defines the substitution expression itself. | |
1785 | The websub expressions follow the old interhg extension syntax, |
|
1789 | The websub expressions follow the old interhg extension syntax, | |
1786 | which in turn imitates the Unix sed replacement syntax:: |
|
1790 | which in turn imitates the Unix sed replacement syntax:: | |
1787 |
|
1791 | |||
1788 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1792 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1789 |
|
1793 | |||
1790 | You can use any separator other than "/". The final "i" is optional |
|
1794 | You can use any separator other than "/". The final "i" is optional | |
1791 | and indicates that the search must be case insensitive. |
|
1795 | and indicates that the search must be case insensitive. | |
1792 |
|
1796 | |||
1793 | Examples:: |
|
1797 | Examples:: | |
1794 |
|
1798 | |||
1795 | [websub] |
|
1799 | [websub] | |
1796 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1800 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1797 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1801 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1798 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1802 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1799 |
|
1803 | |||
1800 | ``worker`` |
|
1804 | ``worker`` | |
1801 | ---------- |
|
1805 | ---------- | |
1802 |
|
1806 | |||
1803 | Parallel master/worker configuration. We currently perform working |
|
1807 | Parallel master/worker configuration. We currently perform working | |
1804 | directory updates in parallel on Unix-like systems, which greatly |
|
1808 | directory updates in parallel on Unix-like systems, which greatly | |
1805 | helps performance. |
|
1809 | helps performance. | |
1806 |
|
1810 | |||
1807 | ``numcpus`` |
|
1811 | ``numcpus`` | |
1808 | Number of CPUs to use for parallel operations. Default is 4 or the |
|
1812 | Number of CPUs to use for parallel operations. Default is 4 or the | |
1809 | number of CPUs on the system, whichever is larger. A zero or |
|
1813 | number of CPUs on the system, whichever is larger. A zero or | |
1810 | negative value is treated as ``use the default``. |
|
1814 | negative value is treated as ``use the default``. |
@@ -1,858 +1,859 b'' | |||||
1 | # wireproto.py - generic wire protocol support functions |
|
1 | # wireproto.py - generic wire protocol support functions | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2010 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2010 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 | import urllib, tempfile, os, sys |
|
8 | import urllib, tempfile, os, sys | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | from node import bin, hex |
|
10 | from node import bin, hex | |
11 | import changegroup as changegroupmod, bundle2, pushkey as pushkeymod |
|
11 | import changegroup as changegroupmod, bundle2, pushkey as pushkeymod | |
12 | import peer, error, encoding, util, exchange |
|
12 | import peer, error, encoding, util, exchange | |
13 |
|
13 | |||
14 |
|
14 | |||
15 | class abstractserverproto(object): |
|
15 | class abstractserverproto(object): | |
16 | """abstract class that summarizes the protocol API |
|
16 | """abstract class that summarizes the protocol API | |
17 |
|
17 | |||
18 | Used as reference and documentation. |
|
18 | Used as reference and documentation. | |
19 | """ |
|
19 | """ | |
20 |
|
20 | |||
21 | def getargs(self, args): |
|
21 | def getargs(self, args): | |
22 | """return the value for arguments in <args> |
|
22 | """return the value for arguments in <args> | |
23 |
|
23 | |||
24 | returns a list of values (same order as <args>)""" |
|
24 | returns a list of values (same order as <args>)""" | |
25 | raise NotImplementedError() |
|
25 | raise NotImplementedError() | |
26 |
|
26 | |||
27 | def getfile(self, fp): |
|
27 | def getfile(self, fp): | |
28 | """write the whole content of a file into a file like object |
|
28 | """write the whole content of a file into a file like object | |
29 |
|
29 | |||
30 | The file is in the form:: |
|
30 | The file is in the form:: | |
31 |
|
31 | |||
32 | (<chunk-size>\n<chunk>)+0\n |
|
32 | (<chunk-size>\n<chunk>)+0\n | |
33 |
|
33 | |||
34 | chunk size is the ascii version of the int. |
|
34 | chunk size is the ascii version of the int. | |
35 | """ |
|
35 | """ | |
36 | raise NotImplementedError() |
|
36 | raise NotImplementedError() | |
37 |
|
37 | |||
38 | def redirect(self): |
|
38 | def redirect(self): | |
39 | """may setup interception for stdout and stderr |
|
39 | """may setup interception for stdout and stderr | |
40 |
|
40 | |||
41 | See also the `restore` method.""" |
|
41 | See also the `restore` method.""" | |
42 | raise NotImplementedError() |
|
42 | raise NotImplementedError() | |
43 |
|
43 | |||
44 | # If the `redirect` function does install interception, the `restore` |
|
44 | # If the `redirect` function does install interception, the `restore` | |
45 | # function MUST be defined. If interception is not used, this function |
|
45 | # function MUST be defined. If interception is not used, this function | |
46 | # MUST NOT be defined. |
|
46 | # MUST NOT be defined. | |
47 | # |
|
47 | # | |
48 | # left commented here on purpose |
|
48 | # left commented here on purpose | |
49 | # |
|
49 | # | |
50 | #def restore(self): |
|
50 | #def restore(self): | |
51 | # """reinstall previous stdout and stderr and return intercepted stdout |
|
51 | # """reinstall previous stdout and stderr and return intercepted stdout | |
52 | # """ |
|
52 | # """ | |
53 | # raise NotImplementedError() |
|
53 | # raise NotImplementedError() | |
54 |
|
54 | |||
55 | def groupchunks(self, cg): |
|
55 | def groupchunks(self, cg): | |
56 | """return 4096 chunks from a changegroup object |
|
56 | """return 4096 chunks from a changegroup object | |
57 |
|
57 | |||
58 | Some protocols may have compressed the contents.""" |
|
58 | Some protocols may have compressed the contents.""" | |
59 | raise NotImplementedError() |
|
59 | raise NotImplementedError() | |
60 |
|
60 | |||
61 | # abstract batching support |
|
61 | # abstract batching support | |
62 |
|
62 | |||
63 | class future(object): |
|
63 | class future(object): | |
64 | '''placeholder for a value to be set later''' |
|
64 | '''placeholder for a value to be set later''' | |
65 | def set(self, value): |
|
65 | def set(self, value): | |
66 | if util.safehasattr(self, 'value'): |
|
66 | if util.safehasattr(self, 'value'): | |
67 | raise error.RepoError("future is already set") |
|
67 | raise error.RepoError("future is already set") | |
68 | self.value = value |
|
68 | self.value = value | |
69 |
|
69 | |||
70 | class batcher(object): |
|
70 | class batcher(object): | |
71 | '''base class for batches of commands submittable in a single request |
|
71 | '''base class for batches of commands submittable in a single request | |
72 |
|
72 | |||
73 | All methods invoked on instances of this class are simply queued and |
|
73 | All methods invoked on instances of this class are simply queued and | |
74 | return a a future for the result. Once you call submit(), all the queued |
|
74 | return a a future for the result. Once you call submit(), all the queued | |
75 | calls are performed and the results set in their respective futures. |
|
75 | calls are performed and the results set in their respective futures. | |
76 | ''' |
|
76 | ''' | |
77 | def __init__(self): |
|
77 | def __init__(self): | |
78 | self.calls = [] |
|
78 | self.calls = [] | |
79 | def __getattr__(self, name): |
|
79 | def __getattr__(self, name): | |
80 | def call(*args, **opts): |
|
80 | def call(*args, **opts): | |
81 | resref = future() |
|
81 | resref = future() | |
82 | self.calls.append((name, args, opts, resref,)) |
|
82 | self.calls.append((name, args, opts, resref,)) | |
83 | return resref |
|
83 | return resref | |
84 | return call |
|
84 | return call | |
85 | def submit(self): |
|
85 | def submit(self): | |
86 | pass |
|
86 | pass | |
87 |
|
87 | |||
88 | class localbatch(batcher): |
|
88 | class localbatch(batcher): | |
89 | '''performs the queued calls directly''' |
|
89 | '''performs the queued calls directly''' | |
90 | def __init__(self, local): |
|
90 | def __init__(self, local): | |
91 | batcher.__init__(self) |
|
91 | batcher.__init__(self) | |
92 | self.local = local |
|
92 | self.local = local | |
93 | def submit(self): |
|
93 | def submit(self): | |
94 | for name, args, opts, resref in self.calls: |
|
94 | for name, args, opts, resref in self.calls: | |
95 | resref.set(getattr(self.local, name)(*args, **opts)) |
|
95 | resref.set(getattr(self.local, name)(*args, **opts)) | |
96 |
|
96 | |||
97 | class remotebatch(batcher): |
|
97 | class remotebatch(batcher): | |
98 | '''batches the queued calls; uses as few roundtrips as possible''' |
|
98 | '''batches the queued calls; uses as few roundtrips as possible''' | |
99 | def __init__(self, remote): |
|
99 | def __init__(self, remote): | |
100 | '''remote must support _submitbatch(encbatch) and |
|
100 | '''remote must support _submitbatch(encbatch) and | |
101 | _submitone(op, encargs)''' |
|
101 | _submitone(op, encargs)''' | |
102 | batcher.__init__(self) |
|
102 | batcher.__init__(self) | |
103 | self.remote = remote |
|
103 | self.remote = remote | |
104 | def submit(self): |
|
104 | def submit(self): | |
105 | req, rsp = [], [] |
|
105 | req, rsp = [], [] | |
106 | for name, args, opts, resref in self.calls: |
|
106 | for name, args, opts, resref in self.calls: | |
107 | mtd = getattr(self.remote, name) |
|
107 | mtd = getattr(self.remote, name) | |
108 | batchablefn = getattr(mtd, 'batchable', None) |
|
108 | batchablefn = getattr(mtd, 'batchable', None) | |
109 | if batchablefn is not None: |
|
109 | if batchablefn is not None: | |
110 | batchable = batchablefn(mtd.im_self, *args, **opts) |
|
110 | batchable = batchablefn(mtd.im_self, *args, **opts) | |
111 | encargsorres, encresref = batchable.next() |
|
111 | encargsorres, encresref = batchable.next() | |
112 | if encresref: |
|
112 | if encresref: | |
113 | req.append((name, encargsorres,)) |
|
113 | req.append((name, encargsorres,)) | |
114 | rsp.append((batchable, encresref, resref,)) |
|
114 | rsp.append((batchable, encresref, resref,)) | |
115 | else: |
|
115 | else: | |
116 | resref.set(encargsorres) |
|
116 | resref.set(encargsorres) | |
117 | else: |
|
117 | else: | |
118 | if req: |
|
118 | if req: | |
119 | self._submitreq(req, rsp) |
|
119 | self._submitreq(req, rsp) | |
120 | req, rsp = [], [] |
|
120 | req, rsp = [], [] | |
121 | resref.set(mtd(*args, **opts)) |
|
121 | resref.set(mtd(*args, **opts)) | |
122 | if req: |
|
122 | if req: | |
123 | self._submitreq(req, rsp) |
|
123 | self._submitreq(req, rsp) | |
124 | def _submitreq(self, req, rsp): |
|
124 | def _submitreq(self, req, rsp): | |
125 | encresults = self.remote._submitbatch(req) |
|
125 | encresults = self.remote._submitbatch(req) | |
126 | for encres, r in zip(encresults, rsp): |
|
126 | for encres, r in zip(encresults, rsp): | |
127 | batchable, encresref, resref = r |
|
127 | batchable, encresref, resref = r | |
128 | encresref.set(encres) |
|
128 | encresref.set(encres) | |
129 | resref.set(batchable.next()) |
|
129 | resref.set(batchable.next()) | |
130 |
|
130 | |||
131 | def batchable(f): |
|
131 | def batchable(f): | |
132 | '''annotation for batchable methods |
|
132 | '''annotation for batchable methods | |
133 |
|
133 | |||
134 | Such methods must implement a coroutine as follows: |
|
134 | Such methods must implement a coroutine as follows: | |
135 |
|
135 | |||
136 | @batchable |
|
136 | @batchable | |
137 | def sample(self, one, two=None): |
|
137 | def sample(self, one, two=None): | |
138 | # Handle locally computable results first: |
|
138 | # Handle locally computable results first: | |
139 | if not one: |
|
139 | if not one: | |
140 | yield "a local result", None |
|
140 | yield "a local result", None | |
141 | # Build list of encoded arguments suitable for your wire protocol: |
|
141 | # Build list of encoded arguments suitable for your wire protocol: | |
142 | encargs = [('one', encode(one),), ('two', encode(two),)] |
|
142 | encargs = [('one', encode(one),), ('two', encode(two),)] | |
143 | # Create future for injection of encoded result: |
|
143 | # Create future for injection of encoded result: | |
144 | encresref = future() |
|
144 | encresref = future() | |
145 | # Return encoded arguments and future: |
|
145 | # Return encoded arguments and future: | |
146 | yield encargs, encresref |
|
146 | yield encargs, encresref | |
147 | # Assuming the future to be filled with the result from the batched |
|
147 | # Assuming the future to be filled with the result from the batched | |
148 | # request now. Decode it: |
|
148 | # request now. Decode it: | |
149 | yield decode(encresref.value) |
|
149 | yield decode(encresref.value) | |
150 |
|
150 | |||
151 | The decorator returns a function which wraps this coroutine as a plain |
|
151 | The decorator returns a function which wraps this coroutine as a plain | |
152 | method, but adds the original method as an attribute called "batchable", |
|
152 | method, but adds the original method as an attribute called "batchable", | |
153 | which is used by remotebatch to split the call into separate encoding and |
|
153 | which is used by remotebatch to split the call into separate encoding and | |
154 | decoding phases. |
|
154 | decoding phases. | |
155 | ''' |
|
155 | ''' | |
156 | def plain(*args, **opts): |
|
156 | def plain(*args, **opts): | |
157 | batchable = f(*args, **opts) |
|
157 | batchable = f(*args, **opts) | |
158 | encargsorres, encresref = batchable.next() |
|
158 | encargsorres, encresref = batchable.next() | |
159 | if not encresref: |
|
159 | if not encresref: | |
160 | return encargsorres # a local result in this case |
|
160 | return encargsorres # a local result in this case | |
161 | self = args[0] |
|
161 | self = args[0] | |
162 | encresref.set(self._submitone(f.func_name, encargsorres)) |
|
162 | encresref.set(self._submitone(f.func_name, encargsorres)) | |
163 | return batchable.next() |
|
163 | return batchable.next() | |
164 | setattr(plain, 'batchable', f) |
|
164 | setattr(plain, 'batchable', f) | |
165 | return plain |
|
165 | return plain | |
166 |
|
166 | |||
167 | # list of nodes encoding / decoding |
|
167 | # list of nodes encoding / decoding | |
168 |
|
168 | |||
169 | def decodelist(l, sep=' '): |
|
169 | def decodelist(l, sep=' '): | |
170 | if l: |
|
170 | if l: | |
171 | return map(bin, l.split(sep)) |
|
171 | return map(bin, l.split(sep)) | |
172 | return [] |
|
172 | return [] | |
173 |
|
173 | |||
174 | def encodelist(l, sep=' '): |
|
174 | def encodelist(l, sep=' '): | |
175 | try: |
|
175 | try: | |
176 | return sep.join(map(hex, l)) |
|
176 | return sep.join(map(hex, l)) | |
177 | except TypeError: |
|
177 | except TypeError: | |
178 | print l |
|
178 | print l | |
179 | raise |
|
179 | raise | |
180 |
|
180 | |||
181 | # batched call argument encoding |
|
181 | # batched call argument encoding | |
182 |
|
182 | |||
183 | def escapearg(plain): |
|
183 | def escapearg(plain): | |
184 | return (plain |
|
184 | return (plain | |
185 | .replace(':', '::') |
|
185 | .replace(':', '::') | |
186 | .replace(',', ':,') |
|
186 | .replace(',', ':,') | |
187 | .replace(';', ':;') |
|
187 | .replace(';', ':;') | |
188 | .replace('=', ':=')) |
|
188 | .replace('=', ':=')) | |
189 |
|
189 | |||
190 | def unescapearg(escaped): |
|
190 | def unescapearg(escaped): | |
191 | return (escaped |
|
191 | return (escaped | |
192 | .replace(':=', '=') |
|
192 | .replace(':=', '=') | |
193 | .replace(':;', ';') |
|
193 | .replace(':;', ';') | |
194 | .replace(':,', ',') |
|
194 | .replace(':,', ',') | |
195 | .replace('::', ':')) |
|
195 | .replace('::', ':')) | |
196 |
|
196 | |||
197 | # mapping of options accepted by getbundle and their types |
|
197 | # mapping of options accepted by getbundle and their types | |
198 | # |
|
198 | # | |
199 | # Meant to be extended by extensions. It is extensions responsibility to ensure |
|
199 | # Meant to be extended by extensions. It is extensions responsibility to ensure | |
200 | # such options are properly processed in exchange.getbundle. |
|
200 | # such options are properly processed in exchange.getbundle. | |
201 | # |
|
201 | # | |
202 | # supported types are: |
|
202 | # supported types are: | |
203 | # |
|
203 | # | |
204 | # :nodes: list of binary nodes |
|
204 | # :nodes: list of binary nodes | |
205 | # :csv: list of comma-separated values |
|
205 | # :csv: list of comma-separated values | |
206 | # :scsv: list of comma-separated values return as set |
|
206 | # :scsv: list of comma-separated values return as set | |
207 | # :plain: string with no transformation needed. |
|
207 | # :plain: string with no transformation needed. | |
208 | gboptsmap = {'heads': 'nodes', |
|
208 | gboptsmap = {'heads': 'nodes', | |
209 | 'common': 'nodes', |
|
209 | 'common': 'nodes', | |
210 | 'obsmarkers': 'boolean', |
|
210 | 'obsmarkers': 'boolean', | |
211 | 'bundlecaps': 'scsv', |
|
211 | 'bundlecaps': 'scsv', | |
212 | 'listkeys': 'csv', |
|
212 | 'listkeys': 'csv', | |
213 | 'cg': 'boolean'} |
|
213 | 'cg': 'boolean'} | |
214 |
|
214 | |||
215 | # client side |
|
215 | # client side | |
216 |
|
216 | |||
217 | class wirepeer(peer.peerrepository): |
|
217 | class wirepeer(peer.peerrepository): | |
218 |
|
218 | |||
219 | def batch(self): |
|
219 | def batch(self): | |
220 | return remotebatch(self) |
|
220 | return remotebatch(self) | |
221 | def _submitbatch(self, req): |
|
221 | def _submitbatch(self, req): | |
222 | cmds = [] |
|
222 | cmds = [] | |
223 | for op, argsdict in req: |
|
223 | for op, argsdict in req: | |
224 | args = ','.join('%s=%s' % p for p in argsdict.iteritems()) |
|
224 | args = ','.join('%s=%s' % p for p in argsdict.iteritems()) | |
225 | cmds.append('%s %s' % (op, args)) |
|
225 | cmds.append('%s %s' % (op, args)) | |
226 | rsp = self._call("batch", cmds=';'.join(cmds)) |
|
226 | rsp = self._call("batch", cmds=';'.join(cmds)) | |
227 | return rsp.split(';') |
|
227 | return rsp.split(';') | |
228 | def _submitone(self, op, args): |
|
228 | def _submitone(self, op, args): | |
229 | return self._call(op, **args) |
|
229 | return self._call(op, **args) | |
230 |
|
230 | |||
231 | @batchable |
|
231 | @batchable | |
232 | def lookup(self, key): |
|
232 | def lookup(self, key): | |
233 | self.requirecap('lookup', _('look up remote revision')) |
|
233 | self.requirecap('lookup', _('look up remote revision')) | |
234 | f = future() |
|
234 | f = future() | |
235 | yield {'key': encoding.fromlocal(key)}, f |
|
235 | yield {'key': encoding.fromlocal(key)}, f | |
236 | d = f.value |
|
236 | d = f.value | |
237 | success, data = d[:-1].split(" ", 1) |
|
237 | success, data = d[:-1].split(" ", 1) | |
238 | if int(success): |
|
238 | if int(success): | |
239 | yield bin(data) |
|
239 | yield bin(data) | |
240 | self._abort(error.RepoError(data)) |
|
240 | self._abort(error.RepoError(data)) | |
241 |
|
241 | |||
242 | @batchable |
|
242 | @batchable | |
243 | def heads(self): |
|
243 | def heads(self): | |
244 | f = future() |
|
244 | f = future() | |
245 | yield {}, f |
|
245 | yield {}, f | |
246 | d = f.value |
|
246 | d = f.value | |
247 | try: |
|
247 | try: | |
248 | yield decodelist(d[:-1]) |
|
248 | yield decodelist(d[:-1]) | |
249 | except ValueError: |
|
249 | except ValueError: | |
250 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
250 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
251 |
|
251 | |||
252 | @batchable |
|
252 | @batchable | |
253 | def known(self, nodes): |
|
253 | def known(self, nodes): | |
254 | f = future() |
|
254 | f = future() | |
255 | yield {'nodes': encodelist(nodes)}, f |
|
255 | yield {'nodes': encodelist(nodes)}, f | |
256 | d = f.value |
|
256 | d = f.value | |
257 | try: |
|
257 | try: | |
258 | yield [bool(int(b)) for b in d] |
|
258 | yield [bool(int(b)) for b in d] | |
259 | except ValueError: |
|
259 | except ValueError: | |
260 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
260 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
261 |
|
261 | |||
262 | @batchable |
|
262 | @batchable | |
263 | def branchmap(self): |
|
263 | def branchmap(self): | |
264 | f = future() |
|
264 | f = future() | |
265 | yield {}, f |
|
265 | yield {}, f | |
266 | d = f.value |
|
266 | d = f.value | |
267 | try: |
|
267 | try: | |
268 | branchmap = {} |
|
268 | branchmap = {} | |
269 | for branchpart in d.splitlines(): |
|
269 | for branchpart in d.splitlines(): | |
270 | branchname, branchheads = branchpart.split(' ', 1) |
|
270 | branchname, branchheads = branchpart.split(' ', 1) | |
271 | branchname = encoding.tolocal(urllib.unquote(branchname)) |
|
271 | branchname = encoding.tolocal(urllib.unquote(branchname)) | |
272 | branchheads = decodelist(branchheads) |
|
272 | branchheads = decodelist(branchheads) | |
273 | branchmap[branchname] = branchheads |
|
273 | branchmap[branchname] = branchheads | |
274 | yield branchmap |
|
274 | yield branchmap | |
275 | except TypeError: |
|
275 | except TypeError: | |
276 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
276 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
277 |
|
277 | |||
278 | def branches(self, nodes): |
|
278 | def branches(self, nodes): | |
279 | n = encodelist(nodes) |
|
279 | n = encodelist(nodes) | |
280 | d = self._call("branches", nodes=n) |
|
280 | d = self._call("branches", nodes=n) | |
281 | try: |
|
281 | try: | |
282 | br = [tuple(decodelist(b)) for b in d.splitlines()] |
|
282 | br = [tuple(decodelist(b)) for b in d.splitlines()] | |
283 | return br |
|
283 | return br | |
284 | except ValueError: |
|
284 | except ValueError: | |
285 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
285 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
286 |
|
286 | |||
287 | def between(self, pairs): |
|
287 | def between(self, pairs): | |
288 | batch = 8 # avoid giant requests |
|
288 | batch = 8 # avoid giant requests | |
289 | r = [] |
|
289 | r = [] | |
290 | for i in xrange(0, len(pairs), batch): |
|
290 | for i in xrange(0, len(pairs), batch): | |
291 | n = " ".join([encodelist(p, '-') for p in pairs[i:i + batch]]) |
|
291 | n = " ".join([encodelist(p, '-') for p in pairs[i:i + batch]]) | |
292 | d = self._call("between", pairs=n) |
|
292 | d = self._call("between", pairs=n) | |
293 | try: |
|
293 | try: | |
294 | r.extend(l and decodelist(l) or [] for l in d.splitlines()) |
|
294 | r.extend(l and decodelist(l) or [] for l in d.splitlines()) | |
295 | except ValueError: |
|
295 | except ValueError: | |
296 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
296 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
297 | return r |
|
297 | return r | |
298 |
|
298 | |||
299 | @batchable |
|
299 | @batchable | |
300 | def pushkey(self, namespace, key, old, new): |
|
300 | def pushkey(self, namespace, key, old, new): | |
301 | if not self.capable('pushkey'): |
|
301 | if not self.capable('pushkey'): | |
302 | yield False, None |
|
302 | yield False, None | |
303 | f = future() |
|
303 | f = future() | |
304 | self.ui.debug('preparing pushkey for "%s:%s"\n' % (namespace, key)) |
|
304 | self.ui.debug('preparing pushkey for "%s:%s"\n' % (namespace, key)) | |
305 | yield {'namespace': encoding.fromlocal(namespace), |
|
305 | yield {'namespace': encoding.fromlocal(namespace), | |
306 | 'key': encoding.fromlocal(key), |
|
306 | 'key': encoding.fromlocal(key), | |
307 | 'old': encoding.fromlocal(old), |
|
307 | 'old': encoding.fromlocal(old), | |
308 | 'new': encoding.fromlocal(new)}, f |
|
308 | 'new': encoding.fromlocal(new)}, f | |
309 | d = f.value |
|
309 | d = f.value | |
310 | d, output = d.split('\n', 1) |
|
310 | d, output = d.split('\n', 1) | |
311 | try: |
|
311 | try: | |
312 | d = bool(int(d)) |
|
312 | d = bool(int(d)) | |
313 | except ValueError: |
|
313 | except ValueError: | |
314 | raise error.ResponseError( |
|
314 | raise error.ResponseError( | |
315 | _('push failed (unexpected response):'), d) |
|
315 | _('push failed (unexpected response):'), d) | |
316 | for l in output.splitlines(True): |
|
316 | for l in output.splitlines(True): | |
317 | self.ui.status(_('remote: '), l) |
|
317 | self.ui.status(_('remote: '), l) | |
318 | yield d |
|
318 | yield d | |
319 |
|
319 | |||
320 | @batchable |
|
320 | @batchable | |
321 | def listkeys(self, namespace): |
|
321 | def listkeys(self, namespace): | |
322 | if not self.capable('pushkey'): |
|
322 | if not self.capable('pushkey'): | |
323 | yield {}, None |
|
323 | yield {}, None | |
324 | f = future() |
|
324 | f = future() | |
325 | self.ui.debug('preparing listkeys for "%s"\n' % namespace) |
|
325 | self.ui.debug('preparing listkeys for "%s"\n' % namespace) | |
326 | yield {'namespace': encoding.fromlocal(namespace)}, f |
|
326 | yield {'namespace': encoding.fromlocal(namespace)}, f | |
327 | d = f.value |
|
327 | d = f.value | |
328 | self.ui.debug('received listkey for "%s": %i bytes\n' |
|
328 | self.ui.debug('received listkey for "%s": %i bytes\n' | |
329 | % (namespace, len(d))) |
|
329 | % (namespace, len(d))) | |
330 | yield pushkeymod.decodekeys(d) |
|
330 | yield pushkeymod.decodekeys(d) | |
331 |
|
331 | |||
332 | def stream_out(self): |
|
332 | def stream_out(self): | |
333 | return self._callstream('stream_out') |
|
333 | return self._callstream('stream_out') | |
334 |
|
334 | |||
335 | def changegroup(self, nodes, kind): |
|
335 | def changegroup(self, nodes, kind): | |
336 | n = encodelist(nodes) |
|
336 | n = encodelist(nodes) | |
337 | f = self._callcompressable("changegroup", roots=n) |
|
337 | f = self._callcompressable("changegroup", roots=n) | |
338 | return changegroupmod.cg1unpacker(f, 'UN') |
|
338 | return changegroupmod.cg1unpacker(f, 'UN') | |
339 |
|
339 | |||
340 | def changegroupsubset(self, bases, heads, kind): |
|
340 | def changegroupsubset(self, bases, heads, kind): | |
341 | self.requirecap('changegroupsubset', _('look up remote changes')) |
|
341 | self.requirecap('changegroupsubset', _('look up remote changes')) | |
342 | bases = encodelist(bases) |
|
342 | bases = encodelist(bases) | |
343 | heads = encodelist(heads) |
|
343 | heads = encodelist(heads) | |
344 | f = self._callcompressable("changegroupsubset", |
|
344 | f = self._callcompressable("changegroupsubset", | |
345 | bases=bases, heads=heads) |
|
345 | bases=bases, heads=heads) | |
346 | return changegroupmod.cg1unpacker(f, 'UN') |
|
346 | return changegroupmod.cg1unpacker(f, 'UN') | |
347 |
|
347 | |||
348 | def getbundle(self, source, **kwargs): |
|
348 | def getbundle(self, source, **kwargs): | |
349 | self.requirecap('getbundle', _('look up remote changes')) |
|
349 | self.requirecap('getbundle', _('look up remote changes')) | |
350 | opts = {} |
|
350 | opts = {} | |
351 | bundlecaps = kwargs.get('bundlecaps') |
|
351 | bundlecaps = kwargs.get('bundlecaps') | |
352 | if bundlecaps is not None: |
|
352 | if bundlecaps is not None: | |
353 | kwargs['bundlecaps'] = sorted(bundlecaps) |
|
353 | kwargs['bundlecaps'] = sorted(bundlecaps) | |
354 | else: |
|
354 | else: | |
355 | bundlecaps = () # kwargs could have it to None |
|
355 | bundlecaps = () # kwargs could have it to None | |
356 | for key, value in kwargs.iteritems(): |
|
356 | for key, value in kwargs.iteritems(): | |
357 | if value is None: |
|
357 | if value is None: | |
358 | continue |
|
358 | continue | |
359 | keytype = gboptsmap.get(key) |
|
359 | keytype = gboptsmap.get(key) | |
360 | if keytype is None: |
|
360 | if keytype is None: | |
361 | assert False, 'unexpected' |
|
361 | assert False, 'unexpected' | |
362 | elif keytype == 'nodes': |
|
362 | elif keytype == 'nodes': | |
363 | value = encodelist(value) |
|
363 | value = encodelist(value) | |
364 | elif keytype in ('csv', 'scsv'): |
|
364 | elif keytype in ('csv', 'scsv'): | |
365 | value = ','.join(value) |
|
365 | value = ','.join(value) | |
366 | elif keytype == 'boolean': |
|
366 | elif keytype == 'boolean': | |
367 | value = '%i' % bool(value) |
|
367 | value = '%i' % bool(value) | |
368 | elif keytype != 'plain': |
|
368 | elif keytype != 'plain': | |
369 | raise KeyError('unknown getbundle option type %s' |
|
369 | raise KeyError('unknown getbundle option type %s' | |
370 | % keytype) |
|
370 | % keytype) | |
371 | opts[key] = value |
|
371 | opts[key] = value | |
372 | f = self._callcompressable("getbundle", **opts) |
|
372 | f = self._callcompressable("getbundle", **opts) | |
373 | if any((cap.startswith('HG2') for cap in bundlecaps)): |
|
373 | if any((cap.startswith('HG2') for cap in bundlecaps)): | |
374 | return bundle2.getunbundler(self.ui, f) |
|
374 | return bundle2.getunbundler(self.ui, f) | |
375 | else: |
|
375 | else: | |
376 | return changegroupmod.cg1unpacker(f, 'UN') |
|
376 | return changegroupmod.cg1unpacker(f, 'UN') | |
377 |
|
377 | |||
378 | def unbundle(self, cg, heads, source): |
|
378 | def unbundle(self, cg, heads, source): | |
379 | '''Send cg (a readable file-like object representing the |
|
379 | '''Send cg (a readable file-like object representing the | |
380 | changegroup to push, typically a chunkbuffer object) to the |
|
380 | changegroup to push, typically a chunkbuffer object) to the | |
381 | remote server as a bundle. |
|
381 | remote server as a bundle. | |
382 |
|
382 | |||
383 | When pushing a bundle10 stream, return an integer indicating the |
|
383 | When pushing a bundle10 stream, return an integer indicating the | |
384 | result of the push (see localrepository.addchangegroup()). |
|
384 | result of the push (see localrepository.addchangegroup()). | |
385 |
|
385 | |||
386 | When pushing a bundle20 stream, return a bundle20 stream.''' |
|
386 | When pushing a bundle20 stream, return a bundle20 stream.''' | |
387 |
|
387 | |||
388 | if heads != ['force'] and self.capable('unbundlehash'): |
|
388 | if heads != ['force'] and self.capable('unbundlehash'): | |
389 | heads = encodelist(['hashed', |
|
389 | heads = encodelist(['hashed', | |
390 | util.sha1(''.join(sorted(heads))).digest()]) |
|
390 | util.sha1(''.join(sorted(heads))).digest()]) | |
391 | else: |
|
391 | else: | |
392 | heads = encodelist(heads) |
|
392 | heads = encodelist(heads) | |
393 |
|
393 | |||
394 | if util.safehasattr(cg, 'deltaheader'): |
|
394 | if util.safehasattr(cg, 'deltaheader'): | |
395 | # this a bundle10, do the old style call sequence |
|
395 | # this a bundle10, do the old style call sequence | |
396 | ret, output = self._callpush("unbundle", cg, heads=heads) |
|
396 | ret, output = self._callpush("unbundle", cg, heads=heads) | |
397 | if ret == "": |
|
397 | if ret == "": | |
398 | raise error.ResponseError( |
|
398 | raise error.ResponseError( | |
399 | _('push failed:'), output) |
|
399 | _('push failed:'), output) | |
400 | try: |
|
400 | try: | |
401 | ret = int(ret) |
|
401 | ret = int(ret) | |
402 | except ValueError: |
|
402 | except ValueError: | |
403 | raise error.ResponseError( |
|
403 | raise error.ResponseError( | |
404 | _('push failed (unexpected response):'), ret) |
|
404 | _('push failed (unexpected response):'), ret) | |
405 |
|
405 | |||
406 | for l in output.splitlines(True): |
|
406 | for l in output.splitlines(True): | |
407 | self.ui.status(_('remote: '), l) |
|
407 | self.ui.status(_('remote: '), l) | |
408 | else: |
|
408 | else: | |
409 | # bundle2 push. Send a stream, fetch a stream. |
|
409 | # bundle2 push. Send a stream, fetch a stream. | |
410 | stream = self._calltwowaystream('unbundle', cg, heads=heads) |
|
410 | stream = self._calltwowaystream('unbundle', cg, heads=heads) | |
411 | ret = bundle2.getunbundler(self.ui, stream) |
|
411 | ret = bundle2.getunbundler(self.ui, stream) | |
412 | return ret |
|
412 | return ret | |
413 |
|
413 | |||
414 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
414 | def debugwireargs(self, one, two, three=None, four=None, five=None): | |
415 | # don't pass optional arguments left at their default value |
|
415 | # don't pass optional arguments left at their default value | |
416 | opts = {} |
|
416 | opts = {} | |
417 | if three is not None: |
|
417 | if three is not None: | |
418 | opts['three'] = three |
|
418 | opts['three'] = three | |
419 | if four is not None: |
|
419 | if four is not None: | |
420 | opts['four'] = four |
|
420 | opts['four'] = four | |
421 | return self._call('debugwireargs', one=one, two=two, **opts) |
|
421 | return self._call('debugwireargs', one=one, two=two, **opts) | |
422 |
|
422 | |||
423 | def _call(self, cmd, **args): |
|
423 | def _call(self, cmd, **args): | |
424 | """execute <cmd> on the server |
|
424 | """execute <cmd> on the server | |
425 |
|
425 | |||
426 | The command is expected to return a simple string. |
|
426 | The command is expected to return a simple string. | |
427 |
|
427 | |||
428 | returns the server reply as a string.""" |
|
428 | returns the server reply as a string.""" | |
429 | raise NotImplementedError() |
|
429 | raise NotImplementedError() | |
430 |
|
430 | |||
431 | def _callstream(self, cmd, **args): |
|
431 | def _callstream(self, cmd, **args): | |
432 | """execute <cmd> on the server |
|
432 | """execute <cmd> on the server | |
433 |
|
433 | |||
434 | The command is expected to return a stream. |
|
434 | The command is expected to return a stream. | |
435 |
|
435 | |||
436 | returns the server reply as a file like object.""" |
|
436 | returns the server reply as a file like object.""" | |
437 | raise NotImplementedError() |
|
437 | raise NotImplementedError() | |
438 |
|
438 | |||
439 | def _callcompressable(self, cmd, **args): |
|
439 | def _callcompressable(self, cmd, **args): | |
440 | """execute <cmd> on the server |
|
440 | """execute <cmd> on the server | |
441 |
|
441 | |||
442 | The command is expected to return a stream. |
|
442 | The command is expected to return a stream. | |
443 |
|
443 | |||
444 | The stream may have been compressed in some implementations. This |
|
444 | The stream may have been compressed in some implementations. This | |
445 | function takes care of the decompression. This is the only difference |
|
445 | function takes care of the decompression. This is the only difference | |
446 | with _callstream. |
|
446 | with _callstream. | |
447 |
|
447 | |||
448 | returns the server reply as a file like object. |
|
448 | returns the server reply as a file like object. | |
449 | """ |
|
449 | """ | |
450 | raise NotImplementedError() |
|
450 | raise NotImplementedError() | |
451 |
|
451 | |||
452 | def _callpush(self, cmd, fp, **args): |
|
452 | def _callpush(self, cmd, fp, **args): | |
453 | """execute a <cmd> on server |
|
453 | """execute a <cmd> on server | |
454 |
|
454 | |||
455 | The command is expected to be related to a push. Push has a special |
|
455 | The command is expected to be related to a push. Push has a special | |
456 | return method. |
|
456 | return method. | |
457 |
|
457 | |||
458 | returns the server reply as a (ret, output) tuple. ret is either |
|
458 | returns the server reply as a (ret, output) tuple. ret is either | |
459 | empty (error) or a stringified int. |
|
459 | empty (error) or a stringified int. | |
460 | """ |
|
460 | """ | |
461 | raise NotImplementedError() |
|
461 | raise NotImplementedError() | |
462 |
|
462 | |||
463 | def _calltwowaystream(self, cmd, fp, **args): |
|
463 | def _calltwowaystream(self, cmd, fp, **args): | |
464 | """execute <cmd> on server |
|
464 | """execute <cmd> on server | |
465 |
|
465 | |||
466 | The command will send a stream to the server and get a stream in reply. |
|
466 | The command will send a stream to the server and get a stream in reply. | |
467 | """ |
|
467 | """ | |
468 | raise NotImplementedError() |
|
468 | raise NotImplementedError() | |
469 |
|
469 | |||
470 | def _abort(self, exception): |
|
470 | def _abort(self, exception): | |
471 | """clearly abort the wire protocol connection and raise the exception |
|
471 | """clearly abort the wire protocol connection and raise the exception | |
472 | """ |
|
472 | """ | |
473 | raise NotImplementedError() |
|
473 | raise NotImplementedError() | |
474 |
|
474 | |||
475 | # server side |
|
475 | # server side | |
476 |
|
476 | |||
477 | # wire protocol command can either return a string or one of these classes. |
|
477 | # wire protocol command can either return a string or one of these classes. | |
478 | class streamres(object): |
|
478 | class streamres(object): | |
479 | """wireproto reply: binary stream |
|
479 | """wireproto reply: binary stream | |
480 |
|
480 | |||
481 | The call was successful and the result is a stream. |
|
481 | The call was successful and the result is a stream. | |
482 | Iterate on the `self.gen` attribute to retrieve chunks. |
|
482 | Iterate on the `self.gen` attribute to retrieve chunks. | |
483 | """ |
|
483 | """ | |
484 | def __init__(self, gen): |
|
484 | def __init__(self, gen): | |
485 | self.gen = gen |
|
485 | self.gen = gen | |
486 |
|
486 | |||
487 | class pushres(object): |
|
487 | class pushres(object): | |
488 | """wireproto reply: success with simple integer return |
|
488 | """wireproto reply: success with simple integer return | |
489 |
|
489 | |||
490 | The call was successful and returned an integer contained in `self.res`. |
|
490 | The call was successful and returned an integer contained in `self.res`. | |
491 | """ |
|
491 | """ | |
492 | def __init__(self, res): |
|
492 | def __init__(self, res): | |
493 | self.res = res |
|
493 | self.res = res | |
494 |
|
494 | |||
495 | class pusherr(object): |
|
495 | class pusherr(object): | |
496 | """wireproto reply: failure |
|
496 | """wireproto reply: failure | |
497 |
|
497 | |||
498 | The call failed. The `self.res` attribute contains the error message. |
|
498 | The call failed. The `self.res` attribute contains the error message. | |
499 | """ |
|
499 | """ | |
500 | def __init__(self, res): |
|
500 | def __init__(self, res): | |
501 | self.res = res |
|
501 | self.res = res | |
502 |
|
502 | |||
503 | class ooberror(object): |
|
503 | class ooberror(object): | |
504 | """wireproto reply: failure of a batch of operation |
|
504 | """wireproto reply: failure of a batch of operation | |
505 |
|
505 | |||
506 | Something failed during a batch call. The error message is stored in |
|
506 | Something failed during a batch call. The error message is stored in | |
507 | `self.message`. |
|
507 | `self.message`. | |
508 | """ |
|
508 | """ | |
509 | def __init__(self, message): |
|
509 | def __init__(self, message): | |
510 | self.message = message |
|
510 | self.message = message | |
511 |
|
511 | |||
512 | def dispatch(repo, proto, command): |
|
512 | def dispatch(repo, proto, command): | |
513 | repo = repo.filtered("served") |
|
513 | repo = repo.filtered("served") | |
514 | func, spec = commands[command] |
|
514 | func, spec = commands[command] | |
515 | args = proto.getargs(spec) |
|
515 | args = proto.getargs(spec) | |
516 | return func(repo, proto, *args) |
|
516 | return func(repo, proto, *args) | |
517 |
|
517 | |||
518 | def options(cmd, keys, others): |
|
518 | def options(cmd, keys, others): | |
519 | opts = {} |
|
519 | opts = {} | |
520 | for k in keys: |
|
520 | for k in keys: | |
521 | if k in others: |
|
521 | if k in others: | |
522 | opts[k] = others[k] |
|
522 | opts[k] = others[k] | |
523 | del others[k] |
|
523 | del others[k] | |
524 | if others: |
|
524 | if others: | |
525 | sys.stderr.write("warning: %s ignored unexpected arguments %s\n" |
|
525 | sys.stderr.write("warning: %s ignored unexpected arguments %s\n" | |
526 | % (cmd, ",".join(others))) |
|
526 | % (cmd, ",".join(others))) | |
527 | return opts |
|
527 | return opts | |
528 |
|
528 | |||
529 | # list of commands |
|
529 | # list of commands | |
530 | commands = {} |
|
530 | commands = {} | |
531 |
|
531 | |||
532 | def wireprotocommand(name, args=''): |
|
532 | def wireprotocommand(name, args=''): | |
533 | """decorator for wire protocol command""" |
|
533 | """decorator for wire protocol command""" | |
534 | def register(func): |
|
534 | def register(func): | |
535 | commands[name] = (func, args) |
|
535 | commands[name] = (func, args) | |
536 | return func |
|
536 | return func | |
537 | return register |
|
537 | return register | |
538 |
|
538 | |||
539 | @wireprotocommand('batch', 'cmds *') |
|
539 | @wireprotocommand('batch', 'cmds *') | |
540 | def batch(repo, proto, cmds, others): |
|
540 | def batch(repo, proto, cmds, others): | |
541 | repo = repo.filtered("served") |
|
541 | repo = repo.filtered("served") | |
542 | res = [] |
|
542 | res = [] | |
543 | for pair in cmds.split(';'): |
|
543 | for pair in cmds.split(';'): | |
544 | op, args = pair.split(' ', 1) |
|
544 | op, args = pair.split(' ', 1) | |
545 | vals = {} |
|
545 | vals = {} | |
546 | for a in args.split(','): |
|
546 | for a in args.split(','): | |
547 | if a: |
|
547 | if a: | |
548 | n, v = a.split('=') |
|
548 | n, v = a.split('=') | |
549 | vals[n] = unescapearg(v) |
|
549 | vals[n] = unescapearg(v) | |
550 | func, spec = commands[op] |
|
550 | func, spec = commands[op] | |
551 | if spec: |
|
551 | if spec: | |
552 | keys = spec.split() |
|
552 | keys = spec.split() | |
553 | data = {} |
|
553 | data = {} | |
554 | for k in keys: |
|
554 | for k in keys: | |
555 | if k == '*': |
|
555 | if k == '*': | |
556 | star = {} |
|
556 | star = {} | |
557 | for key in vals.keys(): |
|
557 | for key in vals.keys(): | |
558 | if key not in keys: |
|
558 | if key not in keys: | |
559 | star[key] = vals[key] |
|
559 | star[key] = vals[key] | |
560 | data['*'] = star |
|
560 | data['*'] = star | |
561 | else: |
|
561 | else: | |
562 | data[k] = vals[k] |
|
562 | data[k] = vals[k] | |
563 | result = func(repo, proto, *[data[k] for k in keys]) |
|
563 | result = func(repo, proto, *[data[k] for k in keys]) | |
564 | else: |
|
564 | else: | |
565 | result = func(repo, proto) |
|
565 | result = func(repo, proto) | |
566 | if isinstance(result, ooberror): |
|
566 | if isinstance(result, ooberror): | |
567 | return result |
|
567 | return result | |
568 | res.append(escapearg(result)) |
|
568 | res.append(escapearg(result)) | |
569 | return ';'.join(res) |
|
569 | return ';'.join(res) | |
570 |
|
570 | |||
571 | @wireprotocommand('between', 'pairs') |
|
571 | @wireprotocommand('between', 'pairs') | |
572 | def between(repo, proto, pairs): |
|
572 | def between(repo, proto, pairs): | |
573 | pairs = [decodelist(p, '-') for p in pairs.split(" ")] |
|
573 | pairs = [decodelist(p, '-') for p in pairs.split(" ")] | |
574 | r = [] |
|
574 | r = [] | |
575 | for b in repo.between(pairs): |
|
575 | for b in repo.between(pairs): | |
576 | r.append(encodelist(b) + "\n") |
|
576 | r.append(encodelist(b) + "\n") | |
577 | return "".join(r) |
|
577 | return "".join(r) | |
578 |
|
578 | |||
579 | @wireprotocommand('branchmap') |
|
579 | @wireprotocommand('branchmap') | |
580 | def branchmap(repo, proto): |
|
580 | def branchmap(repo, proto): | |
581 | branchmap = repo.branchmap() |
|
581 | branchmap = repo.branchmap() | |
582 | heads = [] |
|
582 | heads = [] | |
583 | for branch, nodes in branchmap.iteritems(): |
|
583 | for branch, nodes in branchmap.iteritems(): | |
584 | branchname = urllib.quote(encoding.fromlocal(branch)) |
|
584 | branchname = urllib.quote(encoding.fromlocal(branch)) | |
585 | branchnodes = encodelist(nodes) |
|
585 | branchnodes = encodelist(nodes) | |
586 | heads.append('%s %s' % (branchname, branchnodes)) |
|
586 | heads.append('%s %s' % (branchname, branchnodes)) | |
587 | return '\n'.join(heads) |
|
587 | return '\n'.join(heads) | |
588 |
|
588 | |||
589 | @wireprotocommand('branches', 'nodes') |
|
589 | @wireprotocommand('branches', 'nodes') | |
590 | def branches(repo, proto, nodes): |
|
590 | def branches(repo, proto, nodes): | |
591 | nodes = decodelist(nodes) |
|
591 | nodes = decodelist(nodes) | |
592 | r = [] |
|
592 | r = [] | |
593 | for b in repo.branches(nodes): |
|
593 | for b in repo.branches(nodes): | |
594 | r.append(encodelist(b) + "\n") |
|
594 | r.append(encodelist(b) + "\n") | |
595 | return "".join(r) |
|
595 | return "".join(r) | |
596 |
|
596 | |||
597 |
|
597 | |||
598 | wireprotocaps = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey', |
|
598 | wireprotocaps = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey', | |
599 | 'known', 'getbundle', 'unbundlehash', 'batch'] |
|
599 | 'known', 'getbundle', 'unbundlehash', 'batch'] | |
600 |
|
600 | |||
601 | def _capabilities(repo, proto): |
|
601 | def _capabilities(repo, proto): | |
602 | """return a list of capabilities for a repo |
|
602 | """return a list of capabilities for a repo | |
603 |
|
603 | |||
604 | This function exists to allow extensions to easily wrap capabilities |
|
604 | This function exists to allow extensions to easily wrap capabilities | |
605 | computation |
|
605 | computation | |
606 |
|
606 | |||
607 | - returns a lists: easy to alter |
|
607 | - returns a lists: easy to alter | |
608 | - change done here will be propagated to both `capabilities` and `hello` |
|
608 | - change done here will be propagated to both `capabilities` and `hello` | |
609 | command without any other action needed. |
|
609 | command without any other action needed. | |
610 | """ |
|
610 | """ | |
611 | # copy to prevent modification of the global list |
|
611 | # copy to prevent modification of the global list | |
612 | caps = list(wireprotocaps) |
|
612 | caps = list(wireprotocaps) | |
613 | if _allowstream(repo.ui): |
|
613 | if _allowstream(repo.ui): | |
614 | if repo.ui.configbool('server', 'preferuncompressed', False): |
|
614 | if repo.ui.configbool('server', 'preferuncompressed', False): | |
615 | caps.append('stream-preferred') |
|
615 | caps.append('stream-preferred') | |
616 | requiredformats = repo.requirements & repo.supportedformats |
|
616 | requiredformats = repo.requirements & repo.supportedformats | |
617 | # if our local revlogs are just revlogv1, add 'stream' cap |
|
617 | # if our local revlogs are just revlogv1, add 'stream' cap | |
618 | if not requiredformats - set(('revlogv1',)): |
|
618 | if not requiredformats - set(('revlogv1',)): | |
619 | caps.append('stream') |
|
619 | caps.append('stream') | |
620 | # otherwise, add 'streamreqs' detailing our local revlog format |
|
620 | # otherwise, add 'streamreqs' detailing our local revlog format | |
621 | else: |
|
621 | else: | |
622 | caps.append('streamreqs=%s' % ','.join(requiredformats)) |
|
622 | caps.append('streamreqs=%s' % ','.join(requiredformats)) | |
623 | if repo.ui.configbool('experimental', 'bundle2-advertise', True): |
|
623 | if repo.ui.configbool('experimental', 'bundle2-advertise', True): | |
624 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) |
|
624 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) | |
625 | caps.append('bundle2=' + urllib.quote(capsblob)) |
|
625 | caps.append('bundle2=' + urllib.quote(capsblob)) | |
626 | caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) |
|
626 | caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) | |
627 |
caps.append( |
|
627 | caps.append( | |
|
628 | 'httpheader=%d' % repo.ui.configint('server', 'maxhttpheaderlen', 1024)) | |||
628 | return caps |
|
629 | return caps | |
629 |
|
630 | |||
630 | # If you are writing an extension and consider wrapping this function. Wrap |
|
631 | # If you are writing an extension and consider wrapping this function. Wrap | |
631 | # `_capabilities` instead. |
|
632 | # `_capabilities` instead. | |
632 | @wireprotocommand('capabilities') |
|
633 | @wireprotocommand('capabilities') | |
633 | def capabilities(repo, proto): |
|
634 | def capabilities(repo, proto): | |
634 | return ' '.join(_capabilities(repo, proto)) |
|
635 | return ' '.join(_capabilities(repo, proto)) | |
635 |
|
636 | |||
636 | @wireprotocommand('changegroup', 'roots') |
|
637 | @wireprotocommand('changegroup', 'roots') | |
637 | def changegroup(repo, proto, roots): |
|
638 | def changegroup(repo, proto, roots): | |
638 | nodes = decodelist(roots) |
|
639 | nodes = decodelist(roots) | |
639 | cg = changegroupmod.changegroup(repo, nodes, 'serve') |
|
640 | cg = changegroupmod.changegroup(repo, nodes, 'serve') | |
640 | return streamres(proto.groupchunks(cg)) |
|
641 | return streamres(proto.groupchunks(cg)) | |
641 |
|
642 | |||
642 | @wireprotocommand('changegroupsubset', 'bases heads') |
|
643 | @wireprotocommand('changegroupsubset', 'bases heads') | |
643 | def changegroupsubset(repo, proto, bases, heads): |
|
644 | def changegroupsubset(repo, proto, bases, heads): | |
644 | bases = decodelist(bases) |
|
645 | bases = decodelist(bases) | |
645 | heads = decodelist(heads) |
|
646 | heads = decodelist(heads) | |
646 | cg = changegroupmod.changegroupsubset(repo, bases, heads, 'serve') |
|
647 | cg = changegroupmod.changegroupsubset(repo, bases, heads, 'serve') | |
647 | return streamres(proto.groupchunks(cg)) |
|
648 | return streamres(proto.groupchunks(cg)) | |
648 |
|
649 | |||
649 | @wireprotocommand('debugwireargs', 'one two *') |
|
650 | @wireprotocommand('debugwireargs', 'one two *') | |
650 | def debugwireargs(repo, proto, one, two, others): |
|
651 | def debugwireargs(repo, proto, one, two, others): | |
651 | # only accept optional args from the known set |
|
652 | # only accept optional args from the known set | |
652 | opts = options('debugwireargs', ['three', 'four'], others) |
|
653 | opts = options('debugwireargs', ['three', 'four'], others) | |
653 | return repo.debugwireargs(one, two, **opts) |
|
654 | return repo.debugwireargs(one, two, **opts) | |
654 |
|
655 | |||
655 | # List of options accepted by getbundle. |
|
656 | # List of options accepted by getbundle. | |
656 | # |
|
657 | # | |
657 | # Meant to be extended by extensions. It is the extension's responsibility to |
|
658 | # Meant to be extended by extensions. It is the extension's responsibility to | |
658 | # ensure such options are properly processed in exchange.getbundle. |
|
659 | # ensure such options are properly processed in exchange.getbundle. | |
659 | gboptslist = ['heads', 'common', 'bundlecaps'] |
|
660 | gboptslist = ['heads', 'common', 'bundlecaps'] | |
660 |
|
661 | |||
661 | @wireprotocommand('getbundle', '*') |
|
662 | @wireprotocommand('getbundle', '*') | |
662 | def getbundle(repo, proto, others): |
|
663 | def getbundle(repo, proto, others): | |
663 | opts = options('getbundle', gboptsmap.keys(), others) |
|
664 | opts = options('getbundle', gboptsmap.keys(), others) | |
664 | for k, v in opts.iteritems(): |
|
665 | for k, v in opts.iteritems(): | |
665 | keytype = gboptsmap[k] |
|
666 | keytype = gboptsmap[k] | |
666 | if keytype == 'nodes': |
|
667 | if keytype == 'nodes': | |
667 | opts[k] = decodelist(v) |
|
668 | opts[k] = decodelist(v) | |
668 | elif keytype == 'csv': |
|
669 | elif keytype == 'csv': | |
669 | opts[k] = list(v.split(',')) |
|
670 | opts[k] = list(v.split(',')) | |
670 | elif keytype == 'scsv': |
|
671 | elif keytype == 'scsv': | |
671 | opts[k] = set(v.split(',')) |
|
672 | opts[k] = set(v.split(',')) | |
672 | elif keytype == 'boolean': |
|
673 | elif keytype == 'boolean': | |
673 | opts[k] = bool(v) |
|
674 | opts[k] = bool(v) | |
674 | elif keytype != 'plain': |
|
675 | elif keytype != 'plain': | |
675 | raise KeyError('unknown getbundle option type %s' |
|
676 | raise KeyError('unknown getbundle option type %s' | |
676 | % keytype) |
|
677 | % keytype) | |
677 | cg = exchange.getbundle(repo, 'serve', **opts) |
|
678 | cg = exchange.getbundle(repo, 'serve', **opts) | |
678 | return streamres(proto.groupchunks(cg)) |
|
679 | return streamres(proto.groupchunks(cg)) | |
679 |
|
680 | |||
680 | @wireprotocommand('heads') |
|
681 | @wireprotocommand('heads') | |
681 | def heads(repo, proto): |
|
682 | def heads(repo, proto): | |
682 | h = repo.heads() |
|
683 | h = repo.heads() | |
683 | return encodelist(h) + "\n" |
|
684 | return encodelist(h) + "\n" | |
684 |
|
685 | |||
685 | @wireprotocommand('hello') |
|
686 | @wireprotocommand('hello') | |
686 | def hello(repo, proto): |
|
687 | def hello(repo, proto): | |
687 | '''the hello command returns a set of lines describing various |
|
688 | '''the hello command returns a set of lines describing various | |
688 | interesting things about the server, in an RFC822-like format. |
|
689 | interesting things about the server, in an RFC822-like format. | |
689 | Currently the only one defined is "capabilities", which |
|
690 | Currently the only one defined is "capabilities", which | |
690 | consists of a line in the form: |
|
691 | consists of a line in the form: | |
691 |
|
692 | |||
692 | capabilities: space separated list of tokens |
|
693 | capabilities: space separated list of tokens | |
693 | ''' |
|
694 | ''' | |
694 | return "capabilities: %s\n" % (capabilities(repo, proto)) |
|
695 | return "capabilities: %s\n" % (capabilities(repo, proto)) | |
695 |
|
696 | |||
696 | @wireprotocommand('listkeys', 'namespace') |
|
697 | @wireprotocommand('listkeys', 'namespace') | |
697 | def listkeys(repo, proto, namespace): |
|
698 | def listkeys(repo, proto, namespace): | |
698 | d = repo.listkeys(encoding.tolocal(namespace)).items() |
|
699 | d = repo.listkeys(encoding.tolocal(namespace)).items() | |
699 | return pushkeymod.encodekeys(d) |
|
700 | return pushkeymod.encodekeys(d) | |
700 |
|
701 | |||
701 | @wireprotocommand('lookup', 'key') |
|
702 | @wireprotocommand('lookup', 'key') | |
702 | def lookup(repo, proto, key): |
|
703 | def lookup(repo, proto, key): | |
703 | try: |
|
704 | try: | |
704 | k = encoding.tolocal(key) |
|
705 | k = encoding.tolocal(key) | |
705 | c = repo[k] |
|
706 | c = repo[k] | |
706 | r = c.hex() |
|
707 | r = c.hex() | |
707 | success = 1 |
|
708 | success = 1 | |
708 | except Exception as inst: |
|
709 | except Exception as inst: | |
709 | r = str(inst) |
|
710 | r = str(inst) | |
710 | success = 0 |
|
711 | success = 0 | |
711 | return "%s %s\n" % (success, r) |
|
712 | return "%s %s\n" % (success, r) | |
712 |
|
713 | |||
713 | @wireprotocommand('known', 'nodes *') |
|
714 | @wireprotocommand('known', 'nodes *') | |
714 | def known(repo, proto, nodes, others): |
|
715 | def known(repo, proto, nodes, others): | |
715 | return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes))) |
|
716 | return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes))) | |
716 |
|
717 | |||
717 | @wireprotocommand('pushkey', 'namespace key old new') |
|
718 | @wireprotocommand('pushkey', 'namespace key old new') | |
718 | def pushkey(repo, proto, namespace, key, old, new): |
|
719 | def pushkey(repo, proto, namespace, key, old, new): | |
719 | # compatibility with pre-1.8 clients which were accidentally |
|
720 | # compatibility with pre-1.8 clients which were accidentally | |
720 | # sending raw binary nodes rather than utf-8-encoded hex |
|
721 | # sending raw binary nodes rather than utf-8-encoded hex | |
721 | if len(new) == 20 and new.encode('string-escape') != new: |
|
722 | if len(new) == 20 and new.encode('string-escape') != new: | |
722 | # looks like it could be a binary node |
|
723 | # looks like it could be a binary node | |
723 | try: |
|
724 | try: | |
724 | new.decode('utf-8') |
|
725 | new.decode('utf-8') | |
725 | new = encoding.tolocal(new) # but cleanly decodes as UTF-8 |
|
726 | new = encoding.tolocal(new) # but cleanly decodes as UTF-8 | |
726 | except UnicodeDecodeError: |
|
727 | except UnicodeDecodeError: | |
727 | pass # binary, leave unmodified |
|
728 | pass # binary, leave unmodified | |
728 | else: |
|
729 | else: | |
729 | new = encoding.tolocal(new) # normal path |
|
730 | new = encoding.tolocal(new) # normal path | |
730 |
|
731 | |||
731 | if util.safehasattr(proto, 'restore'): |
|
732 | if util.safehasattr(proto, 'restore'): | |
732 |
|
733 | |||
733 | proto.redirect() |
|
734 | proto.redirect() | |
734 |
|
735 | |||
735 | try: |
|
736 | try: | |
736 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
|
737 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), | |
737 | encoding.tolocal(old), new) or False |
|
738 | encoding.tolocal(old), new) or False | |
738 | except util.Abort: |
|
739 | except util.Abort: | |
739 | r = False |
|
740 | r = False | |
740 |
|
741 | |||
741 | output = proto.restore() |
|
742 | output = proto.restore() | |
742 |
|
743 | |||
743 | return '%s\n%s' % (int(r), output) |
|
744 | return '%s\n%s' % (int(r), output) | |
744 |
|
745 | |||
745 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
|
746 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), | |
746 | encoding.tolocal(old), new) |
|
747 | encoding.tolocal(old), new) | |
747 | return '%s\n' % int(r) |
|
748 | return '%s\n' % int(r) | |
748 |
|
749 | |||
749 | def _allowstream(ui): |
|
750 | def _allowstream(ui): | |
750 | return ui.configbool('server', 'uncompressed', True, untrusted=True) |
|
751 | return ui.configbool('server', 'uncompressed', True, untrusted=True) | |
751 |
|
752 | |||
752 | @wireprotocommand('stream_out') |
|
753 | @wireprotocommand('stream_out') | |
753 | def stream(repo, proto): |
|
754 | def stream(repo, proto): | |
754 | '''If the server supports streaming clone, it advertises the "stream" |
|
755 | '''If the server supports streaming clone, it advertises the "stream" | |
755 | capability with a value representing the version and flags of the repo |
|
756 | capability with a value representing the version and flags of the repo | |
756 | it is serving. Client checks to see if it understands the format. |
|
757 | it is serving. Client checks to see if it understands the format. | |
757 | ''' |
|
758 | ''' | |
758 | if not _allowstream(repo.ui): |
|
759 | if not _allowstream(repo.ui): | |
759 | return '1\n' |
|
760 | return '1\n' | |
760 |
|
761 | |||
761 | def getstream(it): |
|
762 | def getstream(it): | |
762 | yield '0\n' |
|
763 | yield '0\n' | |
763 | for chunk in it: |
|
764 | for chunk in it: | |
764 | yield chunk |
|
765 | yield chunk | |
765 |
|
766 | |||
766 | try: |
|
767 | try: | |
767 | # LockError may be raised before the first result is yielded. Don't |
|
768 | # LockError may be raised before the first result is yielded. Don't | |
768 | # emit output until we're sure we got the lock successfully. |
|
769 | # emit output until we're sure we got the lock successfully. | |
769 | it = exchange.generatestreamclone(repo) |
|
770 | it = exchange.generatestreamclone(repo) | |
770 | return streamres(getstream(it)) |
|
771 | return streamres(getstream(it)) | |
771 | except error.LockError: |
|
772 | except error.LockError: | |
772 | return '2\n' |
|
773 | return '2\n' | |
773 |
|
774 | |||
774 | @wireprotocommand('unbundle', 'heads') |
|
775 | @wireprotocommand('unbundle', 'heads') | |
775 | def unbundle(repo, proto, heads): |
|
776 | def unbundle(repo, proto, heads): | |
776 | their_heads = decodelist(heads) |
|
777 | their_heads = decodelist(heads) | |
777 |
|
778 | |||
778 | try: |
|
779 | try: | |
779 | proto.redirect() |
|
780 | proto.redirect() | |
780 |
|
781 | |||
781 | exchange.check_heads(repo, their_heads, 'preparing changes') |
|
782 | exchange.check_heads(repo, their_heads, 'preparing changes') | |
782 |
|
783 | |||
783 | # write bundle data to temporary file because it can be big |
|
784 | # write bundle data to temporary file because it can be big | |
784 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') |
|
785 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') | |
785 | fp = os.fdopen(fd, 'wb+') |
|
786 | fp = os.fdopen(fd, 'wb+') | |
786 | r = 0 |
|
787 | r = 0 | |
787 | try: |
|
788 | try: | |
788 | proto.getfile(fp) |
|
789 | proto.getfile(fp) | |
789 | fp.seek(0) |
|
790 | fp.seek(0) | |
790 | gen = exchange.readbundle(repo.ui, fp, None) |
|
791 | gen = exchange.readbundle(repo.ui, fp, None) | |
791 | r = exchange.unbundle(repo, gen, their_heads, 'serve', |
|
792 | r = exchange.unbundle(repo, gen, their_heads, 'serve', | |
792 | proto._client()) |
|
793 | proto._client()) | |
793 | if util.safehasattr(r, 'addpart'): |
|
794 | if util.safehasattr(r, 'addpart'): | |
794 | # The return looks streamable, we are in the bundle2 case and |
|
795 | # The return looks streamable, we are in the bundle2 case and | |
795 | # should return a stream. |
|
796 | # should return a stream. | |
796 | return streamres(r.getchunks()) |
|
797 | return streamres(r.getchunks()) | |
797 | return pushres(r) |
|
798 | return pushres(r) | |
798 |
|
799 | |||
799 | finally: |
|
800 | finally: | |
800 | fp.close() |
|
801 | fp.close() | |
801 | os.unlink(tempname) |
|
802 | os.unlink(tempname) | |
802 |
|
803 | |||
803 | except (error.BundleValueError, util.Abort, error.PushRaced) as exc: |
|
804 | except (error.BundleValueError, util.Abort, error.PushRaced) as exc: | |
804 | # handle non-bundle2 case first |
|
805 | # handle non-bundle2 case first | |
805 | if not getattr(exc, 'duringunbundle2', False): |
|
806 | if not getattr(exc, 'duringunbundle2', False): | |
806 | try: |
|
807 | try: | |
807 | raise |
|
808 | raise | |
808 | except util.Abort: |
|
809 | except util.Abort: | |
809 | # The old code we moved used sys.stderr directly. |
|
810 | # The old code we moved used sys.stderr directly. | |
810 | # We did not change it to minimise code change. |
|
811 | # We did not change it to minimise code change. | |
811 | # This need to be moved to something proper. |
|
812 | # This need to be moved to something proper. | |
812 | # Feel free to do it. |
|
813 | # Feel free to do it. | |
813 | sys.stderr.write("abort: %s\n" % exc) |
|
814 | sys.stderr.write("abort: %s\n" % exc) | |
814 | return pushres(0) |
|
815 | return pushres(0) | |
815 | except error.PushRaced: |
|
816 | except error.PushRaced: | |
816 | return pusherr(str(exc)) |
|
817 | return pusherr(str(exc)) | |
817 |
|
818 | |||
818 | bundler = bundle2.bundle20(repo.ui) |
|
819 | bundler = bundle2.bundle20(repo.ui) | |
819 | for out in getattr(exc, '_bundle2salvagedoutput', ()): |
|
820 | for out in getattr(exc, '_bundle2salvagedoutput', ()): | |
820 | bundler.addpart(out) |
|
821 | bundler.addpart(out) | |
821 | try: |
|
822 | try: | |
822 | try: |
|
823 | try: | |
823 | raise |
|
824 | raise | |
824 | except error.PushkeyFailed as exc: |
|
825 | except error.PushkeyFailed as exc: | |
825 | # check client caps |
|
826 | # check client caps | |
826 | remotecaps = getattr(exc, '_replycaps', None) |
|
827 | remotecaps = getattr(exc, '_replycaps', None) | |
827 | if (remotecaps is not None |
|
828 | if (remotecaps is not None | |
828 | and 'pushkey' not in remotecaps.get('error', ())): |
|
829 | and 'pushkey' not in remotecaps.get('error', ())): | |
829 | # no support remote side, fallback to Abort handler. |
|
830 | # no support remote side, fallback to Abort handler. | |
830 | raise |
|
831 | raise | |
831 | part = bundler.newpart('error:pushkey') |
|
832 | part = bundler.newpart('error:pushkey') | |
832 | part.addparam('in-reply-to', exc.partid) |
|
833 | part.addparam('in-reply-to', exc.partid) | |
833 | if exc.namespace is not None: |
|
834 | if exc.namespace is not None: | |
834 | part.addparam('namespace', exc.namespace, mandatory=False) |
|
835 | part.addparam('namespace', exc.namespace, mandatory=False) | |
835 | if exc.key is not None: |
|
836 | if exc.key is not None: | |
836 | part.addparam('key', exc.key, mandatory=False) |
|
837 | part.addparam('key', exc.key, mandatory=False) | |
837 | if exc.new is not None: |
|
838 | if exc.new is not None: | |
838 | part.addparam('new', exc.new, mandatory=False) |
|
839 | part.addparam('new', exc.new, mandatory=False) | |
839 | if exc.old is not None: |
|
840 | if exc.old is not None: | |
840 | part.addparam('old', exc.old, mandatory=False) |
|
841 | part.addparam('old', exc.old, mandatory=False) | |
841 | if exc.ret is not None: |
|
842 | if exc.ret is not None: | |
842 | part.addparam('ret', exc.ret, mandatory=False) |
|
843 | part.addparam('ret', exc.ret, mandatory=False) | |
843 | except error.BundleValueError as exc: |
|
844 | except error.BundleValueError as exc: | |
844 | errpart = bundler.newpart('error:unsupportedcontent') |
|
845 | errpart = bundler.newpart('error:unsupportedcontent') | |
845 | if exc.parttype is not None: |
|
846 | if exc.parttype is not None: | |
846 | errpart.addparam('parttype', exc.parttype) |
|
847 | errpart.addparam('parttype', exc.parttype) | |
847 | if exc.params: |
|
848 | if exc.params: | |
848 | errpart.addparam('params', '\0'.join(exc.params)) |
|
849 | errpart.addparam('params', '\0'.join(exc.params)) | |
849 | except util.Abort as exc: |
|
850 | except util.Abort as exc: | |
850 | manargs = [('message', str(exc))] |
|
851 | manargs = [('message', str(exc))] | |
851 | advargs = [] |
|
852 | advargs = [] | |
852 | if exc.hint is not None: |
|
853 | if exc.hint is not None: | |
853 | advargs.append(('hint', exc.hint)) |
|
854 | advargs.append(('hint', exc.hint)) | |
854 | bundler.addpart(bundle2.bundlepart('error:abort', |
|
855 | bundler.addpart(bundle2.bundlepart('error:abort', | |
855 | manargs, advargs)) |
|
856 | manargs, advargs)) | |
856 | except error.PushRaced as exc: |
|
857 | except error.PushRaced as exc: | |
857 | bundler.newpart('error:pushraced', [('message', str(exc))]) |
|
858 | bundler.newpart('error:pushraced', [('message', str(exc))]) | |
858 | return streamres(bundler.getchunks()) |
|
859 | return streamres(bundler.getchunks()) |
General Comments 0
You need to be logged in to leave comments.
Login now