Show More
@@ -1,1935 +1,1948 b'' | |||||
1 | The Mercurial system uses a set of configuration files to control |
|
1 | The Mercurial system uses a set of configuration files to control | |
2 | aspects of its behavior. |
|
2 | aspects of its behavior. | |
3 |
|
3 | |||
4 | Troubleshooting |
|
4 | Troubleshooting | |
5 | =============== |
|
5 | =============== | |
6 |
|
6 | |||
7 | If you're having problems with your configuration, |
|
7 | If you're having problems with your configuration, | |
8 | :hg:`config --debug` can help you understand what is introducing |
|
8 | :hg:`config --debug` can help you understand what is introducing | |
9 | a setting into your environment. |
|
9 | a setting into your environment. | |
10 |
|
10 | |||
11 | See :hg:`help config.syntax` and :hg:`help config.files` |
|
11 | See :hg:`help config.syntax` and :hg:`help config.files` | |
12 | for information about how and where to override things. |
|
12 | for information about how and where to override things. | |
13 |
|
13 | |||
14 | Structure |
|
14 | Structure | |
15 | ========= |
|
15 | ========= | |
16 |
|
16 | |||
17 | The configuration files use a simple ini-file format. A configuration |
|
17 | The configuration files use a simple ini-file format. A configuration | |
18 | file consists of sections, led by a ``[section]`` header and followed |
|
18 | file consists of sections, led by a ``[section]`` header and followed | |
19 | by ``name = value`` entries:: |
|
19 | by ``name = value`` entries:: | |
20 |
|
20 | |||
21 | [ui] |
|
21 | [ui] | |
22 | username = Firstname Lastname <firstname.lastname@example.net> |
|
22 | username = Firstname Lastname <firstname.lastname@example.net> | |
23 | verbose = True |
|
23 | verbose = True | |
24 |
|
24 | |||
25 | The above entries will be referred to as ``ui.username`` and |
|
25 | The above entries will be referred to as ``ui.username`` and | |
26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. |
|
26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. | |
27 |
|
27 | |||
28 | Files |
|
28 | Files | |
29 | ===== |
|
29 | ===== | |
30 |
|
30 | |||
31 | Mercurial reads configuration data from several files, if they exist. |
|
31 | Mercurial reads configuration data from several files, if they exist. | |
32 | These files do not exist by default and you will have to create the |
|
32 | These files do not exist by default and you will have to create the | |
33 | appropriate configuration files yourself: global configuration like |
|
33 | appropriate configuration files yourself: global configuration like | |
34 | the username setting is typically put into |
|
34 | the username setting is typically put into | |
35 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
35 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local | |
36 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
36 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
37 |
|
37 | |||
38 | The names of these files depend on the system on which Mercurial is |
|
38 | The names of these files depend on the system on which Mercurial is | |
39 | installed. ``*.rc`` files from a single directory are read in |
|
39 | installed. ``*.rc`` files from a single directory are read in | |
40 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
40 | alphabetical order, later ones overriding earlier ones. Where multiple | |
41 | paths are given below, settings from earlier paths override later |
|
41 | paths are given below, settings from earlier paths override later | |
42 | ones. |
|
42 | ones. | |
43 |
|
43 | |||
44 | .. container:: verbose.unix |
|
44 | .. container:: verbose.unix | |
45 |
|
45 | |||
46 | On Unix, the following files are consulted: |
|
46 | On Unix, the following files are consulted: | |
47 |
|
47 | |||
48 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
48 | - ``<repo>/.hg/hgrc`` (per-repository) | |
49 | - ``$HOME/.hgrc`` (per-user) |
|
49 | - ``$HOME/.hgrc`` (per-user) | |
50 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
50 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) | |
51 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
51 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) | |
52 | - ``/etc/mercurial/hgrc`` (per-system) |
|
52 | - ``/etc/mercurial/hgrc`` (per-system) | |
53 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
53 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) | |
54 | - ``<internal>/default.d/*.rc`` (defaults) |
|
54 | - ``<internal>/default.d/*.rc`` (defaults) | |
55 |
|
55 | |||
56 | .. container:: verbose.windows |
|
56 | .. container:: verbose.windows | |
57 |
|
57 | |||
58 | On Windows, the following files are consulted: |
|
58 | On Windows, the following files are consulted: | |
59 |
|
59 | |||
60 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
60 | - ``<repo>/.hg/hgrc`` (per-repository) | |
61 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
61 | - ``%USERPROFILE%\.hgrc`` (per-user) | |
62 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
62 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) | |
63 | - ``%HOME%\.hgrc`` (per-user) |
|
63 | - ``%HOME%\.hgrc`` (per-user) | |
64 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
64 | - ``%HOME%\Mercurial.ini`` (per-user) | |
65 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
65 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) | |
66 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
66 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) | |
67 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
67 | - ``<install-dir>\Mercurial.ini`` (per-installation) | |
68 | - ``<internal>/default.d/*.rc`` (defaults) |
|
68 | - ``<internal>/default.d/*.rc`` (defaults) | |
69 |
|
69 | |||
70 | .. note:: |
|
70 | .. note:: | |
71 |
|
71 | |||
72 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
72 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
73 | is used when running 32-bit Python on 64-bit Windows. |
|
73 | is used when running 32-bit Python on 64-bit Windows. | |
74 |
|
74 | |||
75 | .. container:: verbose.plan9 |
|
75 | .. container:: verbose.plan9 | |
76 |
|
76 | |||
77 | On Plan9, the following files are consulted: |
|
77 | On Plan9, the following files are consulted: | |
78 |
|
78 | |||
79 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
79 | - ``<repo>/.hg/hgrc`` (per-repository) | |
80 | - ``$home/lib/hgrc`` (per-user) |
|
80 | - ``$home/lib/hgrc`` (per-user) | |
81 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
81 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) | |
82 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
82 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) | |
83 | - ``/lib/mercurial/hgrc`` (per-system) |
|
83 | - ``/lib/mercurial/hgrc`` (per-system) | |
84 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
84 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) | |
85 | - ``<internal>/default.d/*.rc`` (defaults) |
|
85 | - ``<internal>/default.d/*.rc`` (defaults) | |
86 |
|
86 | |||
87 | Per-repository configuration options only apply in a |
|
87 | Per-repository configuration options only apply in a | |
88 | particular repository. This file is not version-controlled, and |
|
88 | particular repository. This file is not version-controlled, and | |
89 | will not get transferred during a "clone" operation. Options in |
|
89 | will not get transferred during a "clone" operation. Options in | |
90 | this file override options in all other configuration files. On |
|
90 | this file override options in all other configuration files. On | |
91 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
91 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
92 | belong to a trusted user or to a trusted group. See |
|
92 | belong to a trusted user or to a trusted group. See | |
93 | :hg:`help config.trusted` for more details. |
|
93 | :hg:`help config.trusted` for more details. | |
94 |
|
94 | |||
95 | Per-user configuration file(s) are for the user running Mercurial. On |
|
95 | Per-user configuration file(s) are for the user running Mercurial. On | |
96 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
96 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
97 | files apply to all Mercurial commands executed by this user in any |
|
97 | files apply to all Mercurial commands executed by this user in any | |
98 | directory. Options in these files override per-system and per-installation |
|
98 | directory. Options in these files override per-system and per-installation | |
99 | options. |
|
99 | options. | |
100 |
|
100 | |||
101 | Per-installation configuration files are searched for in the |
|
101 | Per-installation configuration files are searched for in the | |
102 | directory where Mercurial is installed. ``<install-root>`` is the |
|
102 | directory where Mercurial is installed. ``<install-root>`` is the | |
103 | parent directory of the **hg** executable (or symlink) being run. For |
|
103 | parent directory of the **hg** executable (or symlink) being run. For | |
104 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
104 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
105 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
105 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
106 | to all Mercurial commands executed by any user in any directory. |
|
106 | to all Mercurial commands executed by any user in any directory. | |
107 |
|
107 | |||
108 | Per-installation configuration files are for the system on |
|
108 | Per-installation configuration files are for the system on | |
109 | which Mercurial is running. Options in these files apply to all |
|
109 | which Mercurial is running. Options in these files apply to all | |
110 | Mercurial commands executed by any user in any directory. Registry |
|
110 | Mercurial commands executed by any user in any directory. Registry | |
111 | keys contain PATH-like strings, every part of which must reference |
|
111 | keys contain PATH-like strings, every part of which must reference | |
112 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
112 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
113 | be read. Mercurial checks each of these locations in the specified |
|
113 | be read. Mercurial checks each of these locations in the specified | |
114 | order until one or more configuration files are detected. |
|
114 | order until one or more configuration files are detected. | |
115 |
|
115 | |||
116 | Per-system configuration files are for the system on which Mercurial |
|
116 | Per-system configuration files are for the system on which Mercurial | |
117 | is running. Options in these files apply to all Mercurial commands |
|
117 | is running. Options in these files apply to all Mercurial commands | |
118 | executed by any user in any directory. Options in these files |
|
118 | executed by any user in any directory. Options in these files | |
119 | override per-installation options. |
|
119 | override per-installation options. | |
120 |
|
120 | |||
121 | Mercurial comes with some default configuration. The default configuration |
|
121 | Mercurial comes with some default configuration. The default configuration | |
122 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
122 | files are installed with Mercurial and will be overwritten on upgrades. Default | |
123 | configuration files should never be edited by users or administrators but can |
|
123 | configuration files should never be edited by users or administrators but can | |
124 | be overridden in other configuration files. So far the directory only contains |
|
124 | be overridden in other configuration files. So far the directory only contains | |
125 | merge tool configuration but packagers can also put other default configuration |
|
125 | merge tool configuration but packagers can also put other default configuration | |
126 | there. |
|
126 | there. | |
127 |
|
127 | |||
128 | Syntax |
|
128 | Syntax | |
129 | ====== |
|
129 | ====== | |
130 |
|
130 | |||
131 | A configuration file consists of sections, led by a ``[section]`` header |
|
131 | A configuration file consists of sections, led by a ``[section]`` header | |
132 | and followed by ``name = value`` entries (sometimes called |
|
132 | and followed by ``name = value`` entries (sometimes called | |
133 | ``configuration keys``):: |
|
133 | ``configuration keys``):: | |
134 |
|
134 | |||
135 | [spam] |
|
135 | [spam] | |
136 | eggs=ham |
|
136 | eggs=ham | |
137 | green= |
|
137 | green= | |
138 | eggs |
|
138 | eggs | |
139 |
|
139 | |||
140 | Each line contains one entry. If the lines that follow are indented, |
|
140 | Each line contains one entry. If the lines that follow are indented, | |
141 | they are treated as continuations of that entry. Leading whitespace is |
|
141 | they are treated as continuations of that entry. Leading whitespace is | |
142 | removed from values. Empty lines are skipped. Lines beginning with |
|
142 | removed from values. Empty lines are skipped. Lines beginning with | |
143 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
143 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
144 |
|
144 | |||
145 | Configuration keys can be set multiple times, in which case Mercurial |
|
145 | Configuration keys can be set multiple times, in which case Mercurial | |
146 | will use the value that was configured last. As an example:: |
|
146 | will use the value that was configured last. As an example:: | |
147 |
|
147 | |||
148 | [spam] |
|
148 | [spam] | |
149 | eggs=large |
|
149 | eggs=large | |
150 | ham=serrano |
|
150 | ham=serrano | |
151 | eggs=small |
|
151 | eggs=small | |
152 |
|
152 | |||
153 | This would set the configuration key named ``eggs`` to ``small``. |
|
153 | This would set the configuration key named ``eggs`` to ``small``. | |
154 |
|
154 | |||
155 | It is also possible to define a section multiple times. A section can |
|
155 | It is also possible to define a section multiple times. A section can | |
156 | be redefined on the same and/or on different configuration files. For |
|
156 | be redefined on the same and/or on different configuration files. For | |
157 | example:: |
|
157 | example:: | |
158 |
|
158 | |||
159 | [foo] |
|
159 | [foo] | |
160 | eggs=large |
|
160 | eggs=large | |
161 | ham=serrano |
|
161 | ham=serrano | |
162 | eggs=small |
|
162 | eggs=small | |
163 |
|
163 | |||
164 | [bar] |
|
164 | [bar] | |
165 | eggs=ham |
|
165 | eggs=ham | |
166 | green= |
|
166 | green= | |
167 | eggs |
|
167 | eggs | |
168 |
|
168 | |||
169 | [foo] |
|
169 | [foo] | |
170 | ham=prosciutto |
|
170 | ham=prosciutto | |
171 | eggs=medium |
|
171 | eggs=medium | |
172 | bread=toasted |
|
172 | bread=toasted | |
173 |
|
173 | |||
174 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
174 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
175 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
175 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
176 | respectively. As you can see there only thing that matters is the last |
|
176 | respectively. As you can see there only thing that matters is the last | |
177 | value that was set for each of the configuration keys. |
|
177 | value that was set for each of the configuration keys. | |
178 |
|
178 | |||
179 | If a configuration key is set multiple times in different |
|
179 | If a configuration key is set multiple times in different | |
180 | configuration files the final value will depend on the order in which |
|
180 | configuration files the final value will depend on the order in which | |
181 | the different configuration files are read, with settings from earlier |
|
181 | the different configuration files are read, with settings from earlier | |
182 | paths overriding later ones as described on the ``Files`` section |
|
182 | paths overriding later ones as described on the ``Files`` section | |
183 | above. |
|
183 | above. | |
184 |
|
184 | |||
185 | A line of the form ``%include file`` will include ``file`` into the |
|
185 | A line of the form ``%include file`` will include ``file`` into the | |
186 | current configuration file. The inclusion is recursive, which means |
|
186 | current configuration file. The inclusion is recursive, which means | |
187 | that included files can include other files. Filenames are relative to |
|
187 | that included files can include other files. Filenames are relative to | |
188 | the configuration file in which the ``%include`` directive is found. |
|
188 | the configuration file in which the ``%include`` directive is found. | |
189 | Environment variables and ``~user`` constructs are expanded in |
|
189 | Environment variables and ``~user`` constructs are expanded in | |
190 | ``file``. This lets you do something like:: |
|
190 | ``file``. This lets you do something like:: | |
191 |
|
191 | |||
192 | %include ~/.hgrc.d/$HOST.rc |
|
192 | %include ~/.hgrc.d/$HOST.rc | |
193 |
|
193 | |||
194 | to include a different configuration file on each computer you use. |
|
194 | to include a different configuration file on each computer you use. | |
195 |
|
195 | |||
196 | A line with ``%unset name`` will remove ``name`` from the current |
|
196 | A line with ``%unset name`` will remove ``name`` from the current | |
197 | section, if it has been set previously. |
|
197 | section, if it has been set previously. | |
198 |
|
198 | |||
199 | The values are either free-form text strings, lists of text strings, |
|
199 | The values are either free-form text strings, lists of text strings, | |
200 | or Boolean values. Boolean values can be set to true using any of "1", |
|
200 | or Boolean values. Boolean values can be set to true using any of "1", | |
201 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
201 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
202 | (all case insensitive). |
|
202 | (all case insensitive). | |
203 |
|
203 | |||
204 | List values are separated by whitespace or comma, except when values are |
|
204 | List values are separated by whitespace or comma, except when values are | |
205 | placed in double quotation marks:: |
|
205 | placed in double quotation marks:: | |
206 |
|
206 | |||
207 | allow_read = "John Doe, PhD", brian, betty |
|
207 | allow_read = "John Doe, PhD", brian, betty | |
208 |
|
208 | |||
209 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
209 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
210 | quotation marks at the beginning of a word is counted as a quotation |
|
210 | quotation marks at the beginning of a word is counted as a quotation | |
211 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
211 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
212 |
|
212 | |||
213 | Sections |
|
213 | Sections | |
214 | ======== |
|
214 | ======== | |
215 |
|
215 | |||
216 | This section describes the different sections that may appear in a |
|
216 | This section describes the different sections that may appear in a | |
217 | Mercurial configuration file, the purpose of each section, its possible |
|
217 | Mercurial configuration file, the purpose of each section, its possible | |
218 | keys, and their possible values. |
|
218 | keys, and their possible values. | |
219 |
|
219 | |||
220 | ``alias`` |
|
220 | ``alias`` | |
221 | --------- |
|
221 | --------- | |
222 |
|
222 | |||
223 | Defines command aliases. |
|
223 | Defines command aliases. | |
224 |
|
224 | |||
225 | Aliases allow you to define your own commands in terms of other |
|
225 | Aliases allow you to define your own commands in terms of other | |
226 | commands (or aliases), optionally including arguments. Positional |
|
226 | commands (or aliases), optionally including arguments. Positional | |
227 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
227 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition | |
228 | are expanded by Mercurial before execution. Positional arguments not |
|
228 | are expanded by Mercurial before execution. Positional arguments not | |
229 | already used by ``$N`` in the definition are put at the end of the |
|
229 | already used by ``$N`` in the definition are put at the end of the | |
230 | command to be executed. |
|
230 | command to be executed. | |
231 |
|
231 | |||
232 | Alias definitions consist of lines of the form:: |
|
232 | Alias definitions consist of lines of the form:: | |
233 |
|
233 | |||
234 | <alias> = <command> [<argument>]... |
|
234 | <alias> = <command> [<argument>]... | |
235 |
|
235 | |||
236 | For example, this definition:: |
|
236 | For example, this definition:: | |
237 |
|
237 | |||
238 | latest = log --limit 5 |
|
238 | latest = log --limit 5 | |
239 |
|
239 | |||
240 | creates a new command ``latest`` that shows only the five most recent |
|
240 | creates a new command ``latest`` that shows only the five most recent | |
241 | changesets. You can define subsequent aliases using earlier ones:: |
|
241 | changesets. You can define subsequent aliases using earlier ones:: | |
242 |
|
242 | |||
243 | stable5 = latest -b stable |
|
243 | stable5 = latest -b stable | |
244 |
|
244 | |||
245 | .. note:: |
|
245 | .. note:: | |
246 |
|
246 | |||
247 | It is possible to create aliases with the same names as |
|
247 | It is possible to create aliases with the same names as | |
248 | existing commands, which will then override the original |
|
248 | existing commands, which will then override the original | |
249 | definitions. This is almost always a bad idea! |
|
249 | definitions. This is almost always a bad idea! | |
250 |
|
250 | |||
251 | An alias can start with an exclamation point (``!``) to make it a |
|
251 | An alias can start with an exclamation point (``!``) to make it a | |
252 | shell alias. A shell alias is executed with the shell and will let you |
|
252 | shell alias. A shell alias is executed with the shell and will let you | |
253 | run arbitrary commands. As an example, :: |
|
253 | run arbitrary commands. As an example, :: | |
254 |
|
254 | |||
255 | echo = !echo $@ |
|
255 | echo = !echo $@ | |
256 |
|
256 | |||
257 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
257 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
258 | terminal. A better example might be:: |
|
258 | terminal. A better example might be:: | |
259 |
|
259 | |||
260 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
260 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
261 |
|
261 | |||
262 | which will make ``hg purge`` delete all unknown files in the |
|
262 | which will make ``hg purge`` delete all unknown files in the | |
263 | repository in the same manner as the purge extension. |
|
263 | repository in the same manner as the purge extension. | |
264 |
|
264 | |||
265 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
265 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
266 | expand to the command arguments. Unmatched arguments are |
|
266 | expand to the command arguments. Unmatched arguments are | |
267 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
267 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
268 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
268 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
269 | arguments quoted individually and separated by a space. These expansions |
|
269 | arguments quoted individually and separated by a space. These expansions | |
270 | happen before the command is passed to the shell. |
|
270 | happen before the command is passed to the shell. | |
271 |
|
271 | |||
272 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
272 | Shell aliases are executed in an environment where ``$HG`` expands to | |
273 | the path of the Mercurial that was used to execute the alias. This is |
|
273 | the path of the Mercurial that was used to execute the alias. This is | |
274 | useful when you want to call further Mercurial commands in a shell |
|
274 | useful when you want to call further Mercurial commands in a shell | |
275 | alias, as was done above for the purge alias. In addition, |
|
275 | alias, as was done above for the purge alias. In addition, | |
276 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
276 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
277 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
277 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
278 |
|
278 | |||
279 | .. note:: |
|
279 | .. note:: | |
280 |
|
280 | |||
281 | Some global configuration options such as ``-R`` are |
|
281 | Some global configuration options such as ``-R`` are | |
282 | processed before shell aliases and will thus not be passed to |
|
282 | processed before shell aliases and will thus not be passed to | |
283 | aliases. |
|
283 | aliases. | |
284 |
|
284 | |||
285 |
|
285 | |||
286 | ``annotate`` |
|
286 | ``annotate`` | |
287 | ------------ |
|
287 | ------------ | |
288 |
|
288 | |||
289 | Settings used when displaying file annotations. All values are |
|
289 | Settings used when displaying file annotations. All values are | |
290 | Booleans and default to False. See :hg:`help config.diff` for |
|
290 | Booleans and default to False. See :hg:`help config.diff` for | |
291 | related options for the diff command. |
|
291 | related options for the diff command. | |
292 |
|
292 | |||
293 | ``ignorews`` |
|
293 | ``ignorews`` | |
294 | Ignore white space when comparing lines. |
|
294 | Ignore white space when comparing lines. | |
295 |
|
295 | |||
296 | ``ignorewsamount`` |
|
296 | ``ignorewsamount`` | |
297 | Ignore changes in the amount of white space. |
|
297 | Ignore changes in the amount of white space. | |
298 |
|
298 | |||
299 | ``ignoreblanklines`` |
|
299 | ``ignoreblanklines`` | |
300 | Ignore changes whose lines are all blank. |
|
300 | Ignore changes whose lines are all blank. | |
301 |
|
301 | |||
302 |
|
302 | |||
303 | ``auth`` |
|
303 | ``auth`` | |
304 | -------- |
|
304 | -------- | |
305 |
|
305 | |||
306 | Authentication credentials for HTTP authentication. This section |
|
306 | Authentication credentials for HTTP authentication. This section | |
307 | allows you to store usernames and passwords for use when logging |
|
307 | allows you to store usernames and passwords for use when logging | |
308 | *into* HTTP servers. See :hg:`help config.web` if |
|
308 | *into* HTTP servers. See :hg:`help config.web` if | |
309 | you want to configure *who* can login to your HTTP server. |
|
309 | you want to configure *who* can login to your HTTP server. | |
310 |
|
310 | |||
311 | Each line has the following format:: |
|
311 | Each line has the following format:: | |
312 |
|
312 | |||
313 | <name>.<argument> = <value> |
|
313 | <name>.<argument> = <value> | |
314 |
|
314 | |||
315 | where ``<name>`` is used to group arguments into authentication |
|
315 | where ``<name>`` is used to group arguments into authentication | |
316 | entries. Example:: |
|
316 | entries. Example:: | |
317 |
|
317 | |||
318 | foo.prefix = hg.intevation.org/mercurial |
|
318 | foo.prefix = hg.intevation.org/mercurial | |
319 | foo.username = foo |
|
319 | foo.username = foo | |
320 | foo.password = bar |
|
320 | foo.password = bar | |
321 | foo.schemes = http https |
|
321 | foo.schemes = http https | |
322 |
|
322 | |||
323 | bar.prefix = secure.example.org |
|
323 | bar.prefix = secure.example.org | |
324 | bar.key = path/to/file.key |
|
324 | bar.key = path/to/file.key | |
325 | bar.cert = path/to/file.cert |
|
325 | bar.cert = path/to/file.cert | |
326 | bar.schemes = https |
|
326 | bar.schemes = https | |
327 |
|
327 | |||
328 | Supported arguments: |
|
328 | Supported arguments: | |
329 |
|
329 | |||
330 | ``prefix`` |
|
330 | ``prefix`` | |
331 | Either ``*`` or a URI prefix with or without the scheme part. |
|
331 | Either ``*`` or a URI prefix with or without the scheme part. | |
332 | The authentication entry with the longest matching prefix is used |
|
332 | The authentication entry with the longest matching prefix is used | |
333 | (where ``*`` matches everything and counts as a match of length |
|
333 | (where ``*`` matches everything and counts as a match of length | |
334 | 1). If the prefix doesn't include a scheme, the match is performed |
|
334 | 1). If the prefix doesn't include a scheme, the match is performed | |
335 | against the URI with its scheme stripped as well, and the schemes |
|
335 | against the URI with its scheme stripped as well, and the schemes | |
336 | argument, q.v., is then subsequently consulted. |
|
336 | argument, q.v., is then subsequently consulted. | |
337 |
|
337 | |||
338 | ``username`` |
|
338 | ``username`` | |
339 | Optional. Username to authenticate with. If not given, and the |
|
339 | Optional. Username to authenticate with. If not given, and the | |
340 | remote site requires basic or digest authentication, the user will |
|
340 | remote site requires basic or digest authentication, the user will | |
341 | be prompted for it. Environment variables are expanded in the |
|
341 | be prompted for it. Environment variables are expanded in the | |
342 | username letting you do ``foo.username = $USER``. If the URI |
|
342 | username letting you do ``foo.username = $USER``. If the URI | |
343 | includes a username, only ``[auth]`` entries with a matching |
|
343 | includes a username, only ``[auth]`` entries with a matching | |
344 | username or without a username will be considered. |
|
344 | username or without a username will be considered. | |
345 |
|
345 | |||
346 | ``password`` |
|
346 | ``password`` | |
347 | Optional. Password to authenticate with. If not given, and the |
|
347 | Optional. Password to authenticate with. If not given, and the | |
348 | remote site requires basic or digest authentication, the user |
|
348 | remote site requires basic or digest authentication, the user | |
349 | will be prompted for it. |
|
349 | will be prompted for it. | |
350 |
|
350 | |||
351 | ``key`` |
|
351 | ``key`` | |
352 | Optional. PEM encoded client certificate key file. Environment |
|
352 | Optional. PEM encoded client certificate key file. Environment | |
353 | variables are expanded in the filename. |
|
353 | variables are expanded in the filename. | |
354 |
|
354 | |||
355 | ``cert`` |
|
355 | ``cert`` | |
356 | Optional. PEM encoded client certificate chain file. Environment |
|
356 | Optional. PEM encoded client certificate chain file. Environment | |
357 | variables are expanded in the filename. |
|
357 | variables are expanded in the filename. | |
358 |
|
358 | |||
359 | ``schemes`` |
|
359 | ``schemes`` | |
360 | Optional. Space separated list of URI schemes to use this |
|
360 | Optional. Space separated list of URI schemes to use this | |
361 | authentication entry with. Only used if the prefix doesn't include |
|
361 | authentication entry with. Only used if the prefix doesn't include | |
362 | a scheme. Supported schemes are http and https. They will match |
|
362 | a scheme. Supported schemes are http and https. They will match | |
363 | static-http and static-https respectively, as well. |
|
363 | static-http and static-https respectively, as well. | |
364 | (default: https) |
|
364 | (default: https) | |
365 |
|
365 | |||
366 | If no suitable authentication entry is found, the user is prompted |
|
366 | If no suitable authentication entry is found, the user is prompted | |
367 | for credentials as usual if required by the remote. |
|
367 | for credentials as usual if required by the remote. | |
368 |
|
368 | |||
369 |
|
369 | |||
370 | ``committemplate`` |
|
370 | ``committemplate`` | |
371 | ------------------ |
|
371 | ------------------ | |
372 |
|
372 | |||
373 | ``changeset`` |
|
373 | ``changeset`` | |
374 | String: configuration in this section is used as the template to |
|
374 | String: configuration in this section is used as the template to | |
375 | customize the text shown in the editor when committing. |
|
375 | customize the text shown in the editor when committing. | |
376 |
|
376 | |||
377 | In addition to pre-defined template keywords, commit log specific one |
|
377 | In addition to pre-defined template keywords, commit log specific one | |
378 | below can be used for customization: |
|
378 | below can be used for customization: | |
379 |
|
379 | |||
380 | ``extramsg`` |
|
380 | ``extramsg`` | |
381 | String: Extra message (typically 'Leave message empty to abort |
|
381 | String: Extra message (typically 'Leave message empty to abort | |
382 | commit.'). This may be changed by some commands or extensions. |
|
382 | commit.'). This may be changed by some commands or extensions. | |
383 |
|
383 | |||
384 | For example, the template configuration below shows as same text as |
|
384 | For example, the template configuration below shows as same text as | |
385 | one shown by default:: |
|
385 | one shown by default:: | |
386 |
|
386 | |||
387 | [committemplate] |
|
387 | [committemplate] | |
388 | changeset = {desc}\n\n |
|
388 | changeset = {desc}\n\n | |
389 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
389 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
390 | HG: {extramsg} |
|
390 | HG: {extramsg} | |
391 | HG: -- |
|
391 | HG: -- | |
392 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
392 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
393 | "HG: branch merge\n") |
|
393 | "HG: branch merge\n") | |
394 | }HG: branch '{branch}'\n{if(activebookmark, |
|
394 | }HG: branch '{branch}'\n{if(activebookmark, | |
395 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
395 | "HG: bookmark '{activebookmark}'\n") }{subrepos % | |
396 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
396 | "HG: subrepo {subrepo}\n" }{file_adds % | |
397 | "HG: added {file}\n" }{file_mods % |
|
397 | "HG: added {file}\n" }{file_mods % | |
398 | "HG: changed {file}\n" }{file_dels % |
|
398 | "HG: changed {file}\n" }{file_dels % | |
399 | "HG: removed {file}\n" }{if(files, "", |
|
399 | "HG: removed {file}\n" }{if(files, "", | |
400 | "HG: no files changed\n")} |
|
400 | "HG: no files changed\n")} | |
401 |
|
401 | |||
402 | .. note:: |
|
402 | .. note:: | |
403 |
|
403 | |||
404 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
404 | For some problematic encodings (see :hg:`help win32mbcs` for | |
405 | detail), this customization should be configured carefully, to |
|
405 | detail), this customization should be configured carefully, to | |
406 | avoid showing broken characters. |
|
406 | avoid showing broken characters. | |
407 |
|
407 | |||
408 | For example, if a multibyte character ending with backslash (0x5c) is |
|
408 | For example, if a multibyte character ending with backslash (0x5c) is | |
409 | followed by the ASCII character 'n' in the customized template, |
|
409 | followed by the ASCII character 'n' in the customized template, | |
410 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
410 | the sequence of backslash and 'n' is treated as line-feed unexpectedly | |
411 | (and the multibyte character is broken, too). |
|
411 | (and the multibyte character is broken, too). | |
412 |
|
412 | |||
413 | Customized template is used for commands below (``--edit`` may be |
|
413 | Customized template is used for commands below (``--edit`` may be | |
414 | required): |
|
414 | required): | |
415 |
|
415 | |||
416 | - :hg:`backout` |
|
416 | - :hg:`backout` | |
417 | - :hg:`commit` |
|
417 | - :hg:`commit` | |
418 | - :hg:`fetch` (for merge commit only) |
|
418 | - :hg:`fetch` (for merge commit only) | |
419 | - :hg:`graft` |
|
419 | - :hg:`graft` | |
420 | - :hg:`histedit` |
|
420 | - :hg:`histedit` | |
421 | - :hg:`import` |
|
421 | - :hg:`import` | |
422 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
422 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
423 | - :hg:`rebase` |
|
423 | - :hg:`rebase` | |
424 | - :hg:`shelve` |
|
424 | - :hg:`shelve` | |
425 | - :hg:`sign` |
|
425 | - :hg:`sign` | |
426 | - :hg:`tag` |
|
426 | - :hg:`tag` | |
427 | - :hg:`transplant` |
|
427 | - :hg:`transplant` | |
428 |
|
428 | |||
429 | Configuring items below instead of ``changeset`` allows showing |
|
429 | Configuring items below instead of ``changeset`` allows showing | |
430 | customized message only for specific actions, or showing different |
|
430 | customized message only for specific actions, or showing different | |
431 | messages for each action. |
|
431 | messages for each action. | |
432 |
|
432 | |||
433 | - ``changeset.backout`` for :hg:`backout` |
|
433 | - ``changeset.backout`` for :hg:`backout` | |
434 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
434 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges | |
435 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
435 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other | |
436 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
436 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges | |
437 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
437 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other | |
438 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
438 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
439 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
439 | - ``changeset.gpg.sign`` for :hg:`sign` | |
440 | - ``changeset.graft`` for :hg:`graft` |
|
440 | - ``changeset.graft`` for :hg:`graft` | |
441 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
441 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
442 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
442 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
443 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
443 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
444 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
444 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
445 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
445 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
446 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
446 | - ``changeset.import.normal.merge`` for :hg:`import` on merges | |
447 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
447 | - ``changeset.import.normal.normal`` for :hg:`import` on other | |
448 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
448 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
449 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
449 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
450 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
450 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
451 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
451 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
452 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
452 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges | |
453 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
453 | - ``changeset.rebase.normal`` for :hg:`rebase` on other | |
454 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
454 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
455 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
455 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
456 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
456 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
457 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
457 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges | |
458 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
458 | - ``changeset.transplant.normal`` for :hg:`transplant` on other | |
459 |
|
459 | |||
460 | These dot-separated lists of names are treated as hierarchical ones. |
|
460 | These dot-separated lists of names are treated as hierarchical ones. | |
461 | For example, ``changeset.tag.remove`` customizes the commit message |
|
461 | For example, ``changeset.tag.remove`` customizes the commit message | |
462 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
462 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
463 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
463 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
464 |
|
464 | |||
465 | When the external editor is invoked for a commit, the corresponding |
|
465 | When the external editor is invoked for a commit, the corresponding | |
466 | dot-separated list of names without the ``changeset.`` prefix |
|
466 | dot-separated list of names without the ``changeset.`` prefix | |
467 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
467 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment | |
468 | variable. |
|
468 | variable. | |
469 |
|
469 | |||
470 | In this section, items other than ``changeset`` can be referred from |
|
470 | In this section, items other than ``changeset`` can be referred from | |
471 | others. For example, the configuration to list committed files up |
|
471 | others. For example, the configuration to list committed files up | |
472 | below can be referred as ``{listupfiles}``:: |
|
472 | below can be referred as ``{listupfiles}``:: | |
473 |
|
473 | |||
474 | [committemplate] |
|
474 | [committemplate] | |
475 | listupfiles = {file_adds % |
|
475 | listupfiles = {file_adds % | |
476 | "HG: added {file}\n" }{file_mods % |
|
476 | "HG: added {file}\n" }{file_mods % | |
477 | "HG: changed {file}\n" }{file_dels % |
|
477 | "HG: changed {file}\n" }{file_dels % | |
478 | "HG: removed {file}\n" }{if(files, "", |
|
478 | "HG: removed {file}\n" }{if(files, "", | |
479 | "HG: no files changed\n")} |
|
479 | "HG: no files changed\n")} | |
480 |
|
480 | |||
481 | ``decode/encode`` |
|
481 | ``decode/encode`` | |
482 | ----------------- |
|
482 | ----------------- | |
483 |
|
483 | |||
484 | Filters for transforming files on checkout/checkin. This would |
|
484 | Filters for transforming files on checkout/checkin. This would | |
485 | typically be used for newline processing or other |
|
485 | typically be used for newline processing or other | |
486 | localization/canonicalization of files. |
|
486 | localization/canonicalization of files. | |
487 |
|
487 | |||
488 | Filters consist of a filter pattern followed by a filter command. |
|
488 | Filters consist of a filter pattern followed by a filter command. | |
489 | Filter patterns are globs by default, rooted at the repository root. |
|
489 | Filter patterns are globs by default, rooted at the repository root. | |
490 | For example, to match any file ending in ``.txt`` in the root |
|
490 | For example, to match any file ending in ``.txt`` in the root | |
491 | directory only, use the pattern ``*.txt``. To match any file ending |
|
491 | directory only, use the pattern ``*.txt``. To match any file ending | |
492 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
492 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
493 | For each file only the first matching filter applies. |
|
493 | For each file only the first matching filter applies. | |
494 |
|
494 | |||
495 | The filter command can start with a specifier, either ``pipe:`` or |
|
495 | The filter command can start with a specifier, either ``pipe:`` or | |
496 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
496 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
497 |
|
497 | |||
498 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
498 | A ``pipe:`` command must accept data on stdin and return the transformed | |
499 | data on stdout. |
|
499 | data on stdout. | |
500 |
|
500 | |||
501 | Pipe example:: |
|
501 | Pipe example:: | |
502 |
|
502 | |||
503 | [encode] |
|
503 | [encode] | |
504 | # uncompress gzip files on checkin to improve delta compression |
|
504 | # uncompress gzip files on checkin to improve delta compression | |
505 | # note: not necessarily a good idea, just an example |
|
505 | # note: not necessarily a good idea, just an example | |
506 | *.gz = pipe: gunzip |
|
506 | *.gz = pipe: gunzip | |
507 |
|
507 | |||
508 | [decode] |
|
508 | [decode] | |
509 | # recompress gzip files when writing them to the working dir (we |
|
509 | # recompress gzip files when writing them to the working dir (we | |
510 | # can safely omit "pipe:", because it's the default) |
|
510 | # can safely omit "pipe:", because it's the default) | |
511 | *.gz = gzip |
|
511 | *.gz = gzip | |
512 |
|
512 | |||
513 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
513 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
514 | with the name of a temporary file that contains the data to be |
|
514 | with the name of a temporary file that contains the data to be | |
515 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
515 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
516 | of an empty temporary file, where the filtered data must be written by |
|
516 | of an empty temporary file, where the filtered data must be written by | |
517 | the command. |
|
517 | the command. | |
518 |
|
518 | |||
519 | .. note:: |
|
519 | .. note:: | |
520 |
|
520 | |||
521 | The tempfile mechanism is recommended for Windows systems, |
|
521 | The tempfile mechanism is recommended for Windows systems, | |
522 | where the standard shell I/O redirection operators often have |
|
522 | where the standard shell I/O redirection operators often have | |
523 | strange effects and may corrupt the contents of your files. |
|
523 | strange effects and may corrupt the contents of your files. | |
524 |
|
524 | |||
525 | This filter mechanism is used internally by the ``eol`` extension to |
|
525 | This filter mechanism is used internally by the ``eol`` extension to | |
526 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
526 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
527 | format. We suggest you use the ``eol`` extension for convenience. |
|
527 | format. We suggest you use the ``eol`` extension for convenience. | |
528 |
|
528 | |||
529 |
|
529 | |||
530 | ``defaults`` |
|
530 | ``defaults`` | |
531 | ------------ |
|
531 | ------------ | |
532 |
|
532 | |||
533 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
533 | (defaults are deprecated. Don't use them. Use aliases instead.) | |
534 |
|
534 | |||
535 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
535 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
536 | default options/arguments to pass to the specified commands. |
|
536 | default options/arguments to pass to the specified commands. | |
537 |
|
537 | |||
538 | The following example makes :hg:`log` run in verbose mode, and |
|
538 | The following example makes :hg:`log` run in verbose mode, and | |
539 | :hg:`status` show only the modified files, by default:: |
|
539 | :hg:`status` show only the modified files, by default:: | |
540 |
|
540 | |||
541 | [defaults] |
|
541 | [defaults] | |
542 | log = -v |
|
542 | log = -v | |
543 | status = -m |
|
543 | status = -m | |
544 |
|
544 | |||
545 | The actual commands, instead of their aliases, must be used when |
|
545 | The actual commands, instead of their aliases, must be used when | |
546 | defining command defaults. The command defaults will also be applied |
|
546 | defining command defaults. The command defaults will also be applied | |
547 | to the aliases of the commands defined. |
|
547 | to the aliases of the commands defined. | |
548 |
|
548 | |||
549 |
|
549 | |||
550 | ``diff`` |
|
550 | ``diff`` | |
551 | -------- |
|
551 | -------- | |
552 |
|
552 | |||
553 | Settings used when displaying diffs. Everything except for ``unified`` |
|
553 | Settings used when displaying diffs. Everything except for ``unified`` | |
554 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
554 | is a Boolean and defaults to False. See :hg:`help config.annotate` | |
555 | for related options for the annotate command. |
|
555 | for related options for the annotate command. | |
556 |
|
556 | |||
557 | ``git`` |
|
557 | ``git`` | |
558 | Use git extended diff format. |
|
558 | Use git extended diff format. | |
559 |
|
559 | |||
560 | ``nobinary`` |
|
560 | ``nobinary`` | |
561 | Omit git binary patches. |
|
561 | Omit git binary patches. | |
562 |
|
562 | |||
563 | ``nodates`` |
|
563 | ``nodates`` | |
564 | Don't include dates in diff headers. |
|
564 | Don't include dates in diff headers. | |
565 |
|
565 | |||
566 | ``noprefix`` |
|
566 | ``noprefix`` | |
567 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
567 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. | |
568 |
|
568 | |||
569 | ``showfunc`` |
|
569 | ``showfunc`` | |
570 | Show which function each change is in. |
|
570 | Show which function each change is in. | |
571 |
|
571 | |||
572 | ``ignorews`` |
|
572 | ``ignorews`` | |
573 | Ignore white space when comparing lines. |
|
573 | Ignore white space when comparing lines. | |
574 |
|
574 | |||
575 | ``ignorewsamount`` |
|
575 | ``ignorewsamount`` | |
576 | Ignore changes in the amount of white space. |
|
576 | Ignore changes in the amount of white space. | |
577 |
|
577 | |||
578 | ``ignoreblanklines`` |
|
578 | ``ignoreblanklines`` | |
579 | Ignore changes whose lines are all blank. |
|
579 | Ignore changes whose lines are all blank. | |
580 |
|
580 | |||
581 | ``unified`` |
|
581 | ``unified`` | |
582 | Number of lines of context to show. |
|
582 | Number of lines of context to show. | |
583 |
|
583 | |||
584 | ``email`` |
|
584 | ``email`` | |
585 | --------- |
|
585 | --------- | |
586 |
|
586 | |||
587 | Settings for extensions that send email messages. |
|
587 | Settings for extensions that send email messages. | |
588 |
|
588 | |||
589 | ``from`` |
|
589 | ``from`` | |
590 | Optional. Email address to use in "From" header and SMTP envelope |
|
590 | Optional. Email address to use in "From" header and SMTP envelope | |
591 | of outgoing messages. |
|
591 | of outgoing messages. | |
592 |
|
592 | |||
593 | ``to`` |
|
593 | ``to`` | |
594 | Optional. Comma-separated list of recipients' email addresses. |
|
594 | Optional. Comma-separated list of recipients' email addresses. | |
595 |
|
595 | |||
596 | ``cc`` |
|
596 | ``cc`` | |
597 | Optional. Comma-separated list of carbon copy recipients' |
|
597 | Optional. Comma-separated list of carbon copy recipients' | |
598 | email addresses. |
|
598 | email addresses. | |
599 |
|
599 | |||
600 | ``bcc`` |
|
600 | ``bcc`` | |
601 | Optional. Comma-separated list of blind carbon copy recipients' |
|
601 | Optional. Comma-separated list of blind carbon copy recipients' | |
602 | email addresses. |
|
602 | email addresses. | |
603 |
|
603 | |||
604 | ``method`` |
|
604 | ``method`` | |
605 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
605 | Optional. Method to use to send email messages. If value is ``smtp`` | |
606 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
606 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
607 | Otherwise, use as name of program to run that acts like sendmail |
|
607 | Otherwise, use as name of program to run that acts like sendmail | |
608 | (takes ``-f`` option for sender, list of recipients on command line, |
|
608 | (takes ``-f`` option for sender, list of recipients on command line, | |
609 | message on stdin). Normally, setting this to ``sendmail`` or |
|
609 | message on stdin). Normally, setting this to ``sendmail`` or | |
610 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
610 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
611 |
|
611 | |||
612 | ``charsets`` |
|
612 | ``charsets`` | |
613 | Optional. Comma-separated list of character sets considered |
|
613 | Optional. Comma-separated list of character sets considered | |
614 | convenient for recipients. Addresses, headers, and parts not |
|
614 | convenient for recipients. Addresses, headers, and parts not | |
615 | containing patches of outgoing messages will be encoded in the |
|
615 | containing patches of outgoing messages will be encoded in the | |
616 | first character set to which conversion from local encoding |
|
616 | first character set to which conversion from local encoding | |
617 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
617 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
618 | conversion fails, the text in question is sent as is. |
|
618 | conversion fails, the text in question is sent as is. | |
619 | (default: '') |
|
619 | (default: '') | |
620 |
|
620 | |||
621 | Order of outgoing email character sets: |
|
621 | Order of outgoing email character sets: | |
622 |
|
622 | |||
623 | 1. ``us-ascii``: always first, regardless of settings |
|
623 | 1. ``us-ascii``: always first, regardless of settings | |
624 | 2. ``email.charsets``: in order given by user |
|
624 | 2. ``email.charsets``: in order given by user | |
625 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
625 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
626 | 4. ``$HGENCODING``: if not in email.charsets |
|
626 | 4. ``$HGENCODING``: if not in email.charsets | |
627 | 5. ``utf-8``: always last, regardless of settings |
|
627 | 5. ``utf-8``: always last, regardless of settings | |
628 |
|
628 | |||
629 | Email example:: |
|
629 | Email example:: | |
630 |
|
630 | |||
631 | [email] |
|
631 | [email] | |
632 | from = Joseph User <joe.user@example.com> |
|
632 | from = Joseph User <joe.user@example.com> | |
633 | method = /usr/sbin/sendmail |
|
633 | method = /usr/sbin/sendmail | |
634 | # charsets for western Europeans |
|
634 | # charsets for western Europeans | |
635 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
635 | # us-ascii, utf-8 omitted, as they are tried first and last | |
636 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
636 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
637 |
|
637 | |||
638 |
|
638 | |||
639 | ``extensions`` |
|
639 | ``extensions`` | |
640 | -------------- |
|
640 | -------------- | |
641 |
|
641 | |||
642 | Mercurial has an extension mechanism for adding new features. To |
|
642 | Mercurial has an extension mechanism for adding new features. To | |
643 | enable an extension, create an entry for it in this section. |
|
643 | enable an extension, create an entry for it in this section. | |
644 |
|
644 | |||
645 | If you know that the extension is already in Python's search path, |
|
645 | If you know that the extension is already in Python's search path, | |
646 | you can give the name of the module, followed by ``=``, with nothing |
|
646 | you can give the name of the module, followed by ``=``, with nothing | |
647 | after the ``=``. |
|
647 | after the ``=``. | |
648 |
|
648 | |||
649 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
649 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
650 | the path to the ``.py`` file (including the file name extension) that |
|
650 | the path to the ``.py`` file (including the file name extension) that | |
651 | defines the extension. |
|
651 | defines the extension. | |
652 |
|
652 | |||
653 | To explicitly disable an extension that is enabled in an hgrc of |
|
653 | To explicitly disable an extension that is enabled in an hgrc of | |
654 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
654 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
655 | or ``foo = !`` when path is not supplied. |
|
655 | or ``foo = !`` when path is not supplied. | |
656 |
|
656 | |||
657 | Example for ``~/.hgrc``:: |
|
657 | Example for ``~/.hgrc``:: | |
658 |
|
658 | |||
659 | [extensions] |
|
659 | [extensions] | |
660 | # (the color extension will get loaded from Mercurial's path) |
|
660 | # (the color extension will get loaded from Mercurial's path) | |
661 | color = |
|
661 | color = | |
662 | # (this extension will get loaded from the file specified) |
|
662 | # (this extension will get loaded from the file specified) | |
663 | myfeature = ~/.hgext/myfeature.py |
|
663 | myfeature = ~/.hgext/myfeature.py | |
664 |
|
664 | |||
665 |
|
665 | |||
666 | ``format`` |
|
666 | ``format`` | |
667 | ---------- |
|
667 | ---------- | |
668 |
|
668 | |||
669 | ``usegeneraldelta`` |
|
669 | ``usegeneraldelta`` | |
670 | Enable or disable the "generaldelta" repository format which improves |
|
670 | Enable or disable the "generaldelta" repository format which improves | |
671 | repository compression by allowing "revlog" to store delta against arbitrary |
|
671 | repository compression by allowing "revlog" to store delta against arbitrary | |
672 | revision instead of the previous stored one. This provides significant |
|
672 | revision instead of the previous stored one. This provides significant | |
673 | improvement for repositories with branches. |
|
673 | improvement for repositories with branches. | |
674 |
|
674 | |||
675 | Repositories with this on-disk format require Mercurial version 1.9. |
|
675 | Repositories with this on-disk format require Mercurial version 1.9. | |
676 |
|
676 | |||
677 | Enabled by default. |
|
677 | Enabled by default. | |
678 |
|
678 | |||
679 | ``dotencode`` |
|
679 | ``dotencode`` | |
680 | Enable or disable the "dotencode" repository format which enhances |
|
680 | Enable or disable the "dotencode" repository format which enhances | |
681 | the "fncache" repository format (which has to be enabled to use |
|
681 | the "fncache" repository format (which has to be enabled to use | |
682 | dotencode) to avoid issues with filenames starting with ._ on |
|
682 | dotencode) to avoid issues with filenames starting with ._ on | |
683 | Mac OS X and spaces on Windows. |
|
683 | Mac OS X and spaces on Windows. | |
684 |
|
684 | |||
685 | Repositories with this on-disk format require Mercurial version 1.7. |
|
685 | Repositories with this on-disk format require Mercurial version 1.7. | |
686 |
|
686 | |||
687 | Enabled by default. |
|
687 | Enabled by default. | |
688 |
|
688 | |||
689 | ``usefncache`` |
|
689 | ``usefncache`` | |
690 | Enable or disable the "fncache" repository format which enhances |
|
690 | Enable or disable the "fncache" repository format which enhances | |
691 | the "store" repository format (which has to be enabled to use |
|
691 | the "store" repository format (which has to be enabled to use | |
692 | fncache) to allow longer filenames and avoids using Windows |
|
692 | fncache) to allow longer filenames and avoids using Windows | |
693 | reserved names, e.g. "nul". |
|
693 | reserved names, e.g. "nul". | |
694 |
|
694 | |||
695 | Repositories with this on-disk format require Mercurial version 1.1. |
|
695 | Repositories with this on-disk format require Mercurial version 1.1. | |
696 |
|
696 | |||
697 | Enabled by default. |
|
697 | Enabled by default. | |
698 |
|
698 | |||
699 | ``usestore`` |
|
699 | ``usestore`` | |
700 | Enable or disable the "store" repository format which improves |
|
700 | Enable or disable the "store" repository format which improves | |
701 | compatibility with systems that fold case or otherwise mangle |
|
701 | compatibility with systems that fold case or otherwise mangle | |
702 | filenames. Disabling this option will allow you to store longer filenames |
|
702 | filenames. Disabling this option will allow you to store longer filenames | |
703 | in some situations at the expense of compatibility. |
|
703 | in some situations at the expense of compatibility. | |
704 |
|
704 | |||
705 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
705 | Repositories with this on-disk format require Mercurial version 0.9.4. | |
706 |
|
706 | |||
707 | Enabled by default. |
|
707 | Enabled by default. | |
708 |
|
708 | |||
709 | ``graph`` |
|
709 | ``graph`` | |
710 | --------- |
|
710 | --------- | |
711 |
|
711 | |||
712 | Web graph view configuration. This section let you change graph |
|
712 | Web graph view configuration. This section let you change graph | |
713 | elements display properties by branches, for instance to make the |
|
713 | elements display properties by branches, for instance to make the | |
714 | ``default`` branch stand out. |
|
714 | ``default`` branch stand out. | |
715 |
|
715 | |||
716 | Each line has the following format:: |
|
716 | Each line has the following format:: | |
717 |
|
717 | |||
718 | <branch>.<argument> = <value> |
|
718 | <branch>.<argument> = <value> | |
719 |
|
719 | |||
720 | where ``<branch>`` is the name of the branch being |
|
720 | where ``<branch>`` is the name of the branch being | |
721 | customized. Example:: |
|
721 | customized. Example:: | |
722 |
|
722 | |||
723 | [graph] |
|
723 | [graph] | |
724 | # 2px width |
|
724 | # 2px width | |
725 | default.width = 2 |
|
725 | default.width = 2 | |
726 | # red color |
|
726 | # red color | |
727 | default.color = FF0000 |
|
727 | default.color = FF0000 | |
728 |
|
728 | |||
729 | Supported arguments: |
|
729 | Supported arguments: | |
730 |
|
730 | |||
731 | ``width`` |
|
731 | ``width`` | |
732 | Set branch edges width in pixels. |
|
732 | Set branch edges width in pixels. | |
733 |
|
733 | |||
734 | ``color`` |
|
734 | ``color`` | |
735 | Set branch edges color in hexadecimal RGB notation. |
|
735 | Set branch edges color in hexadecimal RGB notation. | |
736 |
|
736 | |||
737 | ``hooks`` |
|
737 | ``hooks`` | |
738 | --------- |
|
738 | --------- | |
739 |
|
739 | |||
740 | Commands or Python functions that get automatically executed by |
|
740 | Commands or Python functions that get automatically executed by | |
741 | various actions such as starting or finishing a commit. Multiple |
|
741 | various actions such as starting or finishing a commit. Multiple | |
742 | hooks can be run for the same action by appending a suffix to the |
|
742 | hooks can be run for the same action by appending a suffix to the | |
743 | action. Overriding a site-wide hook can be done by changing its |
|
743 | action. Overriding a site-wide hook can be done by changing its | |
744 | value or setting it to an empty string. Hooks can be prioritized |
|
744 | value or setting it to an empty string. Hooks can be prioritized | |
745 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
745 | by adding a prefix of ``priority.`` to the hook name on a new line | |
746 | and setting the priority. The default priority is 0. |
|
746 | and setting the priority. The default priority is 0. | |
747 |
|
747 | |||
748 | Example ``.hg/hgrc``:: |
|
748 | Example ``.hg/hgrc``:: | |
749 |
|
749 | |||
750 | [hooks] |
|
750 | [hooks] | |
751 | # update working directory after adding changesets |
|
751 | # update working directory after adding changesets | |
752 | changegroup.update = hg update |
|
752 | changegroup.update = hg update | |
753 | # do not use the site-wide hook |
|
753 | # do not use the site-wide hook | |
754 | incoming = |
|
754 | incoming = | |
755 | incoming.email = /my/email/hook |
|
755 | incoming.email = /my/email/hook | |
756 | incoming.autobuild = /my/build/hook |
|
756 | incoming.autobuild = /my/build/hook | |
757 | # force autobuild hook to run before other incoming hooks |
|
757 | # force autobuild hook to run before other incoming hooks | |
758 | priority.incoming.autobuild = 1 |
|
758 | priority.incoming.autobuild = 1 | |
759 |
|
759 | |||
760 | Most hooks are run with environment variables set that give useful |
|
760 | Most hooks are run with environment variables set that give useful | |
761 | additional information. For each hook below, the environment |
|
761 | additional information. For each hook below, the environment | |
762 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
762 | variables it is passed are listed with names of the form ``$HG_foo``. | |
763 |
|
763 | |||
764 | ``changegroup`` |
|
764 | ``changegroup`` | |
765 | Run after a changegroup has been added via push, pull or unbundle. |
|
765 | Run after a changegroup has been added via push, pull or unbundle. | |
766 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
766 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
767 | changes came is in ``$HG_URL``. |
|
767 | changes came is in ``$HG_URL``. | |
768 |
|
768 | |||
769 | ``commit`` |
|
769 | ``commit`` | |
770 | Run after a changeset has been created in the local repository. ID |
|
770 | Run after a changeset has been created in the local repository. ID | |
771 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
771 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
772 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
772 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
773 |
|
773 | |||
774 | ``incoming`` |
|
774 | ``incoming`` | |
775 | Run after a changeset has been pulled, pushed, or unbundled into |
|
775 | Run after a changeset has been pulled, pushed, or unbundled into | |
776 | the local repository. The ID of the newly arrived changeset is in |
|
776 | the local repository. The ID of the newly arrived changeset is in | |
777 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
777 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
778 |
|
778 | |||
779 | ``outgoing`` |
|
779 | ``outgoing`` | |
780 | Run after sending changes from local repository to another. ID of |
|
780 | Run after sending changes from local repository to another. ID of | |
781 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
781 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
782 | ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook. |
|
782 | ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook. | |
783 |
|
783 | |||
784 | ``post-<command>`` |
|
784 | ``post-<command>`` | |
785 | Run after successful invocations of the associated command. The |
|
785 | Run after successful invocations of the associated command. The | |
786 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
786 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
787 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
787 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
788 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
788 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
789 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
789 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
790 | dictionary of options (with unspecified options set to their defaults). |
|
790 | dictionary of options (with unspecified options set to their defaults). | |
791 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
791 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
792 |
|
792 | |||
793 | ``pre-<command>`` |
|
793 | ``pre-<command>`` | |
794 | Run before executing the associated command. The contents of the |
|
794 | Run before executing the associated command. The contents of the | |
795 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
795 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
796 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
796 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
797 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
797 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
798 | is a dictionary of options (with unspecified options set to their |
|
798 | is a dictionary of options (with unspecified options set to their | |
799 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
799 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
800 | failure, the command doesn't execute and Mercurial returns the failure |
|
800 | failure, the command doesn't execute and Mercurial returns the failure | |
801 | code. |
|
801 | code. | |
802 |
|
802 | |||
803 | ``prechangegroup`` |
|
803 | ``prechangegroup`` | |
804 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
804 | Run before a changegroup is added via push, pull or unbundle. Exit | |
805 | status 0 allows the changegroup to proceed. Non-zero status will |
|
805 | status 0 allows the changegroup to proceed. Non-zero status will | |
806 | cause the push, pull or unbundle to fail. URL from which changes |
|
806 | cause the push, pull or unbundle to fail. URL from which changes | |
807 | will come is in ``$HG_URL``. |
|
807 | will come is in ``$HG_URL``. | |
808 |
|
808 | |||
809 | ``precommit`` |
|
809 | ``precommit`` | |
810 | Run before starting a local commit. Exit status 0 allows the |
|
810 | Run before starting a local commit. Exit status 0 allows the | |
811 | commit to proceed. Non-zero status will cause the commit to fail. |
|
811 | commit to proceed. Non-zero status will cause the commit to fail. | |
812 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
812 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
813 |
|
813 | |||
814 | ``prelistkeys`` |
|
814 | ``prelistkeys`` | |
815 | Run before listing pushkeys (like bookmarks) in the |
|
815 | Run before listing pushkeys (like bookmarks) in the | |
816 | repository. Non-zero status will cause failure. The key namespace is |
|
816 | repository. Non-zero status will cause failure. The key namespace is | |
817 | in ``$HG_NAMESPACE``. |
|
817 | in ``$HG_NAMESPACE``. | |
818 |
|
818 | |||
819 | ``preoutgoing`` |
|
819 | ``preoutgoing`` | |
820 | Run before collecting changes to send from the local repository to |
|
820 | Run before collecting changes to send from the local repository to | |
821 | another. Non-zero status will cause failure. This lets you prevent |
|
821 | another. Non-zero status will cause failure. This lets you prevent | |
822 | pull over HTTP or SSH. Also prevents against local pull, push |
|
822 | pull over HTTP or SSH. Also prevents against local pull, push | |
823 | (outbound) or bundle commands, but not effective, since you can |
|
823 | (outbound) or bundle commands, but not effective, since you can | |
824 | just copy files instead then. Source of operation is in |
|
824 | just copy files instead then. Source of operation is in | |
825 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
825 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
826 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
826 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
827 | is happening on behalf of repository on same system. |
|
827 | is happening on behalf of repository on same system. | |
828 |
|
828 | |||
829 | ``prepushkey`` |
|
829 | ``prepushkey`` | |
830 | Run before a pushkey (like a bookmark) is added to the |
|
830 | Run before a pushkey (like a bookmark) is added to the | |
831 | repository. Non-zero status will cause the key to be rejected. The |
|
831 | repository. Non-zero status will cause the key to be rejected. The | |
832 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
832 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
833 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
833 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
834 | ``$HG_NEW``. |
|
834 | ``$HG_NEW``. | |
835 |
|
835 | |||
836 | ``pretag`` |
|
836 | ``pretag`` | |
837 | Run before creating a tag. Exit status 0 allows the tag to be |
|
837 | Run before creating a tag. Exit status 0 allows the tag to be | |
838 | created. Non-zero status will cause the tag to fail. ID of |
|
838 | created. Non-zero status will cause the tag to fail. ID of | |
839 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
839 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
840 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
840 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
841 |
|
841 | |||
842 | ``pretxnopen`` |
|
842 | ``pretxnopen`` | |
843 | Run before any new repository transaction is open. The reason for the |
|
843 | Run before any new repository transaction is open. The reason for the | |
844 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the |
|
844 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the | |
845 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
845 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the | |
846 | transaction from being opened. |
|
846 | transaction from being opened. | |
847 |
|
847 | |||
848 | ``pretxnclose`` |
|
848 | ``pretxnclose`` | |
849 | Run right before the transaction is actually finalized. Any |
|
849 | Run right before the transaction is actually finalized. Any | |
850 | repository change will be visible to the hook program. This lets you |
|
850 | repository change will be visible to the hook program. This lets you | |
851 | validate the transaction content or change it. Exit status 0 allows |
|
851 | validate the transaction content or change it. Exit status 0 allows | |
852 | the commit to proceed. Non-zero status will cause the transaction to |
|
852 | the commit to proceed. Non-zero status will cause the transaction to | |
853 | be rolled back. The reason for the transaction opening will be in |
|
853 | be rolled back. The reason for the transaction opening will be in | |
854 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in |
|
854 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in | |
855 | ``HG_TXNID``. The rest of the available data will vary according the |
|
855 | ``HG_TXNID``. The rest of the available data will vary according the | |
856 | transaction type. New changesets will add ``$HG_NODE`` (id of the |
|
856 | transaction type. New changesets will add ``$HG_NODE`` (id of the | |
857 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, |
|
857 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, | |
858 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and |
|
858 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and | |
859 | ``HG_PHASES_MOVED`` to ``1``, etc. |
|
859 | ``HG_PHASES_MOVED`` to ``1``, etc. | |
860 |
|
860 | |||
861 | ``txnclose`` |
|
861 | ``txnclose`` | |
862 | Run after any repository transaction has been committed. At this |
|
862 | Run after any repository transaction has been committed. At this | |
863 | point, the transaction can no longer be rolled back. The hook will run |
|
863 | point, the transaction can no longer be rolled back. The hook will run | |
864 | after the lock is released. See :hg:`help config.pretxnclose` docs for |
|
864 | after the lock is released. See :hg:`help config.pretxnclose` docs for | |
865 | details about available variables. |
|
865 | details about available variables. | |
866 |
|
866 | |||
867 | ``txnabort`` |
|
867 | ``txnabort`` | |
868 | Run when a transaction is aborted. See :hg:`help config.pretxnclose` |
|
868 | Run when a transaction is aborted. See :hg:`help config.pretxnclose` | |
869 | docs for details about available variables. |
|
869 | docs for details about available variables. | |
870 |
|
870 | |||
871 | ``pretxnchangegroup`` |
|
871 | ``pretxnchangegroup`` | |
872 | Run after a changegroup has been added via push, pull or unbundle, |
|
872 | Run after a changegroup has been added via push, pull or unbundle, | |
873 | but before the transaction has been committed. Changegroup is |
|
873 | but before the transaction has been committed. Changegroup is | |
874 | visible to hook program. This lets you validate incoming changes |
|
874 | visible to hook program. This lets you validate incoming changes | |
875 | before accepting them. Passed the ID of the first new changeset in |
|
875 | before accepting them. Passed the ID of the first new changeset in | |
876 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
876 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
877 | status will cause the transaction to be rolled back and the push, |
|
877 | status will cause the transaction to be rolled back and the push, | |
878 | pull or unbundle will fail. URL that was source of changes is in |
|
878 | pull or unbundle will fail. URL that was source of changes is in | |
879 | ``$HG_URL``. |
|
879 | ``$HG_URL``. | |
880 |
|
880 | |||
881 | ``pretxncommit`` |
|
881 | ``pretxncommit`` | |
882 | Run after a changeset has been created but the transaction not yet |
|
882 | Run after a changeset has been created but the transaction not yet | |
883 | committed. Changeset is visible to hook program. This lets you |
|
883 | committed. Changeset is visible to hook program. This lets you | |
884 | validate commit message and changes. Exit status 0 allows the |
|
884 | validate commit message and changes. Exit status 0 allows the | |
885 | commit to proceed. Non-zero status will cause the transaction to |
|
885 | commit to proceed. Non-zero status will cause the transaction to | |
886 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
886 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
887 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
887 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
888 |
|
888 | |||
889 | ``preupdate`` |
|
889 | ``preupdate`` | |
890 | Run before updating the working directory. Exit status 0 allows |
|
890 | Run before updating the working directory. Exit status 0 allows | |
891 | the update to proceed. Non-zero status will prevent the update. |
|
891 | the update to proceed. Non-zero status will prevent the update. | |
892 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
892 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
893 | of second new parent is in ``$HG_PARENT2``. |
|
893 | of second new parent is in ``$HG_PARENT2``. | |
894 |
|
894 | |||
895 | ``listkeys`` |
|
895 | ``listkeys`` | |
896 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
896 | Run after listing pushkeys (like bookmarks) in the repository. The | |
897 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
897 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
898 | dictionary containing the keys and values. |
|
898 | dictionary containing the keys and values. | |
899 |
|
899 | |||
900 | ``pushkey`` |
|
900 | ``pushkey`` | |
901 | Run after a pushkey (like a bookmark) is added to the |
|
901 | Run after a pushkey (like a bookmark) is added to the | |
902 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
902 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
903 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
903 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
904 | value is in ``$HG_NEW``. |
|
904 | value is in ``$HG_NEW``. | |
905 |
|
905 | |||
906 | ``tag`` |
|
906 | ``tag`` | |
907 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
907 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
908 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
908 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
909 | repository if ``$HG_LOCAL=0``. |
|
909 | repository if ``$HG_LOCAL=0``. | |
910 |
|
910 | |||
911 | ``update`` |
|
911 | ``update`` | |
912 | Run after updating the working directory. Changeset ID of first |
|
912 | Run after updating the working directory. Changeset ID of first | |
913 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
913 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
914 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
914 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
915 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
915 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
916 |
|
916 | |||
917 | .. note:: |
|
917 | .. note:: | |
918 |
|
918 | |||
919 | It is generally better to use standard hooks rather than the |
|
919 | It is generally better to use standard hooks rather than the | |
920 | generic pre- and post- command hooks as they are guaranteed to be |
|
920 | generic pre- and post- command hooks as they are guaranteed to be | |
921 | called in the appropriate contexts for influencing transactions. |
|
921 | called in the appropriate contexts for influencing transactions. | |
922 | Also, hooks like "commit" will be called in all contexts that |
|
922 | Also, hooks like "commit" will be called in all contexts that | |
923 | generate a commit (e.g. tag) and not just the commit command. |
|
923 | generate a commit (e.g. tag) and not just the commit command. | |
924 |
|
924 | |||
925 | .. note:: |
|
925 | .. note:: | |
926 |
|
926 | |||
927 | Environment variables with empty values may not be passed to |
|
927 | Environment variables with empty values may not be passed to | |
928 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
928 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
929 | will have an empty value under Unix-like platforms for non-merge |
|
929 | will have an empty value under Unix-like platforms for non-merge | |
930 | changesets, while it will not be available at all under Windows. |
|
930 | changesets, while it will not be available at all under Windows. | |
931 |
|
931 | |||
932 | The syntax for Python hooks is as follows:: |
|
932 | The syntax for Python hooks is as follows:: | |
933 |
|
933 | |||
934 | hookname = python:modulename.submodule.callable |
|
934 | hookname = python:modulename.submodule.callable | |
935 | hookname = python:/path/to/python/module.py:callable |
|
935 | hookname = python:/path/to/python/module.py:callable | |
936 |
|
936 | |||
937 | Python hooks are run within the Mercurial process. Each hook is |
|
937 | Python hooks are run within the Mercurial process. Each hook is | |
938 | called with at least three keyword arguments: a ui object (keyword |
|
938 | called with at least three keyword arguments: a ui object (keyword | |
939 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
939 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
940 | keyword that tells what kind of hook is used. Arguments listed as |
|
940 | keyword that tells what kind of hook is used. Arguments listed as | |
941 | environment variables above are passed as keyword arguments, with no |
|
941 | environment variables above are passed as keyword arguments, with no | |
942 | ``HG_`` prefix, and names in lower case. |
|
942 | ``HG_`` prefix, and names in lower case. | |
943 |
|
943 | |||
944 | If a Python hook returns a "true" value or raises an exception, this |
|
944 | If a Python hook returns a "true" value or raises an exception, this | |
945 | is treated as a failure. |
|
945 | is treated as a failure. | |
946 |
|
946 | |||
947 |
|
947 | |||
948 | ``hostfingerprints`` |
|
948 | ``hostfingerprints`` | |
949 | -------------------- |
|
949 | -------------------- | |
950 |
|
950 | |||
951 | Fingerprints of the certificates of known HTTPS servers. |
|
951 | Fingerprints of the certificates of known HTTPS servers. | |
952 | A HTTPS connection to a server with a fingerprint configured here will |
|
952 | A HTTPS connection to a server with a fingerprint configured here will | |
953 | only succeed if the servers certificate matches the fingerprint. |
|
953 | only succeed if the servers certificate matches the fingerprint. | |
954 | This is very similar to how ssh known hosts works. |
|
954 | This is very similar to how ssh known hosts works. | |
955 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
955 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
956 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
956 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
957 |
|
957 | |||
958 | For example:: |
|
958 | For example:: | |
959 |
|
959 | |||
960 | [hostfingerprints] |
|
960 | [hostfingerprints] | |
961 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 |
|
961 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 | |
962 |
|
962 | |||
963 | This feature is only supported when using Python 2.6 or later. |
|
963 | This feature is only supported when using Python 2.6 or later. | |
964 |
|
964 | |||
965 |
|
965 | |||
966 | ``http_proxy`` |
|
966 | ``http_proxy`` | |
967 | -------------- |
|
967 | -------------- | |
968 |
|
968 | |||
969 | Used to access web-based Mercurial repositories through a HTTP |
|
969 | Used to access web-based Mercurial repositories through a HTTP | |
970 | proxy. |
|
970 | proxy. | |
971 |
|
971 | |||
972 | ``host`` |
|
972 | ``host`` | |
973 | Host name and (optional) port of the proxy server, for example |
|
973 | Host name and (optional) port of the proxy server, for example | |
974 | "myproxy:8000". |
|
974 | "myproxy:8000". | |
975 |
|
975 | |||
976 | ``no`` |
|
976 | ``no`` | |
977 | Optional. Comma-separated list of host names that should bypass |
|
977 | Optional. Comma-separated list of host names that should bypass | |
978 | the proxy. |
|
978 | the proxy. | |
979 |
|
979 | |||
980 | ``passwd`` |
|
980 | ``passwd`` | |
981 | Optional. Password to authenticate with at the proxy server. |
|
981 | Optional. Password to authenticate with at the proxy server. | |
982 |
|
982 | |||
983 | ``user`` |
|
983 | ``user`` | |
984 | Optional. User name to authenticate with at the proxy server. |
|
984 | Optional. User name to authenticate with at the proxy server. | |
985 |
|
985 | |||
986 | ``always`` |
|
986 | ``always`` | |
987 | Optional. Always use the proxy, even for localhost and any entries |
|
987 | Optional. Always use the proxy, even for localhost and any entries | |
988 | in ``http_proxy.no``. (default: False) |
|
988 | in ``http_proxy.no``. (default: False) | |
989 |
|
989 | |||
|
990 | ``merge`` | |||
|
991 | --------- | |||
|
992 | ||||
|
993 | This section specifies behavior during merges and updates. | |||
|
994 | ||||
|
995 | ``checkunknown`` | |||
|
996 | Controls behavior when an unknown file on disk has the same name as a tracked | |||
|
997 | file in the changeset being merged or updated to, and has different | |||
|
998 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, | |||
|
999 | abort on such files. With ``warn``, warn on such files and back them up as | |||
|
1000 | .orig. With ``ignore``, don't print a warning and back them up as | |||
|
1001 | .orig. (default: ``abort``) | |||
|
1002 | ||||
990 | ``merge-patterns`` |
|
1003 | ``merge-patterns`` | |
991 | ------------------ |
|
1004 | ------------------ | |
992 |
|
1005 | |||
993 | This section specifies merge tools to associate with particular file |
|
1006 | This section specifies merge tools to associate with particular file | |
994 | patterns. Tools matched here will take precedence over the default |
|
1007 | patterns. Tools matched here will take precedence over the default | |
995 | merge tool. Patterns are globs by default, rooted at the repository |
|
1008 | merge tool. Patterns are globs by default, rooted at the repository | |
996 | root. |
|
1009 | root. | |
997 |
|
1010 | |||
998 | Example:: |
|
1011 | Example:: | |
999 |
|
1012 | |||
1000 | [merge-patterns] |
|
1013 | [merge-patterns] | |
1001 | **.c = kdiff3 |
|
1014 | **.c = kdiff3 | |
1002 | **.jpg = myimgmerge |
|
1015 | **.jpg = myimgmerge | |
1003 |
|
1016 | |||
1004 | ``merge-tools`` |
|
1017 | ``merge-tools`` | |
1005 | --------------- |
|
1018 | --------------- | |
1006 |
|
1019 | |||
1007 | This section configures external merge tools to use for file-level |
|
1020 | This section configures external merge tools to use for file-level | |
1008 | merges. This section has likely been preconfigured at install time. |
|
1021 | merges. This section has likely been preconfigured at install time. | |
1009 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1022 | Use :hg:`config merge-tools` to check the existing configuration. | |
1010 | Also see :hg:`help merge-tools` for more details. |
|
1023 | Also see :hg:`help merge-tools` for more details. | |
1011 |
|
1024 | |||
1012 | Example ``~/.hgrc``:: |
|
1025 | Example ``~/.hgrc``:: | |
1013 |
|
1026 | |||
1014 | [merge-tools] |
|
1027 | [merge-tools] | |
1015 | # Override stock tool location |
|
1028 | # Override stock tool location | |
1016 | kdiff3.executable = ~/bin/kdiff3 |
|
1029 | kdiff3.executable = ~/bin/kdiff3 | |
1017 | # Specify command line |
|
1030 | # Specify command line | |
1018 | kdiff3.args = $base $local $other -o $output |
|
1031 | kdiff3.args = $base $local $other -o $output | |
1019 | # Give higher priority |
|
1032 | # Give higher priority | |
1020 | kdiff3.priority = 1 |
|
1033 | kdiff3.priority = 1 | |
1021 |
|
1034 | |||
1022 | # Changing the priority of preconfigured tool |
|
1035 | # Changing the priority of preconfigured tool | |
1023 | meld.priority = 0 |
|
1036 | meld.priority = 0 | |
1024 |
|
1037 | |||
1025 | # Disable a preconfigured tool |
|
1038 | # Disable a preconfigured tool | |
1026 | vimdiff.disabled = yes |
|
1039 | vimdiff.disabled = yes | |
1027 |
|
1040 | |||
1028 | # Define new tool |
|
1041 | # Define new tool | |
1029 | myHtmlTool.args = -m $local $other $base $output |
|
1042 | myHtmlTool.args = -m $local $other $base $output | |
1030 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1043 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
1031 | myHtmlTool.priority = 1 |
|
1044 | myHtmlTool.priority = 1 | |
1032 |
|
1045 | |||
1033 | Supported arguments: |
|
1046 | Supported arguments: | |
1034 |
|
1047 | |||
1035 | ``priority`` |
|
1048 | ``priority`` | |
1036 | The priority in which to evaluate this tool. |
|
1049 | The priority in which to evaluate this tool. | |
1037 | (default: 0) |
|
1050 | (default: 0) | |
1038 |
|
1051 | |||
1039 | ``executable`` |
|
1052 | ``executable`` | |
1040 | Either just the name of the executable or its pathname. On Windows, |
|
1053 | Either just the name of the executable or its pathname. On Windows, | |
1041 | the path can use environment variables with ${ProgramFiles} syntax. |
|
1054 | the path can use environment variables with ${ProgramFiles} syntax. | |
1042 | (default: the tool name) |
|
1055 | (default: the tool name) | |
1043 |
|
1056 | |||
1044 | ``args`` |
|
1057 | ``args`` | |
1045 | The arguments to pass to the tool executable. You can refer to the |
|
1058 | The arguments to pass to the tool executable. You can refer to the | |
1046 | files being merged as well as the output file through these |
|
1059 | files being merged as well as the output file through these | |
1047 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1060 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning | |
1048 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1061 | of ``$local`` and ``$other`` can vary depending on which action is being | |
1049 | performed. During and update or merge, ``$local`` represents the original |
|
1062 | performed. During and update or merge, ``$local`` represents the original | |
1050 | state of the file, while ``$other`` represents the commit you are updating |
|
1063 | state of the file, while ``$other`` represents the commit you are updating | |
1051 | to or the commit you are merging with. During a rebase ``$local`` |
|
1064 | to or the commit you are merging with. During a rebase ``$local`` | |
1052 | represents the destination of the rebase, and ``$other`` represents the |
|
1065 | represents the destination of the rebase, and ``$other`` represents the | |
1053 | commit being rebased. |
|
1066 | commit being rebased. | |
1054 | (default: ``$local $base $other``) |
|
1067 | (default: ``$local $base $other``) | |
1055 |
|
1068 | |||
1056 | ``premerge`` |
|
1069 | ``premerge`` | |
1057 | Attempt to run internal non-interactive 3-way merge tool before |
|
1070 | Attempt to run internal non-interactive 3-way merge tool before | |
1058 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1071 | launching external tool. Options are ``true``, ``false``, ``keep`` or | |
1059 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1072 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the | |
1060 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1073 | premerge fails. The ``keep-merge3`` will do the same but include information | |
1061 | about the base of the merge in the marker (see internal :merge3 in |
|
1074 | about the base of the merge in the marker (see internal :merge3 in | |
1062 | :hg:`help merge-tools`). |
|
1075 | :hg:`help merge-tools`). | |
1063 | (default: True) |
|
1076 | (default: True) | |
1064 |
|
1077 | |||
1065 | ``binary`` |
|
1078 | ``binary`` | |
1066 | This tool can merge binary files. (default: False, unless tool |
|
1079 | This tool can merge binary files. (default: False, unless tool | |
1067 | was selected by file pattern match) |
|
1080 | was selected by file pattern match) | |
1068 |
|
1081 | |||
1069 | ``symlink`` |
|
1082 | ``symlink`` | |
1070 | This tool can merge symlinks. (default: False) |
|
1083 | This tool can merge symlinks. (default: False) | |
1071 |
|
1084 | |||
1072 | ``check`` |
|
1085 | ``check`` | |
1073 | A list of merge success-checking options: |
|
1086 | A list of merge success-checking options: | |
1074 |
|
1087 | |||
1075 | ``changed`` |
|
1088 | ``changed`` | |
1076 | Ask whether merge was successful when the merged file shows no changes. |
|
1089 | Ask whether merge was successful when the merged file shows no changes. | |
1077 | ``conflicts`` |
|
1090 | ``conflicts`` | |
1078 | Check whether there are conflicts even though the tool reported success. |
|
1091 | Check whether there are conflicts even though the tool reported success. | |
1079 | ``prompt`` |
|
1092 | ``prompt`` | |
1080 | Always prompt for merge success, regardless of success reported by tool. |
|
1093 | Always prompt for merge success, regardless of success reported by tool. | |
1081 |
|
1094 | |||
1082 | ``fixeol`` |
|
1095 | ``fixeol`` | |
1083 | Attempt to fix up EOL changes caused by the merge tool. |
|
1096 | Attempt to fix up EOL changes caused by the merge tool. | |
1084 | (default: False) |
|
1097 | (default: False) | |
1085 |
|
1098 | |||
1086 | ``gui`` |
|
1099 | ``gui`` | |
1087 | This tool requires a graphical interface to run. (default: False) |
|
1100 | This tool requires a graphical interface to run. (default: False) | |
1088 |
|
1101 | |||
1089 | ``regkey`` |
|
1102 | ``regkey`` | |
1090 | Windows registry key which describes install location of this |
|
1103 | Windows registry key which describes install location of this | |
1091 | tool. Mercurial will search for this key first under |
|
1104 | tool. Mercurial will search for this key first under | |
1092 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1105 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
1093 | (default: None) |
|
1106 | (default: None) | |
1094 |
|
1107 | |||
1095 | ``regkeyalt`` |
|
1108 | ``regkeyalt`` | |
1096 | An alternate Windows registry key to try if the first key is not |
|
1109 | An alternate Windows registry key to try if the first key is not | |
1097 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1110 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
1098 | semantics of the primary key. The most common use for this key |
|
1111 | semantics of the primary key. The most common use for this key | |
1099 | is to search for 32bit applications on 64bit operating systems. |
|
1112 | is to search for 32bit applications on 64bit operating systems. | |
1100 | (default: None) |
|
1113 | (default: None) | |
1101 |
|
1114 | |||
1102 | ``regname`` |
|
1115 | ``regname`` | |
1103 | Name of value to read from specified registry key. |
|
1116 | Name of value to read from specified registry key. | |
1104 | (default: the unnamed (default) value) |
|
1117 | (default: the unnamed (default) value) | |
1105 |
|
1118 | |||
1106 | ``regappend`` |
|
1119 | ``regappend`` | |
1107 | String to append to the value read from the registry, typically |
|
1120 | String to append to the value read from the registry, typically | |
1108 | the executable name of the tool. |
|
1121 | the executable name of the tool. | |
1109 | (default: None) |
|
1122 | (default: None) | |
1110 |
|
1123 | |||
1111 |
|
1124 | |||
1112 | ``patch`` |
|
1125 | ``patch`` | |
1113 | --------- |
|
1126 | --------- | |
1114 |
|
1127 | |||
1115 | Settings used when applying patches, for instance through the 'import' |
|
1128 | Settings used when applying patches, for instance through the 'import' | |
1116 | command or with Mercurial Queues extension. |
|
1129 | command or with Mercurial Queues extension. | |
1117 |
|
1130 | |||
1118 | ``eol`` |
|
1131 | ``eol`` | |
1119 | When set to 'strict' patch content and patched files end of lines |
|
1132 | When set to 'strict' patch content and patched files end of lines | |
1120 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1133 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1121 | lines are ignored when patching and the result line endings are |
|
1134 | lines are ignored when patching and the result line endings are | |
1122 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1135 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1123 | ``auto``, end of lines are again ignored while patching but line |
|
1136 | ``auto``, end of lines are again ignored while patching but line | |
1124 | endings in patched files are normalized to their original setting |
|
1137 | endings in patched files are normalized to their original setting | |
1125 | on a per-file basis. If target file does not exist or has no end |
|
1138 | on a per-file basis. If target file does not exist or has no end | |
1126 | of line, patch line endings are preserved. |
|
1139 | of line, patch line endings are preserved. | |
1127 | (default: strict) |
|
1140 | (default: strict) | |
1128 |
|
1141 | |||
1129 | ``fuzz`` |
|
1142 | ``fuzz`` | |
1130 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1143 | The number of lines of 'fuzz' to allow when applying patches. This | |
1131 | controls how much context the patcher is allowed to ignore when |
|
1144 | controls how much context the patcher is allowed to ignore when | |
1132 | trying to apply a patch. |
|
1145 | trying to apply a patch. | |
1133 | (default: 2) |
|
1146 | (default: 2) | |
1134 |
|
1147 | |||
1135 | ``paths`` |
|
1148 | ``paths`` | |
1136 | --------- |
|
1149 | --------- | |
1137 |
|
1150 | |||
1138 | Assigns symbolic names and behavior to repositories. |
|
1151 | Assigns symbolic names and behavior to repositories. | |
1139 |
|
1152 | |||
1140 | Options are symbolic names defining the URL or directory that is the |
|
1153 | Options are symbolic names defining the URL or directory that is the | |
1141 | location of the repository. Example:: |
|
1154 | location of the repository. Example:: | |
1142 |
|
1155 | |||
1143 | [paths] |
|
1156 | [paths] | |
1144 | my_server = https://example.com/my_repo |
|
1157 | my_server = https://example.com/my_repo | |
1145 | local_path = /home/me/repo |
|
1158 | local_path = /home/me/repo | |
1146 |
|
1159 | |||
1147 | These symbolic names can be used from the command line. To pull |
|
1160 | These symbolic names can be used from the command line. To pull | |
1148 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1161 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: | |
1149 | :hg:`push local_path`. |
|
1162 | :hg:`push local_path`. | |
1150 |
|
1163 | |||
1151 | Options containing colons (``:``) denote sub-options that can influence |
|
1164 | Options containing colons (``:``) denote sub-options that can influence | |
1152 | behavior for that specific path. Example:: |
|
1165 | behavior for that specific path. Example:: | |
1153 |
|
1166 | |||
1154 | [paths] |
|
1167 | [paths] | |
1155 | my_server = https://example.com/my_path |
|
1168 | my_server = https://example.com/my_path | |
1156 | my_server:pushurl = ssh://example.com/my_path |
|
1169 | my_server:pushurl = ssh://example.com/my_path | |
1157 |
|
1170 | |||
1158 | The following sub-options can be defined: |
|
1171 | The following sub-options can be defined: | |
1159 |
|
1172 | |||
1160 | ``pushurl`` |
|
1173 | ``pushurl`` | |
1161 | The URL to use for push operations. If not defined, the location |
|
1174 | The URL to use for push operations. If not defined, the location | |
1162 | defined by the path's main entry is used. |
|
1175 | defined by the path's main entry is used. | |
1163 |
|
1176 | |||
1164 | The following special named paths exist: |
|
1177 | The following special named paths exist: | |
1165 |
|
1178 | |||
1166 | ``default`` |
|
1179 | ``default`` | |
1167 | The URL or directory to use when no source or remote is specified. |
|
1180 | The URL or directory to use when no source or remote is specified. | |
1168 |
|
1181 | |||
1169 | :hg:`clone` will automatically define this path to the location the |
|
1182 | :hg:`clone` will automatically define this path to the location the | |
1170 | repository was cloned from. |
|
1183 | repository was cloned from. | |
1171 |
|
1184 | |||
1172 | ``default-push`` |
|
1185 | ``default-push`` | |
1173 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1186 | (deprecated) The URL or directory for the default :hg:`push` location. | |
1174 | ``default:pushurl`` should be used instead. |
|
1187 | ``default:pushurl`` should be used instead. | |
1175 |
|
1188 | |||
1176 | ``phases`` |
|
1189 | ``phases`` | |
1177 | ---------- |
|
1190 | ---------- | |
1178 |
|
1191 | |||
1179 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1192 | Specifies default handling of phases. See :hg:`help phases` for more | |
1180 | information about working with phases. |
|
1193 | information about working with phases. | |
1181 |
|
1194 | |||
1182 | ``publish`` |
|
1195 | ``publish`` | |
1183 | Controls draft phase behavior when working as a server. When true, |
|
1196 | Controls draft phase behavior when working as a server. When true, | |
1184 | pushed changesets are set to public in both client and server and |
|
1197 | pushed changesets are set to public in both client and server and | |
1185 | pulled or cloned changesets are set to public in the client. |
|
1198 | pulled or cloned changesets are set to public in the client. | |
1186 | (default: True) |
|
1199 | (default: True) | |
1187 |
|
1200 | |||
1188 | ``new-commit`` |
|
1201 | ``new-commit`` | |
1189 | Phase of newly-created commits. |
|
1202 | Phase of newly-created commits. | |
1190 | (default: draft) |
|
1203 | (default: draft) | |
1191 |
|
1204 | |||
1192 | ``checksubrepos`` |
|
1205 | ``checksubrepos`` | |
1193 | Check the phase of the current revision of each subrepository. Allowed |
|
1206 | Check the phase of the current revision of each subrepository. Allowed | |
1194 | values are "ignore", "follow" and "abort". For settings other than |
|
1207 | values are "ignore", "follow" and "abort". For settings other than | |
1195 | "ignore", the phase of the current revision of each subrepository is |
|
1208 | "ignore", the phase of the current revision of each subrepository is | |
1196 | checked before committing the parent repository. If any of those phases is |
|
1209 | checked before committing the parent repository. If any of those phases is | |
1197 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1210 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1198 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1211 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1199 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1212 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1200 | used for the parent repository commit (if set to "follow"). |
|
1213 | used for the parent repository commit (if set to "follow"). | |
1201 | (default: follow) |
|
1214 | (default: follow) | |
1202 |
|
1215 | |||
1203 |
|
1216 | |||
1204 | ``profiling`` |
|
1217 | ``profiling`` | |
1205 | ------------- |
|
1218 | ------------- | |
1206 |
|
1219 | |||
1207 | Specifies profiling type, format, and file output. Two profilers are |
|
1220 | Specifies profiling type, format, and file output. Two profilers are | |
1208 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1221 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1209 | profiler (named ``stat``). |
|
1222 | profiler (named ``stat``). | |
1210 |
|
1223 | |||
1211 | In this section description, 'profiling data' stands for the raw data |
|
1224 | In this section description, 'profiling data' stands for the raw data | |
1212 | collected during profiling, while 'profiling report' stands for a |
|
1225 | collected during profiling, while 'profiling report' stands for a | |
1213 | statistical text report generated from the profiling data. The |
|
1226 | statistical text report generated from the profiling data. The | |
1214 | profiling is done using lsprof. |
|
1227 | profiling is done using lsprof. | |
1215 |
|
1228 | |||
1216 | ``type`` |
|
1229 | ``type`` | |
1217 | The type of profiler to use. |
|
1230 | The type of profiler to use. | |
1218 | (default: ls) |
|
1231 | (default: ls) | |
1219 |
|
1232 | |||
1220 | ``ls`` |
|
1233 | ``ls`` | |
1221 | Use Python's built-in instrumenting profiler. This profiler |
|
1234 | Use Python's built-in instrumenting profiler. This profiler | |
1222 | works on all platforms, but each line number it reports is the |
|
1235 | works on all platforms, but each line number it reports is the | |
1223 | first line of a function. This restriction makes it difficult to |
|
1236 | first line of a function. This restriction makes it difficult to | |
1224 | identify the expensive parts of a non-trivial function. |
|
1237 | identify the expensive parts of a non-trivial function. | |
1225 | ``stat`` |
|
1238 | ``stat`` | |
1226 | Use a third-party statistical profiler, statprof. This profiler |
|
1239 | Use a third-party statistical profiler, statprof. This profiler | |
1227 | currently runs only on Unix systems, and is most useful for |
|
1240 | currently runs only on Unix systems, and is most useful for | |
1228 | profiling commands that run for longer than about 0.1 seconds. |
|
1241 | profiling commands that run for longer than about 0.1 seconds. | |
1229 |
|
1242 | |||
1230 | ``format`` |
|
1243 | ``format`` | |
1231 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1244 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1232 | (default: text) |
|
1245 | (default: text) | |
1233 |
|
1246 | |||
1234 | ``text`` |
|
1247 | ``text`` | |
1235 | Generate a profiling report. When saving to a file, it should be |
|
1248 | Generate a profiling report. When saving to a file, it should be | |
1236 | noted that only the report is saved, and the profiling data is |
|
1249 | noted that only the report is saved, and the profiling data is | |
1237 | not kept. |
|
1250 | not kept. | |
1238 | ``kcachegrind`` |
|
1251 | ``kcachegrind`` | |
1239 | Format profiling data for kcachegrind use: when saving to a |
|
1252 | Format profiling data for kcachegrind use: when saving to a | |
1240 | file, the generated file can directly be loaded into |
|
1253 | file, the generated file can directly be loaded into | |
1241 | kcachegrind. |
|
1254 | kcachegrind. | |
1242 |
|
1255 | |||
1243 | ``frequency`` |
|
1256 | ``frequency`` | |
1244 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1257 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1245 | (default: 1000) |
|
1258 | (default: 1000) | |
1246 |
|
1259 | |||
1247 | ``output`` |
|
1260 | ``output`` | |
1248 | File path where profiling data or report should be saved. If the |
|
1261 | File path where profiling data or report should be saved. If the | |
1249 | file exists, it is replaced. (default: None, data is printed on |
|
1262 | file exists, it is replaced. (default: None, data is printed on | |
1250 | stderr) |
|
1263 | stderr) | |
1251 |
|
1264 | |||
1252 | ``sort`` |
|
1265 | ``sort`` | |
1253 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1266 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1254 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1267 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1255 | ``inlinetime``. |
|
1268 | ``inlinetime``. | |
1256 | (default: inlinetime) |
|
1269 | (default: inlinetime) | |
1257 |
|
1270 | |||
1258 | ``limit`` |
|
1271 | ``limit`` | |
1259 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1272 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1260 | (default: 30) |
|
1273 | (default: 30) | |
1261 |
|
1274 | |||
1262 | ``nested`` |
|
1275 | ``nested`` | |
1263 | Show at most this number of lines of drill-down info after each main entry. |
|
1276 | Show at most this number of lines of drill-down info after each main entry. | |
1264 | This can help explain the difference between Total and Inline. |
|
1277 | This can help explain the difference between Total and Inline. | |
1265 | Specific to the ``ls`` instrumenting profiler. |
|
1278 | Specific to the ``ls`` instrumenting profiler. | |
1266 | (default: 5) |
|
1279 | (default: 5) | |
1267 |
|
1280 | |||
1268 | ``progress`` |
|
1281 | ``progress`` | |
1269 | ------------ |
|
1282 | ------------ | |
1270 |
|
1283 | |||
1271 | Mercurial commands can draw progress bars that are as informative as |
|
1284 | Mercurial commands can draw progress bars that are as informative as | |
1272 | possible. Some progress bars only offer indeterminate information, while others |
|
1285 | possible. Some progress bars only offer indeterminate information, while others | |
1273 | have a definite end point. |
|
1286 | have a definite end point. | |
1274 |
|
1287 | |||
1275 | ``delay`` |
|
1288 | ``delay`` | |
1276 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1289 | Number of seconds (float) before showing the progress bar. (default: 3) | |
1277 |
|
1290 | |||
1278 | ``changedelay`` |
|
1291 | ``changedelay`` | |
1279 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1292 | Minimum delay before showing a new topic. When set to less than 3 * refresh, | |
1280 | that value will be used instead. (default: 1) |
|
1293 | that value will be used instead. (default: 1) | |
1281 |
|
1294 | |||
1282 | ``refresh`` |
|
1295 | ``refresh`` | |
1283 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1296 | Time in seconds between refreshes of the progress bar. (default: 0.1) | |
1284 |
|
1297 | |||
1285 | ``format`` |
|
1298 | ``format`` | |
1286 | Format of the progress bar. |
|
1299 | Format of the progress bar. | |
1287 |
|
1300 | |||
1288 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1301 | Valid entries for the format field are ``topic``, ``bar``, ``number``, | |
1289 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 |
|
1302 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 | |
1290 | characters of the item, but this can be changed by adding either ``-<num>`` |
|
1303 | characters of the item, but this can be changed by adding either ``-<num>`` | |
1291 | which would take the last num characters, or ``+<num>`` for the first num |
|
1304 | which would take the last num characters, or ``+<num>`` for the first num | |
1292 | characters. |
|
1305 | characters. | |
1293 |
|
1306 | |||
1294 | (default: Topic bar number estimate) |
|
1307 | (default: Topic bar number estimate) | |
1295 |
|
1308 | |||
1296 | ``width`` |
|
1309 | ``width`` | |
1297 | If set, the maximum width of the progress information (that is, min(width, |
|
1310 | If set, the maximum width of the progress information (that is, min(width, | |
1298 | term width) will be used). |
|
1311 | term width) will be used). | |
1299 |
|
1312 | |||
1300 | ``clear-complete`` |
|
1313 | ``clear-complete`` | |
1301 | Clear the progress bar after it's done. (default: True) |
|
1314 | Clear the progress bar after it's done. (default: True) | |
1302 |
|
1315 | |||
1303 | ``disable`` |
|
1316 | ``disable`` | |
1304 | If true, don't show a progress bar. |
|
1317 | If true, don't show a progress bar. | |
1305 |
|
1318 | |||
1306 | ``assume-tty`` |
|
1319 | ``assume-tty`` | |
1307 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1320 | If true, ALWAYS show a progress bar, unless disable is given. | |
1308 |
|
1321 | |||
1309 | ``revsetalias`` |
|
1322 | ``revsetalias`` | |
1310 | --------------- |
|
1323 | --------------- | |
1311 |
|
1324 | |||
1312 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1325 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1313 |
|
1326 | |||
1314 | ``server`` |
|
1327 | ``server`` | |
1315 | ---------- |
|
1328 | ---------- | |
1316 |
|
1329 | |||
1317 | Controls generic server settings. |
|
1330 | Controls generic server settings. | |
1318 |
|
1331 | |||
1319 | ``uncompressed`` |
|
1332 | ``uncompressed`` | |
1320 | Whether to allow clients to clone a repository using the |
|
1333 | Whether to allow clients to clone a repository using the | |
1321 | uncompressed streaming protocol. This transfers about 40% more |
|
1334 | uncompressed streaming protocol. This transfers about 40% more | |
1322 | data than a regular clone, but uses less memory and CPU on both |
|
1335 | data than a regular clone, but uses less memory and CPU on both | |
1323 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1336 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1324 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1337 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1325 | regular clone. Over most WAN connections (anything slower than |
|
1338 | regular clone. Over most WAN connections (anything slower than | |
1326 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1339 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1327 | extra data transfer overhead. This mode will also temporarily hold |
|
1340 | extra data transfer overhead. This mode will also temporarily hold | |
1328 | the write lock while determining what data to transfer. |
|
1341 | the write lock while determining what data to transfer. | |
1329 | (default: True) |
|
1342 | (default: True) | |
1330 |
|
1343 | |||
1331 | ``preferuncompressed`` |
|
1344 | ``preferuncompressed`` | |
1332 | When set, clients will try to use the uncompressed streaming |
|
1345 | When set, clients will try to use the uncompressed streaming | |
1333 | protocol. (default: False) |
|
1346 | protocol. (default: False) | |
1334 |
|
1347 | |||
1335 | ``validate`` |
|
1348 | ``validate`` | |
1336 | Whether to validate the completeness of pushed changesets by |
|
1349 | Whether to validate the completeness of pushed changesets by | |
1337 | checking that all new file revisions specified in manifests are |
|
1350 | checking that all new file revisions specified in manifests are | |
1338 | present. (default: False) |
|
1351 | present. (default: False) | |
1339 |
|
1352 | |||
1340 | ``maxhttpheaderlen`` |
|
1353 | ``maxhttpheaderlen`` | |
1341 | Instruct HTTP clients not to send request headers longer than this |
|
1354 | Instruct HTTP clients not to send request headers longer than this | |
1342 | many bytes. (default: 1024) |
|
1355 | many bytes. (default: 1024) | |
1343 |
|
1356 | |||
1344 | ``bundle1`` |
|
1357 | ``bundle1`` | |
1345 | Whether to allow clients to push and pull using the legacy bundle1 |
|
1358 | Whether to allow clients to push and pull using the legacy bundle1 | |
1346 | exchange format. (default: True) |
|
1359 | exchange format. (default: True) | |
1347 |
|
1360 | |||
1348 | ``bundle1gd`` |
|
1361 | ``bundle1gd`` | |
1349 | Like ``bundle1` but only used if the repository is using the |
|
1362 | Like ``bundle1` but only used if the repository is using the | |
1350 | *generaldelta* storage format. (default: True) |
|
1363 | *generaldelta* storage format. (default: True) | |
1351 |
|
1364 | |||
1352 | ``bundle1.push`` |
|
1365 | ``bundle1.push`` | |
1353 | Whether to allow clients to push using the legacy bundle1 exchange |
|
1366 | Whether to allow clients to push using the legacy bundle1 exchange | |
1354 | format. (default: True) |
|
1367 | format. (default: True) | |
1355 |
|
1368 | |||
1356 | ``bundle1gd.push`` |
|
1369 | ``bundle1gd.push`` | |
1357 | Like ``bundle1.push` but only used if the repository is using the |
|
1370 | Like ``bundle1.push` but only used if the repository is using the | |
1358 | *generaldelta* storage format. (default: True) |
|
1371 | *generaldelta* storage format. (default: True) | |
1359 |
|
1372 | |||
1360 | ``bundle1.pull`` |
|
1373 | ``bundle1.pull`` | |
1361 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
1374 | Whether to allow clients to pull using the legacy bundle1 exchange | |
1362 | format. (default: True) |
|
1375 | format. (default: True) | |
1363 |
|
1376 | |||
1364 | ``bundle1gd.pull`` |
|
1377 | ``bundle1gd.pull`` | |
1365 | Like ``bundle1.pull` but only used if the repository is using the |
|
1378 | Like ``bundle1.pull` but only used if the repository is using the | |
1366 | *generaldelta* storage format. (default: True) |
|
1379 | *generaldelta* storage format. (default: True) | |
1367 |
|
1380 | |||
1368 | Large repositories using the *generaldelta* storage format should |
|
1381 | Large repositories using the *generaldelta* storage format should | |
1369 | consider setting this option because converting *generaldelta* |
|
1382 | consider setting this option because converting *generaldelta* | |
1370 | repositories to the exchange format required by the bundle1 data |
|
1383 | repositories to the exchange format required by the bundle1 data | |
1371 | format can consume a lot of CPU. |
|
1384 | format can consume a lot of CPU. | |
1372 |
|
1385 | |||
1373 | ``smtp`` |
|
1386 | ``smtp`` | |
1374 | -------- |
|
1387 | -------- | |
1375 |
|
1388 | |||
1376 | Configuration for extensions that need to send email messages. |
|
1389 | Configuration for extensions that need to send email messages. | |
1377 |
|
1390 | |||
1378 | ``host`` |
|
1391 | ``host`` | |
1379 | Host name of mail server, e.g. "mail.example.com". |
|
1392 | Host name of mail server, e.g. "mail.example.com". | |
1380 |
|
1393 | |||
1381 | ``port`` |
|
1394 | ``port`` | |
1382 | Optional. Port to connect to on mail server. (default: 465 if |
|
1395 | Optional. Port to connect to on mail server. (default: 465 if | |
1383 | ``tls`` is smtps; 25 otherwise) |
|
1396 | ``tls`` is smtps; 25 otherwise) | |
1384 |
|
1397 | |||
1385 | ``tls`` |
|
1398 | ``tls`` | |
1386 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1399 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1387 | smtps or none. (default: none) |
|
1400 | smtps or none. (default: none) | |
1388 |
|
1401 | |||
1389 | ``verifycert`` |
|
1402 | ``verifycert`` | |
1390 | Optional. Verification for the certificate of mail server, when |
|
1403 | Optional. Verification for the certificate of mail server, when | |
1391 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1404 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1392 | "strict" or "loose", the certificate is verified as same as the |
|
1405 | "strict" or "loose", the certificate is verified as same as the | |
1393 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1406 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1394 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1407 | ``[web] cacerts`` also). For "strict", sending email is also | |
1395 | aborted, if there is no configuration for mail server in |
|
1408 | aborted, if there is no configuration for mail server in | |
1396 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1409 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1397 | :hg:`email` overwrites this as "loose". (default: strict) |
|
1410 | :hg:`email` overwrites this as "loose". (default: strict) | |
1398 |
|
1411 | |||
1399 | ``username`` |
|
1412 | ``username`` | |
1400 | Optional. User name for authenticating with the SMTP server. |
|
1413 | Optional. User name for authenticating with the SMTP server. | |
1401 | (default: None) |
|
1414 | (default: None) | |
1402 |
|
1415 | |||
1403 | ``password`` |
|
1416 | ``password`` | |
1404 | Optional. Password for authenticating with the SMTP server. If not |
|
1417 | Optional. Password for authenticating with the SMTP server. If not | |
1405 | specified, interactive sessions will prompt the user for a |
|
1418 | specified, interactive sessions will prompt the user for a | |
1406 | password; non-interactive sessions will fail. (default: None) |
|
1419 | password; non-interactive sessions will fail. (default: None) | |
1407 |
|
1420 | |||
1408 | ``local_hostname`` |
|
1421 | ``local_hostname`` | |
1409 | Optional. The hostname that the sender can use to identify |
|
1422 | Optional. The hostname that the sender can use to identify | |
1410 | itself to the MTA. |
|
1423 | itself to the MTA. | |
1411 |
|
1424 | |||
1412 |
|
1425 | |||
1413 | ``subpaths`` |
|
1426 | ``subpaths`` | |
1414 | ------------ |
|
1427 | ------------ | |
1415 |
|
1428 | |||
1416 | Subrepository source URLs can go stale if a remote server changes name |
|
1429 | Subrepository source URLs can go stale if a remote server changes name | |
1417 | or becomes temporarily unavailable. This section lets you define |
|
1430 | or becomes temporarily unavailable. This section lets you define | |
1418 | rewrite rules of the form:: |
|
1431 | rewrite rules of the form:: | |
1419 |
|
1432 | |||
1420 | <pattern> = <replacement> |
|
1433 | <pattern> = <replacement> | |
1421 |
|
1434 | |||
1422 | where ``pattern`` is a regular expression matching a subrepository |
|
1435 | where ``pattern`` is a regular expression matching a subrepository | |
1423 | source URL and ``replacement`` is the replacement string used to |
|
1436 | source URL and ``replacement`` is the replacement string used to | |
1424 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1437 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1425 | ``replacements``. For instance:: |
|
1438 | ``replacements``. For instance:: | |
1426 |
|
1439 | |||
1427 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1440 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1428 |
|
1441 | |||
1429 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1442 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1430 |
|
1443 | |||
1431 | Relative subrepository paths are first made absolute, and the |
|
1444 | Relative subrepository paths are first made absolute, and the | |
1432 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1445 | rewrite rules are then applied on the full (absolute) path. The rules | |
1433 | are applied in definition order. |
|
1446 | are applied in definition order. | |
1434 |
|
1447 | |||
1435 | ``trusted`` |
|
1448 | ``trusted`` | |
1436 | ----------- |
|
1449 | ----------- | |
1437 |
|
1450 | |||
1438 | Mercurial will not use the settings in the |
|
1451 | Mercurial will not use the settings in the | |
1439 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1452 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1440 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1453 | user or to a trusted group, as various hgrc features allow arbitrary | |
1441 | commands to be run. This issue is often encountered when configuring |
|
1454 | commands to be run. This issue is often encountered when configuring | |
1442 | hooks or extensions for shared repositories or servers. However, |
|
1455 | hooks or extensions for shared repositories or servers. However, | |
1443 | the web interface will use some safe settings from the ``[web]`` |
|
1456 | the web interface will use some safe settings from the ``[web]`` | |
1444 | section. |
|
1457 | section. | |
1445 |
|
1458 | |||
1446 | This section specifies what users and groups are trusted. The |
|
1459 | This section specifies what users and groups are trusted. The | |
1447 | current user is always trusted. To trust everybody, list a user or a |
|
1460 | current user is always trusted. To trust everybody, list a user or a | |
1448 | group with name ``*``. These settings must be placed in an |
|
1461 | group with name ``*``. These settings must be placed in an | |
1449 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1462 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1450 | user or service running Mercurial. |
|
1463 | user or service running Mercurial. | |
1451 |
|
1464 | |||
1452 | ``users`` |
|
1465 | ``users`` | |
1453 | Comma-separated list of trusted users. |
|
1466 | Comma-separated list of trusted users. | |
1454 |
|
1467 | |||
1455 | ``groups`` |
|
1468 | ``groups`` | |
1456 | Comma-separated list of trusted groups. |
|
1469 | Comma-separated list of trusted groups. | |
1457 |
|
1470 | |||
1458 |
|
1471 | |||
1459 | ``ui`` |
|
1472 | ``ui`` | |
1460 | ------ |
|
1473 | ------ | |
1461 |
|
1474 | |||
1462 | User interface controls. |
|
1475 | User interface controls. | |
1463 |
|
1476 | |||
1464 | ``archivemeta`` |
|
1477 | ``archivemeta`` | |
1465 | Whether to include the .hg_archival.txt file containing meta data |
|
1478 | Whether to include the .hg_archival.txt file containing meta data | |
1466 | (hashes for the repository base and for tip) in archives created |
|
1479 | (hashes for the repository base and for tip) in archives created | |
1467 | by the :hg:`archive` command or downloaded via hgweb. |
|
1480 | by the :hg:`archive` command or downloaded via hgweb. | |
1468 | (default: True) |
|
1481 | (default: True) | |
1469 |
|
1482 | |||
1470 | ``askusername`` |
|
1483 | ``askusername`` | |
1471 | Whether to prompt for a username when committing. If True, and |
|
1484 | Whether to prompt for a username when committing. If True, and | |
1472 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1485 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1473 | be prompted to enter a username. If no username is entered, the |
|
1486 | be prompted to enter a username. If no username is entered, the | |
1474 | default ``USER@HOST`` is used instead. |
|
1487 | default ``USER@HOST`` is used instead. | |
1475 | (default: False) |
|
1488 | (default: False) | |
1476 |
|
1489 | |||
1477 | ``clonebundlefallback`` |
|
1490 | ``clonebundlefallback`` | |
1478 | Whether failure to apply an advertised "clone bundle" from a server |
|
1491 | Whether failure to apply an advertised "clone bundle" from a server | |
1479 | should result in fallback to a regular clone. |
|
1492 | should result in fallback to a regular clone. | |
1480 |
|
1493 | |||
1481 | This is disabled by default because servers advertising "clone |
|
1494 | This is disabled by default because servers advertising "clone | |
1482 | bundles" often do so to reduce server load. If advertised bundles |
|
1495 | bundles" often do so to reduce server load. If advertised bundles | |
1483 | start mass failing and clients automatically fall back to a regular |
|
1496 | start mass failing and clients automatically fall back to a regular | |
1484 | clone, this would add significant and unexpected load to the server |
|
1497 | clone, this would add significant and unexpected load to the server | |
1485 | since the server is expecting clone operations to be offloaded to |
|
1498 | since the server is expecting clone operations to be offloaded to | |
1486 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
1499 | pre-generated bundles. Failing fast (the default behavior) ensures | |
1487 | clients don't overwhelm the server when "clone bundle" application |
|
1500 | clients don't overwhelm the server when "clone bundle" application | |
1488 | fails. |
|
1501 | fails. | |
1489 |
|
1502 | |||
1490 | (default: False) |
|
1503 | (default: False) | |
1491 |
|
1504 | |||
1492 | ``commitsubrepos`` |
|
1505 | ``commitsubrepos`` | |
1493 | Whether to commit modified subrepositories when committing the |
|
1506 | Whether to commit modified subrepositories when committing the | |
1494 | parent repository. If False and one subrepository has uncommitted |
|
1507 | parent repository. If False and one subrepository has uncommitted | |
1495 | changes, abort the commit. |
|
1508 | changes, abort the commit. | |
1496 | (default: False) |
|
1509 | (default: False) | |
1497 |
|
1510 | |||
1498 | ``debug`` |
|
1511 | ``debug`` | |
1499 | Print debugging information. (default: False) |
|
1512 | Print debugging information. (default: False) | |
1500 |
|
1513 | |||
1501 | ``editor`` |
|
1514 | ``editor`` | |
1502 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
1515 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) | |
1503 |
|
1516 | |||
1504 | ``fallbackencoding`` |
|
1517 | ``fallbackencoding`` | |
1505 | Encoding to try if it's not possible to decode the changelog using |
|
1518 | Encoding to try if it's not possible to decode the changelog using | |
1506 | UTF-8. (default: ISO-8859-1) |
|
1519 | UTF-8. (default: ISO-8859-1) | |
1507 |
|
1520 | |||
1508 | ``graphnodetemplate`` |
|
1521 | ``graphnodetemplate`` | |
1509 | The template used to print changeset nodes in an ASCII revision graph. |
|
1522 | The template used to print changeset nodes in an ASCII revision graph. | |
1510 | (default: ``{graphnode}``) |
|
1523 | (default: ``{graphnode}``) | |
1511 |
|
1524 | |||
1512 | ``ignore`` |
|
1525 | ``ignore`` | |
1513 | A file to read per-user ignore patterns from. This file should be |
|
1526 | A file to read per-user ignore patterns from. This file should be | |
1514 | in the same format as a repository-wide .hgignore file. Filenames |
|
1527 | in the same format as a repository-wide .hgignore file. Filenames | |
1515 | are relative to the repository root. This option supports hook syntax, |
|
1528 | are relative to the repository root. This option supports hook syntax, | |
1516 | so if you want to specify multiple ignore files, you can do so by |
|
1529 | so if you want to specify multiple ignore files, you can do so by | |
1517 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
1530 | setting something like ``ignore.other = ~/.hgignore2``. For details | |
1518 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
1531 | of the ignore file format, see the ``hgignore(5)`` man page. | |
1519 |
|
1532 | |||
1520 | ``interactive`` |
|
1533 | ``interactive`` | |
1521 | Allow to prompt the user. (default: True) |
|
1534 | Allow to prompt the user. (default: True) | |
1522 |
|
1535 | |||
1523 | ``logtemplate`` |
|
1536 | ``logtemplate`` | |
1524 | Template string for commands that print changesets. |
|
1537 | Template string for commands that print changesets. | |
1525 |
|
1538 | |||
1526 | ``merge`` |
|
1539 | ``merge`` | |
1527 | The conflict resolution program to use during a manual merge. |
|
1540 | The conflict resolution program to use during a manual merge. | |
1528 | For more information on merge tools see :hg:`help merge-tools`. |
|
1541 | For more information on merge tools see :hg:`help merge-tools`. | |
1529 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1542 | For configuring merge tools see the ``[merge-tools]`` section. | |
1530 |
|
1543 | |||
1531 | ``mergemarkers`` |
|
1544 | ``mergemarkers`` | |
1532 | Sets the merge conflict marker label styling. The ``detailed`` |
|
1545 | Sets the merge conflict marker label styling. The ``detailed`` | |
1533 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
1546 | style uses the ``mergemarkertemplate`` setting to style the labels. | |
1534 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
1547 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
1535 | One of ``basic`` or ``detailed``. |
|
1548 | One of ``basic`` or ``detailed``. | |
1536 | (default: ``basic``) |
|
1549 | (default: ``basic``) | |
1537 |
|
1550 | |||
1538 | ``mergemarkertemplate`` |
|
1551 | ``mergemarkertemplate`` | |
1539 | The template used to print the commit description next to each conflict |
|
1552 | The template used to print the commit description next to each conflict | |
1540 | marker during merge conflicts. See :hg:`help templates` for the template |
|
1553 | marker during merge conflicts. See :hg:`help templates` for the template | |
1541 | format. |
|
1554 | format. | |
1542 |
|
1555 | |||
1543 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
1556 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
1544 | the first line of the commit description. |
|
1557 | the first line of the commit description. | |
1545 |
|
1558 | |||
1546 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
1559 | If you use non-ASCII characters in names for tags, branches, bookmarks, | |
1547 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
1560 | authors, and/or commit descriptions, you must pay attention to encodings of | |
1548 | managed files. At template expansion, non-ASCII characters use the encoding |
|
1561 | managed files. At template expansion, non-ASCII characters use the encoding | |
1549 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
1562 | specified by the ``--encoding`` global option, ``HGENCODING`` or other | |
1550 | environment variables that govern your locale. If the encoding of the merge |
|
1563 | environment variables that govern your locale. If the encoding of the merge | |
1551 | markers is different from the encoding of the merged files, |
|
1564 | markers is different from the encoding of the merged files, | |
1552 | serious problems may occur. |
|
1565 | serious problems may occur. | |
1553 |
|
1566 | |||
1554 | ``origbackuppath`` |
|
1567 | ``origbackuppath`` | |
1555 | The path to a directory used to store generated .orig files. If the path is |
|
1568 | The path to a directory used to store generated .orig files. If the path is | |
1556 | not a directory, one will be created. |
|
1569 | not a directory, one will be created. | |
1557 |
|
1570 | |||
1558 | ``patch`` |
|
1571 | ``patch`` | |
1559 | An optional external tool that ``hg import`` and some extensions |
|
1572 | An optional external tool that ``hg import`` and some extensions | |
1560 | will use for applying patches. By default Mercurial uses an |
|
1573 | will use for applying patches. By default Mercurial uses an | |
1561 | internal patch utility. The external tool must work as the common |
|
1574 | internal patch utility. The external tool must work as the common | |
1562 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
1575 | Unix ``patch`` program. In particular, it must accept a ``-p`` | |
1563 | argument to strip patch headers, a ``-d`` argument to specify the |
|
1576 | argument to strip patch headers, a ``-d`` argument to specify the | |
1564 | current directory, a file name to patch, and a patch file to take |
|
1577 | current directory, a file name to patch, and a patch file to take | |
1565 | from stdin. |
|
1578 | from stdin. | |
1566 |
|
1579 | |||
1567 | It is possible to specify a patch tool together with extra |
|
1580 | It is possible to specify a patch tool together with extra | |
1568 | arguments. For example, setting this option to ``patch --merge`` |
|
1581 | arguments. For example, setting this option to ``patch --merge`` | |
1569 | will use the ``patch`` program with its 2-way merge option. |
|
1582 | will use the ``patch`` program with its 2-way merge option. | |
1570 |
|
1583 | |||
1571 | ``portablefilenames`` |
|
1584 | ``portablefilenames`` | |
1572 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1585 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1573 | (default: ``warn``) |
|
1586 | (default: ``warn``) | |
1574 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1587 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1575 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1588 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1576 | with a name that can't be created on Windows because it contains reserved |
|
1589 | with a name that can't be created on Windows because it contains reserved | |
1577 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1590 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1578 | collision with an existing file). |
|
1591 | collision with an existing file). | |
1579 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1592 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1580 | If set to ``abort``, the command is aborted. |
|
1593 | If set to ``abort``, the command is aborted. | |
1581 | On Windows, this configuration option is ignored and the command aborted. |
|
1594 | On Windows, this configuration option is ignored and the command aborted. | |
1582 |
|
1595 | |||
1583 | ``quiet`` |
|
1596 | ``quiet`` | |
1584 | Reduce the amount of output printed. (default: False) |
|
1597 | Reduce the amount of output printed. (default: False) | |
1585 |
|
1598 | |||
1586 | ``remotecmd`` |
|
1599 | ``remotecmd`` | |
1587 | Remote command to use for clone/push/pull operations. (default: ``hg``) |
|
1600 | Remote command to use for clone/push/pull operations. (default: ``hg``) | |
1588 |
|
1601 | |||
1589 | ``report_untrusted`` |
|
1602 | ``report_untrusted`` | |
1590 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1603 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1591 | trusted user or group. (default: True) |
|
1604 | trusted user or group. (default: True) | |
1592 |
|
1605 | |||
1593 | ``slash`` |
|
1606 | ``slash`` | |
1594 | Display paths using a slash (``/``) as the path separator. This |
|
1607 | Display paths using a slash (``/``) as the path separator. This | |
1595 | only makes a difference on systems where the default path |
|
1608 | only makes a difference on systems where the default path | |
1596 | separator is not the slash character (e.g. Windows uses the |
|
1609 | separator is not the slash character (e.g. Windows uses the | |
1597 | backslash character (``\``)). |
|
1610 | backslash character (``\``)). | |
1598 | (default: False) |
|
1611 | (default: False) | |
1599 |
|
1612 | |||
1600 | ``statuscopies`` |
|
1613 | ``statuscopies`` | |
1601 | Display copies in the status command. |
|
1614 | Display copies in the status command. | |
1602 |
|
1615 | |||
1603 | ``ssh`` |
|
1616 | ``ssh`` | |
1604 | Command to use for SSH connections. (default: ``ssh``) |
|
1617 | Command to use for SSH connections. (default: ``ssh``) | |
1605 |
|
1618 | |||
1606 | ``strict`` |
|
1619 | ``strict`` | |
1607 | Require exact command names, instead of allowing unambiguous |
|
1620 | Require exact command names, instead of allowing unambiguous | |
1608 | abbreviations. (default: False) |
|
1621 | abbreviations. (default: False) | |
1609 |
|
1622 | |||
1610 | ``style`` |
|
1623 | ``style`` | |
1611 | Name of style to use for command output. |
|
1624 | Name of style to use for command output. | |
1612 |
|
1625 | |||
1613 | ``supportcontact`` |
|
1626 | ``supportcontact`` | |
1614 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
1627 | A URL where users should report a Mercurial traceback. Use this if you are a | |
1615 | large organisation with its own Mercurial deployment process and crash |
|
1628 | large organisation with its own Mercurial deployment process and crash | |
1616 | reports should be addressed to your internal support. |
|
1629 | reports should be addressed to your internal support. | |
1617 |
|
1630 | |||
1618 | ``timeout`` |
|
1631 | ``timeout`` | |
1619 | The timeout used when a lock is held (in seconds), a negative value |
|
1632 | The timeout used when a lock is held (in seconds), a negative value | |
1620 | means no timeout. (default: 600) |
|
1633 | means no timeout. (default: 600) | |
1621 |
|
1634 | |||
1622 | ``traceback`` |
|
1635 | ``traceback`` | |
1623 | Mercurial always prints a traceback when an unknown exception |
|
1636 | Mercurial always prints a traceback when an unknown exception | |
1624 | occurs. Setting this to True will make Mercurial print a traceback |
|
1637 | occurs. Setting this to True will make Mercurial print a traceback | |
1625 | on all exceptions, even those recognized by Mercurial (such as |
|
1638 | on all exceptions, even those recognized by Mercurial (such as | |
1626 | IOError or MemoryError). (default: False) |
|
1639 | IOError or MemoryError). (default: False) | |
1627 |
|
1640 | |||
1628 | ``username`` |
|
1641 | ``username`` | |
1629 | The committer of a changeset created when running "commit". |
|
1642 | The committer of a changeset created when running "commit". | |
1630 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1643 | Typically a person's name and email address, e.g. ``Fred Widget | |
1631 | <fred@example.com>``. Environment variables in the |
|
1644 | <fred@example.com>``. Environment variables in the | |
1632 | username are expanded. |
|
1645 | username are expanded. | |
1633 |
|
1646 | |||
1634 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
1647 | (default: ``$EMAIL`` or ``username@hostname``. If the username in | |
1635 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
1648 | hgrc is empty, e.g. if the system admin set ``username =`` in the | |
1636 | system hgrc, it has to be specified manually or in a different |
|
1649 | system hgrc, it has to be specified manually or in a different | |
1637 | hgrc file) |
|
1650 | hgrc file) | |
1638 |
|
1651 | |||
1639 | ``verbose`` |
|
1652 | ``verbose`` | |
1640 | Increase the amount of output printed. (default: False) |
|
1653 | Increase the amount of output printed. (default: False) | |
1641 |
|
1654 | |||
1642 |
|
1655 | |||
1643 | ``web`` |
|
1656 | ``web`` | |
1644 | ------- |
|
1657 | ------- | |
1645 |
|
1658 | |||
1646 | Web interface configuration. The settings in this section apply to |
|
1659 | Web interface configuration. The settings in this section apply to | |
1647 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1660 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1648 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1661 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1649 | and WSGI). |
|
1662 | and WSGI). | |
1650 |
|
1663 | |||
1651 | The Mercurial webserver does no authentication (it does not prompt for |
|
1664 | The Mercurial webserver does no authentication (it does not prompt for | |
1652 | usernames and passwords to validate *who* users are), but it does do |
|
1665 | usernames and passwords to validate *who* users are), but it does do | |
1653 | authorization (it grants or denies access for *authenticated users* |
|
1666 | authorization (it grants or denies access for *authenticated users* | |
1654 | based on settings in this section). You must either configure your |
|
1667 | based on settings in this section). You must either configure your | |
1655 | webserver to do authentication for you, or disable the authorization |
|
1668 | webserver to do authentication for you, or disable the authorization | |
1656 | checks. |
|
1669 | checks. | |
1657 |
|
1670 | |||
1658 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1671 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1659 | you want it to accept pushes from anybody, you can use the following |
|
1672 | you want it to accept pushes from anybody, you can use the following | |
1660 | command line:: |
|
1673 | command line:: | |
1661 |
|
1674 | |||
1662 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1675 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1663 |
|
1676 | |||
1664 | Note that this will allow anybody to push anything to the server and |
|
1677 | Note that this will allow anybody to push anything to the server and | |
1665 | that this should not be used for public servers. |
|
1678 | that this should not be used for public servers. | |
1666 |
|
1679 | |||
1667 | The full set of options is: |
|
1680 | The full set of options is: | |
1668 |
|
1681 | |||
1669 | ``accesslog`` |
|
1682 | ``accesslog`` | |
1670 | Where to output the access log. (default: stdout) |
|
1683 | Where to output the access log. (default: stdout) | |
1671 |
|
1684 | |||
1672 | ``address`` |
|
1685 | ``address`` | |
1673 | Interface address to bind to. (default: all) |
|
1686 | Interface address to bind to. (default: all) | |
1674 |
|
1687 | |||
1675 | ``allow_archive`` |
|
1688 | ``allow_archive`` | |
1676 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1689 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1677 | (default: empty) |
|
1690 | (default: empty) | |
1678 |
|
1691 | |||
1679 | ``allowbz2`` |
|
1692 | ``allowbz2`` | |
1680 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1693 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1681 | revisions. |
|
1694 | revisions. | |
1682 | (default: False) |
|
1695 | (default: False) | |
1683 |
|
1696 | |||
1684 | ``allowgz`` |
|
1697 | ``allowgz`` | |
1685 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1698 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1686 | revisions. |
|
1699 | revisions. | |
1687 | (default: False) |
|
1700 | (default: False) | |
1688 |
|
1701 | |||
1689 | ``allowpull`` |
|
1702 | ``allowpull`` | |
1690 | Whether to allow pulling from the repository. (default: True) |
|
1703 | Whether to allow pulling from the repository. (default: True) | |
1691 |
|
1704 | |||
1692 | ``allow_push`` |
|
1705 | ``allow_push`` | |
1693 | Whether to allow pushing to the repository. If empty or not set, |
|
1706 | Whether to allow pushing to the repository. If empty or not set, | |
1694 | pushing is not allowed. If the special value ``*``, any remote |
|
1707 | pushing is not allowed. If the special value ``*``, any remote | |
1695 | user can push, including unauthenticated users. Otherwise, the |
|
1708 | user can push, including unauthenticated users. Otherwise, the | |
1696 | remote user must have been authenticated, and the authenticated |
|
1709 | remote user must have been authenticated, and the authenticated | |
1697 | user name must be present in this list. The contents of the |
|
1710 | user name must be present in this list. The contents of the | |
1698 | allow_push list are examined after the deny_push list. |
|
1711 | allow_push list are examined after the deny_push list. | |
1699 |
|
1712 | |||
1700 | ``allow_read`` |
|
1713 | ``allow_read`` | |
1701 | If the user has not already been denied repository access due to |
|
1714 | If the user has not already been denied repository access due to | |
1702 | the contents of deny_read, this list determines whether to grant |
|
1715 | the contents of deny_read, this list determines whether to grant | |
1703 | repository access to the user. If this list is not empty, and the |
|
1716 | repository access to the user. If this list is not empty, and the | |
1704 | user is unauthenticated or not present in the list, then access is |
|
1717 | user is unauthenticated or not present in the list, then access is | |
1705 | denied for the user. If the list is empty or not set, then access |
|
1718 | denied for the user. If the list is empty or not set, then access | |
1706 | is permitted to all users by default. Setting allow_read to the |
|
1719 | is permitted to all users by default. Setting allow_read to the | |
1707 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1720 | special value ``*`` is equivalent to it not being set (i.e. access | |
1708 | is permitted to all users). The contents of the allow_read list are |
|
1721 | is permitted to all users). The contents of the allow_read list are | |
1709 | examined after the deny_read list. |
|
1722 | examined after the deny_read list. | |
1710 |
|
1723 | |||
1711 | ``allowzip`` |
|
1724 | ``allowzip`` | |
1712 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1725 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1713 | revisions. This feature creates temporary files. |
|
1726 | revisions. This feature creates temporary files. | |
1714 | (default: False) |
|
1727 | (default: False) | |
1715 |
|
1728 | |||
1716 | ``archivesubrepos`` |
|
1729 | ``archivesubrepos`` | |
1717 | Whether to recurse into subrepositories when archiving. |
|
1730 | Whether to recurse into subrepositories when archiving. | |
1718 | (default: False) |
|
1731 | (default: False) | |
1719 |
|
1732 | |||
1720 | ``baseurl`` |
|
1733 | ``baseurl`` | |
1721 | Base URL to use when publishing URLs in other locations, so |
|
1734 | Base URL to use when publishing URLs in other locations, so | |
1722 | third-party tools like email notification hooks can construct |
|
1735 | third-party tools like email notification hooks can construct | |
1723 | URLs. Example: ``http://hgserver/repos/``. |
|
1736 | URLs. Example: ``http://hgserver/repos/``. | |
1724 |
|
1737 | |||
1725 | ``cacerts`` |
|
1738 | ``cacerts`` | |
1726 | Path to file containing a list of PEM encoded certificate |
|
1739 | Path to file containing a list of PEM encoded certificate | |
1727 | authority certificates. Environment variables and ``~user`` |
|
1740 | authority certificates. Environment variables and ``~user`` | |
1728 | constructs are expanded in the filename. If specified on the |
|
1741 | constructs are expanded in the filename. If specified on the | |
1729 | client, then it will verify the identity of remote HTTPS servers |
|
1742 | client, then it will verify the identity of remote HTTPS servers | |
1730 | with these certificates. |
|
1743 | with these certificates. | |
1731 |
|
1744 | |||
1732 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1745 | This feature is only supported when using Python 2.6 or later. If you wish | |
1733 | to use it with earlier versions of Python, install the backported |
|
1746 | to use it with earlier versions of Python, install the backported | |
1734 | version of the ssl library that is available from |
|
1747 | version of the ssl library that is available from | |
1735 | ``http://pypi.python.org``. |
|
1748 | ``http://pypi.python.org``. | |
1736 |
|
1749 | |||
1737 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1750 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1738 | command line. |
|
1751 | command line. | |
1739 |
|
1752 | |||
1740 | You can use OpenSSL's CA certificate file if your platform has |
|
1753 | You can use OpenSSL's CA certificate file if your platform has | |
1741 | one. On most Linux systems this will be |
|
1754 | one. On most Linux systems this will be | |
1742 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1755 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1743 | generate this file manually. The form must be as follows:: |
|
1756 | generate this file manually. The form must be as follows:: | |
1744 |
|
1757 | |||
1745 | -----BEGIN CERTIFICATE----- |
|
1758 | -----BEGIN CERTIFICATE----- | |
1746 | ... (certificate in base64 PEM encoding) ... |
|
1759 | ... (certificate in base64 PEM encoding) ... | |
1747 | -----END CERTIFICATE----- |
|
1760 | -----END CERTIFICATE----- | |
1748 | -----BEGIN CERTIFICATE----- |
|
1761 | -----BEGIN CERTIFICATE----- | |
1749 | ... (certificate in base64 PEM encoding) ... |
|
1762 | ... (certificate in base64 PEM encoding) ... | |
1750 | -----END CERTIFICATE----- |
|
1763 | -----END CERTIFICATE----- | |
1751 |
|
1764 | |||
1752 | ``cache`` |
|
1765 | ``cache`` | |
1753 | Whether to support caching in hgweb. (default: True) |
|
1766 | Whether to support caching in hgweb. (default: True) | |
1754 |
|
1767 | |||
1755 | ``certificate`` |
|
1768 | ``certificate`` | |
1756 | Certificate to use when running :hg:`serve`. |
|
1769 | Certificate to use when running :hg:`serve`. | |
1757 |
|
1770 | |||
1758 | ``collapse`` |
|
1771 | ``collapse`` | |
1759 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1772 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1760 | a single level alongside repositories in the current path. With |
|
1773 | a single level alongside repositories in the current path. With | |
1761 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1774 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1762 | the current path are grouped behind navigable directory entries that |
|
1775 | the current path are grouped behind navigable directory entries that | |
1763 | lead to the locations of these repositories. In effect, this setting |
|
1776 | lead to the locations of these repositories. In effect, this setting | |
1764 | collapses each collection of repositories found within a subdirectory |
|
1777 | collapses each collection of repositories found within a subdirectory | |
1765 | into a single entry for that subdirectory. (default: False) |
|
1778 | into a single entry for that subdirectory. (default: False) | |
1766 |
|
1779 | |||
1767 | ``comparisoncontext`` |
|
1780 | ``comparisoncontext`` | |
1768 | Number of lines of context to show in side-by-side file comparison. If |
|
1781 | Number of lines of context to show in side-by-side file comparison. If | |
1769 | negative or the value ``full``, whole files are shown. (default: 5) |
|
1782 | negative or the value ``full``, whole files are shown. (default: 5) | |
1770 |
|
1783 | |||
1771 | This setting can be overridden by a ``context`` request parameter to the |
|
1784 | This setting can be overridden by a ``context`` request parameter to the | |
1772 | ``comparison`` command, taking the same values. |
|
1785 | ``comparison`` command, taking the same values. | |
1773 |
|
1786 | |||
1774 | ``contact`` |
|
1787 | ``contact`` | |
1775 | Name or email address of the person in charge of the repository. |
|
1788 | Name or email address of the person in charge of the repository. | |
1776 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
1789 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) | |
1777 |
|
1790 | |||
1778 | ``deny_push`` |
|
1791 | ``deny_push`` | |
1779 | Whether to deny pushing to the repository. If empty or not set, |
|
1792 | Whether to deny pushing to the repository. If empty or not set, | |
1780 | push is not denied. If the special value ``*``, all remote users are |
|
1793 | push is not denied. If the special value ``*``, all remote users are | |
1781 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1794 | denied push. Otherwise, unauthenticated users are all denied, and | |
1782 | any authenticated user name present in this list is also denied. The |
|
1795 | any authenticated user name present in this list is also denied. The | |
1783 | contents of the deny_push list are examined before the allow_push list. |
|
1796 | contents of the deny_push list are examined before the allow_push list. | |
1784 |
|
1797 | |||
1785 | ``deny_read`` |
|
1798 | ``deny_read`` | |
1786 | Whether to deny reading/viewing of the repository. If this list is |
|
1799 | Whether to deny reading/viewing of the repository. If this list is | |
1787 | not empty, unauthenticated users are all denied, and any |
|
1800 | not empty, unauthenticated users are all denied, and any | |
1788 | authenticated user name present in this list is also denied access to |
|
1801 | authenticated user name present in this list is also denied access to | |
1789 | the repository. If set to the special value ``*``, all remote users |
|
1802 | the repository. If set to the special value ``*``, all remote users | |
1790 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1803 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1791 | the determination of repository access depends on the presence and |
|
1804 | the determination of repository access depends on the presence and | |
1792 | content of the allow_read list (see description). If both |
|
1805 | content of the allow_read list (see description). If both | |
1793 | deny_read and allow_read are empty or not set, then access is |
|
1806 | deny_read and allow_read are empty or not set, then access is | |
1794 | permitted to all users by default. If the repository is being |
|
1807 | permitted to all users by default. If the repository is being | |
1795 | served via hgwebdir, denied users will not be able to see it in |
|
1808 | served via hgwebdir, denied users will not be able to see it in | |
1796 | the list of repositories. The contents of the deny_read list have |
|
1809 | the list of repositories. The contents of the deny_read list have | |
1797 | priority over (are examined before) the contents of the allow_read |
|
1810 | priority over (are examined before) the contents of the allow_read | |
1798 | list. |
|
1811 | list. | |
1799 |
|
1812 | |||
1800 | ``descend`` |
|
1813 | ``descend`` | |
1801 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1814 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1802 | directly in the current path will be shown (other repositories are still |
|
1815 | directly in the current path will be shown (other repositories are still | |
1803 | available from the index corresponding to their containing path). |
|
1816 | available from the index corresponding to their containing path). | |
1804 |
|
1817 | |||
1805 | ``description`` |
|
1818 | ``description`` | |
1806 | Textual description of the repository's purpose or contents. |
|
1819 | Textual description of the repository's purpose or contents. | |
1807 | (default: "unknown") |
|
1820 | (default: "unknown") | |
1808 |
|
1821 | |||
1809 | ``encoding`` |
|
1822 | ``encoding`` | |
1810 | Character encoding name. (default: the current locale charset) |
|
1823 | Character encoding name. (default: the current locale charset) | |
1811 | Example: "UTF-8". |
|
1824 | Example: "UTF-8". | |
1812 |
|
1825 | |||
1813 | ``errorlog`` |
|
1826 | ``errorlog`` | |
1814 | Where to output the error log. (default: stderr) |
|
1827 | Where to output the error log. (default: stderr) | |
1815 |
|
1828 | |||
1816 | ``guessmime`` |
|
1829 | ``guessmime`` | |
1817 | Control MIME types for raw download of file content. |
|
1830 | Control MIME types for raw download of file content. | |
1818 | Set to True to let hgweb guess the content type from the file |
|
1831 | Set to True to let hgweb guess the content type from the file | |
1819 | extension. This will serve HTML files as ``text/html`` and might |
|
1832 | extension. This will serve HTML files as ``text/html`` and might | |
1820 | allow cross-site scripting attacks when serving untrusted |
|
1833 | allow cross-site scripting attacks when serving untrusted | |
1821 | repositories. (default: False) |
|
1834 | repositories. (default: False) | |
1822 |
|
1835 | |||
1823 | ``hidden`` |
|
1836 | ``hidden`` | |
1824 | Whether to hide the repository in the hgwebdir index. |
|
1837 | Whether to hide the repository in the hgwebdir index. | |
1825 | (default: False) |
|
1838 | (default: False) | |
1826 |
|
1839 | |||
1827 | ``ipv6`` |
|
1840 | ``ipv6`` | |
1828 | Whether to use IPv6. (default: False) |
|
1841 | Whether to use IPv6. (default: False) | |
1829 |
|
1842 | |||
1830 | ``logoimg`` |
|
1843 | ``logoimg`` | |
1831 | File name of the logo image that some templates display on each page. |
|
1844 | File name of the logo image that some templates display on each page. | |
1832 | The file name is relative to ``staticurl``. That is, the full path to |
|
1845 | The file name is relative to ``staticurl``. That is, the full path to | |
1833 | the logo image is "staticurl/logoimg". |
|
1846 | the logo image is "staticurl/logoimg". | |
1834 | If unset, ``hglogo.png`` will be used. |
|
1847 | If unset, ``hglogo.png`` will be used. | |
1835 |
|
1848 | |||
1836 | ``logourl`` |
|
1849 | ``logourl`` | |
1837 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
1850 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` | |
1838 | will be used. |
|
1851 | will be used. | |
1839 |
|
1852 | |||
1840 | ``maxchanges`` |
|
1853 | ``maxchanges`` | |
1841 | Maximum number of changes to list on the changelog. (default: 10) |
|
1854 | Maximum number of changes to list on the changelog. (default: 10) | |
1842 |
|
1855 | |||
1843 | ``maxfiles`` |
|
1856 | ``maxfiles`` | |
1844 | Maximum number of files to list per changeset. (default: 10) |
|
1857 | Maximum number of files to list per changeset. (default: 10) | |
1845 |
|
1858 | |||
1846 | ``maxshortchanges`` |
|
1859 | ``maxshortchanges`` | |
1847 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1860 | Maximum number of changes to list on the shortlog, graph or filelog | |
1848 | pages. (default: 60) |
|
1861 | pages. (default: 60) | |
1849 |
|
1862 | |||
1850 | ``name`` |
|
1863 | ``name`` | |
1851 | Repository name to use in the web interface. |
|
1864 | Repository name to use in the web interface. | |
1852 | (default: current working directory) |
|
1865 | (default: current working directory) | |
1853 |
|
1866 | |||
1854 | ``port`` |
|
1867 | ``port`` | |
1855 | Port to listen on. (default: 8000) |
|
1868 | Port to listen on. (default: 8000) | |
1856 |
|
1869 | |||
1857 | ``prefix`` |
|
1870 | ``prefix`` | |
1858 | Prefix path to serve from. (default: '' (server root)) |
|
1871 | Prefix path to serve from. (default: '' (server root)) | |
1859 |
|
1872 | |||
1860 | ``push_ssl`` |
|
1873 | ``push_ssl`` | |
1861 | Whether to require that inbound pushes be transported over SSL to |
|
1874 | Whether to require that inbound pushes be transported over SSL to | |
1862 | prevent password sniffing. (default: True) |
|
1875 | prevent password sniffing. (default: True) | |
1863 |
|
1876 | |||
1864 | ``refreshinterval`` |
|
1877 | ``refreshinterval`` | |
1865 | How frequently directory listings re-scan the filesystem for new |
|
1878 | How frequently directory listings re-scan the filesystem for new | |
1866 | repositories, in seconds. This is relevant when wildcards are used |
|
1879 | repositories, in seconds. This is relevant when wildcards are used | |
1867 | to define paths. Depending on how much filesystem traversal is |
|
1880 | to define paths. Depending on how much filesystem traversal is | |
1868 | required, refreshing may negatively impact performance. |
|
1881 | required, refreshing may negatively impact performance. | |
1869 |
|
1882 | |||
1870 | Values less than or equal to 0 always refresh. |
|
1883 | Values less than or equal to 0 always refresh. | |
1871 | (default: 20) |
|
1884 | (default: 20) | |
1872 |
|
1885 | |||
1873 | ``staticurl`` |
|
1886 | ``staticurl`` | |
1874 | Base URL to use for static files. If unset, static files (e.g. the |
|
1887 | Base URL to use for static files. If unset, static files (e.g. the | |
1875 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1888 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1876 | this setting to serve them directly with the HTTP server. |
|
1889 | this setting to serve them directly with the HTTP server. | |
1877 | Example: ``http://hgserver/static/``. |
|
1890 | Example: ``http://hgserver/static/``. | |
1878 |
|
1891 | |||
1879 | ``stripes`` |
|
1892 | ``stripes`` | |
1880 | How many lines a "zebra stripe" should span in multi-line output. |
|
1893 | How many lines a "zebra stripe" should span in multi-line output. | |
1881 | Set to 0 to disable. (default: 1) |
|
1894 | Set to 0 to disable. (default: 1) | |
1882 |
|
1895 | |||
1883 | ``style`` |
|
1896 | ``style`` | |
1884 | Which template map style to use. The available options are the names of |
|
1897 | Which template map style to use. The available options are the names of | |
1885 | subdirectories in the HTML templates path. (default: ``paper``) |
|
1898 | subdirectories in the HTML templates path. (default: ``paper``) | |
1886 | Example: ``monoblue``. |
|
1899 | Example: ``monoblue``. | |
1887 |
|
1900 | |||
1888 | ``templates`` |
|
1901 | ``templates`` | |
1889 | Where to find the HTML templates. The default path to the HTML templates |
|
1902 | Where to find the HTML templates. The default path to the HTML templates | |
1890 | can be obtained from ``hg debuginstall``. |
|
1903 | can be obtained from ``hg debuginstall``. | |
1891 |
|
1904 | |||
1892 | ``websub`` |
|
1905 | ``websub`` | |
1893 | ---------- |
|
1906 | ---------- | |
1894 |
|
1907 | |||
1895 | Web substitution filter definition. You can use this section to |
|
1908 | Web substitution filter definition. You can use this section to | |
1896 | define a set of regular expression substitution patterns which |
|
1909 | define a set of regular expression substitution patterns which | |
1897 | let you automatically modify the hgweb server output. |
|
1910 | let you automatically modify the hgweb server output. | |
1898 |
|
1911 | |||
1899 | The default hgweb templates only apply these substitution patterns |
|
1912 | The default hgweb templates only apply these substitution patterns | |
1900 | on the revision description fields. You can apply them anywhere |
|
1913 | on the revision description fields. You can apply them anywhere | |
1901 | you want when you create your own templates by adding calls to the |
|
1914 | you want when you create your own templates by adding calls to the | |
1902 | "websub" filter (usually after calling the "escape" filter). |
|
1915 | "websub" filter (usually after calling the "escape" filter). | |
1903 |
|
1916 | |||
1904 | This can be used, for example, to convert issue references to links |
|
1917 | This can be used, for example, to convert issue references to links | |
1905 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1918 | to your issue tracker, or to convert "markdown-like" syntax into | |
1906 | HTML (see the examples below). |
|
1919 | HTML (see the examples below). | |
1907 |
|
1920 | |||
1908 | Each entry in this section names a substitution filter. |
|
1921 | Each entry in this section names a substitution filter. | |
1909 | The value of each entry defines the substitution expression itself. |
|
1922 | The value of each entry defines the substitution expression itself. | |
1910 | The websub expressions follow the old interhg extension syntax, |
|
1923 | The websub expressions follow the old interhg extension syntax, | |
1911 | which in turn imitates the Unix sed replacement syntax:: |
|
1924 | which in turn imitates the Unix sed replacement syntax:: | |
1912 |
|
1925 | |||
1913 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1926 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1914 |
|
1927 | |||
1915 | You can use any separator other than "/". The final "i" is optional |
|
1928 | You can use any separator other than "/". The final "i" is optional | |
1916 | and indicates that the search must be case insensitive. |
|
1929 | and indicates that the search must be case insensitive. | |
1917 |
|
1930 | |||
1918 | Examples:: |
|
1931 | Examples:: | |
1919 |
|
1932 | |||
1920 | [websub] |
|
1933 | [websub] | |
1921 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1934 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1922 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1935 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1923 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1936 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1924 |
|
1937 | |||
1925 | ``worker`` |
|
1938 | ``worker`` | |
1926 | ---------- |
|
1939 | ---------- | |
1927 |
|
1940 | |||
1928 | Parallel master/worker configuration. We currently perform working |
|
1941 | Parallel master/worker configuration. We currently perform working | |
1929 | directory updates in parallel on Unix-like systems, which greatly |
|
1942 | directory updates in parallel on Unix-like systems, which greatly | |
1930 | helps performance. |
|
1943 | helps performance. | |
1931 |
|
1944 | |||
1932 | ``numcpus`` |
|
1945 | ``numcpus`` | |
1933 | Number of CPUs to use for parallel operations. A zero or |
|
1946 | Number of CPUs to use for parallel operations. A zero or | |
1934 | negative value is treated as ``use the default``. |
|
1947 | negative value is treated as ``use the default``. | |
1935 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
1948 | (default: 4 or the number of CPUs on the system, whichever is larger) |
@@ -1,1560 +1,1573 b'' | |||||
1 | # merge.py - directory-level update/merge handling for Mercurial |
|
1 | # merge.py - directory-level update/merge handling for Mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import errno |
|
10 | import errno | |
11 | import os |
|
11 | import os | |
12 | import shutil |
|
12 | import shutil | |
13 | import struct |
|
13 | import struct | |
14 |
|
14 | |||
15 | from .i18n import _ |
|
15 | from .i18n import _ | |
16 | from .node import ( |
|
16 | from .node import ( | |
17 | bin, |
|
17 | bin, | |
18 | hex, |
|
18 | hex, | |
19 | nullhex, |
|
19 | nullhex, | |
20 | nullid, |
|
20 | nullid, | |
21 | nullrev, |
|
21 | nullrev, | |
22 | ) |
|
22 | ) | |
23 | from . import ( |
|
23 | from . import ( | |
24 | copies, |
|
24 | copies, | |
25 | destutil, |
|
25 | destutil, | |
26 | error, |
|
26 | error, | |
27 | filemerge, |
|
27 | filemerge, | |
28 | obsolete, |
|
28 | obsolete, | |
29 | scmutil, |
|
29 | scmutil, | |
30 | subrepo, |
|
30 | subrepo, | |
31 | util, |
|
31 | util, | |
32 | worker, |
|
32 | worker, | |
33 | ) |
|
33 | ) | |
34 |
|
34 | |||
35 | _pack = struct.pack |
|
35 | _pack = struct.pack | |
36 | _unpack = struct.unpack |
|
36 | _unpack = struct.unpack | |
37 |
|
37 | |||
38 | def _droponode(data): |
|
38 | def _droponode(data): | |
39 | # used for compatibility for v1 |
|
39 | # used for compatibility for v1 | |
40 | bits = data.split('\0') |
|
40 | bits = data.split('\0') | |
41 | bits = bits[:-2] + bits[-1:] |
|
41 | bits = bits[:-2] + bits[-1:] | |
42 | return '\0'.join(bits) |
|
42 | return '\0'.join(bits) | |
43 |
|
43 | |||
44 | class mergestate(object): |
|
44 | class mergestate(object): | |
45 | '''track 3-way merge state of individual files |
|
45 | '''track 3-way merge state of individual files | |
46 |
|
46 | |||
47 | The merge state is stored on disk when needed. Two files are used: one with |
|
47 | The merge state is stored on disk when needed. Two files are used: one with | |
48 | an old format (version 1), and one with a new format (version 2). Version 2 |
|
48 | an old format (version 1), and one with a new format (version 2). Version 2 | |
49 | stores a superset of the data in version 1, including new kinds of records |
|
49 | stores a superset of the data in version 1, including new kinds of records | |
50 | in the future. For more about the new format, see the documentation for |
|
50 | in the future. For more about the new format, see the documentation for | |
51 | `_readrecordsv2`. |
|
51 | `_readrecordsv2`. | |
52 |
|
52 | |||
53 | Each record can contain arbitrary content, and has an associated type. This |
|
53 | Each record can contain arbitrary content, and has an associated type. This | |
54 | `type` should be a letter. If `type` is uppercase, the record is mandatory: |
|
54 | `type` should be a letter. If `type` is uppercase, the record is mandatory: | |
55 | versions of Mercurial that don't support it should abort. If `type` is |
|
55 | versions of Mercurial that don't support it should abort. If `type` is | |
56 | lowercase, the record can be safely ignored. |
|
56 | lowercase, the record can be safely ignored. | |
57 |
|
57 | |||
58 | Currently known records: |
|
58 | Currently known records: | |
59 |
|
59 | |||
60 | L: the node of the "local" part of the merge (hexified version) |
|
60 | L: the node of the "local" part of the merge (hexified version) | |
61 | O: the node of the "other" part of the merge (hexified version) |
|
61 | O: the node of the "other" part of the merge (hexified version) | |
62 | F: a file to be merged entry |
|
62 | F: a file to be merged entry | |
63 | C: a change/delete or delete/change conflict |
|
63 | C: a change/delete or delete/change conflict | |
64 | D: a file that the external merge driver will merge internally |
|
64 | D: a file that the external merge driver will merge internally | |
65 | (experimental) |
|
65 | (experimental) | |
66 | m: the external merge driver defined for this merge plus its run state |
|
66 | m: the external merge driver defined for this merge plus its run state | |
67 | (experimental) |
|
67 | (experimental) | |
68 | X: unsupported mandatory record type (used in tests) |
|
68 | X: unsupported mandatory record type (used in tests) | |
69 | x: unsupported advisory record type (used in tests) |
|
69 | x: unsupported advisory record type (used in tests) | |
70 |
|
70 | |||
71 | Merge driver run states (experimental): |
|
71 | Merge driver run states (experimental): | |
72 | u: driver-resolved files unmarked -- needs to be run next time we're about |
|
72 | u: driver-resolved files unmarked -- needs to be run next time we're about | |
73 | to resolve or commit |
|
73 | to resolve or commit | |
74 | m: driver-resolved files marked -- only needs to be run before commit |
|
74 | m: driver-resolved files marked -- only needs to be run before commit | |
75 | s: success/skipped -- does not need to be run any more |
|
75 | s: success/skipped -- does not need to be run any more | |
76 |
|
76 | |||
77 | ''' |
|
77 | ''' | |
78 | statepathv1 = 'merge/state' |
|
78 | statepathv1 = 'merge/state' | |
79 | statepathv2 = 'merge/state2' |
|
79 | statepathv2 = 'merge/state2' | |
80 |
|
80 | |||
81 | @staticmethod |
|
81 | @staticmethod | |
82 | def clean(repo, node=None, other=None): |
|
82 | def clean(repo, node=None, other=None): | |
83 | """Initialize a brand new merge state, removing any existing state on |
|
83 | """Initialize a brand new merge state, removing any existing state on | |
84 | disk.""" |
|
84 | disk.""" | |
85 | ms = mergestate(repo) |
|
85 | ms = mergestate(repo) | |
86 | ms.reset(node, other) |
|
86 | ms.reset(node, other) | |
87 | return ms |
|
87 | return ms | |
88 |
|
88 | |||
89 | @staticmethod |
|
89 | @staticmethod | |
90 | def read(repo): |
|
90 | def read(repo): | |
91 | """Initialize the merge state, reading it from disk.""" |
|
91 | """Initialize the merge state, reading it from disk.""" | |
92 | ms = mergestate(repo) |
|
92 | ms = mergestate(repo) | |
93 | ms._read() |
|
93 | ms._read() | |
94 | return ms |
|
94 | return ms | |
95 |
|
95 | |||
96 | def __init__(self, repo): |
|
96 | def __init__(self, repo): | |
97 | """Initialize the merge state. |
|
97 | """Initialize the merge state. | |
98 |
|
98 | |||
99 | Do not use this directly! Instead call read() or clean().""" |
|
99 | Do not use this directly! Instead call read() or clean().""" | |
100 | self._repo = repo |
|
100 | self._repo = repo | |
101 | self._dirty = False |
|
101 | self._dirty = False | |
102 |
|
102 | |||
103 | def reset(self, node=None, other=None): |
|
103 | def reset(self, node=None, other=None): | |
104 | self._state = {} |
|
104 | self._state = {} | |
105 | self._local = None |
|
105 | self._local = None | |
106 | self._other = None |
|
106 | self._other = None | |
107 | for var in ('localctx', 'otherctx'): |
|
107 | for var in ('localctx', 'otherctx'): | |
108 | if var in vars(self): |
|
108 | if var in vars(self): | |
109 | delattr(self, var) |
|
109 | delattr(self, var) | |
110 | if node: |
|
110 | if node: | |
111 | self._local = node |
|
111 | self._local = node | |
112 | self._other = other |
|
112 | self._other = other | |
113 | self._readmergedriver = None |
|
113 | self._readmergedriver = None | |
114 | if self.mergedriver: |
|
114 | if self.mergedriver: | |
115 | self._mdstate = 's' |
|
115 | self._mdstate = 's' | |
116 | else: |
|
116 | else: | |
117 | self._mdstate = 'u' |
|
117 | self._mdstate = 'u' | |
118 | shutil.rmtree(self._repo.join('merge'), True) |
|
118 | shutil.rmtree(self._repo.join('merge'), True) | |
119 | self._results = {} |
|
119 | self._results = {} | |
120 | self._dirty = False |
|
120 | self._dirty = False | |
121 |
|
121 | |||
122 | def _read(self): |
|
122 | def _read(self): | |
123 | """Analyse each record content to restore a serialized state from disk |
|
123 | """Analyse each record content to restore a serialized state from disk | |
124 |
|
124 | |||
125 | This function process "record" entry produced by the de-serialization |
|
125 | This function process "record" entry produced by the de-serialization | |
126 | of on disk file. |
|
126 | of on disk file. | |
127 | """ |
|
127 | """ | |
128 | self._state = {} |
|
128 | self._state = {} | |
129 | self._local = None |
|
129 | self._local = None | |
130 | self._other = None |
|
130 | self._other = None | |
131 | for var in ('localctx', 'otherctx'): |
|
131 | for var in ('localctx', 'otherctx'): | |
132 | if var in vars(self): |
|
132 | if var in vars(self): | |
133 | delattr(self, var) |
|
133 | delattr(self, var) | |
134 | self._readmergedriver = None |
|
134 | self._readmergedriver = None | |
135 | self._mdstate = 's' |
|
135 | self._mdstate = 's' | |
136 | unsupported = set() |
|
136 | unsupported = set() | |
137 | records = self._readrecords() |
|
137 | records = self._readrecords() | |
138 | for rtype, record in records: |
|
138 | for rtype, record in records: | |
139 | if rtype == 'L': |
|
139 | if rtype == 'L': | |
140 | self._local = bin(record) |
|
140 | self._local = bin(record) | |
141 | elif rtype == 'O': |
|
141 | elif rtype == 'O': | |
142 | self._other = bin(record) |
|
142 | self._other = bin(record) | |
143 | elif rtype == 'm': |
|
143 | elif rtype == 'm': | |
144 | bits = record.split('\0', 1) |
|
144 | bits = record.split('\0', 1) | |
145 | mdstate = bits[1] |
|
145 | mdstate = bits[1] | |
146 | if len(mdstate) != 1 or mdstate not in 'ums': |
|
146 | if len(mdstate) != 1 or mdstate not in 'ums': | |
147 | # the merge driver should be idempotent, so just rerun it |
|
147 | # the merge driver should be idempotent, so just rerun it | |
148 | mdstate = 'u' |
|
148 | mdstate = 'u' | |
149 |
|
149 | |||
150 | self._readmergedriver = bits[0] |
|
150 | self._readmergedriver = bits[0] | |
151 | self._mdstate = mdstate |
|
151 | self._mdstate = mdstate | |
152 | elif rtype in 'FDC': |
|
152 | elif rtype in 'FDC': | |
153 | bits = record.split('\0') |
|
153 | bits = record.split('\0') | |
154 | self._state[bits[0]] = bits[1:] |
|
154 | self._state[bits[0]] = bits[1:] | |
155 | elif not rtype.islower(): |
|
155 | elif not rtype.islower(): | |
156 | unsupported.add(rtype) |
|
156 | unsupported.add(rtype) | |
157 | self._results = {} |
|
157 | self._results = {} | |
158 | self._dirty = False |
|
158 | self._dirty = False | |
159 |
|
159 | |||
160 | if unsupported: |
|
160 | if unsupported: | |
161 | raise error.UnsupportedMergeRecords(unsupported) |
|
161 | raise error.UnsupportedMergeRecords(unsupported) | |
162 |
|
162 | |||
163 | def _readrecords(self): |
|
163 | def _readrecords(self): | |
164 | """Read merge state from disk and return a list of record (TYPE, data) |
|
164 | """Read merge state from disk and return a list of record (TYPE, data) | |
165 |
|
165 | |||
166 | We read data from both v1 and v2 files and decide which one to use. |
|
166 | We read data from both v1 and v2 files and decide which one to use. | |
167 |
|
167 | |||
168 | V1 has been used by version prior to 2.9.1 and contains less data than |
|
168 | V1 has been used by version prior to 2.9.1 and contains less data than | |
169 | v2. We read both versions and check if no data in v2 contradicts |
|
169 | v2. We read both versions and check if no data in v2 contradicts | |
170 | v1. If there is not contradiction we can safely assume that both v1 |
|
170 | v1. If there is not contradiction we can safely assume that both v1 | |
171 | and v2 were written at the same time and use the extract data in v2. If |
|
171 | and v2 were written at the same time and use the extract data in v2. If | |
172 | there is contradiction we ignore v2 content as we assume an old version |
|
172 | there is contradiction we ignore v2 content as we assume an old version | |
173 | of Mercurial has overwritten the mergestate file and left an old v2 |
|
173 | of Mercurial has overwritten the mergestate file and left an old v2 | |
174 | file around. |
|
174 | file around. | |
175 |
|
175 | |||
176 | returns list of record [(TYPE, data), ...]""" |
|
176 | returns list of record [(TYPE, data), ...]""" | |
177 | v1records = self._readrecordsv1() |
|
177 | v1records = self._readrecordsv1() | |
178 | v2records = self._readrecordsv2() |
|
178 | v2records = self._readrecordsv2() | |
179 | if self._v1v2match(v1records, v2records): |
|
179 | if self._v1v2match(v1records, v2records): | |
180 | return v2records |
|
180 | return v2records | |
181 | else: |
|
181 | else: | |
182 | # v1 file is newer than v2 file, use it |
|
182 | # v1 file is newer than v2 file, use it | |
183 | # we have to infer the "other" changeset of the merge |
|
183 | # we have to infer the "other" changeset of the merge | |
184 | # we cannot do better than that with v1 of the format |
|
184 | # we cannot do better than that with v1 of the format | |
185 | mctx = self._repo[None].parents()[-1] |
|
185 | mctx = self._repo[None].parents()[-1] | |
186 | v1records.append(('O', mctx.hex())) |
|
186 | v1records.append(('O', mctx.hex())) | |
187 | # add place holder "other" file node information |
|
187 | # add place holder "other" file node information | |
188 | # nobody is using it yet so we do no need to fetch the data |
|
188 | # nobody is using it yet so we do no need to fetch the data | |
189 | # if mctx was wrong `mctx[bits[-2]]` may fails. |
|
189 | # if mctx was wrong `mctx[bits[-2]]` may fails. | |
190 | for idx, r in enumerate(v1records): |
|
190 | for idx, r in enumerate(v1records): | |
191 | if r[0] == 'F': |
|
191 | if r[0] == 'F': | |
192 | bits = r[1].split('\0') |
|
192 | bits = r[1].split('\0') | |
193 | bits.insert(-2, '') |
|
193 | bits.insert(-2, '') | |
194 | v1records[idx] = (r[0], '\0'.join(bits)) |
|
194 | v1records[idx] = (r[0], '\0'.join(bits)) | |
195 | return v1records |
|
195 | return v1records | |
196 |
|
196 | |||
197 | def _v1v2match(self, v1records, v2records): |
|
197 | def _v1v2match(self, v1records, v2records): | |
198 | oldv2 = set() # old format version of v2 record |
|
198 | oldv2 = set() # old format version of v2 record | |
199 | for rec in v2records: |
|
199 | for rec in v2records: | |
200 | if rec[0] == 'L': |
|
200 | if rec[0] == 'L': | |
201 | oldv2.add(rec) |
|
201 | oldv2.add(rec) | |
202 | elif rec[0] == 'F': |
|
202 | elif rec[0] == 'F': | |
203 | # drop the onode data (not contained in v1) |
|
203 | # drop the onode data (not contained in v1) | |
204 | oldv2.add(('F', _droponode(rec[1]))) |
|
204 | oldv2.add(('F', _droponode(rec[1]))) | |
205 | for rec in v1records: |
|
205 | for rec in v1records: | |
206 | if rec not in oldv2: |
|
206 | if rec not in oldv2: | |
207 | return False |
|
207 | return False | |
208 | else: |
|
208 | else: | |
209 | return True |
|
209 | return True | |
210 |
|
210 | |||
211 | def _readrecordsv1(self): |
|
211 | def _readrecordsv1(self): | |
212 | """read on disk merge state for version 1 file |
|
212 | """read on disk merge state for version 1 file | |
213 |
|
213 | |||
214 | returns list of record [(TYPE, data), ...] |
|
214 | returns list of record [(TYPE, data), ...] | |
215 |
|
215 | |||
216 | Note: the "F" data from this file are one entry short |
|
216 | Note: the "F" data from this file are one entry short | |
217 | (no "other file node" entry) |
|
217 | (no "other file node" entry) | |
218 | """ |
|
218 | """ | |
219 | records = [] |
|
219 | records = [] | |
220 | try: |
|
220 | try: | |
221 | f = self._repo.vfs(self.statepathv1) |
|
221 | f = self._repo.vfs(self.statepathv1) | |
222 | for i, l in enumerate(f): |
|
222 | for i, l in enumerate(f): | |
223 | if i == 0: |
|
223 | if i == 0: | |
224 | records.append(('L', l[:-1])) |
|
224 | records.append(('L', l[:-1])) | |
225 | else: |
|
225 | else: | |
226 | records.append(('F', l[:-1])) |
|
226 | records.append(('F', l[:-1])) | |
227 | f.close() |
|
227 | f.close() | |
228 | except IOError as err: |
|
228 | except IOError as err: | |
229 | if err.errno != errno.ENOENT: |
|
229 | if err.errno != errno.ENOENT: | |
230 | raise |
|
230 | raise | |
231 | return records |
|
231 | return records | |
232 |
|
232 | |||
233 | def _readrecordsv2(self): |
|
233 | def _readrecordsv2(self): | |
234 | """read on disk merge state for version 2 file |
|
234 | """read on disk merge state for version 2 file | |
235 |
|
235 | |||
236 | This format is a list of arbitrary records of the form: |
|
236 | This format is a list of arbitrary records of the form: | |
237 |
|
237 | |||
238 | [type][length][content] |
|
238 | [type][length][content] | |
239 |
|
239 | |||
240 | `type` is a single character, `length` is a 4 byte integer, and |
|
240 | `type` is a single character, `length` is a 4 byte integer, and | |
241 | `content` is an arbitrary byte sequence of length `length`. |
|
241 | `content` is an arbitrary byte sequence of length `length`. | |
242 |
|
242 | |||
243 | Mercurial versions prior to 3.7 have a bug where if there are |
|
243 | Mercurial versions prior to 3.7 have a bug where if there are | |
244 | unsupported mandatory merge records, attempting to clear out the merge |
|
244 | unsupported mandatory merge records, attempting to clear out the merge | |
245 | state with hg update --clean or similar aborts. The 't' record type |
|
245 | state with hg update --clean or similar aborts. The 't' record type | |
246 | works around that by writing out what those versions treat as an |
|
246 | works around that by writing out what those versions treat as an | |
247 | advisory record, but later versions interpret as special: the first |
|
247 | advisory record, but later versions interpret as special: the first | |
248 | character is the 'real' record type and everything onwards is the data. |
|
248 | character is the 'real' record type and everything onwards is the data. | |
249 |
|
249 | |||
250 | Returns list of records [(TYPE, data), ...].""" |
|
250 | Returns list of records [(TYPE, data), ...].""" | |
251 | records = [] |
|
251 | records = [] | |
252 | try: |
|
252 | try: | |
253 | f = self._repo.vfs(self.statepathv2) |
|
253 | f = self._repo.vfs(self.statepathv2) | |
254 | data = f.read() |
|
254 | data = f.read() | |
255 | off = 0 |
|
255 | off = 0 | |
256 | end = len(data) |
|
256 | end = len(data) | |
257 | while off < end: |
|
257 | while off < end: | |
258 | rtype = data[off] |
|
258 | rtype = data[off] | |
259 | off += 1 |
|
259 | off += 1 | |
260 | length = _unpack('>I', data[off:(off + 4)])[0] |
|
260 | length = _unpack('>I', data[off:(off + 4)])[0] | |
261 | off += 4 |
|
261 | off += 4 | |
262 | record = data[off:(off + length)] |
|
262 | record = data[off:(off + length)] | |
263 | off += length |
|
263 | off += length | |
264 | if rtype == 't': |
|
264 | if rtype == 't': | |
265 | rtype, record = record[0], record[1:] |
|
265 | rtype, record = record[0], record[1:] | |
266 | records.append((rtype, record)) |
|
266 | records.append((rtype, record)) | |
267 | f.close() |
|
267 | f.close() | |
268 | except IOError as err: |
|
268 | except IOError as err: | |
269 | if err.errno != errno.ENOENT: |
|
269 | if err.errno != errno.ENOENT: | |
270 | raise |
|
270 | raise | |
271 | return records |
|
271 | return records | |
272 |
|
272 | |||
273 | @util.propertycache |
|
273 | @util.propertycache | |
274 | def mergedriver(self): |
|
274 | def mergedriver(self): | |
275 | # protect against the following: |
|
275 | # protect against the following: | |
276 | # - A configures a malicious merge driver in their hgrc, then |
|
276 | # - A configures a malicious merge driver in their hgrc, then | |
277 | # pauses the merge |
|
277 | # pauses the merge | |
278 | # - A edits their hgrc to remove references to the merge driver |
|
278 | # - A edits their hgrc to remove references to the merge driver | |
279 | # - A gives a copy of their entire repo, including .hg, to B |
|
279 | # - A gives a copy of their entire repo, including .hg, to B | |
280 | # - B inspects .hgrc and finds it to be clean |
|
280 | # - B inspects .hgrc and finds it to be clean | |
281 | # - B then continues the merge and the malicious merge driver |
|
281 | # - B then continues the merge and the malicious merge driver | |
282 | # gets invoked |
|
282 | # gets invoked | |
283 | configmergedriver = self._repo.ui.config('experimental', 'mergedriver') |
|
283 | configmergedriver = self._repo.ui.config('experimental', 'mergedriver') | |
284 | if (self._readmergedriver is not None |
|
284 | if (self._readmergedriver is not None | |
285 | and self._readmergedriver != configmergedriver): |
|
285 | and self._readmergedriver != configmergedriver): | |
286 | raise error.ConfigError( |
|
286 | raise error.ConfigError( | |
287 | _("merge driver changed since merge started"), |
|
287 | _("merge driver changed since merge started"), | |
288 | hint=_("revert merge driver change or abort merge")) |
|
288 | hint=_("revert merge driver change or abort merge")) | |
289 |
|
289 | |||
290 | return configmergedriver |
|
290 | return configmergedriver | |
291 |
|
291 | |||
292 | @util.propertycache |
|
292 | @util.propertycache | |
293 | def localctx(self): |
|
293 | def localctx(self): | |
294 | if self._local is None: |
|
294 | if self._local is None: | |
295 | raise RuntimeError("localctx accessed but self._local isn't set") |
|
295 | raise RuntimeError("localctx accessed but self._local isn't set") | |
296 | return self._repo[self._local] |
|
296 | return self._repo[self._local] | |
297 |
|
297 | |||
298 | @util.propertycache |
|
298 | @util.propertycache | |
299 | def otherctx(self): |
|
299 | def otherctx(self): | |
300 | if self._other is None: |
|
300 | if self._other is None: | |
301 | raise RuntimeError("localctx accessed but self._local isn't set") |
|
301 | raise RuntimeError("localctx accessed but self._local isn't set") | |
302 | return self._repo[self._other] |
|
302 | return self._repo[self._other] | |
303 |
|
303 | |||
304 | def active(self): |
|
304 | def active(self): | |
305 | """Whether mergestate is active. |
|
305 | """Whether mergestate is active. | |
306 |
|
306 | |||
307 | Returns True if there appears to be mergestate. This is a rough proxy |
|
307 | Returns True if there appears to be mergestate. This is a rough proxy | |
308 | for "is a merge in progress." |
|
308 | for "is a merge in progress." | |
309 | """ |
|
309 | """ | |
310 | # Check local variables before looking at filesystem for performance |
|
310 | # Check local variables before looking at filesystem for performance | |
311 | # reasons. |
|
311 | # reasons. | |
312 | return bool(self._local) or bool(self._state) or \ |
|
312 | return bool(self._local) or bool(self._state) or \ | |
313 | self._repo.vfs.exists(self.statepathv1) or \ |
|
313 | self._repo.vfs.exists(self.statepathv1) or \ | |
314 | self._repo.vfs.exists(self.statepathv2) |
|
314 | self._repo.vfs.exists(self.statepathv2) | |
315 |
|
315 | |||
316 | def commit(self): |
|
316 | def commit(self): | |
317 | """Write current state on disk (if necessary)""" |
|
317 | """Write current state on disk (if necessary)""" | |
318 | if self._dirty: |
|
318 | if self._dirty: | |
319 | records = self._makerecords() |
|
319 | records = self._makerecords() | |
320 | self._writerecords(records) |
|
320 | self._writerecords(records) | |
321 | self._dirty = False |
|
321 | self._dirty = False | |
322 |
|
322 | |||
323 | def _makerecords(self): |
|
323 | def _makerecords(self): | |
324 | records = [] |
|
324 | records = [] | |
325 | records.append(('L', hex(self._local))) |
|
325 | records.append(('L', hex(self._local))) | |
326 | records.append(('O', hex(self._other))) |
|
326 | records.append(('O', hex(self._other))) | |
327 | if self.mergedriver: |
|
327 | if self.mergedriver: | |
328 | records.append(('m', '\0'.join([ |
|
328 | records.append(('m', '\0'.join([ | |
329 | self.mergedriver, self._mdstate]))) |
|
329 | self.mergedriver, self._mdstate]))) | |
330 | for d, v in self._state.iteritems(): |
|
330 | for d, v in self._state.iteritems(): | |
331 | if v[0] == 'd': |
|
331 | if v[0] == 'd': | |
332 | records.append(('D', '\0'.join([d] + v))) |
|
332 | records.append(('D', '\0'.join([d] + v))) | |
333 | # v[1] == local ('cd'), v[6] == other ('dc') -- not supported by |
|
333 | # v[1] == local ('cd'), v[6] == other ('dc') -- not supported by | |
334 | # older versions of Mercurial |
|
334 | # older versions of Mercurial | |
335 | elif v[1] == nullhex or v[6] == nullhex: |
|
335 | elif v[1] == nullhex or v[6] == nullhex: | |
336 | records.append(('C', '\0'.join([d] + v))) |
|
336 | records.append(('C', '\0'.join([d] + v))) | |
337 | else: |
|
337 | else: | |
338 | records.append(('F', '\0'.join([d] + v))) |
|
338 | records.append(('F', '\0'.join([d] + v))) | |
339 | return records |
|
339 | return records | |
340 |
|
340 | |||
341 | def _writerecords(self, records): |
|
341 | def _writerecords(self, records): | |
342 | """Write current state on disk (both v1 and v2)""" |
|
342 | """Write current state on disk (both v1 and v2)""" | |
343 | self._writerecordsv1(records) |
|
343 | self._writerecordsv1(records) | |
344 | self._writerecordsv2(records) |
|
344 | self._writerecordsv2(records) | |
345 |
|
345 | |||
346 | def _writerecordsv1(self, records): |
|
346 | def _writerecordsv1(self, records): | |
347 | """Write current state on disk in a version 1 file""" |
|
347 | """Write current state on disk in a version 1 file""" | |
348 | f = self._repo.vfs(self.statepathv1, 'w') |
|
348 | f = self._repo.vfs(self.statepathv1, 'w') | |
349 | irecords = iter(records) |
|
349 | irecords = iter(records) | |
350 | lrecords = irecords.next() |
|
350 | lrecords = irecords.next() | |
351 | assert lrecords[0] == 'L' |
|
351 | assert lrecords[0] == 'L' | |
352 | f.write(hex(self._local) + '\n') |
|
352 | f.write(hex(self._local) + '\n') | |
353 | for rtype, data in irecords: |
|
353 | for rtype, data in irecords: | |
354 | if rtype == 'F': |
|
354 | if rtype == 'F': | |
355 | f.write('%s\n' % _droponode(data)) |
|
355 | f.write('%s\n' % _droponode(data)) | |
356 | f.close() |
|
356 | f.close() | |
357 |
|
357 | |||
358 | def _writerecordsv2(self, records): |
|
358 | def _writerecordsv2(self, records): | |
359 | """Write current state on disk in a version 2 file |
|
359 | """Write current state on disk in a version 2 file | |
360 |
|
360 | |||
361 | See the docstring for _readrecordsv2 for why we use 't'.""" |
|
361 | See the docstring for _readrecordsv2 for why we use 't'.""" | |
362 | # these are the records that all version 2 clients can read |
|
362 | # these are the records that all version 2 clients can read | |
363 | whitelist = 'LOF' |
|
363 | whitelist = 'LOF' | |
364 | f = self._repo.vfs(self.statepathv2, 'w') |
|
364 | f = self._repo.vfs(self.statepathv2, 'w') | |
365 | for key, data in records: |
|
365 | for key, data in records: | |
366 | assert len(key) == 1 |
|
366 | assert len(key) == 1 | |
367 | if key not in whitelist: |
|
367 | if key not in whitelist: | |
368 | key, data = 't', '%s%s' % (key, data) |
|
368 | key, data = 't', '%s%s' % (key, data) | |
369 | format = '>sI%is' % len(data) |
|
369 | format = '>sI%is' % len(data) | |
370 | f.write(_pack(format, key, len(data), data)) |
|
370 | f.write(_pack(format, key, len(data), data)) | |
371 | f.close() |
|
371 | f.close() | |
372 |
|
372 | |||
373 | def add(self, fcl, fco, fca, fd): |
|
373 | def add(self, fcl, fco, fca, fd): | |
374 | """add a new (potentially?) conflicting file the merge state |
|
374 | """add a new (potentially?) conflicting file the merge state | |
375 | fcl: file context for local, |
|
375 | fcl: file context for local, | |
376 | fco: file context for remote, |
|
376 | fco: file context for remote, | |
377 | fca: file context for ancestors, |
|
377 | fca: file context for ancestors, | |
378 | fd: file path of the resulting merge. |
|
378 | fd: file path of the resulting merge. | |
379 |
|
379 | |||
380 | note: also write the local version to the `.hg/merge` directory. |
|
380 | note: also write the local version to the `.hg/merge` directory. | |
381 | """ |
|
381 | """ | |
382 | if fcl.isabsent(): |
|
382 | if fcl.isabsent(): | |
383 | hash = nullhex |
|
383 | hash = nullhex | |
384 | else: |
|
384 | else: | |
385 | hash = util.sha1(fcl.path()).hexdigest() |
|
385 | hash = util.sha1(fcl.path()).hexdigest() | |
386 | self._repo.vfs.write('merge/' + hash, fcl.data()) |
|
386 | self._repo.vfs.write('merge/' + hash, fcl.data()) | |
387 | self._state[fd] = ['u', hash, fcl.path(), |
|
387 | self._state[fd] = ['u', hash, fcl.path(), | |
388 | fca.path(), hex(fca.filenode()), |
|
388 | fca.path(), hex(fca.filenode()), | |
389 | fco.path(), hex(fco.filenode()), |
|
389 | fco.path(), hex(fco.filenode()), | |
390 | fcl.flags()] |
|
390 | fcl.flags()] | |
391 | self._dirty = True |
|
391 | self._dirty = True | |
392 |
|
392 | |||
393 | def __contains__(self, dfile): |
|
393 | def __contains__(self, dfile): | |
394 | return dfile in self._state |
|
394 | return dfile in self._state | |
395 |
|
395 | |||
396 | def __getitem__(self, dfile): |
|
396 | def __getitem__(self, dfile): | |
397 | return self._state[dfile][0] |
|
397 | return self._state[dfile][0] | |
398 |
|
398 | |||
399 | def __iter__(self): |
|
399 | def __iter__(self): | |
400 | return iter(sorted(self._state)) |
|
400 | return iter(sorted(self._state)) | |
401 |
|
401 | |||
402 | def files(self): |
|
402 | def files(self): | |
403 | return self._state.keys() |
|
403 | return self._state.keys() | |
404 |
|
404 | |||
405 | def mark(self, dfile, state): |
|
405 | def mark(self, dfile, state): | |
406 | self._state[dfile][0] = state |
|
406 | self._state[dfile][0] = state | |
407 | self._dirty = True |
|
407 | self._dirty = True | |
408 |
|
408 | |||
409 | def mdstate(self): |
|
409 | def mdstate(self): | |
410 | return self._mdstate |
|
410 | return self._mdstate | |
411 |
|
411 | |||
412 | def unresolved(self): |
|
412 | def unresolved(self): | |
413 | """Obtain the paths of unresolved files.""" |
|
413 | """Obtain the paths of unresolved files.""" | |
414 |
|
414 | |||
415 | for f, entry in self._state.items(): |
|
415 | for f, entry in self._state.items(): | |
416 | if entry[0] == 'u': |
|
416 | if entry[0] == 'u': | |
417 | yield f |
|
417 | yield f | |
418 |
|
418 | |||
419 | def driverresolved(self): |
|
419 | def driverresolved(self): | |
420 | """Obtain the paths of driver-resolved files.""" |
|
420 | """Obtain the paths of driver-resolved files.""" | |
421 |
|
421 | |||
422 | for f, entry in self._state.items(): |
|
422 | for f, entry in self._state.items(): | |
423 | if entry[0] == 'd': |
|
423 | if entry[0] == 'd': | |
424 | yield f |
|
424 | yield f | |
425 |
|
425 | |||
426 | def _resolve(self, preresolve, dfile, wctx, labels=None): |
|
426 | def _resolve(self, preresolve, dfile, wctx, labels=None): | |
427 | """rerun merge process for file path `dfile`""" |
|
427 | """rerun merge process for file path `dfile`""" | |
428 | if self[dfile] in 'rd': |
|
428 | if self[dfile] in 'rd': | |
429 | return True, 0 |
|
429 | return True, 0 | |
430 | stateentry = self._state[dfile] |
|
430 | stateentry = self._state[dfile] | |
431 | state, hash, lfile, afile, anode, ofile, onode, flags = stateentry |
|
431 | state, hash, lfile, afile, anode, ofile, onode, flags = stateentry | |
432 | octx = self._repo[self._other] |
|
432 | octx = self._repo[self._other] | |
433 | fcd = self._filectxorabsent(hash, wctx, dfile) |
|
433 | fcd = self._filectxorabsent(hash, wctx, dfile) | |
434 | fco = self._filectxorabsent(onode, octx, ofile) |
|
434 | fco = self._filectxorabsent(onode, octx, ofile) | |
435 | # TODO: move this to filectxorabsent |
|
435 | # TODO: move this to filectxorabsent | |
436 | fca = self._repo.filectx(afile, fileid=anode) |
|
436 | fca = self._repo.filectx(afile, fileid=anode) | |
437 | # "premerge" x flags |
|
437 | # "premerge" x flags | |
438 | flo = fco.flags() |
|
438 | flo = fco.flags() | |
439 | fla = fca.flags() |
|
439 | fla = fca.flags() | |
440 | if 'x' in flags + flo + fla and 'l' not in flags + flo + fla: |
|
440 | if 'x' in flags + flo + fla and 'l' not in flags + flo + fla: | |
441 | if fca.node() == nullid: |
|
441 | if fca.node() == nullid: | |
442 | if preresolve: |
|
442 | if preresolve: | |
443 | self._repo.ui.warn( |
|
443 | self._repo.ui.warn( | |
444 | _('warning: cannot merge flags for %s\n') % afile) |
|
444 | _('warning: cannot merge flags for %s\n') % afile) | |
445 | elif flags == fla: |
|
445 | elif flags == fla: | |
446 | flags = flo |
|
446 | flags = flo | |
447 | if preresolve: |
|
447 | if preresolve: | |
448 | # restore local |
|
448 | # restore local | |
449 | if hash != nullhex: |
|
449 | if hash != nullhex: | |
450 | f = self._repo.vfs('merge/' + hash) |
|
450 | f = self._repo.vfs('merge/' + hash) | |
451 | self._repo.wwrite(dfile, f.read(), flags) |
|
451 | self._repo.wwrite(dfile, f.read(), flags) | |
452 | f.close() |
|
452 | f.close() | |
453 | else: |
|
453 | else: | |
454 | self._repo.wvfs.unlinkpath(dfile, ignoremissing=True) |
|
454 | self._repo.wvfs.unlinkpath(dfile, ignoremissing=True) | |
455 | complete, r, deleted = filemerge.premerge(self._repo, self._local, |
|
455 | complete, r, deleted = filemerge.premerge(self._repo, self._local, | |
456 | lfile, fcd, fco, fca, |
|
456 | lfile, fcd, fco, fca, | |
457 | labels=labels) |
|
457 | labels=labels) | |
458 | else: |
|
458 | else: | |
459 | complete, r, deleted = filemerge.filemerge(self._repo, self._local, |
|
459 | complete, r, deleted = filemerge.filemerge(self._repo, self._local, | |
460 | lfile, fcd, fco, fca, |
|
460 | lfile, fcd, fco, fca, | |
461 | labels=labels) |
|
461 | labels=labels) | |
462 | if r is None: |
|
462 | if r is None: | |
463 | # no real conflict |
|
463 | # no real conflict | |
464 | del self._state[dfile] |
|
464 | del self._state[dfile] | |
465 | self._dirty = True |
|
465 | self._dirty = True | |
466 | elif not r: |
|
466 | elif not r: | |
467 | self.mark(dfile, 'r') |
|
467 | self.mark(dfile, 'r') | |
468 |
|
468 | |||
469 | if complete: |
|
469 | if complete: | |
470 | action = None |
|
470 | action = None | |
471 | if deleted: |
|
471 | if deleted: | |
472 | if fcd.isabsent(): |
|
472 | if fcd.isabsent(): | |
473 | # dc: local picked. Need to drop if present, which may |
|
473 | # dc: local picked. Need to drop if present, which may | |
474 | # happen on re-resolves. |
|
474 | # happen on re-resolves. | |
475 | action = 'f' |
|
475 | action = 'f' | |
476 | else: |
|
476 | else: | |
477 | # cd: remote picked (or otherwise deleted) |
|
477 | # cd: remote picked (or otherwise deleted) | |
478 | action = 'r' |
|
478 | action = 'r' | |
479 | else: |
|
479 | else: | |
480 | if fcd.isabsent(): # dc: remote picked |
|
480 | if fcd.isabsent(): # dc: remote picked | |
481 | action = 'g' |
|
481 | action = 'g' | |
482 | elif fco.isabsent(): # cd: local picked |
|
482 | elif fco.isabsent(): # cd: local picked | |
483 | if dfile in self.localctx: |
|
483 | if dfile in self.localctx: | |
484 | action = 'am' |
|
484 | action = 'am' | |
485 | else: |
|
485 | else: | |
486 | action = 'a' |
|
486 | action = 'a' | |
487 | # else: regular merges (no action necessary) |
|
487 | # else: regular merges (no action necessary) | |
488 | self._results[dfile] = r, action |
|
488 | self._results[dfile] = r, action | |
489 |
|
489 | |||
490 | return complete, r |
|
490 | return complete, r | |
491 |
|
491 | |||
492 | def _filectxorabsent(self, hexnode, ctx, f): |
|
492 | def _filectxorabsent(self, hexnode, ctx, f): | |
493 | if hexnode == nullhex: |
|
493 | if hexnode == nullhex: | |
494 | return filemerge.absentfilectx(ctx, f) |
|
494 | return filemerge.absentfilectx(ctx, f) | |
495 | else: |
|
495 | else: | |
496 | return ctx[f] |
|
496 | return ctx[f] | |
497 |
|
497 | |||
498 | def preresolve(self, dfile, wctx, labels=None): |
|
498 | def preresolve(self, dfile, wctx, labels=None): | |
499 | """run premerge process for dfile |
|
499 | """run premerge process for dfile | |
500 |
|
500 | |||
501 | Returns whether the merge is complete, and the exit code.""" |
|
501 | Returns whether the merge is complete, and the exit code.""" | |
502 | return self._resolve(True, dfile, wctx, labels=labels) |
|
502 | return self._resolve(True, dfile, wctx, labels=labels) | |
503 |
|
503 | |||
504 | def resolve(self, dfile, wctx, labels=None): |
|
504 | def resolve(self, dfile, wctx, labels=None): | |
505 | """run merge process (assuming premerge was run) for dfile |
|
505 | """run merge process (assuming premerge was run) for dfile | |
506 |
|
506 | |||
507 | Returns the exit code of the merge.""" |
|
507 | Returns the exit code of the merge.""" | |
508 | return self._resolve(False, dfile, wctx, labels=labels)[1] |
|
508 | return self._resolve(False, dfile, wctx, labels=labels)[1] | |
509 |
|
509 | |||
510 | def counts(self): |
|
510 | def counts(self): | |
511 | """return counts for updated, merged and removed files in this |
|
511 | """return counts for updated, merged and removed files in this | |
512 | session""" |
|
512 | session""" | |
513 | updated, merged, removed = 0, 0, 0 |
|
513 | updated, merged, removed = 0, 0, 0 | |
514 | for r, action in self._results.itervalues(): |
|
514 | for r, action in self._results.itervalues(): | |
515 | if r is None: |
|
515 | if r is None: | |
516 | updated += 1 |
|
516 | updated += 1 | |
517 | elif r == 0: |
|
517 | elif r == 0: | |
518 | if action == 'r': |
|
518 | if action == 'r': | |
519 | removed += 1 |
|
519 | removed += 1 | |
520 | else: |
|
520 | else: | |
521 | merged += 1 |
|
521 | merged += 1 | |
522 | return updated, merged, removed |
|
522 | return updated, merged, removed | |
523 |
|
523 | |||
524 | def unresolvedcount(self): |
|
524 | def unresolvedcount(self): | |
525 | """get unresolved count for this merge (persistent)""" |
|
525 | """get unresolved count for this merge (persistent)""" | |
526 | return len([True for f, entry in self._state.iteritems() |
|
526 | return len([True for f, entry in self._state.iteritems() | |
527 | if entry[0] == 'u']) |
|
527 | if entry[0] == 'u']) | |
528 |
|
528 | |||
529 | def actions(self): |
|
529 | def actions(self): | |
530 | """return lists of actions to perform on the dirstate""" |
|
530 | """return lists of actions to perform on the dirstate""" | |
531 | actions = {'r': [], 'f': [], 'a': [], 'am': [], 'g': []} |
|
531 | actions = {'r': [], 'f': [], 'a': [], 'am': [], 'g': []} | |
532 | for f, (r, action) in self._results.iteritems(): |
|
532 | for f, (r, action) in self._results.iteritems(): | |
533 | if action is not None: |
|
533 | if action is not None: | |
534 | actions[action].append((f, None, "merge result")) |
|
534 | actions[action].append((f, None, "merge result")) | |
535 | return actions |
|
535 | return actions | |
536 |
|
536 | |||
537 | def recordactions(self): |
|
537 | def recordactions(self): | |
538 | """record remove/add/get actions in the dirstate""" |
|
538 | """record remove/add/get actions in the dirstate""" | |
539 | branchmerge = self._repo.dirstate.p2() != nullid |
|
539 | branchmerge = self._repo.dirstate.p2() != nullid | |
540 | recordupdates(self._repo, self.actions(), branchmerge) |
|
540 | recordupdates(self._repo, self.actions(), branchmerge) | |
541 |
|
541 | |||
542 | def queueremove(self, f): |
|
542 | def queueremove(self, f): | |
543 | """queues a file to be removed from the dirstate |
|
543 | """queues a file to be removed from the dirstate | |
544 |
|
544 | |||
545 | Meant for use by custom merge drivers.""" |
|
545 | Meant for use by custom merge drivers.""" | |
546 | self._results[f] = 0, 'r' |
|
546 | self._results[f] = 0, 'r' | |
547 |
|
547 | |||
548 | def queueadd(self, f): |
|
548 | def queueadd(self, f): | |
549 | """queues a file to be added to the dirstate |
|
549 | """queues a file to be added to the dirstate | |
550 |
|
550 | |||
551 | Meant for use by custom merge drivers.""" |
|
551 | Meant for use by custom merge drivers.""" | |
552 | self._results[f] = 0, 'a' |
|
552 | self._results[f] = 0, 'a' | |
553 |
|
553 | |||
554 | def queueget(self, f): |
|
554 | def queueget(self, f): | |
555 | """queues a file to be marked modified in the dirstate |
|
555 | """queues a file to be marked modified in the dirstate | |
556 |
|
556 | |||
557 | Meant for use by custom merge drivers.""" |
|
557 | Meant for use by custom merge drivers.""" | |
558 | self._results[f] = 0, 'g' |
|
558 | self._results[f] = 0, 'g' | |
559 |
|
559 | |||
560 | def _checkunknownfile(repo, wctx, mctx, f, f2=None): |
|
560 | def _checkunknownfile(repo, wctx, mctx, f, f2=None): | |
561 | if f2 is None: |
|
561 | if f2 is None: | |
562 | f2 = f |
|
562 | f2 = f | |
563 | return (repo.wvfs.isfileorlink(f) |
|
563 | return (repo.wvfs.isfileorlink(f) | |
564 | and repo.wvfs.audit.check(f) |
|
564 | and repo.wvfs.audit.check(f) | |
565 | and repo.dirstate.normalize(f) not in repo.dirstate |
|
565 | and repo.dirstate.normalize(f) not in repo.dirstate | |
566 | and mctx[f2].cmp(wctx[f])) |
|
566 | and mctx[f2].cmp(wctx[f])) | |
567 |
|
567 | |||
568 | def _checkunknownfiles(repo, wctx, mctx, force, actions): |
|
568 | def _checkunknownfiles(repo, wctx, mctx, force, actions): | |
569 | """ |
|
569 | """ | |
570 | Considers any actions that care about the presence of conflicting unknown |
|
570 | Considers any actions that care about the presence of conflicting unknown | |
571 | files. For some actions, the result is to abort; for others, it is to |
|
571 | files. For some actions, the result is to abort; for others, it is to | |
572 | choose a different action. |
|
572 | choose a different action. | |
573 | """ |
|
573 | """ | |
574 | conflicts = set() |
|
574 | conflicts = set() | |
575 | if not force: |
|
575 | if not force: | |
|
576 | config = repo.ui.config('merge', 'checkunknown', default='abort') | |||
|
577 | valid = ['abort', 'ignore', 'warn'] | |||
|
578 | if config not in valid: | |||
|
579 | validstr = ', '.join(["'" + v + "'" for v in valid]) | |||
|
580 | raise error.ConfigError(_("merge.checkunknown not valid " | |||
|
581 | "('%s' is none of %s)") | |||
|
582 | % (config, validstr)) | |||
|
583 | ||||
576 | for f, (m, args, msg) in actions.iteritems(): |
|
584 | for f, (m, args, msg) in actions.iteritems(): | |
577 | if m in ('c', 'dc'): |
|
585 | if m in ('c', 'dc'): | |
578 | if _checkunknownfile(repo, wctx, mctx, f): |
|
586 | if _checkunknownfile(repo, wctx, mctx, f): | |
579 | conflicts.add(f) |
|
587 | conflicts.add(f) | |
580 | elif m == 'dg': |
|
588 | elif m == 'dg': | |
581 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): |
|
589 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): | |
582 | conflicts.add(f) |
|
590 | conflicts.add(f) | |
583 |
|
591 | |||
584 | for f in sorted(conflicts): |
|
592 | if config == 'abort': | |
585 | repo.ui.warn(_("%s: untracked file differs\n") % f) |
|
593 | for f in sorted(conflicts): | |
586 | if conflicts: |
|
594 | repo.ui.warn(_("%s: untracked file differs\n") % f) | |
587 | raise error.Abort(_("untracked files in working directory differ " |
|
595 | if conflicts: | |
588 | "from files in requested revision")) |
|
596 | raise error.Abort(_("untracked files in working directory " | |
|
597 | "differ from files in requested revision")) | |||
|
598 | elif config == 'warn': | |||
|
599 | for f in sorted(conflicts): | |||
|
600 | repo.ui.warn(_("%s: replacing untracked file\n") % f) | |||
589 |
|
601 | |||
590 | for f, (m, args, msg) in actions.iteritems(): |
|
602 | for f, (m, args, msg) in actions.iteritems(): | |
|
603 | backup = f in conflicts | |||
591 | if m == 'c': |
|
604 | if m == 'c': | |
592 | flags, = args |
|
605 | flags, = args | |
593 |
actions[f] = ('g', (flags, |
|
606 | actions[f] = ('g', (flags, backup), msg) | |
594 | elif m == 'cm': |
|
607 | elif m == 'cm': | |
595 | fl2, anc = args |
|
608 | fl2, anc = args | |
596 | different = _checkunknownfile(repo, wctx, mctx, f) |
|
609 | different = _checkunknownfile(repo, wctx, mctx, f) | |
597 | if different: |
|
610 | if different: | |
598 | actions[f] = ('m', (f, f, None, False, anc), |
|
611 | actions[f] = ('m', (f, f, None, False, anc), | |
599 | "remote differs from untracked local") |
|
612 | "remote differs from untracked local") | |
600 | else: |
|
613 | else: | |
601 |
actions[f] = ('g', (fl2, |
|
614 | actions[f] = ('g', (fl2, backup), "remote created") | |
602 |
|
615 | |||
603 | def _forgetremoved(wctx, mctx, branchmerge): |
|
616 | def _forgetremoved(wctx, mctx, branchmerge): | |
604 | """ |
|
617 | """ | |
605 | Forget removed files |
|
618 | Forget removed files | |
606 |
|
619 | |||
607 | If we're jumping between revisions (as opposed to merging), and if |
|
620 | If we're jumping between revisions (as opposed to merging), and if | |
608 | neither the working directory nor the target rev has the file, |
|
621 | neither the working directory nor the target rev has the file, | |
609 | then we need to remove it from the dirstate, to prevent the |
|
622 | then we need to remove it from the dirstate, to prevent the | |
610 | dirstate from listing the file when it is no longer in the |
|
623 | dirstate from listing the file when it is no longer in the | |
611 | manifest. |
|
624 | manifest. | |
612 |
|
625 | |||
613 | If we're merging, and the other revision has removed a file |
|
626 | If we're merging, and the other revision has removed a file | |
614 | that is not present in the working directory, we need to mark it |
|
627 | that is not present in the working directory, we need to mark it | |
615 | as removed. |
|
628 | as removed. | |
616 | """ |
|
629 | """ | |
617 |
|
630 | |||
618 | actions = {} |
|
631 | actions = {} | |
619 | m = 'f' |
|
632 | m = 'f' | |
620 | if branchmerge: |
|
633 | if branchmerge: | |
621 | m = 'r' |
|
634 | m = 'r' | |
622 | for f in wctx.deleted(): |
|
635 | for f in wctx.deleted(): | |
623 | if f not in mctx: |
|
636 | if f not in mctx: | |
624 | actions[f] = m, None, "forget deleted" |
|
637 | actions[f] = m, None, "forget deleted" | |
625 |
|
638 | |||
626 | if not branchmerge: |
|
639 | if not branchmerge: | |
627 | for f in wctx.removed(): |
|
640 | for f in wctx.removed(): | |
628 | if f not in mctx: |
|
641 | if f not in mctx: | |
629 | actions[f] = 'f', None, "forget removed" |
|
642 | actions[f] = 'f', None, "forget removed" | |
630 |
|
643 | |||
631 | return actions |
|
644 | return actions | |
632 |
|
645 | |||
633 | def _checkcollision(repo, wmf, actions): |
|
646 | def _checkcollision(repo, wmf, actions): | |
634 | # build provisional merged manifest up |
|
647 | # build provisional merged manifest up | |
635 | pmmf = set(wmf) |
|
648 | pmmf = set(wmf) | |
636 |
|
649 | |||
637 | if actions: |
|
650 | if actions: | |
638 | # k, dr, e and rd are no-op |
|
651 | # k, dr, e and rd are no-op | |
639 | for m in 'a', 'am', 'f', 'g', 'cd', 'dc': |
|
652 | for m in 'a', 'am', 'f', 'g', 'cd', 'dc': | |
640 | for f, args, msg in actions[m]: |
|
653 | for f, args, msg in actions[m]: | |
641 | pmmf.add(f) |
|
654 | pmmf.add(f) | |
642 | for f, args, msg in actions['r']: |
|
655 | for f, args, msg in actions['r']: | |
643 | pmmf.discard(f) |
|
656 | pmmf.discard(f) | |
644 | for f, args, msg in actions['dm']: |
|
657 | for f, args, msg in actions['dm']: | |
645 | f2, flags = args |
|
658 | f2, flags = args | |
646 | pmmf.discard(f2) |
|
659 | pmmf.discard(f2) | |
647 | pmmf.add(f) |
|
660 | pmmf.add(f) | |
648 | for f, args, msg in actions['dg']: |
|
661 | for f, args, msg in actions['dg']: | |
649 | pmmf.add(f) |
|
662 | pmmf.add(f) | |
650 | for f, args, msg in actions['m']: |
|
663 | for f, args, msg in actions['m']: | |
651 | f1, f2, fa, move, anc = args |
|
664 | f1, f2, fa, move, anc = args | |
652 | if move: |
|
665 | if move: | |
653 | pmmf.discard(f1) |
|
666 | pmmf.discard(f1) | |
654 | pmmf.add(f) |
|
667 | pmmf.add(f) | |
655 |
|
668 | |||
656 | # check case-folding collision in provisional merged manifest |
|
669 | # check case-folding collision in provisional merged manifest | |
657 | foldmap = {} |
|
670 | foldmap = {} | |
658 | for f in sorted(pmmf): |
|
671 | for f in sorted(pmmf): | |
659 | fold = util.normcase(f) |
|
672 | fold = util.normcase(f) | |
660 | if fold in foldmap: |
|
673 | if fold in foldmap: | |
661 | raise error.Abort(_("case-folding collision between %s and %s") |
|
674 | raise error.Abort(_("case-folding collision between %s and %s") | |
662 | % (f, foldmap[fold])) |
|
675 | % (f, foldmap[fold])) | |
663 | foldmap[fold] = f |
|
676 | foldmap[fold] = f | |
664 |
|
677 | |||
665 | # check case-folding of directories |
|
678 | # check case-folding of directories | |
666 | foldprefix = unfoldprefix = lastfull = '' |
|
679 | foldprefix = unfoldprefix = lastfull = '' | |
667 | for fold, f in sorted(foldmap.items()): |
|
680 | for fold, f in sorted(foldmap.items()): | |
668 | if fold.startswith(foldprefix) and not f.startswith(unfoldprefix): |
|
681 | if fold.startswith(foldprefix) and not f.startswith(unfoldprefix): | |
669 | # the folded prefix matches but actual casing is different |
|
682 | # the folded prefix matches but actual casing is different | |
670 | raise error.Abort(_("case-folding collision between " |
|
683 | raise error.Abort(_("case-folding collision between " | |
671 | "%s and directory of %s") % (lastfull, f)) |
|
684 | "%s and directory of %s") % (lastfull, f)) | |
672 | foldprefix = fold + '/' |
|
685 | foldprefix = fold + '/' | |
673 | unfoldprefix = f + '/' |
|
686 | unfoldprefix = f + '/' | |
674 | lastfull = f |
|
687 | lastfull = f | |
675 |
|
688 | |||
676 | def driverpreprocess(repo, ms, wctx, labels=None): |
|
689 | def driverpreprocess(repo, ms, wctx, labels=None): | |
677 | """run the preprocess step of the merge driver, if any |
|
690 | """run the preprocess step of the merge driver, if any | |
678 |
|
691 | |||
679 | This is currently not implemented -- it's an extension point.""" |
|
692 | This is currently not implemented -- it's an extension point.""" | |
680 | return True |
|
693 | return True | |
681 |
|
694 | |||
682 | def driverconclude(repo, ms, wctx, labels=None): |
|
695 | def driverconclude(repo, ms, wctx, labels=None): | |
683 | """run the conclude step of the merge driver, if any |
|
696 | """run the conclude step of the merge driver, if any | |
684 |
|
697 | |||
685 | This is currently not implemented -- it's an extension point.""" |
|
698 | This is currently not implemented -- it's an extension point.""" | |
686 | return True |
|
699 | return True | |
687 |
|
700 | |||
688 | def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, |
|
701 | def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, | |
689 | acceptremote, followcopies): |
|
702 | acceptremote, followcopies): | |
690 | """ |
|
703 | """ | |
691 | Merge p1 and p2 with ancestor pa and generate merge action list |
|
704 | Merge p1 and p2 with ancestor pa and generate merge action list | |
692 |
|
705 | |||
693 | branchmerge and force are as passed in to update |
|
706 | branchmerge and force are as passed in to update | |
694 | matcher = matcher to filter file lists |
|
707 | matcher = matcher to filter file lists | |
695 | acceptremote = accept the incoming changes without prompting |
|
708 | acceptremote = accept the incoming changes without prompting | |
696 | """ |
|
709 | """ | |
697 | if matcher is not None and matcher.always(): |
|
710 | if matcher is not None and matcher.always(): | |
698 | matcher = None |
|
711 | matcher = None | |
699 |
|
712 | |||
700 | copy, movewithdir, diverge, renamedelete = {}, {}, {}, {} |
|
713 | copy, movewithdir, diverge, renamedelete = {}, {}, {}, {} | |
701 |
|
714 | |||
702 | # manifests fetched in order are going to be faster, so prime the caches |
|
715 | # manifests fetched in order are going to be faster, so prime the caches | |
703 | [x.manifest() for x in |
|
716 | [x.manifest() for x in | |
704 | sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())] |
|
717 | sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())] | |
705 |
|
718 | |||
706 | if followcopies: |
|
719 | if followcopies: | |
707 | ret = copies.mergecopies(repo, wctx, p2, pa) |
|
720 | ret = copies.mergecopies(repo, wctx, p2, pa) | |
708 | copy, movewithdir, diverge, renamedelete = ret |
|
721 | copy, movewithdir, diverge, renamedelete = ret | |
709 |
|
722 | |||
710 | repo.ui.note(_("resolving manifests\n")) |
|
723 | repo.ui.note(_("resolving manifests\n")) | |
711 | repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n" |
|
724 | repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n" | |
712 | % (bool(branchmerge), bool(force), bool(matcher))) |
|
725 | % (bool(branchmerge), bool(force), bool(matcher))) | |
713 | repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2)) |
|
726 | repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2)) | |
714 |
|
727 | |||
715 | m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest() |
|
728 | m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest() | |
716 | copied = set(copy.values()) |
|
729 | copied = set(copy.values()) | |
717 | copied.update(movewithdir.values()) |
|
730 | copied.update(movewithdir.values()) | |
718 |
|
731 | |||
719 | if '.hgsubstate' in m1: |
|
732 | if '.hgsubstate' in m1: | |
720 | # check whether sub state is modified |
|
733 | # check whether sub state is modified | |
721 | for s in sorted(wctx.substate): |
|
734 | for s in sorted(wctx.substate): | |
722 | if wctx.sub(s).dirty(): |
|
735 | if wctx.sub(s).dirty(): | |
723 | m1['.hgsubstate'] += '+' |
|
736 | m1['.hgsubstate'] += '+' | |
724 | break |
|
737 | break | |
725 |
|
738 | |||
726 | # Compare manifests |
|
739 | # Compare manifests | |
727 | if matcher is not None: |
|
740 | if matcher is not None: | |
728 | m1 = m1.matches(matcher) |
|
741 | m1 = m1.matches(matcher) | |
729 | m2 = m2.matches(matcher) |
|
742 | m2 = m2.matches(matcher) | |
730 | diff = m1.diff(m2) |
|
743 | diff = m1.diff(m2) | |
731 |
|
744 | |||
732 | actions = {} |
|
745 | actions = {} | |
733 | for f, ((n1, fl1), (n2, fl2)) in diff.iteritems(): |
|
746 | for f, ((n1, fl1), (n2, fl2)) in diff.iteritems(): | |
734 | if n1 and n2: # file exists on both local and remote side |
|
747 | if n1 and n2: # file exists on both local and remote side | |
735 | if f not in ma: |
|
748 | if f not in ma: | |
736 | fa = copy.get(f, None) |
|
749 | fa = copy.get(f, None) | |
737 | if fa is not None: |
|
750 | if fa is not None: | |
738 | actions[f] = ('m', (f, f, fa, False, pa.node()), |
|
751 | actions[f] = ('m', (f, f, fa, False, pa.node()), | |
739 | "both renamed from " + fa) |
|
752 | "both renamed from " + fa) | |
740 | else: |
|
753 | else: | |
741 | actions[f] = ('m', (f, f, None, False, pa.node()), |
|
754 | actions[f] = ('m', (f, f, None, False, pa.node()), | |
742 | "both created") |
|
755 | "both created") | |
743 | else: |
|
756 | else: | |
744 | a = ma[f] |
|
757 | a = ma[f] | |
745 | fla = ma.flags(f) |
|
758 | fla = ma.flags(f) | |
746 | nol = 'l' not in fl1 + fl2 + fla |
|
759 | nol = 'l' not in fl1 + fl2 + fla | |
747 | if n2 == a and fl2 == fla: |
|
760 | if n2 == a and fl2 == fla: | |
748 | actions[f] = ('k' , (), "remote unchanged") |
|
761 | actions[f] = ('k' , (), "remote unchanged") | |
749 | elif n1 == a and fl1 == fla: # local unchanged - use remote |
|
762 | elif n1 == a and fl1 == fla: # local unchanged - use remote | |
750 | if n1 == n2: # optimization: keep local content |
|
763 | if n1 == n2: # optimization: keep local content | |
751 | actions[f] = ('e', (fl2,), "update permissions") |
|
764 | actions[f] = ('e', (fl2,), "update permissions") | |
752 | else: |
|
765 | else: | |
753 | actions[f] = ('g', (fl2, False), "remote is newer") |
|
766 | actions[f] = ('g', (fl2, False), "remote is newer") | |
754 | elif nol and n2 == a: # remote only changed 'x' |
|
767 | elif nol and n2 == a: # remote only changed 'x' | |
755 | actions[f] = ('e', (fl2,), "update permissions") |
|
768 | actions[f] = ('e', (fl2,), "update permissions") | |
756 | elif nol and n1 == a: # local only changed 'x' |
|
769 | elif nol and n1 == a: # local only changed 'x' | |
757 | actions[f] = ('g', (fl1, False), "remote is newer") |
|
770 | actions[f] = ('g', (fl1, False), "remote is newer") | |
758 | else: # both changed something |
|
771 | else: # both changed something | |
759 | actions[f] = ('m', (f, f, f, False, pa.node()), |
|
772 | actions[f] = ('m', (f, f, f, False, pa.node()), | |
760 | "versions differ") |
|
773 | "versions differ") | |
761 | elif n1: # file exists only on local side |
|
774 | elif n1: # file exists only on local side | |
762 | if f in copied: |
|
775 | if f in copied: | |
763 | pass # we'll deal with it on m2 side |
|
776 | pass # we'll deal with it on m2 side | |
764 | elif f in movewithdir: # directory rename, move local |
|
777 | elif f in movewithdir: # directory rename, move local | |
765 | f2 = movewithdir[f] |
|
778 | f2 = movewithdir[f] | |
766 | if f2 in m2: |
|
779 | if f2 in m2: | |
767 | actions[f2] = ('m', (f, f2, None, True, pa.node()), |
|
780 | actions[f2] = ('m', (f, f2, None, True, pa.node()), | |
768 | "remote directory rename, both created") |
|
781 | "remote directory rename, both created") | |
769 | else: |
|
782 | else: | |
770 | actions[f2] = ('dm', (f, fl1), |
|
783 | actions[f2] = ('dm', (f, fl1), | |
771 | "remote directory rename - move from " + f) |
|
784 | "remote directory rename - move from " + f) | |
772 | elif f in copy: |
|
785 | elif f in copy: | |
773 | f2 = copy[f] |
|
786 | f2 = copy[f] | |
774 | actions[f] = ('m', (f, f2, f2, False, pa.node()), |
|
787 | actions[f] = ('m', (f, f2, f2, False, pa.node()), | |
775 | "local copied/moved from " + f2) |
|
788 | "local copied/moved from " + f2) | |
776 | elif f in ma: # clean, a different, no remote |
|
789 | elif f in ma: # clean, a different, no remote | |
777 | if n1 != ma[f]: |
|
790 | if n1 != ma[f]: | |
778 | if acceptremote: |
|
791 | if acceptremote: | |
779 | actions[f] = ('r', None, "remote delete") |
|
792 | actions[f] = ('r', None, "remote delete") | |
780 | else: |
|
793 | else: | |
781 | actions[f] = ('cd', (f, None, f, False, pa.node()), |
|
794 | actions[f] = ('cd', (f, None, f, False, pa.node()), | |
782 | "prompt changed/deleted") |
|
795 | "prompt changed/deleted") | |
783 | elif n1[20:] == 'a': |
|
796 | elif n1[20:] == 'a': | |
784 | # This extra 'a' is added by working copy manifest to mark |
|
797 | # This extra 'a' is added by working copy manifest to mark | |
785 | # the file as locally added. We should forget it instead of |
|
798 | # the file as locally added. We should forget it instead of | |
786 | # deleting it. |
|
799 | # deleting it. | |
787 | actions[f] = ('f', None, "remote deleted") |
|
800 | actions[f] = ('f', None, "remote deleted") | |
788 | else: |
|
801 | else: | |
789 | actions[f] = ('r', None, "other deleted") |
|
802 | actions[f] = ('r', None, "other deleted") | |
790 | elif n2: # file exists only on remote side |
|
803 | elif n2: # file exists only on remote side | |
791 | if f in copied: |
|
804 | if f in copied: | |
792 | pass # we'll deal with it on m1 side |
|
805 | pass # we'll deal with it on m1 side | |
793 | elif f in movewithdir: |
|
806 | elif f in movewithdir: | |
794 | f2 = movewithdir[f] |
|
807 | f2 = movewithdir[f] | |
795 | if f2 in m1: |
|
808 | if f2 in m1: | |
796 | actions[f2] = ('m', (f2, f, None, False, pa.node()), |
|
809 | actions[f2] = ('m', (f2, f, None, False, pa.node()), | |
797 | "local directory rename, both created") |
|
810 | "local directory rename, both created") | |
798 | else: |
|
811 | else: | |
799 | actions[f2] = ('dg', (f, fl2), |
|
812 | actions[f2] = ('dg', (f, fl2), | |
800 | "local directory rename - get from " + f) |
|
813 | "local directory rename - get from " + f) | |
801 | elif f in copy: |
|
814 | elif f in copy: | |
802 | f2 = copy[f] |
|
815 | f2 = copy[f] | |
803 | if f2 in m2: |
|
816 | if f2 in m2: | |
804 | actions[f] = ('m', (f2, f, f2, False, pa.node()), |
|
817 | actions[f] = ('m', (f2, f, f2, False, pa.node()), | |
805 | "remote copied from " + f2) |
|
818 | "remote copied from " + f2) | |
806 | else: |
|
819 | else: | |
807 | actions[f] = ('m', (f2, f, f2, True, pa.node()), |
|
820 | actions[f] = ('m', (f2, f, f2, True, pa.node()), | |
808 | "remote moved from " + f2) |
|
821 | "remote moved from " + f2) | |
809 | elif f not in ma: |
|
822 | elif f not in ma: | |
810 | # local unknown, remote created: the logic is described by the |
|
823 | # local unknown, remote created: the logic is described by the | |
811 | # following table: |
|
824 | # following table: | |
812 | # |
|
825 | # | |
813 | # force branchmerge different | action |
|
826 | # force branchmerge different | action | |
814 | # n * * | create |
|
827 | # n * * | create | |
815 | # y n * | create |
|
828 | # y n * | create | |
816 | # y y n | create |
|
829 | # y y n | create | |
817 | # y y y | merge |
|
830 | # y y y | merge | |
818 | # |
|
831 | # | |
819 | # Checking whether the files are different is expensive, so we |
|
832 | # Checking whether the files are different is expensive, so we | |
820 | # don't do that when we can avoid it. |
|
833 | # don't do that when we can avoid it. | |
821 | if not force: |
|
834 | if not force: | |
822 | actions[f] = ('c', (fl2,), "remote created") |
|
835 | actions[f] = ('c', (fl2,), "remote created") | |
823 | elif not branchmerge: |
|
836 | elif not branchmerge: | |
824 | actions[f] = ('c', (fl2,), "remote created") |
|
837 | actions[f] = ('c', (fl2,), "remote created") | |
825 | else: |
|
838 | else: | |
826 | actions[f] = ('cm', (fl2, pa.node()), |
|
839 | actions[f] = ('cm', (fl2, pa.node()), | |
827 | "remote created, get or merge") |
|
840 | "remote created, get or merge") | |
828 | elif n2 != ma[f]: |
|
841 | elif n2 != ma[f]: | |
829 | if acceptremote: |
|
842 | if acceptremote: | |
830 | actions[f] = ('c', (fl2,), "remote recreating") |
|
843 | actions[f] = ('c', (fl2,), "remote recreating") | |
831 | else: |
|
844 | else: | |
832 | actions[f] = ('dc', (None, f, f, False, pa.node()), |
|
845 | actions[f] = ('dc', (None, f, f, False, pa.node()), | |
833 | "prompt deleted/changed") |
|
846 | "prompt deleted/changed") | |
834 |
|
847 | |||
835 | return actions, diverge, renamedelete |
|
848 | return actions, diverge, renamedelete | |
836 |
|
849 | |||
837 | def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
|
850 | def _resolvetrivial(repo, wctx, mctx, ancestor, actions): | |
838 | """Resolves false conflicts where the nodeid changed but the content |
|
851 | """Resolves false conflicts where the nodeid changed but the content | |
839 | remained the same.""" |
|
852 | remained the same.""" | |
840 |
|
853 | |||
841 | for f, (m, args, msg) in actions.items(): |
|
854 | for f, (m, args, msg) in actions.items(): | |
842 | if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]): |
|
855 | if m == 'cd' and f in ancestor and not wctx[f].cmp(ancestor[f]): | |
843 | # local did change but ended up with same content |
|
856 | # local did change but ended up with same content | |
844 | actions[f] = 'r', None, "prompt same" |
|
857 | actions[f] = 'r', None, "prompt same" | |
845 | elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]): |
|
858 | elif m == 'dc' and f in ancestor and not mctx[f].cmp(ancestor[f]): | |
846 | # remote did change but ended up with same content |
|
859 | # remote did change but ended up with same content | |
847 | del actions[f] # don't get = keep local deleted |
|
860 | del actions[f] # don't get = keep local deleted | |
848 |
|
861 | |||
849 | def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, |
|
862 | def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, | |
850 | acceptremote, followcopies, matcher=None): |
|
863 | acceptremote, followcopies, matcher=None): | |
851 | "Calculate the actions needed to merge mctx into wctx using ancestors" |
|
864 | "Calculate the actions needed to merge mctx into wctx using ancestors" | |
852 | if len(ancestors) == 1: # default |
|
865 | if len(ancestors) == 1: # default | |
853 | actions, diverge, renamedelete = manifestmerge( |
|
866 | actions, diverge, renamedelete = manifestmerge( | |
854 | repo, wctx, mctx, ancestors[0], branchmerge, force, matcher, |
|
867 | repo, wctx, mctx, ancestors[0], branchmerge, force, matcher, | |
855 | acceptremote, followcopies) |
|
868 | acceptremote, followcopies) | |
856 | _checkunknownfiles(repo, wctx, mctx, force, actions) |
|
869 | _checkunknownfiles(repo, wctx, mctx, force, actions) | |
857 |
|
870 | |||
858 | else: # only when merge.preferancestor=* - the default |
|
871 | else: # only when merge.preferancestor=* - the default | |
859 | repo.ui.note( |
|
872 | repo.ui.note( | |
860 | _("note: merging %s and %s using bids from ancestors %s\n") % |
|
873 | _("note: merging %s and %s using bids from ancestors %s\n") % | |
861 | (wctx, mctx, _(' and ').join(str(anc) for anc in ancestors))) |
|
874 | (wctx, mctx, _(' and ').join(str(anc) for anc in ancestors))) | |
862 |
|
875 | |||
863 | # Call for bids |
|
876 | # Call for bids | |
864 | fbids = {} # mapping filename to bids (action method to list af actions) |
|
877 | fbids = {} # mapping filename to bids (action method to list af actions) | |
865 | diverge, renamedelete = None, None |
|
878 | diverge, renamedelete = None, None | |
866 | for ancestor in ancestors: |
|
879 | for ancestor in ancestors: | |
867 | repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor) |
|
880 | repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor) | |
868 | actions, diverge1, renamedelete1 = manifestmerge( |
|
881 | actions, diverge1, renamedelete1 = manifestmerge( | |
869 | repo, wctx, mctx, ancestor, branchmerge, force, matcher, |
|
882 | repo, wctx, mctx, ancestor, branchmerge, force, matcher, | |
870 | acceptremote, followcopies) |
|
883 | acceptremote, followcopies) | |
871 | _checkunknownfiles(repo, wctx, mctx, force, actions) |
|
884 | _checkunknownfiles(repo, wctx, mctx, force, actions) | |
872 |
|
885 | |||
873 | # Track the shortest set of warning on the theory that bid |
|
886 | # Track the shortest set of warning on the theory that bid | |
874 | # merge will correctly incorporate more information |
|
887 | # merge will correctly incorporate more information | |
875 | if diverge is None or len(diverge1) < len(diverge): |
|
888 | if diverge is None or len(diverge1) < len(diverge): | |
876 | diverge = diverge1 |
|
889 | diverge = diverge1 | |
877 | if renamedelete is None or len(renamedelete) < len(renamedelete1): |
|
890 | if renamedelete is None or len(renamedelete) < len(renamedelete1): | |
878 | renamedelete = renamedelete1 |
|
891 | renamedelete = renamedelete1 | |
879 |
|
892 | |||
880 | for f, a in sorted(actions.iteritems()): |
|
893 | for f, a in sorted(actions.iteritems()): | |
881 | m, args, msg = a |
|
894 | m, args, msg = a | |
882 | repo.ui.debug(' %s: %s -> %s\n' % (f, msg, m)) |
|
895 | repo.ui.debug(' %s: %s -> %s\n' % (f, msg, m)) | |
883 | if f in fbids: |
|
896 | if f in fbids: | |
884 | d = fbids[f] |
|
897 | d = fbids[f] | |
885 | if m in d: |
|
898 | if m in d: | |
886 | d[m].append(a) |
|
899 | d[m].append(a) | |
887 | else: |
|
900 | else: | |
888 | d[m] = [a] |
|
901 | d[m] = [a] | |
889 | else: |
|
902 | else: | |
890 | fbids[f] = {m: [a]} |
|
903 | fbids[f] = {m: [a]} | |
891 |
|
904 | |||
892 | # Pick the best bid for each file |
|
905 | # Pick the best bid for each file | |
893 | repo.ui.note(_('\nauction for merging merge bids\n')) |
|
906 | repo.ui.note(_('\nauction for merging merge bids\n')) | |
894 | actions = {} |
|
907 | actions = {} | |
895 | for f, bids in sorted(fbids.items()): |
|
908 | for f, bids in sorted(fbids.items()): | |
896 | # bids is a mapping from action method to list af actions |
|
909 | # bids is a mapping from action method to list af actions | |
897 | # Consensus? |
|
910 | # Consensus? | |
898 | if len(bids) == 1: # all bids are the same kind of method |
|
911 | if len(bids) == 1: # all bids are the same kind of method | |
899 | m, l = bids.items()[0] |
|
912 | m, l = bids.items()[0] | |
900 | if all(a == l[0] for a in l[1:]): # len(bids) is > 1 |
|
913 | if all(a == l[0] for a in l[1:]): # len(bids) is > 1 | |
901 | repo.ui.note(" %s: consensus for %s\n" % (f, m)) |
|
914 | repo.ui.note(" %s: consensus for %s\n" % (f, m)) | |
902 | actions[f] = l[0] |
|
915 | actions[f] = l[0] | |
903 | continue |
|
916 | continue | |
904 | # If keep is an option, just do it. |
|
917 | # If keep is an option, just do it. | |
905 | if 'k' in bids: |
|
918 | if 'k' in bids: | |
906 | repo.ui.note(" %s: picking 'keep' action\n" % f) |
|
919 | repo.ui.note(" %s: picking 'keep' action\n" % f) | |
907 | actions[f] = bids['k'][0] |
|
920 | actions[f] = bids['k'][0] | |
908 | continue |
|
921 | continue | |
909 | # If there are gets and they all agree [how could they not?], do it. |
|
922 | # If there are gets and they all agree [how could they not?], do it. | |
910 | if 'g' in bids: |
|
923 | if 'g' in bids: | |
911 | ga0 = bids['g'][0] |
|
924 | ga0 = bids['g'][0] | |
912 | if all(a == ga0 for a in bids['g'][1:]): |
|
925 | if all(a == ga0 for a in bids['g'][1:]): | |
913 | repo.ui.note(" %s: picking 'get' action\n" % f) |
|
926 | repo.ui.note(" %s: picking 'get' action\n" % f) | |
914 | actions[f] = ga0 |
|
927 | actions[f] = ga0 | |
915 | continue |
|
928 | continue | |
916 | # TODO: Consider other simple actions such as mode changes |
|
929 | # TODO: Consider other simple actions such as mode changes | |
917 | # Handle inefficient democrazy. |
|
930 | # Handle inefficient democrazy. | |
918 | repo.ui.note(_(' %s: multiple bids for merge action:\n') % f) |
|
931 | repo.ui.note(_(' %s: multiple bids for merge action:\n') % f) | |
919 | for m, l in sorted(bids.items()): |
|
932 | for m, l in sorted(bids.items()): | |
920 | for _f, args, msg in l: |
|
933 | for _f, args, msg in l: | |
921 | repo.ui.note(' %s -> %s\n' % (msg, m)) |
|
934 | repo.ui.note(' %s -> %s\n' % (msg, m)) | |
922 | # Pick random action. TODO: Instead, prompt user when resolving |
|
935 | # Pick random action. TODO: Instead, prompt user when resolving | |
923 | m, l = bids.items()[0] |
|
936 | m, l = bids.items()[0] | |
924 | repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % |
|
937 | repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') % | |
925 | (f, m)) |
|
938 | (f, m)) | |
926 | actions[f] = l[0] |
|
939 | actions[f] = l[0] | |
927 | continue |
|
940 | continue | |
928 | repo.ui.note(_('end of auction\n\n')) |
|
941 | repo.ui.note(_('end of auction\n\n')) | |
929 |
|
942 | |||
930 | _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) |
|
943 | _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) | |
931 |
|
944 | |||
932 | if wctx.rev() is None: |
|
945 | if wctx.rev() is None: | |
933 | fractions = _forgetremoved(wctx, mctx, branchmerge) |
|
946 | fractions = _forgetremoved(wctx, mctx, branchmerge) | |
934 | actions.update(fractions) |
|
947 | actions.update(fractions) | |
935 |
|
948 | |||
936 | return actions, diverge, renamedelete |
|
949 | return actions, diverge, renamedelete | |
937 |
|
950 | |||
938 | def batchremove(repo, actions): |
|
951 | def batchremove(repo, actions): | |
939 | """apply removes to the working directory |
|
952 | """apply removes to the working directory | |
940 |
|
953 | |||
941 | yields tuples for progress updates |
|
954 | yields tuples for progress updates | |
942 | """ |
|
955 | """ | |
943 | verbose = repo.ui.verbose |
|
956 | verbose = repo.ui.verbose | |
944 | unlink = util.unlinkpath |
|
957 | unlink = util.unlinkpath | |
945 | wjoin = repo.wjoin |
|
958 | wjoin = repo.wjoin | |
946 | audit = repo.wvfs.audit |
|
959 | audit = repo.wvfs.audit | |
947 | i = 0 |
|
960 | i = 0 | |
948 | for f, args, msg in actions: |
|
961 | for f, args, msg in actions: | |
949 | repo.ui.debug(" %s: %s -> r\n" % (f, msg)) |
|
962 | repo.ui.debug(" %s: %s -> r\n" % (f, msg)) | |
950 | if verbose: |
|
963 | if verbose: | |
951 | repo.ui.note(_("removing %s\n") % f) |
|
964 | repo.ui.note(_("removing %s\n") % f) | |
952 | audit(f) |
|
965 | audit(f) | |
953 | try: |
|
966 | try: | |
954 | unlink(wjoin(f), ignoremissing=True) |
|
967 | unlink(wjoin(f), ignoremissing=True) | |
955 | except OSError as inst: |
|
968 | except OSError as inst: | |
956 | repo.ui.warn(_("update failed to remove %s: %s!\n") % |
|
969 | repo.ui.warn(_("update failed to remove %s: %s!\n") % | |
957 | (f, inst.strerror)) |
|
970 | (f, inst.strerror)) | |
958 | if i == 100: |
|
971 | if i == 100: | |
959 | yield i, f |
|
972 | yield i, f | |
960 | i = 0 |
|
973 | i = 0 | |
961 | i += 1 |
|
974 | i += 1 | |
962 | if i > 0: |
|
975 | if i > 0: | |
963 | yield i, f |
|
976 | yield i, f | |
964 |
|
977 | |||
965 | def batchget(repo, mctx, actions): |
|
978 | def batchget(repo, mctx, actions): | |
966 | """apply gets to the working directory |
|
979 | """apply gets to the working directory | |
967 |
|
980 | |||
968 | mctx is the context to get from |
|
981 | mctx is the context to get from | |
969 |
|
982 | |||
970 | yields tuples for progress updates |
|
983 | yields tuples for progress updates | |
971 | """ |
|
984 | """ | |
972 | verbose = repo.ui.verbose |
|
985 | verbose = repo.ui.verbose | |
973 | fctx = mctx.filectx |
|
986 | fctx = mctx.filectx | |
974 | wwrite = repo.wwrite |
|
987 | wwrite = repo.wwrite | |
975 | ui = repo.ui |
|
988 | ui = repo.ui | |
976 | i = 0 |
|
989 | i = 0 | |
977 | for f, (flags, backup), msg in actions: |
|
990 | for f, (flags, backup), msg in actions: | |
978 | repo.ui.debug(" %s: %s -> g\n" % (f, msg)) |
|
991 | repo.ui.debug(" %s: %s -> g\n" % (f, msg)) | |
979 | if verbose: |
|
992 | if verbose: | |
980 | repo.ui.note(_("getting %s\n") % f) |
|
993 | repo.ui.note(_("getting %s\n") % f) | |
981 |
|
994 | |||
982 | if backup: |
|
995 | if backup: | |
983 | absf = repo.wjoin(f) |
|
996 | absf = repo.wjoin(f) | |
984 | orig = scmutil.origpath(ui, repo, absf) |
|
997 | orig = scmutil.origpath(ui, repo, absf) | |
985 | try: |
|
998 | try: | |
986 | # TODO Mercurial has always aborted if an untracked directory |
|
999 | # TODO Mercurial has always aborted if an untracked directory | |
987 | # is replaced by a tracked file, or generally with |
|
1000 | # is replaced by a tracked file, or generally with | |
988 | # file/directory merges. This needs to be sorted out. |
|
1001 | # file/directory merges. This needs to be sorted out. | |
989 | if repo.wvfs.isfileorlink(f): |
|
1002 | if repo.wvfs.isfileorlink(f): | |
990 | util.rename(absf, orig) |
|
1003 | util.rename(absf, orig) | |
991 | except OSError as e: |
|
1004 | except OSError as e: | |
992 | if e.errno != errno.ENOENT: |
|
1005 | if e.errno != errno.ENOENT: | |
993 | raise |
|
1006 | raise | |
994 |
|
1007 | |||
995 | wwrite(f, fctx(f).data(), flags) |
|
1008 | wwrite(f, fctx(f).data(), flags) | |
996 | if i == 100: |
|
1009 | if i == 100: | |
997 | yield i, f |
|
1010 | yield i, f | |
998 | i = 0 |
|
1011 | i = 0 | |
999 | i += 1 |
|
1012 | i += 1 | |
1000 | if i > 0: |
|
1013 | if i > 0: | |
1001 | yield i, f |
|
1014 | yield i, f | |
1002 |
|
1015 | |||
1003 | def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): |
|
1016 | def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): | |
1004 | """apply the merge action list to the working directory |
|
1017 | """apply the merge action list to the working directory | |
1005 |
|
1018 | |||
1006 | wctx is the working copy context |
|
1019 | wctx is the working copy context | |
1007 | mctx is the context to be merged into the working copy |
|
1020 | mctx is the context to be merged into the working copy | |
1008 |
|
1021 | |||
1009 | Return a tuple of counts (updated, merged, removed, unresolved) that |
|
1022 | Return a tuple of counts (updated, merged, removed, unresolved) that | |
1010 | describes how many files were affected by the update. |
|
1023 | describes how many files were affected by the update. | |
1011 | """ |
|
1024 | """ | |
1012 |
|
1025 | |||
1013 | updated, merged, removed = 0, 0, 0 |
|
1026 | updated, merged, removed = 0, 0, 0 | |
1014 | ms = mergestate.clean(repo, wctx.p1().node(), mctx.node()) |
|
1027 | ms = mergestate.clean(repo, wctx.p1().node(), mctx.node()) | |
1015 | moves = [] |
|
1028 | moves = [] | |
1016 | for m, l in actions.items(): |
|
1029 | for m, l in actions.items(): | |
1017 | l.sort() |
|
1030 | l.sort() | |
1018 |
|
1031 | |||
1019 | # 'cd' and 'dc' actions are treated like other merge conflicts |
|
1032 | # 'cd' and 'dc' actions are treated like other merge conflicts | |
1020 | mergeactions = sorted(actions['cd']) |
|
1033 | mergeactions = sorted(actions['cd']) | |
1021 | mergeactions.extend(sorted(actions['dc'])) |
|
1034 | mergeactions.extend(sorted(actions['dc'])) | |
1022 | mergeactions.extend(actions['m']) |
|
1035 | mergeactions.extend(actions['m']) | |
1023 | for f, args, msg in mergeactions: |
|
1036 | for f, args, msg in mergeactions: | |
1024 | f1, f2, fa, move, anc = args |
|
1037 | f1, f2, fa, move, anc = args | |
1025 | if f == '.hgsubstate': # merged internally |
|
1038 | if f == '.hgsubstate': # merged internally | |
1026 | continue |
|
1039 | continue | |
1027 | if f1 is None: |
|
1040 | if f1 is None: | |
1028 | fcl = filemerge.absentfilectx(wctx, fa) |
|
1041 | fcl = filemerge.absentfilectx(wctx, fa) | |
1029 | else: |
|
1042 | else: | |
1030 | repo.ui.debug(" preserving %s for resolve of %s\n" % (f1, f)) |
|
1043 | repo.ui.debug(" preserving %s for resolve of %s\n" % (f1, f)) | |
1031 | fcl = wctx[f1] |
|
1044 | fcl = wctx[f1] | |
1032 | if f2 is None: |
|
1045 | if f2 is None: | |
1033 | fco = filemerge.absentfilectx(mctx, fa) |
|
1046 | fco = filemerge.absentfilectx(mctx, fa) | |
1034 | else: |
|
1047 | else: | |
1035 | fco = mctx[f2] |
|
1048 | fco = mctx[f2] | |
1036 | actx = repo[anc] |
|
1049 | actx = repo[anc] | |
1037 | if fa in actx: |
|
1050 | if fa in actx: | |
1038 | fca = actx[fa] |
|
1051 | fca = actx[fa] | |
1039 | else: |
|
1052 | else: | |
1040 | # TODO: move to absentfilectx |
|
1053 | # TODO: move to absentfilectx | |
1041 | fca = repo.filectx(f1, fileid=nullrev) |
|
1054 | fca = repo.filectx(f1, fileid=nullrev) | |
1042 | ms.add(fcl, fco, fca, f) |
|
1055 | ms.add(fcl, fco, fca, f) | |
1043 | if f1 != f and move: |
|
1056 | if f1 != f and move: | |
1044 | moves.append(f1) |
|
1057 | moves.append(f1) | |
1045 |
|
1058 | |||
1046 | audit = repo.wvfs.audit |
|
1059 | audit = repo.wvfs.audit | |
1047 | _updating = _('updating') |
|
1060 | _updating = _('updating') | |
1048 | _files = _('files') |
|
1061 | _files = _('files') | |
1049 | progress = repo.ui.progress |
|
1062 | progress = repo.ui.progress | |
1050 |
|
1063 | |||
1051 | # remove renamed files after safely stored |
|
1064 | # remove renamed files after safely stored | |
1052 | for f in moves: |
|
1065 | for f in moves: | |
1053 | if os.path.lexists(repo.wjoin(f)): |
|
1066 | if os.path.lexists(repo.wjoin(f)): | |
1054 | repo.ui.debug("removing %s\n" % f) |
|
1067 | repo.ui.debug("removing %s\n" % f) | |
1055 | audit(f) |
|
1068 | audit(f) | |
1056 | util.unlinkpath(repo.wjoin(f)) |
|
1069 | util.unlinkpath(repo.wjoin(f)) | |
1057 |
|
1070 | |||
1058 | numupdates = sum(len(l) for m, l in actions.items() if m != 'k') |
|
1071 | numupdates = sum(len(l) for m, l in actions.items() if m != 'k') | |
1059 |
|
1072 | |||
1060 | if [a for a in actions['r'] if a[0] == '.hgsubstate']: |
|
1073 | if [a for a in actions['r'] if a[0] == '.hgsubstate']: | |
1061 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
|
1074 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
1062 |
|
1075 | |||
1063 | # remove in parallel (must come first) |
|
1076 | # remove in parallel (must come first) | |
1064 | z = 0 |
|
1077 | z = 0 | |
1065 | prog = worker.worker(repo.ui, 0.001, batchremove, (repo,), actions['r']) |
|
1078 | prog = worker.worker(repo.ui, 0.001, batchremove, (repo,), actions['r']) | |
1066 | for i, item in prog: |
|
1079 | for i, item in prog: | |
1067 | z += i |
|
1080 | z += i | |
1068 | progress(_updating, z, item=item, total=numupdates, unit=_files) |
|
1081 | progress(_updating, z, item=item, total=numupdates, unit=_files) | |
1069 | removed = len(actions['r']) |
|
1082 | removed = len(actions['r']) | |
1070 |
|
1083 | |||
1071 | # get in parallel |
|
1084 | # get in parallel | |
1072 | prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx), actions['g']) |
|
1085 | prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx), actions['g']) | |
1073 | for i, item in prog: |
|
1086 | for i, item in prog: | |
1074 | z += i |
|
1087 | z += i | |
1075 | progress(_updating, z, item=item, total=numupdates, unit=_files) |
|
1088 | progress(_updating, z, item=item, total=numupdates, unit=_files) | |
1076 | updated = len(actions['g']) |
|
1089 | updated = len(actions['g']) | |
1077 |
|
1090 | |||
1078 | if [a for a in actions['g'] if a[0] == '.hgsubstate']: |
|
1091 | if [a for a in actions['g'] if a[0] == '.hgsubstate']: | |
1079 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
|
1092 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | |
1080 |
|
1093 | |||
1081 | # forget (manifest only, just log it) (must come first) |
|
1094 | # forget (manifest only, just log it) (must come first) | |
1082 | for f, args, msg in actions['f']: |
|
1095 | for f, args, msg in actions['f']: | |
1083 | repo.ui.debug(" %s: %s -> f\n" % (f, msg)) |
|
1096 | repo.ui.debug(" %s: %s -> f\n" % (f, msg)) | |
1084 | z += 1 |
|
1097 | z += 1 | |
1085 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1098 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1086 |
|
1099 | |||
1087 | # re-add (manifest only, just log it) |
|
1100 | # re-add (manifest only, just log it) | |
1088 | for f, args, msg in actions['a']: |
|
1101 | for f, args, msg in actions['a']: | |
1089 | repo.ui.debug(" %s: %s -> a\n" % (f, msg)) |
|
1102 | repo.ui.debug(" %s: %s -> a\n" % (f, msg)) | |
1090 | z += 1 |
|
1103 | z += 1 | |
1091 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1104 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1092 |
|
1105 | |||
1093 | # re-add/mark as modified (manifest only, just log it) |
|
1106 | # re-add/mark as modified (manifest only, just log it) | |
1094 | for f, args, msg in actions['am']: |
|
1107 | for f, args, msg in actions['am']: | |
1095 | repo.ui.debug(" %s: %s -> am\n" % (f, msg)) |
|
1108 | repo.ui.debug(" %s: %s -> am\n" % (f, msg)) | |
1096 | z += 1 |
|
1109 | z += 1 | |
1097 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1110 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1098 |
|
1111 | |||
1099 | # keep (noop, just log it) |
|
1112 | # keep (noop, just log it) | |
1100 | for f, args, msg in actions['k']: |
|
1113 | for f, args, msg in actions['k']: | |
1101 | repo.ui.debug(" %s: %s -> k\n" % (f, msg)) |
|
1114 | repo.ui.debug(" %s: %s -> k\n" % (f, msg)) | |
1102 | # no progress |
|
1115 | # no progress | |
1103 |
|
1116 | |||
1104 | # directory rename, move local |
|
1117 | # directory rename, move local | |
1105 | for f, args, msg in actions['dm']: |
|
1118 | for f, args, msg in actions['dm']: | |
1106 | repo.ui.debug(" %s: %s -> dm\n" % (f, msg)) |
|
1119 | repo.ui.debug(" %s: %s -> dm\n" % (f, msg)) | |
1107 | z += 1 |
|
1120 | z += 1 | |
1108 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1121 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1109 | f0, flags = args |
|
1122 | f0, flags = args | |
1110 | repo.ui.note(_("moving %s to %s\n") % (f0, f)) |
|
1123 | repo.ui.note(_("moving %s to %s\n") % (f0, f)) | |
1111 | audit(f) |
|
1124 | audit(f) | |
1112 | repo.wwrite(f, wctx.filectx(f0).data(), flags) |
|
1125 | repo.wwrite(f, wctx.filectx(f0).data(), flags) | |
1113 | util.unlinkpath(repo.wjoin(f0)) |
|
1126 | util.unlinkpath(repo.wjoin(f0)) | |
1114 | updated += 1 |
|
1127 | updated += 1 | |
1115 |
|
1128 | |||
1116 | # local directory rename, get |
|
1129 | # local directory rename, get | |
1117 | for f, args, msg in actions['dg']: |
|
1130 | for f, args, msg in actions['dg']: | |
1118 | repo.ui.debug(" %s: %s -> dg\n" % (f, msg)) |
|
1131 | repo.ui.debug(" %s: %s -> dg\n" % (f, msg)) | |
1119 | z += 1 |
|
1132 | z += 1 | |
1120 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1133 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1121 | f0, flags = args |
|
1134 | f0, flags = args | |
1122 | repo.ui.note(_("getting %s to %s\n") % (f0, f)) |
|
1135 | repo.ui.note(_("getting %s to %s\n") % (f0, f)) | |
1123 | repo.wwrite(f, mctx.filectx(f0).data(), flags) |
|
1136 | repo.wwrite(f, mctx.filectx(f0).data(), flags) | |
1124 | updated += 1 |
|
1137 | updated += 1 | |
1125 |
|
1138 | |||
1126 | # exec |
|
1139 | # exec | |
1127 | for f, args, msg in actions['e']: |
|
1140 | for f, args, msg in actions['e']: | |
1128 | repo.ui.debug(" %s: %s -> e\n" % (f, msg)) |
|
1141 | repo.ui.debug(" %s: %s -> e\n" % (f, msg)) | |
1129 | z += 1 |
|
1142 | z += 1 | |
1130 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1143 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1131 | flags, = args |
|
1144 | flags, = args | |
1132 | audit(f) |
|
1145 | audit(f) | |
1133 | util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) |
|
1146 | util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) | |
1134 | updated += 1 |
|
1147 | updated += 1 | |
1135 |
|
1148 | |||
1136 | # the ordering is important here -- ms.mergedriver will raise if the merge |
|
1149 | # the ordering is important here -- ms.mergedriver will raise if the merge | |
1137 | # driver has changed, and we want to be able to bypass it when overwrite is |
|
1150 | # driver has changed, and we want to be able to bypass it when overwrite is | |
1138 | # True |
|
1151 | # True | |
1139 | usemergedriver = not overwrite and mergeactions and ms.mergedriver |
|
1152 | usemergedriver = not overwrite and mergeactions and ms.mergedriver | |
1140 |
|
1153 | |||
1141 | if usemergedriver: |
|
1154 | if usemergedriver: | |
1142 | ms.commit() |
|
1155 | ms.commit() | |
1143 | proceed = driverpreprocess(repo, ms, wctx, labels=labels) |
|
1156 | proceed = driverpreprocess(repo, ms, wctx, labels=labels) | |
1144 | # the driver might leave some files unresolved |
|
1157 | # the driver might leave some files unresolved | |
1145 | unresolvedf = set(ms.unresolved()) |
|
1158 | unresolvedf = set(ms.unresolved()) | |
1146 | if not proceed: |
|
1159 | if not proceed: | |
1147 | # XXX setting unresolved to at least 1 is a hack to make sure we |
|
1160 | # XXX setting unresolved to at least 1 is a hack to make sure we | |
1148 | # error out |
|
1161 | # error out | |
1149 | return updated, merged, removed, max(len(unresolvedf), 1) |
|
1162 | return updated, merged, removed, max(len(unresolvedf), 1) | |
1150 | newactions = [] |
|
1163 | newactions = [] | |
1151 | for f, args, msg in mergeactions: |
|
1164 | for f, args, msg in mergeactions: | |
1152 | if f in unresolvedf: |
|
1165 | if f in unresolvedf: | |
1153 | newactions.append((f, args, msg)) |
|
1166 | newactions.append((f, args, msg)) | |
1154 | mergeactions = newactions |
|
1167 | mergeactions = newactions | |
1155 |
|
1168 | |||
1156 | # premerge |
|
1169 | # premerge | |
1157 | tocomplete = [] |
|
1170 | tocomplete = [] | |
1158 | for f, args, msg in mergeactions: |
|
1171 | for f, args, msg in mergeactions: | |
1159 | repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) |
|
1172 | repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) | |
1160 | z += 1 |
|
1173 | z += 1 | |
1161 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1174 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1162 | if f == '.hgsubstate': # subrepo states need updating |
|
1175 | if f == '.hgsubstate': # subrepo states need updating | |
1163 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
|
1176 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | |
1164 | overwrite) |
|
1177 | overwrite) | |
1165 | continue |
|
1178 | continue | |
1166 | audit(f) |
|
1179 | audit(f) | |
1167 | complete, r = ms.preresolve(f, wctx, labels=labels) |
|
1180 | complete, r = ms.preresolve(f, wctx, labels=labels) | |
1168 | if not complete: |
|
1181 | if not complete: | |
1169 | numupdates += 1 |
|
1182 | numupdates += 1 | |
1170 | tocomplete.append((f, args, msg)) |
|
1183 | tocomplete.append((f, args, msg)) | |
1171 |
|
1184 | |||
1172 | # merge |
|
1185 | # merge | |
1173 | for f, args, msg in tocomplete: |
|
1186 | for f, args, msg in tocomplete: | |
1174 | repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) |
|
1187 | repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) | |
1175 | z += 1 |
|
1188 | z += 1 | |
1176 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1189 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1177 | ms.resolve(f, wctx, labels=labels) |
|
1190 | ms.resolve(f, wctx, labels=labels) | |
1178 |
|
1191 | |||
1179 | ms.commit() |
|
1192 | ms.commit() | |
1180 |
|
1193 | |||
1181 | unresolved = ms.unresolvedcount() |
|
1194 | unresolved = ms.unresolvedcount() | |
1182 |
|
1195 | |||
1183 | if usemergedriver and not unresolved and ms.mdstate() != 's': |
|
1196 | if usemergedriver and not unresolved and ms.mdstate() != 's': | |
1184 | if not driverconclude(repo, ms, wctx, labels=labels): |
|
1197 | if not driverconclude(repo, ms, wctx, labels=labels): | |
1185 | # XXX setting unresolved to at least 1 is a hack to make sure we |
|
1198 | # XXX setting unresolved to at least 1 is a hack to make sure we | |
1186 | # error out |
|
1199 | # error out | |
1187 | unresolved = max(unresolved, 1) |
|
1200 | unresolved = max(unresolved, 1) | |
1188 |
|
1201 | |||
1189 | ms.commit() |
|
1202 | ms.commit() | |
1190 |
|
1203 | |||
1191 | msupdated, msmerged, msremoved = ms.counts() |
|
1204 | msupdated, msmerged, msremoved = ms.counts() | |
1192 | updated += msupdated |
|
1205 | updated += msupdated | |
1193 | merged += msmerged |
|
1206 | merged += msmerged | |
1194 | removed += msremoved |
|
1207 | removed += msremoved | |
1195 |
|
1208 | |||
1196 | extraactions = ms.actions() |
|
1209 | extraactions = ms.actions() | |
1197 | for k, acts in extraactions.iteritems(): |
|
1210 | for k, acts in extraactions.iteritems(): | |
1198 | actions[k].extend(acts) |
|
1211 | actions[k].extend(acts) | |
1199 |
|
1212 | |||
1200 | progress(_updating, None, total=numupdates, unit=_files) |
|
1213 | progress(_updating, None, total=numupdates, unit=_files) | |
1201 |
|
1214 | |||
1202 | return updated, merged, removed, unresolved |
|
1215 | return updated, merged, removed, unresolved | |
1203 |
|
1216 | |||
1204 | def recordupdates(repo, actions, branchmerge): |
|
1217 | def recordupdates(repo, actions, branchmerge): | |
1205 | "record merge actions to the dirstate" |
|
1218 | "record merge actions to the dirstate" | |
1206 | # remove (must come first) |
|
1219 | # remove (must come first) | |
1207 | for f, args, msg in actions.get('r', []): |
|
1220 | for f, args, msg in actions.get('r', []): | |
1208 | if branchmerge: |
|
1221 | if branchmerge: | |
1209 | repo.dirstate.remove(f) |
|
1222 | repo.dirstate.remove(f) | |
1210 | else: |
|
1223 | else: | |
1211 | repo.dirstate.drop(f) |
|
1224 | repo.dirstate.drop(f) | |
1212 |
|
1225 | |||
1213 | # forget (must come first) |
|
1226 | # forget (must come first) | |
1214 | for f, args, msg in actions.get('f', []): |
|
1227 | for f, args, msg in actions.get('f', []): | |
1215 | repo.dirstate.drop(f) |
|
1228 | repo.dirstate.drop(f) | |
1216 |
|
1229 | |||
1217 | # re-add |
|
1230 | # re-add | |
1218 | for f, args, msg in actions.get('a', []): |
|
1231 | for f, args, msg in actions.get('a', []): | |
1219 | repo.dirstate.add(f) |
|
1232 | repo.dirstate.add(f) | |
1220 |
|
1233 | |||
1221 | # re-add/mark as modified |
|
1234 | # re-add/mark as modified | |
1222 | for f, args, msg in actions.get('am', []): |
|
1235 | for f, args, msg in actions.get('am', []): | |
1223 | if branchmerge: |
|
1236 | if branchmerge: | |
1224 | repo.dirstate.normallookup(f) |
|
1237 | repo.dirstate.normallookup(f) | |
1225 | else: |
|
1238 | else: | |
1226 | repo.dirstate.add(f) |
|
1239 | repo.dirstate.add(f) | |
1227 |
|
1240 | |||
1228 | # exec change |
|
1241 | # exec change | |
1229 | for f, args, msg in actions.get('e', []): |
|
1242 | for f, args, msg in actions.get('e', []): | |
1230 | repo.dirstate.normallookup(f) |
|
1243 | repo.dirstate.normallookup(f) | |
1231 |
|
1244 | |||
1232 | # keep |
|
1245 | # keep | |
1233 | for f, args, msg in actions.get('k', []): |
|
1246 | for f, args, msg in actions.get('k', []): | |
1234 | pass |
|
1247 | pass | |
1235 |
|
1248 | |||
1236 | # get |
|
1249 | # get | |
1237 | for f, args, msg in actions.get('g', []): |
|
1250 | for f, args, msg in actions.get('g', []): | |
1238 | if branchmerge: |
|
1251 | if branchmerge: | |
1239 | repo.dirstate.otherparent(f) |
|
1252 | repo.dirstate.otherparent(f) | |
1240 | else: |
|
1253 | else: | |
1241 | repo.dirstate.normal(f) |
|
1254 | repo.dirstate.normal(f) | |
1242 |
|
1255 | |||
1243 | # merge |
|
1256 | # merge | |
1244 | for f, args, msg in actions.get('m', []): |
|
1257 | for f, args, msg in actions.get('m', []): | |
1245 | f1, f2, fa, move, anc = args |
|
1258 | f1, f2, fa, move, anc = args | |
1246 | if branchmerge: |
|
1259 | if branchmerge: | |
1247 | # We've done a branch merge, mark this file as merged |
|
1260 | # We've done a branch merge, mark this file as merged | |
1248 | # so that we properly record the merger later |
|
1261 | # so that we properly record the merger later | |
1249 | repo.dirstate.merge(f) |
|
1262 | repo.dirstate.merge(f) | |
1250 | if f1 != f2: # copy/rename |
|
1263 | if f1 != f2: # copy/rename | |
1251 | if move: |
|
1264 | if move: | |
1252 | repo.dirstate.remove(f1) |
|
1265 | repo.dirstate.remove(f1) | |
1253 | if f1 != f: |
|
1266 | if f1 != f: | |
1254 | repo.dirstate.copy(f1, f) |
|
1267 | repo.dirstate.copy(f1, f) | |
1255 | else: |
|
1268 | else: | |
1256 | repo.dirstate.copy(f2, f) |
|
1269 | repo.dirstate.copy(f2, f) | |
1257 | else: |
|
1270 | else: | |
1258 | # We've update-merged a locally modified file, so |
|
1271 | # We've update-merged a locally modified file, so | |
1259 | # we set the dirstate to emulate a normal checkout |
|
1272 | # we set the dirstate to emulate a normal checkout | |
1260 | # of that file some time in the past. Thus our |
|
1273 | # of that file some time in the past. Thus our | |
1261 | # merge will appear as a normal local file |
|
1274 | # merge will appear as a normal local file | |
1262 | # modification. |
|
1275 | # modification. | |
1263 | if f2 == f: # file not locally copied/moved |
|
1276 | if f2 == f: # file not locally copied/moved | |
1264 | repo.dirstate.normallookup(f) |
|
1277 | repo.dirstate.normallookup(f) | |
1265 | if move: |
|
1278 | if move: | |
1266 | repo.dirstate.drop(f1) |
|
1279 | repo.dirstate.drop(f1) | |
1267 |
|
1280 | |||
1268 | # directory rename, move local |
|
1281 | # directory rename, move local | |
1269 | for f, args, msg in actions.get('dm', []): |
|
1282 | for f, args, msg in actions.get('dm', []): | |
1270 | f0, flag = args |
|
1283 | f0, flag = args | |
1271 | if branchmerge: |
|
1284 | if branchmerge: | |
1272 | repo.dirstate.add(f) |
|
1285 | repo.dirstate.add(f) | |
1273 | repo.dirstate.remove(f0) |
|
1286 | repo.dirstate.remove(f0) | |
1274 | repo.dirstate.copy(f0, f) |
|
1287 | repo.dirstate.copy(f0, f) | |
1275 | else: |
|
1288 | else: | |
1276 | repo.dirstate.normal(f) |
|
1289 | repo.dirstate.normal(f) | |
1277 | repo.dirstate.drop(f0) |
|
1290 | repo.dirstate.drop(f0) | |
1278 |
|
1291 | |||
1279 | # directory rename, get |
|
1292 | # directory rename, get | |
1280 | for f, args, msg in actions.get('dg', []): |
|
1293 | for f, args, msg in actions.get('dg', []): | |
1281 | f0, flag = args |
|
1294 | f0, flag = args | |
1282 | if branchmerge: |
|
1295 | if branchmerge: | |
1283 | repo.dirstate.add(f) |
|
1296 | repo.dirstate.add(f) | |
1284 | repo.dirstate.copy(f0, f) |
|
1297 | repo.dirstate.copy(f0, f) | |
1285 | else: |
|
1298 | else: | |
1286 | repo.dirstate.normal(f) |
|
1299 | repo.dirstate.normal(f) | |
1287 |
|
1300 | |||
1288 | def update(repo, node, branchmerge, force, ancestor=None, |
|
1301 | def update(repo, node, branchmerge, force, ancestor=None, | |
1289 | mergeancestor=False, labels=None, matcher=None): |
|
1302 | mergeancestor=False, labels=None, matcher=None): | |
1290 | """ |
|
1303 | """ | |
1291 | Perform a merge between the working directory and the given node |
|
1304 | Perform a merge between the working directory and the given node | |
1292 |
|
1305 | |||
1293 | node = the node to update to, or None if unspecified |
|
1306 | node = the node to update to, or None if unspecified | |
1294 | branchmerge = whether to merge between branches |
|
1307 | branchmerge = whether to merge between branches | |
1295 | force = whether to force branch merging or file overwriting |
|
1308 | force = whether to force branch merging or file overwriting | |
1296 | matcher = a matcher to filter file lists (dirstate not updated) |
|
1309 | matcher = a matcher to filter file lists (dirstate not updated) | |
1297 | mergeancestor = whether it is merging with an ancestor. If true, |
|
1310 | mergeancestor = whether it is merging with an ancestor. If true, | |
1298 | we should accept the incoming changes for any prompts that occur. |
|
1311 | we should accept the incoming changes for any prompts that occur. | |
1299 | If false, merging with an ancestor (fast-forward) is only allowed |
|
1312 | If false, merging with an ancestor (fast-forward) is only allowed | |
1300 | between different named branches. This flag is used by rebase extension |
|
1313 | between different named branches. This flag is used by rebase extension | |
1301 | as a temporary fix and should be avoided in general. |
|
1314 | as a temporary fix and should be avoided in general. | |
1302 |
|
1315 | |||
1303 | The table below shows all the behaviors of the update command |
|
1316 | The table below shows all the behaviors of the update command | |
1304 | given the -c and -C or no options, whether the working directory |
|
1317 | given the -c and -C or no options, whether the working directory | |
1305 | is dirty, whether a revision is specified, and the relationship of |
|
1318 | is dirty, whether a revision is specified, and the relationship of | |
1306 | the parent rev to the target rev (linear, on the same named |
|
1319 | the parent rev to the target rev (linear, on the same named | |
1307 | branch, or on another named branch). |
|
1320 | branch, or on another named branch). | |
1308 |
|
1321 | |||
1309 | This logic is tested by test-update-branches.t. |
|
1322 | This logic is tested by test-update-branches.t. | |
1310 |
|
1323 | |||
1311 | -c -C dirty rev | linear same cross |
|
1324 | -c -C dirty rev | linear same cross | |
1312 | n n n n | ok (1) x |
|
1325 | n n n n | ok (1) x | |
1313 | n n n y | ok ok ok |
|
1326 | n n n y | ok ok ok | |
1314 | n n y n | merge (2) (2) |
|
1327 | n n y n | merge (2) (2) | |
1315 | n n y y | merge (3) (3) |
|
1328 | n n y y | merge (3) (3) | |
1316 | n y * * | discard discard discard |
|
1329 | n y * * | discard discard discard | |
1317 | y n y * | (4) (4) (4) |
|
1330 | y n y * | (4) (4) (4) | |
1318 | y n n * | ok ok ok |
|
1331 | y n n * | ok ok ok | |
1319 | y y * * | (5) (5) (5) |
|
1332 | y y * * | (5) (5) (5) | |
1320 |
|
1333 | |||
1321 | x = can't happen |
|
1334 | x = can't happen | |
1322 | * = don't-care |
|
1335 | * = don't-care | |
1323 | 1 = abort: not a linear update (merge or update --check to force update) |
|
1336 | 1 = abort: not a linear update (merge or update --check to force update) | |
1324 | 2 = abort: uncommitted changes (commit and merge, or update --clean to |
|
1337 | 2 = abort: uncommitted changes (commit and merge, or update --clean to | |
1325 | discard changes) |
|
1338 | discard changes) | |
1326 | 3 = abort: uncommitted changes (commit or update --clean to discard changes) |
|
1339 | 3 = abort: uncommitted changes (commit or update --clean to discard changes) | |
1327 | 4 = abort: uncommitted changes (checked in commands.py) |
|
1340 | 4 = abort: uncommitted changes (checked in commands.py) | |
1328 | 5 = incompatible options (checked in commands.py) |
|
1341 | 5 = incompatible options (checked in commands.py) | |
1329 |
|
1342 | |||
1330 | Return the same tuple as applyupdates(). |
|
1343 | Return the same tuple as applyupdates(). | |
1331 | """ |
|
1344 | """ | |
1332 |
|
1345 | |||
1333 | onode = node |
|
1346 | onode = node | |
1334 | wlock = repo.wlock() |
|
1347 | wlock = repo.wlock() | |
1335 | # If we're doing a partial update, we need to skip updating |
|
1348 | # If we're doing a partial update, we need to skip updating | |
1336 | # the dirstate, so make a note of any partial-ness to the |
|
1349 | # the dirstate, so make a note of any partial-ness to the | |
1337 | # update here. |
|
1350 | # update here. | |
1338 | if matcher is None or matcher.always(): |
|
1351 | if matcher is None or matcher.always(): | |
1339 | partial = False |
|
1352 | partial = False | |
1340 | else: |
|
1353 | else: | |
1341 | partial = True |
|
1354 | partial = True | |
1342 | try: |
|
1355 | try: | |
1343 | wc = repo[None] |
|
1356 | wc = repo[None] | |
1344 | pl = wc.parents() |
|
1357 | pl = wc.parents() | |
1345 | p1 = pl[0] |
|
1358 | p1 = pl[0] | |
1346 | pas = [None] |
|
1359 | pas = [None] | |
1347 | if ancestor is not None: |
|
1360 | if ancestor is not None: | |
1348 | pas = [repo[ancestor]] |
|
1361 | pas = [repo[ancestor]] | |
1349 |
|
1362 | |||
1350 | if node is None: |
|
1363 | if node is None: | |
1351 | if (repo.ui.configbool('devel', 'all-warnings') |
|
1364 | if (repo.ui.configbool('devel', 'all-warnings') | |
1352 | or repo.ui.configbool('devel', 'oldapi')): |
|
1365 | or repo.ui.configbool('devel', 'oldapi')): | |
1353 | repo.ui.develwarn('update with no target') |
|
1366 | repo.ui.develwarn('update with no target') | |
1354 | rev, _mark, _act = destutil.destupdate(repo) |
|
1367 | rev, _mark, _act = destutil.destupdate(repo) | |
1355 | node = repo[rev].node() |
|
1368 | node = repo[rev].node() | |
1356 |
|
1369 | |||
1357 | overwrite = force and not branchmerge |
|
1370 | overwrite = force and not branchmerge | |
1358 |
|
1371 | |||
1359 | p2 = repo[node] |
|
1372 | p2 = repo[node] | |
1360 | if pas[0] is None: |
|
1373 | if pas[0] is None: | |
1361 | if repo.ui.configlist('merge', 'preferancestor', ['*']) == ['*']: |
|
1374 | if repo.ui.configlist('merge', 'preferancestor', ['*']) == ['*']: | |
1362 | cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node()) |
|
1375 | cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node()) | |
1363 | pas = [repo[anc] for anc in (sorted(cahs) or [nullid])] |
|
1376 | pas = [repo[anc] for anc in (sorted(cahs) or [nullid])] | |
1364 | else: |
|
1377 | else: | |
1365 | pas = [p1.ancestor(p2, warn=branchmerge)] |
|
1378 | pas = [p1.ancestor(p2, warn=branchmerge)] | |
1366 |
|
1379 | |||
1367 | fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) |
|
1380 | fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) | |
1368 |
|
1381 | |||
1369 | ### check phase |
|
1382 | ### check phase | |
1370 | if not overwrite: |
|
1383 | if not overwrite: | |
1371 | if len(pl) > 1: |
|
1384 | if len(pl) > 1: | |
1372 | raise error.Abort(_("outstanding uncommitted merge")) |
|
1385 | raise error.Abort(_("outstanding uncommitted merge")) | |
1373 | ms = mergestate.read(repo) |
|
1386 | ms = mergestate.read(repo) | |
1374 | if list(ms.unresolved()): |
|
1387 | if list(ms.unresolved()): | |
1375 | raise error.Abort(_("outstanding merge conflicts")) |
|
1388 | raise error.Abort(_("outstanding merge conflicts")) | |
1376 | if branchmerge: |
|
1389 | if branchmerge: | |
1377 | if pas == [p2]: |
|
1390 | if pas == [p2]: | |
1378 | raise error.Abort(_("merging with a working directory ancestor" |
|
1391 | raise error.Abort(_("merging with a working directory ancestor" | |
1379 | " has no effect")) |
|
1392 | " has no effect")) | |
1380 | elif pas == [p1]: |
|
1393 | elif pas == [p1]: | |
1381 | if not mergeancestor and p1.branch() == p2.branch(): |
|
1394 | if not mergeancestor and p1.branch() == p2.branch(): | |
1382 | raise error.Abort(_("nothing to merge"), |
|
1395 | raise error.Abort(_("nothing to merge"), | |
1383 | hint=_("use 'hg update' " |
|
1396 | hint=_("use 'hg update' " | |
1384 | "or check 'hg heads'")) |
|
1397 | "or check 'hg heads'")) | |
1385 | if not force and (wc.files() or wc.deleted()): |
|
1398 | if not force and (wc.files() or wc.deleted()): | |
1386 | raise error.Abort(_("uncommitted changes"), |
|
1399 | raise error.Abort(_("uncommitted changes"), | |
1387 | hint=_("use 'hg status' to list changes")) |
|
1400 | hint=_("use 'hg status' to list changes")) | |
1388 | for s in sorted(wc.substate): |
|
1401 | for s in sorted(wc.substate): | |
1389 | wc.sub(s).bailifchanged() |
|
1402 | wc.sub(s).bailifchanged() | |
1390 |
|
1403 | |||
1391 | elif not overwrite: |
|
1404 | elif not overwrite: | |
1392 | if p1 == p2: # no-op update |
|
1405 | if p1 == p2: # no-op update | |
1393 | # call the hooks and exit early |
|
1406 | # call the hooks and exit early | |
1394 | repo.hook('preupdate', throw=True, parent1=xp2, parent2='') |
|
1407 | repo.hook('preupdate', throw=True, parent1=xp2, parent2='') | |
1395 | repo.hook('update', parent1=xp2, parent2='', error=0) |
|
1408 | repo.hook('update', parent1=xp2, parent2='', error=0) | |
1396 | return 0, 0, 0, 0 |
|
1409 | return 0, 0, 0, 0 | |
1397 |
|
1410 | |||
1398 | if pas not in ([p1], [p2]): # nonlinear |
|
1411 | if pas not in ([p1], [p2]): # nonlinear | |
1399 | dirty = wc.dirty(missing=True) |
|
1412 | dirty = wc.dirty(missing=True) | |
1400 | if dirty or onode is None: |
|
1413 | if dirty or onode is None: | |
1401 | # Branching is a bit strange to ensure we do the minimal |
|
1414 | # Branching is a bit strange to ensure we do the minimal | |
1402 | # amount of call to obsolete.background. |
|
1415 | # amount of call to obsolete.background. | |
1403 | foreground = obsolete.foreground(repo, [p1.node()]) |
|
1416 | foreground = obsolete.foreground(repo, [p1.node()]) | |
1404 | # note: the <node> variable contains a random identifier |
|
1417 | # note: the <node> variable contains a random identifier | |
1405 | if repo[node].node() in foreground: |
|
1418 | if repo[node].node() in foreground: | |
1406 | pas = [p1] # allow updating to successors |
|
1419 | pas = [p1] # allow updating to successors | |
1407 | elif dirty: |
|
1420 | elif dirty: | |
1408 | msg = _("uncommitted changes") |
|
1421 | msg = _("uncommitted changes") | |
1409 | if onode is None: |
|
1422 | if onode is None: | |
1410 | hint = _("commit and merge, or update --clean to" |
|
1423 | hint = _("commit and merge, or update --clean to" | |
1411 | " discard changes") |
|
1424 | " discard changes") | |
1412 | else: |
|
1425 | else: | |
1413 | hint = _("commit or update --clean to discard" |
|
1426 | hint = _("commit or update --clean to discard" | |
1414 | " changes") |
|
1427 | " changes") | |
1415 | raise error.Abort(msg, hint=hint) |
|
1428 | raise error.Abort(msg, hint=hint) | |
1416 | else: # node is none |
|
1429 | else: # node is none | |
1417 | msg = _("not a linear update") |
|
1430 | msg = _("not a linear update") | |
1418 | hint = _("merge or update --check to force update") |
|
1431 | hint = _("merge or update --check to force update") | |
1419 | raise error.Abort(msg, hint=hint) |
|
1432 | raise error.Abort(msg, hint=hint) | |
1420 | else: |
|
1433 | else: | |
1421 | # Allow jumping branches if clean and specific rev given |
|
1434 | # Allow jumping branches if clean and specific rev given | |
1422 | pas = [p1] |
|
1435 | pas = [p1] | |
1423 |
|
1436 | |||
1424 | # deprecated config: merge.followcopies |
|
1437 | # deprecated config: merge.followcopies | |
1425 | followcopies = False |
|
1438 | followcopies = False | |
1426 | if overwrite: |
|
1439 | if overwrite: | |
1427 | pas = [wc] |
|
1440 | pas = [wc] | |
1428 | elif pas == [p2]: # backwards |
|
1441 | elif pas == [p2]: # backwards | |
1429 | pas = [wc.p1()] |
|
1442 | pas = [wc.p1()] | |
1430 | elif not branchmerge and not wc.dirty(missing=True): |
|
1443 | elif not branchmerge and not wc.dirty(missing=True): | |
1431 | pass |
|
1444 | pass | |
1432 | elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): |
|
1445 | elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): | |
1433 | followcopies = True |
|
1446 | followcopies = True | |
1434 |
|
1447 | |||
1435 | ### calculate phase |
|
1448 | ### calculate phase | |
1436 | actionbyfile, diverge, renamedelete = calculateupdates( |
|
1449 | actionbyfile, diverge, renamedelete = calculateupdates( | |
1437 | repo, wc, p2, pas, branchmerge, force, mergeancestor, |
|
1450 | repo, wc, p2, pas, branchmerge, force, mergeancestor, | |
1438 | followcopies, matcher=matcher) |
|
1451 | followcopies, matcher=matcher) | |
1439 | # Convert to dictionary-of-lists format |
|
1452 | # Convert to dictionary-of-lists format | |
1440 | actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) |
|
1453 | actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) | |
1441 | for f, (m, args, msg) in actionbyfile.iteritems(): |
|
1454 | for f, (m, args, msg) in actionbyfile.iteritems(): | |
1442 | if m not in actions: |
|
1455 | if m not in actions: | |
1443 | actions[m] = [] |
|
1456 | actions[m] = [] | |
1444 | actions[m].append((f, args, msg)) |
|
1457 | actions[m].append((f, args, msg)) | |
1445 |
|
1458 | |||
1446 | if not util.checkcase(repo.path): |
|
1459 | if not util.checkcase(repo.path): | |
1447 | # check collision between files only in p2 for clean update |
|
1460 | # check collision between files only in p2 for clean update | |
1448 | if (not branchmerge and |
|
1461 | if (not branchmerge and | |
1449 | (force or not wc.dirty(missing=True, branch=False))): |
|
1462 | (force or not wc.dirty(missing=True, branch=False))): | |
1450 | _checkcollision(repo, p2.manifest(), None) |
|
1463 | _checkcollision(repo, p2.manifest(), None) | |
1451 | else: |
|
1464 | else: | |
1452 | _checkcollision(repo, wc.manifest(), actions) |
|
1465 | _checkcollision(repo, wc.manifest(), actions) | |
1453 |
|
1466 | |||
1454 | # Prompt and create actions. Most of this is in the resolve phase |
|
1467 | # Prompt and create actions. Most of this is in the resolve phase | |
1455 | # already, but we can't handle .hgsubstate in filemerge or |
|
1468 | # already, but we can't handle .hgsubstate in filemerge or | |
1456 | # subrepo.submerge yet so we have to keep prompting for it. |
|
1469 | # subrepo.submerge yet so we have to keep prompting for it. | |
1457 | for f, args, msg in sorted(actions['cd']): |
|
1470 | for f, args, msg in sorted(actions['cd']): | |
1458 | if f != '.hgsubstate': |
|
1471 | if f != '.hgsubstate': | |
1459 | continue |
|
1472 | continue | |
1460 | if repo.ui.promptchoice( |
|
1473 | if repo.ui.promptchoice( | |
1461 | _("local changed %s which remote deleted\n" |
|
1474 | _("local changed %s which remote deleted\n" | |
1462 | "use (c)hanged version or (d)elete?" |
|
1475 | "use (c)hanged version or (d)elete?" | |
1463 | "$$ &Changed $$ &Delete") % f, 0): |
|
1476 | "$$ &Changed $$ &Delete") % f, 0): | |
1464 | actions['r'].append((f, None, "prompt delete")) |
|
1477 | actions['r'].append((f, None, "prompt delete")) | |
1465 | elif f in p1: |
|
1478 | elif f in p1: | |
1466 | actions['am'].append((f, None, "prompt keep")) |
|
1479 | actions['am'].append((f, None, "prompt keep")) | |
1467 | else: |
|
1480 | else: | |
1468 | actions['a'].append((f, None, "prompt keep")) |
|
1481 | actions['a'].append((f, None, "prompt keep")) | |
1469 |
|
1482 | |||
1470 | for f, args, msg in sorted(actions['dc']): |
|
1483 | for f, args, msg in sorted(actions['dc']): | |
1471 | if f != '.hgsubstate': |
|
1484 | if f != '.hgsubstate': | |
1472 | continue |
|
1485 | continue | |
1473 | f1, f2, fa, move, anc = args |
|
1486 | f1, f2, fa, move, anc = args | |
1474 | flags = p2[f2].flags() |
|
1487 | flags = p2[f2].flags() | |
1475 | if repo.ui.promptchoice( |
|
1488 | if repo.ui.promptchoice( | |
1476 | _("remote changed %s which local deleted\n" |
|
1489 | _("remote changed %s which local deleted\n" | |
1477 | "use (c)hanged version or leave (d)eleted?" |
|
1490 | "use (c)hanged version or leave (d)eleted?" | |
1478 | "$$ &Changed $$ &Deleted") % f, 0) == 0: |
|
1491 | "$$ &Changed $$ &Deleted") % f, 0) == 0: | |
1479 | actions['g'].append((f, (flags, False), "prompt recreating")) |
|
1492 | actions['g'].append((f, (flags, False), "prompt recreating")) | |
1480 |
|
1493 | |||
1481 | # divergent renames |
|
1494 | # divergent renames | |
1482 | for f, fl in sorted(diverge.iteritems()): |
|
1495 | for f, fl in sorted(diverge.iteritems()): | |
1483 | repo.ui.warn(_("note: possible conflict - %s was renamed " |
|
1496 | repo.ui.warn(_("note: possible conflict - %s was renamed " | |
1484 | "multiple times to:\n") % f) |
|
1497 | "multiple times to:\n") % f) | |
1485 | for nf in fl: |
|
1498 | for nf in fl: | |
1486 | repo.ui.warn(" %s\n" % nf) |
|
1499 | repo.ui.warn(" %s\n" % nf) | |
1487 |
|
1500 | |||
1488 | # rename and delete |
|
1501 | # rename and delete | |
1489 | for f, fl in sorted(renamedelete.iteritems()): |
|
1502 | for f, fl in sorted(renamedelete.iteritems()): | |
1490 | repo.ui.warn(_("note: possible conflict - %s was deleted " |
|
1503 | repo.ui.warn(_("note: possible conflict - %s was deleted " | |
1491 | "and renamed to:\n") % f) |
|
1504 | "and renamed to:\n") % f) | |
1492 | for nf in fl: |
|
1505 | for nf in fl: | |
1493 | repo.ui.warn(" %s\n" % nf) |
|
1506 | repo.ui.warn(" %s\n" % nf) | |
1494 |
|
1507 | |||
1495 | ### apply phase |
|
1508 | ### apply phase | |
1496 | if not branchmerge: # just jump to the new rev |
|
1509 | if not branchmerge: # just jump to the new rev | |
1497 | fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' |
|
1510 | fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' | |
1498 | if not partial: |
|
1511 | if not partial: | |
1499 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
1512 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) | |
1500 | # note that we're in the middle of an update |
|
1513 | # note that we're in the middle of an update | |
1501 | repo.vfs.write('updatestate', p2.hex()) |
|
1514 | repo.vfs.write('updatestate', p2.hex()) | |
1502 |
|
1515 | |||
1503 | stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels) |
|
1516 | stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels) | |
1504 |
|
1517 | |||
1505 | if not partial: |
|
1518 | if not partial: | |
1506 | repo.dirstate.beginparentchange() |
|
1519 | repo.dirstate.beginparentchange() | |
1507 | repo.setparents(fp1, fp2) |
|
1520 | repo.setparents(fp1, fp2) | |
1508 | recordupdates(repo, actions, branchmerge) |
|
1521 | recordupdates(repo, actions, branchmerge) | |
1509 | # update completed, clear state |
|
1522 | # update completed, clear state | |
1510 | util.unlink(repo.join('updatestate')) |
|
1523 | util.unlink(repo.join('updatestate')) | |
1511 |
|
1524 | |||
1512 | if not branchmerge: |
|
1525 | if not branchmerge: | |
1513 | repo.dirstate.setbranch(p2.branch()) |
|
1526 | repo.dirstate.setbranch(p2.branch()) | |
1514 | repo.dirstate.endparentchange() |
|
1527 | repo.dirstate.endparentchange() | |
1515 | finally: |
|
1528 | finally: | |
1516 | wlock.release() |
|
1529 | wlock.release() | |
1517 |
|
1530 | |||
1518 | if not partial: |
|
1531 | if not partial: | |
1519 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
|
1532 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) | |
1520 | return stats |
|
1533 | return stats | |
1521 |
|
1534 | |||
1522 | def graft(repo, ctx, pctx, labels, keepparent=False): |
|
1535 | def graft(repo, ctx, pctx, labels, keepparent=False): | |
1523 | """Do a graft-like merge. |
|
1536 | """Do a graft-like merge. | |
1524 |
|
1537 | |||
1525 | This is a merge where the merge ancestor is chosen such that one |
|
1538 | This is a merge where the merge ancestor is chosen such that one | |
1526 | or more changesets are grafted onto the current changeset. In |
|
1539 | or more changesets are grafted onto the current changeset. In | |
1527 | addition to the merge, this fixes up the dirstate to include only |
|
1540 | addition to the merge, this fixes up the dirstate to include only | |
1528 | a single parent (if keepparent is False) and tries to duplicate any |
|
1541 | a single parent (if keepparent is False) and tries to duplicate any | |
1529 | renames/copies appropriately. |
|
1542 | renames/copies appropriately. | |
1530 |
|
1543 | |||
1531 | ctx - changeset to rebase |
|
1544 | ctx - changeset to rebase | |
1532 | pctx - merge base, usually ctx.p1() |
|
1545 | pctx - merge base, usually ctx.p1() | |
1533 | labels - merge labels eg ['local', 'graft'] |
|
1546 | labels - merge labels eg ['local', 'graft'] | |
1534 | keepparent - keep second parent if any |
|
1547 | keepparent - keep second parent if any | |
1535 |
|
1548 | |||
1536 | """ |
|
1549 | """ | |
1537 | # If we're grafting a descendant onto an ancestor, be sure to pass |
|
1550 | # If we're grafting a descendant onto an ancestor, be sure to pass | |
1538 | # mergeancestor=True to update. This does two things: 1) allows the merge if |
|
1551 | # mergeancestor=True to update. This does two things: 1) allows the merge if | |
1539 | # the destination is the same as the parent of the ctx (so we can use graft |
|
1552 | # the destination is the same as the parent of the ctx (so we can use graft | |
1540 | # to copy commits), and 2) informs update that the incoming changes are |
|
1553 | # to copy commits), and 2) informs update that the incoming changes are | |
1541 | # newer than the destination so it doesn't prompt about "remote changed foo |
|
1554 | # newer than the destination so it doesn't prompt about "remote changed foo | |
1542 | # which local deleted". |
|
1555 | # which local deleted". | |
1543 | mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node()) |
|
1556 | mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node()) | |
1544 |
|
1557 | |||
1545 | stats = update(repo, ctx.node(), True, True, pctx.node(), |
|
1558 | stats = update(repo, ctx.node(), True, True, pctx.node(), | |
1546 | mergeancestor=mergeancestor, labels=labels) |
|
1559 | mergeancestor=mergeancestor, labels=labels) | |
1547 |
|
1560 | |||
1548 | pother = nullid |
|
1561 | pother = nullid | |
1549 | parents = ctx.parents() |
|
1562 | parents = ctx.parents() | |
1550 | if keepparent and len(parents) == 2 and pctx in parents: |
|
1563 | if keepparent and len(parents) == 2 and pctx in parents: | |
1551 | parents.remove(pctx) |
|
1564 | parents.remove(pctx) | |
1552 | pother = parents[0].node() |
|
1565 | pother = parents[0].node() | |
1553 |
|
1566 | |||
1554 | repo.dirstate.beginparentchange() |
|
1567 | repo.dirstate.beginparentchange() | |
1555 | repo.setparents(repo['.'].node(), pother) |
|
1568 | repo.setparents(repo['.'].node(), pother) | |
1556 | repo.dirstate.write(repo.currenttransaction()) |
|
1569 | repo.dirstate.write(repo.currenttransaction()) | |
1557 | # fix up dirstate for copies and renames |
|
1570 | # fix up dirstate for copies and renames | |
1558 | copies.duplicatecopies(repo, ctx.rev(), pctx.rev()) |
|
1571 | copies.duplicatecopies(repo, ctx.rev(), pctx.rev()) | |
1559 | repo.dirstate.endparentchange() |
|
1572 | repo.dirstate.endparentchange() | |
1560 | return stats |
|
1573 | return stats |
@@ -1,318 +1,354 b'' | |||||
1 | $ cat <<EOF > merge |
|
1 | $ cat <<EOF > merge | |
2 | > import sys, os |
|
2 | > import sys, os | |
3 | > |
|
3 | > | |
4 | > try: |
|
4 | > try: | |
5 | > import msvcrt |
|
5 | > import msvcrt | |
6 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
6 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) | |
7 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
7 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) | |
8 | > except ImportError: |
|
8 | > except ImportError: | |
9 | > pass |
|
9 | > pass | |
10 | > |
|
10 | > | |
11 | > print "merging for", os.path.basename(sys.argv[1]) |
|
11 | > print "merging for", os.path.basename(sys.argv[1]) | |
12 | > EOF |
|
12 | > EOF | |
13 | $ HGMERGE="python ../merge"; export HGMERGE |
|
13 | $ HGMERGE="python ../merge"; export HGMERGE | |
14 |
|
14 | |||
15 | $ hg init t |
|
15 | $ hg init t | |
16 | $ cd t |
|
16 | $ cd t | |
17 | $ echo This is file a1 > a |
|
17 | $ echo This is file a1 > a | |
18 | $ hg add a |
|
18 | $ hg add a | |
19 | $ hg commit -m "commit #0" |
|
19 | $ hg commit -m "commit #0" | |
20 | $ echo This is file b1 > b |
|
20 | $ echo This is file b1 > b | |
21 | $ hg add b |
|
21 | $ hg add b | |
22 | $ hg commit -m "commit #1" |
|
22 | $ hg commit -m "commit #1" | |
23 |
|
23 | |||
24 | $ hg update 0 |
|
24 | $ hg update 0 | |
25 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
25 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
26 |
|
26 | |||
27 | Test interrupted updates by exploiting our non-handling of directory collisions |
|
27 | Test interrupted updates by exploiting our non-handling of directory collisions | |
28 |
|
28 | |||
29 | $ mkdir b |
|
29 | $ mkdir b | |
30 | $ hg up |
|
30 | $ hg up | |
31 | abort: *: '$TESTTMP/t/b' (glob) |
|
31 | abort: *: '$TESTTMP/t/b' (glob) | |
32 | [255] |
|
32 | [255] | |
33 | $ hg ci |
|
33 | $ hg ci | |
34 | abort: last update was interrupted |
|
34 | abort: last update was interrupted | |
35 | (use 'hg update' to get a consistent checkout) |
|
35 | (use 'hg update' to get a consistent checkout) | |
36 | [255] |
|
36 | [255] | |
37 | $ hg sum |
|
37 | $ hg sum | |
38 | parent: 0:538afb845929 |
|
38 | parent: 0:538afb845929 | |
39 | commit #0 |
|
39 | commit #0 | |
40 | branch: default |
|
40 | branch: default | |
41 | commit: (interrupted update) |
|
41 | commit: (interrupted update) | |
42 | update: 1 new changesets (update) |
|
42 | update: 1 new changesets (update) | |
43 | phases: 2 draft |
|
43 | phases: 2 draft | |
44 | $ rmdir b |
|
44 | $ rmdir b | |
45 | $ hg up |
|
45 | $ hg up | |
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
47 | $ hg sum |
|
47 | $ hg sum | |
48 | parent: 1:b8bb4a988f25 tip |
|
48 | parent: 1:b8bb4a988f25 tip | |
49 | commit #1 |
|
49 | commit #1 | |
50 | branch: default |
|
50 | branch: default | |
51 | commit: (clean) |
|
51 | commit: (clean) | |
52 | update: (current) |
|
52 | update: (current) | |
53 | phases: 2 draft |
|
53 | phases: 2 draft | |
54 |
|
54 | |||
55 | Prepare a basic merge |
|
55 | Prepare a basic merge | |
56 |
|
56 | |||
57 | $ hg up 0 |
|
57 | $ hg up 0 | |
58 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
58 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
59 | $ echo This is file c1 > c |
|
59 | $ echo This is file c1 > c | |
60 | $ hg add c |
|
60 | $ hg add c | |
61 | $ hg commit -m "commit #2" |
|
61 | $ hg commit -m "commit #2" | |
62 | created new head |
|
62 | created new head | |
63 | $ echo This is file b1 > b |
|
63 | $ echo This is file b1 > b | |
64 | no merges expected |
|
64 | no merges expected | |
65 | $ hg merge -P 1 |
|
65 | $ hg merge -P 1 | |
66 | changeset: 1:b8bb4a988f25 |
|
66 | changeset: 1:b8bb4a988f25 | |
67 | user: test |
|
67 | user: test | |
68 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
68 | date: Thu Jan 01 00:00:00 1970 +0000 | |
69 | summary: commit #1 |
|
69 | summary: commit #1 | |
70 |
|
70 | |||
71 | $ hg merge 1 |
|
71 | $ hg merge 1 | |
72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
73 | (branch merge, don't forget to commit) |
|
73 | (branch merge, don't forget to commit) | |
74 | $ hg diff --nodates |
|
74 | $ hg diff --nodates | |
75 | diff -r 49035e18a8e6 b |
|
75 | diff -r 49035e18a8e6 b | |
76 | --- /dev/null |
|
76 | --- /dev/null | |
77 | +++ b/b |
|
77 | +++ b/b | |
78 | @@ -0,0 +1,1 @@ |
|
78 | @@ -0,0 +1,1 @@ | |
79 | +This is file b1 |
|
79 | +This is file b1 | |
80 | $ hg status |
|
80 | $ hg status | |
81 | M b |
|
81 | M b | |
82 | $ cd ..; rm -r t |
|
82 | $ cd ..; rm -r t | |
83 |
|
83 | |||
84 | $ hg init t |
|
84 | $ hg init t | |
85 | $ cd t |
|
85 | $ cd t | |
86 | $ echo This is file a1 > a |
|
86 | $ echo This is file a1 > a | |
87 | $ hg add a |
|
87 | $ hg add a | |
88 | $ hg commit -m "commit #0" |
|
88 | $ hg commit -m "commit #0" | |
89 | $ echo This is file b1 > b |
|
89 | $ echo This is file b1 > b | |
90 | $ hg add b |
|
90 | $ hg add b | |
91 | $ hg commit -m "commit #1" |
|
91 | $ hg commit -m "commit #1" | |
92 |
|
92 | |||
93 | $ hg update 0 |
|
93 | $ hg update 0 | |
94 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
94 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
95 | $ echo This is file c1 > c |
|
95 | $ echo This is file c1 > c | |
96 | $ hg add c |
|
96 | $ hg add c | |
97 | $ hg commit -m "commit #2" |
|
97 | $ hg commit -m "commit #2" | |
98 | created new head |
|
98 | created new head | |
99 | $ echo This is file b2 > b |
|
99 | $ echo This is file b2 > b | |
100 | merge should fail |
|
100 | merge should fail | |
101 | $ hg merge 1 |
|
101 | $ hg merge 1 | |
102 | b: untracked file differs |
|
102 | b: untracked file differs | |
103 | abort: untracked files in working directory differ from files in requested revision |
|
103 | abort: untracked files in working directory differ from files in requested revision | |
104 | [255] |
|
104 | [255] | |
105 |
|
105 | |||
106 | #if symlink |
|
106 | #if symlink | |
107 | symlinks to directories should be treated as regular files (issue5027) |
|
107 | symlinks to directories should be treated as regular files (issue5027) | |
108 | $ rm b |
|
108 | $ rm b | |
109 | $ ln -s 'This is file b2' b |
|
109 | $ ln -s 'This is file b2' b | |
110 | $ hg merge 1 |
|
110 | $ hg merge 1 | |
111 | b: untracked file differs |
|
111 | b: untracked file differs | |
112 | abort: untracked files in working directory differ from files in requested revision |
|
112 | abort: untracked files in working directory differ from files in requested revision | |
113 | [255] |
|
113 | [255] | |
114 | symlinks shouldn't be followed |
|
114 | symlinks shouldn't be followed | |
115 | $ rm b |
|
115 | $ rm b | |
116 | $ echo This is file b1 > .hg/b |
|
116 | $ echo This is file b1 > .hg/b | |
117 | $ ln -s .hg/b b |
|
117 | $ ln -s .hg/b b | |
118 | $ hg merge 1 |
|
118 | $ hg merge 1 | |
119 | b: untracked file differs |
|
119 | b: untracked file differs | |
120 | abort: untracked files in working directory differ from files in requested revision |
|
120 | abort: untracked files in working directory differ from files in requested revision | |
121 | [255] |
|
121 | [255] | |
122 |
|
122 | |||
123 | $ rm b |
|
123 | $ rm b | |
124 | $ echo This is file b2 > b |
|
124 | $ echo This is file b2 > b | |
125 | #endif |
|
125 | #endif | |
126 |
|
126 | |||
127 | merge of b expected |
|
127 | bad config | |
|
128 | $ hg merge 1 --config merge.checkunknown=x | |||
|
129 | abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') | |||
|
130 | [255] | |||
|
131 | this merge should fail | |||
|
132 | $ hg merge 1 --config merge.checkunknown=abort | |||
|
133 | b: untracked file differs | |||
|
134 | abort: untracked files in working directory differ from files in requested revision | |||
|
135 | [255] | |||
|
136 | ||||
|
137 | this merge should warn | |||
|
138 | $ hg merge 1 --config merge.checkunknown=warn | |||
|
139 | b: replacing untracked file | |||
|
140 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
141 | (branch merge, don't forget to commit) | |||
|
142 | $ cat b.orig | |||
|
143 | This is file b2 | |||
|
144 | $ hg up --clean 2 | |||
|
145 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
146 | $ mv b.orig b | |||
|
147 | ||||
|
148 | this merge should silently ignore | |||
|
149 | $ cat b | |||
|
150 | This is file b2 | |||
|
151 | $ hg merge 1 --config merge.checkunknown=ignore | |||
|
152 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
153 | (branch merge, don't forget to commit) | |||
|
154 | ||||
|
155 | $ cat b.orig | |||
|
156 | This is file b2 | |||
|
157 | $ hg up --clean 2 | |||
|
158 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
159 | $ mv b.orig b | |||
|
160 | ||||
|
161 | this merge of b should work | |||
|
162 | $ cat b | |||
|
163 | This is file b2 | |||
128 | $ hg merge -f 1 |
|
164 | $ hg merge -f 1 | |
129 | merging b |
|
165 | merging b | |
130 | merging for b |
|
166 | merging for b | |
131 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
167 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
132 | (branch merge, don't forget to commit) |
|
168 | (branch merge, don't forget to commit) | |
133 | $ hg diff --nodates |
|
169 | $ hg diff --nodates | |
134 | diff -r 49035e18a8e6 b |
|
170 | diff -r 49035e18a8e6 b | |
135 | --- /dev/null |
|
171 | --- /dev/null | |
136 | +++ b/b |
|
172 | +++ b/b | |
137 | @@ -0,0 +1,1 @@ |
|
173 | @@ -0,0 +1,1 @@ | |
138 | +This is file b2 |
|
174 | +This is file b2 | |
139 | $ hg status |
|
175 | $ hg status | |
140 | M b |
|
176 | M b | |
141 | $ cd ..; rm -r t |
|
177 | $ cd ..; rm -r t | |
142 |
|
178 | |||
143 | $ hg init t |
|
179 | $ hg init t | |
144 | $ cd t |
|
180 | $ cd t | |
145 | $ echo This is file a1 > a |
|
181 | $ echo This is file a1 > a | |
146 | $ hg add a |
|
182 | $ hg add a | |
147 | $ hg commit -m "commit #0" |
|
183 | $ hg commit -m "commit #0" | |
148 | $ echo This is file b1 > b |
|
184 | $ echo This is file b1 > b | |
149 | $ hg add b |
|
185 | $ hg add b | |
150 | $ hg commit -m "commit #1" |
|
186 | $ hg commit -m "commit #1" | |
151 | $ echo This is file b22 > b |
|
187 | $ echo This is file b22 > b | |
152 | $ hg commit -m "commit #2" |
|
188 | $ hg commit -m "commit #2" | |
153 | $ hg update 1 |
|
189 | $ hg update 1 | |
154 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
190 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
155 | $ echo This is file c1 > c |
|
191 | $ echo This is file c1 > c | |
156 | $ hg add c |
|
192 | $ hg add c | |
157 | $ hg commit -m "commit #3" |
|
193 | $ hg commit -m "commit #3" | |
158 | created new head |
|
194 | created new head | |
159 |
|
195 | |||
160 | Contents of b should be "this is file b1" |
|
196 | Contents of b should be "this is file b1" | |
161 | $ cat b |
|
197 | $ cat b | |
162 | This is file b1 |
|
198 | This is file b1 | |
163 |
|
199 | |||
164 | $ echo This is file b22 > b |
|
200 | $ echo This is file b22 > b | |
165 | merge fails |
|
201 | merge fails | |
166 | $ hg merge 2 |
|
202 | $ hg merge 2 | |
167 | abort: uncommitted changes |
|
203 | abort: uncommitted changes | |
168 | (use 'hg status' to list changes) |
|
204 | (use 'hg status' to list changes) | |
169 | [255] |
|
205 | [255] | |
170 | merge expected! |
|
206 | merge expected! | |
171 | $ hg merge -f 2 |
|
207 | $ hg merge -f 2 | |
172 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
208 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
173 | (branch merge, don't forget to commit) |
|
209 | (branch merge, don't forget to commit) | |
174 | $ hg diff --nodates |
|
210 | $ hg diff --nodates | |
175 | diff -r 85de557015a8 b |
|
211 | diff -r 85de557015a8 b | |
176 | --- a/b |
|
212 | --- a/b | |
177 | +++ b/b |
|
213 | +++ b/b | |
178 | @@ -1,1 +1,1 @@ |
|
214 | @@ -1,1 +1,1 @@ | |
179 | -This is file b1 |
|
215 | -This is file b1 | |
180 | +This is file b22 |
|
216 | +This is file b22 | |
181 | $ hg status |
|
217 | $ hg status | |
182 | M b |
|
218 | M b | |
183 | $ cd ..; rm -r t |
|
219 | $ cd ..; rm -r t | |
184 |
|
220 | |||
185 | $ hg init t |
|
221 | $ hg init t | |
186 | $ cd t |
|
222 | $ cd t | |
187 | $ echo This is file a1 > a |
|
223 | $ echo This is file a1 > a | |
188 | $ hg add a |
|
224 | $ hg add a | |
189 | $ hg commit -m "commit #0" |
|
225 | $ hg commit -m "commit #0" | |
190 | $ echo This is file b1 > b |
|
226 | $ echo This is file b1 > b | |
191 | $ hg add b |
|
227 | $ hg add b | |
192 | $ hg commit -m "commit #1" |
|
228 | $ hg commit -m "commit #1" | |
193 | $ echo This is file b22 > b |
|
229 | $ echo This is file b22 > b | |
194 | $ hg commit -m "commit #2" |
|
230 | $ hg commit -m "commit #2" | |
195 | $ hg update 1 |
|
231 | $ hg update 1 | |
196 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
197 | $ echo This is file c1 > c |
|
233 | $ echo This is file c1 > c | |
198 | $ hg add c |
|
234 | $ hg add c | |
199 | $ hg commit -m "commit #3" |
|
235 | $ hg commit -m "commit #3" | |
200 | created new head |
|
236 | created new head | |
201 | $ echo This is file b33 > b |
|
237 | $ echo This is file b33 > b | |
202 | merge of b should fail |
|
238 | merge of b should fail | |
203 | $ hg merge 2 |
|
239 | $ hg merge 2 | |
204 | abort: uncommitted changes |
|
240 | abort: uncommitted changes | |
205 | (use 'hg status' to list changes) |
|
241 | (use 'hg status' to list changes) | |
206 | [255] |
|
242 | [255] | |
207 | merge of b expected |
|
243 | merge of b expected | |
208 | $ hg merge -f 2 |
|
244 | $ hg merge -f 2 | |
209 | merging b |
|
245 | merging b | |
210 | merging for b |
|
246 | merging for b | |
211 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
247 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
212 | (branch merge, don't forget to commit) |
|
248 | (branch merge, don't forget to commit) | |
213 | $ hg diff --nodates |
|
249 | $ hg diff --nodates | |
214 | diff -r 85de557015a8 b |
|
250 | diff -r 85de557015a8 b | |
215 | --- a/b |
|
251 | --- a/b | |
216 | +++ b/b |
|
252 | +++ b/b | |
217 | @@ -1,1 +1,1 @@ |
|
253 | @@ -1,1 +1,1 @@ | |
218 | -This is file b1 |
|
254 | -This is file b1 | |
219 | +This is file b33 |
|
255 | +This is file b33 | |
220 | $ hg status |
|
256 | $ hg status | |
221 | M b |
|
257 | M b | |
222 |
|
258 | |||
223 | Test for issue2364 |
|
259 | Test for issue2364 | |
224 |
|
260 | |||
225 | $ hg up -qC . |
|
261 | $ hg up -qC . | |
226 | $ hg rm b |
|
262 | $ hg rm b | |
227 | $ hg ci -md |
|
263 | $ hg ci -md | |
228 | $ hg revert -r -2 b |
|
264 | $ hg revert -r -2 b | |
229 | $ hg up -q -- -2 |
|
265 | $ hg up -q -- -2 | |
230 |
|
266 | |||
231 | Test that updated files are treated as "modified", when |
|
267 | Test that updated files are treated as "modified", when | |
232 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents |
|
268 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents | |
233 | aren't changed), even if none of mode, size and timestamp of them |
|
269 | aren't changed), even if none of mode, size and timestamp of them | |
234 | isn't changed on the filesystem (see also issue4583). |
|
270 | isn't changed on the filesystem (see also issue4583). | |
235 |
|
271 | |||
236 | $ cat > $TESTTMP/abort.py <<EOF |
|
272 | $ cat > $TESTTMP/abort.py <<EOF | |
237 | > # emulate aborting before "recordupdates()". in this case, files |
|
273 | > # emulate aborting before "recordupdates()". in this case, files | |
238 | > # are changed without updating dirstate |
|
274 | > # are changed without updating dirstate | |
239 | > from mercurial import extensions, merge, error |
|
275 | > from mercurial import extensions, merge, error | |
240 | > def applyupdates(orig, *args, **kwargs): |
|
276 | > def applyupdates(orig, *args, **kwargs): | |
241 | > orig(*args, **kwargs) |
|
277 | > orig(*args, **kwargs) | |
242 | > raise error.Abort('intentional aborting') |
|
278 | > raise error.Abort('intentional aborting') | |
243 | > def extsetup(ui): |
|
279 | > def extsetup(ui): | |
244 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) |
|
280 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) | |
245 | > EOF |
|
281 | > EOF | |
246 |
|
282 | |||
247 | $ cat >> .hg/hgrc <<EOF |
|
283 | $ cat >> .hg/hgrc <<EOF | |
248 | > [fakedirstatewritetime] |
|
284 | > [fakedirstatewritetime] | |
249 | > # emulate invoking dirstate.write() via repo.status() |
|
285 | > # emulate invoking dirstate.write() via repo.status() | |
250 | > # at 2000-01-01 00:00 |
|
286 | > # at 2000-01-01 00:00 | |
251 | > fakenow = 200001010000 |
|
287 | > fakenow = 200001010000 | |
252 | > EOF |
|
288 | > EOF | |
253 |
|
289 | |||
254 | (file gotten from other revision) |
|
290 | (file gotten from other revision) | |
255 |
|
291 | |||
256 | $ hg update -q -C 2 |
|
292 | $ hg update -q -C 2 | |
257 | $ echo 'THIS IS FILE B5' > b |
|
293 | $ echo 'THIS IS FILE B5' > b | |
258 | $ hg commit -m 'commit #5' |
|
294 | $ hg commit -m 'commit #5' | |
259 |
|
295 | |||
260 | $ hg update -q -C 3 |
|
296 | $ hg update -q -C 3 | |
261 | $ cat b |
|
297 | $ cat b | |
262 | This is file b1 |
|
298 | This is file b1 | |
263 | $ touch -t 200001010000 b |
|
299 | $ touch -t 200001010000 b | |
264 | $ hg debugrebuildstate |
|
300 | $ hg debugrebuildstate | |
265 |
|
301 | |||
266 | $ cat >> .hg/hgrc <<EOF |
|
302 | $ cat >> .hg/hgrc <<EOF | |
267 | > [extensions] |
|
303 | > [extensions] | |
268 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
304 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
269 | > abort = $TESTTMP/abort.py |
|
305 | > abort = $TESTTMP/abort.py | |
270 | > EOF |
|
306 | > EOF | |
271 | $ hg merge 5 |
|
307 | $ hg merge 5 | |
272 | abort: intentional aborting |
|
308 | abort: intentional aborting | |
273 | [255] |
|
309 | [255] | |
274 | $ cat >> .hg/hgrc <<EOF |
|
310 | $ cat >> .hg/hgrc <<EOF | |
275 | > [extensions] |
|
311 | > [extensions] | |
276 | > fakedirstatewritetime = ! |
|
312 | > fakedirstatewritetime = ! | |
277 | > abort = ! |
|
313 | > abort = ! | |
278 | > EOF |
|
314 | > EOF | |
279 |
|
315 | |||
280 | $ cat b |
|
316 | $ cat b | |
281 | THIS IS FILE B5 |
|
317 | THIS IS FILE B5 | |
282 | $ touch -t 200001010000 b |
|
318 | $ touch -t 200001010000 b | |
283 | $ hg status -A b |
|
319 | $ hg status -A b | |
284 | M b |
|
320 | M b | |
285 |
|
321 | |||
286 | (file merged from other revision) |
|
322 | (file merged from other revision) | |
287 |
|
323 | |||
288 | $ hg update -q -C 3 |
|
324 | $ hg update -q -C 3 | |
289 | $ echo 'this is file b6' > b |
|
325 | $ echo 'this is file b6' > b | |
290 | $ hg commit -m 'commit #6' |
|
326 | $ hg commit -m 'commit #6' | |
291 | created new head |
|
327 | created new head | |
292 |
|
328 | |||
293 | $ cat b |
|
329 | $ cat b | |
294 | this is file b6 |
|
330 | this is file b6 | |
295 | $ touch -t 200001010000 b |
|
331 | $ touch -t 200001010000 b | |
296 | $ hg debugrebuildstate |
|
332 | $ hg debugrebuildstate | |
297 |
|
333 | |||
298 | $ cat >> .hg/hgrc <<EOF |
|
334 | $ cat >> .hg/hgrc <<EOF | |
299 | > [extensions] |
|
335 | > [extensions] | |
300 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
336 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
301 | > abort = $TESTTMP/abort.py |
|
337 | > abort = $TESTTMP/abort.py | |
302 | > EOF |
|
338 | > EOF | |
303 | $ hg merge --tool internal:other 5 |
|
339 | $ hg merge --tool internal:other 5 | |
304 | abort: intentional aborting |
|
340 | abort: intentional aborting | |
305 | [255] |
|
341 | [255] | |
306 | $ cat >> .hg/hgrc <<EOF |
|
342 | $ cat >> .hg/hgrc <<EOF | |
307 | > [extensions] |
|
343 | > [extensions] | |
308 | > fakedirstatewritetime = ! |
|
344 | > fakedirstatewritetime = ! | |
309 | > abort = ! |
|
345 | > abort = ! | |
310 | > EOF |
|
346 | > EOF | |
311 |
|
347 | |||
312 | $ cat b |
|
348 | $ cat b | |
313 | THIS IS FILE B5 |
|
349 | THIS IS FILE B5 | |
314 | $ touch -t 200001010000 b |
|
350 | $ touch -t 200001010000 b | |
315 | $ hg status -A b |
|
351 | $ hg status -A b | |
316 | M b |
|
352 | M b | |
317 |
|
353 | |||
318 | $ cd .. |
|
354 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now