Show More
@@ -1,49 +1,50 | |||
|
1 | 1 | # Some default global settings for common merge tools |
|
2 | 2 | |
|
3 | 3 | [merge-tools] |
|
4 | 4 | kdiff3.args=--auto -L1 base --L2 local --L3 other $base $local $other -o $output |
|
5 | 5 | kdiff3.regkey=Software\KDiff3 |
|
6 | 6 | kdiff3.regappend=\kdiff3.exe |
|
7 | 7 | kdiff3.fixeol=True |
|
8 | 8 | kdiff3.gui=True |
|
9 | 9 | |
|
10 | 10 | gvimdiff.args=--nofork -d -g -O $local $other $base |
|
11 | 11 | gvimdiff.regkey=Software\Vim\GVim |
|
12 | 12 | gvimdiff.regname=path |
|
13 | 13 | gvimdiff.priority=-9 |
|
14 | 14 | |
|
15 | 15 | merge.checkconflicts=True |
|
16 | 16 | merge.priority=-10 |
|
17 | 17 | |
|
18 | 18 | gpyfm.gui=True |
|
19 | 19 | |
|
20 | 20 | meld.gui=True |
|
21 | 21 | |
|
22 | 22 | tkdiff.args=$local $other -a $base -o $output |
|
23 | 23 | tkdiff.gui=True |
|
24 | 24 | tkdiff.priority=-8 |
|
25 | 25 | |
|
26 | 26 | xxdiff.args=--show-merged-pane --exit-with-merge-status --title1 local --title2 base --title3 other --merged-filename $output --merge $local $base $other |
|
27 | 27 | xxdiff.gui=True |
|
28 | 28 | xxdiff.priority=-8 |
|
29 | 29 | |
|
30 | 30 | diffmerge.args=--nosplash --merge --title1=base --title2=local --title3=other $base $local $other |
|
31 | diffmerge.checkchanged=True | |
|
31 | 32 | diffmerge.gui=True |
|
32 | 33 | |
|
33 | 34 | p4merge.args=$base $local $other $output |
|
34 | 35 | p4merge.regkey=Software\Perforce\Environment |
|
35 | 36 | p4merge.regname=P4INSTROOT |
|
36 | 37 | p4merge.regappend=\p4merge.exe |
|
37 | 38 | p4merge.gui=True |
|
38 | 39 | p4merge.priority=-8 |
|
39 | 40 | |
|
40 | 41 | tortoisemerge.args=/base: $output /mine:$local /theirs:$other /merged:$output |
|
41 | 42 | tortoisemerge.regkey=Software\TortoiseSVN |
|
42 | 43 | tortoisemerge.gui=True |
|
43 | 44 | |
|
44 | 45 | ecmerge.args=$base $local $other --mode=merge3 --title0=base --title1=local --title2=other --to=$output |
|
45 | 46 | ecmerge.regkey=Software\Elli\xc3\xa9 Computing\Merge |
|
46 | 47 | ecmerge.gui=True |
|
47 | 48 | |
|
48 | 49 | filemerge.args=-left $other -right $local -ancestor $base -merge $output |
|
49 | 50 | filemerge.gui=True |
@@ -1,687 +1,691 | |||
|
1 | 1 | HGRC(5) |
|
2 | 2 | ======= |
|
3 | 3 | Bryan O'Sullivan <bos@serpentine.com> |
|
4 | 4 | |
|
5 | 5 | NAME |
|
6 | 6 | ---- |
|
7 | 7 | hgrc - configuration files for Mercurial |
|
8 | 8 | |
|
9 | 9 | SYNOPSIS |
|
10 | 10 | -------- |
|
11 | 11 | |
|
12 | 12 | The Mercurial system uses a set of configuration files to control |
|
13 | 13 | aspects of its behaviour. |
|
14 | 14 | |
|
15 | 15 | FILES |
|
16 | 16 | ----- |
|
17 | 17 | |
|
18 | 18 | Mercurial reads configuration data from several files, if they exist. |
|
19 | 19 | The names of these files depend on the system on which Mercurial is |
|
20 | 20 | installed. Windows registry keys contain PATH-like strings, every |
|
21 | 21 | part must reference a Mercurial.ini file or be a directory where *.rc |
|
22 | 22 | files will be read. |
|
23 | 23 | |
|
24 | 24 | (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc:: |
|
25 | 25 | (Unix) <install-root>/etc/mercurial/hgrc:: |
|
26 | 26 | Per-installation configuration files, searched for in the |
|
27 | 27 | directory where Mercurial is installed. For example, if installed |
|
28 | 28 | in /shared/tools, Mercurial will look in |
|
29 | 29 | /shared/tools/etc/mercurial/hgrc. Options in these files apply to |
|
30 | 30 | all Mercurial commands executed by any user in any directory. |
|
31 | 31 | |
|
32 | 32 | (Unix) /etc/mercurial/hgrc.d/*.rc:: |
|
33 | 33 | (Unix) /etc/mercurial/hgrc:: |
|
34 | 34 | (Windows) HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial:: |
|
35 | 35 | or:: |
|
36 | 36 | (Windows) C:\Mercurial\Mercurial.ini:: |
|
37 | 37 | Per-system configuration files, for the system on which Mercurial |
|
38 | 38 | is running. Options in these files apply to all Mercurial |
|
39 | 39 | commands executed by any user in any directory. Options in these |
|
40 | 40 | files override per-installation options. |
|
41 | 41 | |
|
42 | 42 | (Unix) $HOME/.hgrc:: |
|
43 | 43 | (Windows) C:\Documents and Settings\USERNAME\Mercurial.ini:: |
|
44 | 44 | (Windows) $HOME\Mercurial.ini:: |
|
45 | 45 | Per-user configuration file, for the user running Mercurial. |
|
46 | 46 | Options in this file apply to all Mercurial commands executed by |
|
47 | 47 | any user in any directory. Options in this file override |
|
48 | 48 | per-installation and per-system options. |
|
49 | 49 | On Windows system, one of these is chosen exclusively according |
|
50 | 50 | to definition of HOME environment variable. |
|
51 | 51 | |
|
52 | 52 | (Unix, Windows) <repo>/.hg/hgrc:: |
|
53 | 53 | Per-repository configuration options that only apply in a |
|
54 | 54 | particular repository. This file is not version-controlled, and |
|
55 | 55 | will not get transferred during a "clone" operation. Options in |
|
56 | 56 | this file override options in all other configuration files. |
|
57 | 57 | On Unix, most of this file will be ignored if it doesn't belong |
|
58 | 58 | to a trusted user or to a trusted group. See the documentation |
|
59 | 59 | for the trusted section below for more details. |
|
60 | 60 | |
|
61 | 61 | SYNTAX |
|
62 | 62 | ------ |
|
63 | 63 | |
|
64 | 64 | A configuration file consists of sections, led by a "[section]" header |
|
65 | 65 | and followed by "name: value" entries; "name=value" is also accepted. |
|
66 | 66 | |
|
67 | 67 | [spam] |
|
68 | 68 | eggs=ham |
|
69 | 69 | green= |
|
70 | 70 | eggs |
|
71 | 71 | |
|
72 | 72 | Each line contains one entry. If the lines that follow are indented, |
|
73 | 73 | they are treated as continuations of that entry. |
|
74 | 74 | |
|
75 | 75 | Leading whitespace is removed from values. Empty lines are skipped. |
|
76 | 76 | |
|
77 | 77 | The optional values can contain format strings which refer to other |
|
78 | 78 | values in the same section, or values in a special DEFAULT section. |
|
79 | 79 | |
|
80 | 80 | Lines beginning with "#" or ";" are ignored and may be used to provide |
|
81 | 81 | comments. |
|
82 | 82 | |
|
83 | 83 | SECTIONS |
|
84 | 84 | -------- |
|
85 | 85 | |
|
86 | 86 | This section describes the different sections that may appear in a |
|
87 | 87 | Mercurial "hgrc" file, the purpose of each section, its possible |
|
88 | 88 | keys, and their possible values. |
|
89 | 89 | |
|
90 | 90 | decode/encode:: |
|
91 | 91 | Filters for transforming files on checkout/checkin. This would |
|
92 | 92 | typically be used for newline processing or other |
|
93 | 93 | localization/canonicalization of files. |
|
94 | 94 | |
|
95 | 95 | Filters consist of a filter pattern followed by a filter command. |
|
96 | 96 | Filter patterns are globs by default, rooted at the repository |
|
97 | 97 | root. For example, to match any file ending in ".txt" in the root |
|
98 | 98 | directory only, use the pattern "*.txt". To match any file ending |
|
99 | 99 | in ".c" anywhere in the repository, use the pattern "**.c". |
|
100 | 100 | |
|
101 | 101 | The filter command can start with a specifier, either "pipe:" or |
|
102 | 102 | "tempfile:". If no specifier is given, "pipe:" is used by default. |
|
103 | 103 | |
|
104 | 104 | A "pipe:" command must accept data on stdin and return the |
|
105 | 105 | transformed data on stdout. |
|
106 | 106 | |
|
107 | 107 | Pipe example: |
|
108 | 108 | |
|
109 | 109 | [encode] |
|
110 | 110 | # uncompress gzip files on checkin to improve delta compression |
|
111 | 111 | # note: not necessarily a good idea, just an example |
|
112 | 112 | *.gz = pipe: gunzip |
|
113 | 113 | |
|
114 | 114 | [decode] |
|
115 | 115 | # recompress gzip files when writing them to the working dir (we |
|
116 | 116 | # can safely omit "pipe:", because it's the default) |
|
117 | 117 | *.gz = gzip |
|
118 | 118 | |
|
119 | 119 | A "tempfile:" command is a template. The string INFILE is replaced |
|
120 | 120 | with the name of a temporary file that contains the data to be |
|
121 | 121 | filtered by the command. The string OUTFILE is replaced with the |
|
122 | 122 | name of an empty temporary file, where the filtered data must be |
|
123 | 123 | written by the command. |
|
124 | 124 | |
|
125 | 125 | NOTE: the tempfile mechanism is recommended for Windows systems, |
|
126 | 126 | where the standard shell I/O redirection operators often have |
|
127 | 127 | strange effects and may corrupt the contents of your files. |
|
128 | 128 | |
|
129 | 129 | The most common usage is for LF <-> CRLF translation on Windows. |
|
130 | 130 | For this, use the "smart" convertors which check for binary files: |
|
131 | 131 | |
|
132 | 132 | [extensions] |
|
133 | 133 | hgext.win32text = |
|
134 | 134 | [encode] |
|
135 | 135 | ** = cleverencode: |
|
136 | 136 | [decode] |
|
137 | 137 | ** = cleverdecode: |
|
138 | 138 | |
|
139 | 139 | or if you only want to translate certain files: |
|
140 | 140 | |
|
141 | 141 | [extensions] |
|
142 | 142 | hgext.win32text = |
|
143 | 143 | [encode] |
|
144 | 144 | **.txt = dumbencode: |
|
145 | 145 | [decode] |
|
146 | 146 | **.txt = dumbdecode: |
|
147 | 147 | |
|
148 | 148 | defaults:: |
|
149 | 149 | Use the [defaults] section to define command defaults, i.e. the |
|
150 | 150 | default options/arguments to pass to the specified commands. |
|
151 | 151 | |
|
152 | 152 | The following example makes 'hg log' run in verbose mode, and |
|
153 | 153 | 'hg status' show only the modified files, by default. |
|
154 | 154 | |
|
155 | 155 | [defaults] |
|
156 | 156 | log = -v |
|
157 | 157 | status = -m |
|
158 | 158 | |
|
159 | 159 | The actual commands, instead of their aliases, must be used when |
|
160 | 160 | defining command defaults. The command defaults will also be |
|
161 | 161 | applied to the aliases of the commands defined. |
|
162 | 162 | |
|
163 | 163 | diff:: |
|
164 | 164 | Settings used when displaying diffs. They are all boolean and |
|
165 | 165 | defaults to False. |
|
166 | 166 | git;; |
|
167 | 167 | Use git extended diff format. |
|
168 | 168 | nodates;; |
|
169 | 169 | Don't include dates in diff headers. |
|
170 | 170 | showfunc;; |
|
171 | 171 | Show which function each change is in. |
|
172 | 172 | ignorews;; |
|
173 | 173 | Ignore white space when comparing lines. |
|
174 | 174 | ignorewsamount;; |
|
175 | 175 | Ignore changes in the amount of white space. |
|
176 | 176 | ignoreblanklines;; |
|
177 | 177 | Ignore changes whose lines are all blank. |
|
178 | 178 | |
|
179 | 179 | email:: |
|
180 | 180 | Settings for extensions that send email messages. |
|
181 | 181 | from;; |
|
182 | 182 | Optional. Email address to use in "From" header and SMTP envelope |
|
183 | 183 | of outgoing messages. |
|
184 | 184 | to;; |
|
185 | 185 | Optional. Comma-separated list of recipients' email addresses. |
|
186 | 186 | cc;; |
|
187 | 187 | Optional. Comma-separated list of carbon copy recipients' |
|
188 | 188 | email addresses. |
|
189 | 189 | bcc;; |
|
190 | 190 | Optional. Comma-separated list of blind carbon copy |
|
191 | 191 | recipients' email addresses. Cannot be set interactively. |
|
192 | 192 | method;; |
|
193 | 193 | Optional. Method to use to send email messages. If value is |
|
194 | 194 | "smtp" (default), use SMTP (see section "[smtp]" for |
|
195 | 195 | configuration). Otherwise, use as name of program to run that |
|
196 | 196 | acts like sendmail (takes "-f" option for sender, list of |
|
197 | 197 | recipients on command line, message on stdin). Normally, setting |
|
198 | 198 | this to "sendmail" or "/usr/sbin/sendmail" is enough to use |
|
199 | 199 | sendmail to send messages. |
|
200 | 200 | |
|
201 | 201 | Email example: |
|
202 | 202 | |
|
203 | 203 | [email] |
|
204 | 204 | from = Joseph User <joe.user@example.com> |
|
205 | 205 | method = /usr/sbin/sendmail |
|
206 | 206 | |
|
207 | 207 | extensions:: |
|
208 | 208 | Mercurial has an extension mechanism for adding new features. To |
|
209 | 209 | enable an extension, create an entry for it in this section. |
|
210 | 210 | |
|
211 | 211 | If you know that the extension is already in Python's search path, |
|
212 | 212 | you can give the name of the module, followed by "=", with nothing |
|
213 | 213 | after the "=". |
|
214 | 214 | |
|
215 | 215 | Otherwise, give a name that you choose, followed by "=", followed by |
|
216 | 216 | the path to the ".py" file (including the file name extension) that |
|
217 | 217 | defines the extension. |
|
218 | 218 | |
|
219 | 219 | Example for ~/.hgrc: |
|
220 | 220 | |
|
221 | 221 | [extensions] |
|
222 | 222 | # (the mq extension will get loaded from mercurial's path) |
|
223 | 223 | hgext.mq = |
|
224 | 224 | # (this extension will get loaded from the file specified) |
|
225 | 225 | myfeature = ~/.hgext/myfeature.py |
|
226 | 226 | |
|
227 | 227 | format:: |
|
228 | 228 | |
|
229 | 229 | usestore;; |
|
230 | 230 | Enable or disable the "store" repository format which improves |
|
231 | 231 | compatibility with systems that fold case or otherwise mangle |
|
232 | 232 | filenames. Enabled by default. Disabling this option will allow |
|
233 | 233 | you to store longer filenames in some situations at the expense of |
|
234 | 234 | compatibility. |
|
235 | 235 | |
|
236 | 236 | merge-patterns:: |
|
237 | 237 | This section specifies merge tools to associate with particular file |
|
238 | 238 | patterns. Tools matched here will take precedence over the default |
|
239 | 239 | merge tool. Patterns are globs by default, rooted at the repository root. |
|
240 | 240 | |
|
241 | 241 | Example: |
|
242 | 242 | |
|
243 | 243 | [merge-patterns] |
|
244 | 244 | **.c = kdiff3 |
|
245 | 245 | **.jpg = myimgmerge |
|
246 | 246 | |
|
247 | 247 | merge-tools:: |
|
248 | 248 | This section configures external merge tools to use for file-level |
|
249 | 249 | merges. |
|
250 | 250 | |
|
251 | 251 | Example ~/.hgrc: |
|
252 | 252 | |
|
253 | 253 | [merge-tools] |
|
254 | 254 | # Override stock tool location |
|
255 | 255 | kdiff3.executable = ~/bin/kdiff3 |
|
256 | 256 | # Specify command line |
|
257 | 257 | kdiff3.args = $base $local $other -o $output |
|
258 | 258 | # Give higher priority |
|
259 | 259 | kdiff3.priority = 1 |
|
260 | 260 | |
|
261 | 261 | # Define new tool |
|
262 | 262 | myHtmlTool.args = -m $local $other $base $output |
|
263 | 263 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
264 | 264 | myHtmlTool.priority = 1 |
|
265 | 265 | |
|
266 | 266 | Supported arguments: |
|
267 | 267 | priority;; |
|
268 | 268 | The priority in which to evaluate this tool. |
|
269 | 269 | Default: 0. |
|
270 | 270 | executable;; |
|
271 | 271 | Either just the name of the executable or its pathname. |
|
272 | 272 | Default: the tool name. |
|
273 | 273 | args;; |
|
274 | 274 | The arguments to pass to the tool executable. You can refer to the files |
|
275 | 275 | being merged as well as the output file through these variables: $base, |
|
276 | 276 | $local, $other, $output. |
|
277 | 277 | Default: $local $base $other |
|
278 | 278 | premerge;; |
|
279 | 279 | Attempt to run internal non-interactive 3-way merge tool before |
|
280 | 280 | launching external tool. |
|
281 | 281 | Default: True |
|
282 | 282 | binary;; |
|
283 | 283 | This tool can merge binary files. Defaults to False, unless tool |
|
284 | 284 | was selected by file pattern match. |
|
285 | 285 | symlink;; |
|
286 | 286 | This tool can merge symlinks. Defaults to False, even if tool was |
|
287 | 287 | selected by file pattern match. |
|
288 | 288 | checkconflicts;; |
|
289 | 289 | Check whether there are conflicts even though the tool reported |
|
290 | 290 | success. |
|
291 | 291 | Default: False |
|
292 | checkchanged;; | |
|
293 | Check whether outputs were written even though the tool reported | |
|
294 | success. | |
|
295 | Default: False | |
|
292 | 296 | fixeol;; |
|
293 | 297 | Attempt to fix up EOL changes caused by the merge tool. |
|
294 | 298 | Default: False |
|
295 | 299 | gui:; |
|
296 | 300 | This tool requires a graphical interface to run. Default: False |
|
297 | 301 | regkey;; |
|
298 | 302 | Windows registry key which describes install location of this tool. |
|
299 | 303 | Mercurial will search for this key first under HKEY_CURRENT_USER and |
|
300 | 304 | then under HKEY_LOCAL_MACHINE. Default: None |
|
301 | 305 | regname;; |
|
302 | 306 | Name of value to read from specified registry key. Defaults to the |
|
303 | 307 | unnamed (default) value. |
|
304 | 308 | regappend;; |
|
305 | 309 | String to append to the value read from the registry, typically the |
|
306 | 310 | executable name of the tool. Default: None |
|
307 | 311 | |
|
308 | 312 | hooks:: |
|
309 | 313 | Commands or Python functions that get automatically executed by |
|
310 | 314 | various actions such as starting or finishing a commit. Multiple |
|
311 | 315 | hooks can be run for the same action by appending a suffix to the |
|
312 | 316 | action. Overriding a site-wide hook can be done by changing its |
|
313 | 317 | value or setting it to an empty string. |
|
314 | 318 | |
|
315 | 319 | Example .hg/hgrc: |
|
316 | 320 | |
|
317 | 321 | [hooks] |
|
318 | 322 | # do not use the site-wide hook |
|
319 | 323 | incoming = |
|
320 | 324 | incoming.email = /my/email/hook |
|
321 | 325 | incoming.autobuild = /my/build/hook |
|
322 | 326 | |
|
323 | 327 | Most hooks are run with environment variables set that give added |
|
324 | 328 | useful information. For each hook below, the environment variables |
|
325 | 329 | it is passed are listed with names of the form "$HG_foo". |
|
326 | 330 | |
|
327 | 331 | changegroup;; |
|
328 | 332 | Run after a changegroup has been added via push, pull or |
|
329 | 333 | unbundle. ID of the first new changeset is in $HG_NODE. URL from |
|
330 | 334 | which changes came is in $HG_URL. |
|
331 | 335 | commit;; |
|
332 | 336 | Run after a changeset has been created in the local repository. |
|
333 | 337 | ID of the newly created changeset is in $HG_NODE. Parent |
|
334 | 338 | changeset IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
335 | 339 | incoming;; |
|
336 | 340 | Run after a changeset has been pulled, pushed, or unbundled into |
|
337 | 341 | the local repository. The ID of the newly arrived changeset is in |
|
338 | 342 | $HG_NODE. URL that was source of changes came is in $HG_URL. |
|
339 | 343 | outgoing;; |
|
340 | 344 | Run after sending changes from local repository to another. ID of |
|
341 | 345 | first changeset sent is in $HG_NODE. Source of operation is in |
|
342 | 346 | $HG_SOURCE; see "preoutgoing" hook for description. |
|
343 | 347 | post-<command>;; |
|
344 | 348 | Run after successful invocations of the associated command. The |
|
345 | 349 | contents of the command line are passed as $HG_ARGS and the result |
|
346 | 350 | code in $HG_RESULT. Hook failure is ignored. |
|
347 | 351 | pre-<command>;; |
|
348 | 352 | Run before executing the associated command. The contents of the |
|
349 | 353 | command line are passed as $HG_ARGS. If the hook returns failure, |
|
350 | 354 | the command doesn't execute and Mercurial returns the failure code. |
|
351 | 355 | prechangegroup;; |
|
352 | 356 | Run before a changegroup is added via push, pull or unbundle. |
|
353 | 357 | Exit status 0 allows the changegroup to proceed. Non-zero status |
|
354 | 358 | will cause the push, pull or unbundle to fail. URL from which |
|
355 | 359 | changes will come is in $HG_URL. |
|
356 | 360 | precommit;; |
|
357 | 361 | Run before starting a local commit. Exit status 0 allows the |
|
358 | 362 | commit to proceed. Non-zero status will cause the commit to fail. |
|
359 | 363 | Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
360 | 364 | preoutgoing;; |
|
361 | 365 | Run before collecting changes to send from the local repository to |
|
362 | 366 | another. Non-zero status will cause failure. This lets you |
|
363 | 367 | prevent pull over http or ssh. Also prevents against local pull, |
|
364 | 368 | push (outbound) or bundle commands, but not effective, since you |
|
365 | 369 | can just copy files instead then. Source of operation is in |
|
366 | 370 | $HG_SOURCE. If "serve", operation is happening on behalf of |
|
367 | 371 | remote ssh or http repository. If "push", "pull" or "bundle", |
|
368 | 372 | operation is happening on behalf of repository on same system. |
|
369 | 373 | pretag;; |
|
370 | 374 | Run before creating a tag. Exit status 0 allows the tag to be |
|
371 | 375 | created. Non-zero status will cause the tag to fail. ID of |
|
372 | 376 | changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag |
|
373 | 377 | is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
374 | 378 | pretxnchangegroup;; |
|
375 | 379 | Run after a changegroup has been added via push, pull or unbundle, |
|
376 | 380 | but before the transaction has been committed. Changegroup is |
|
377 | 381 | visible to hook program. This lets you validate incoming changes |
|
378 | 382 | before accepting them. Passed the ID of the first new changeset |
|
379 | 383 | in $HG_NODE. Exit status 0 allows the transaction to commit. |
|
380 | 384 | Non-zero status will cause the transaction to be rolled back and |
|
381 | 385 | the push, pull or unbundle will fail. URL that was source of |
|
382 | 386 | changes is in $HG_URL. |
|
383 | 387 | pretxncommit;; |
|
384 | 388 | Run after a changeset has been created but the transaction not yet |
|
385 | 389 | committed. Changeset is visible to hook program. This lets you |
|
386 | 390 | validate commit message and changes. Exit status 0 allows the |
|
387 | 391 | commit to proceed. Non-zero status will cause the transaction to |
|
388 | 392 | be rolled back. ID of changeset is in $HG_NODE. Parent changeset |
|
389 | 393 | IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
390 | 394 | preupdate;; |
|
391 | 395 | Run before updating the working directory. Exit status 0 allows |
|
392 | 396 | the update to proceed. Non-zero status will prevent the update. |
|
393 | 397 | Changeset ID of first new parent is in $HG_PARENT1. If merge, ID |
|
394 | 398 | of second new parent is in $HG_PARENT2. |
|
395 | 399 | tag;; |
|
396 | 400 | Run after a tag is created. ID of tagged changeset is in |
|
397 | 401 | $HG_NODE. Name of tag is in $HG_TAG. Tag is local if |
|
398 | 402 | $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
399 | 403 | update;; |
|
400 | 404 | Run after updating the working directory. Changeset ID of first |
|
401 | 405 | new parent is in $HG_PARENT1. If merge, ID of second new parent |
|
402 | 406 | is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update |
|
403 | 407 | failed (e.g. because conflicts not resolved), $HG_ERROR=1. |
|
404 | 408 | |
|
405 | 409 | Note: it is generally better to use standard hooks rather than the |
|
406 | 410 | generic pre- and post- command hooks as they are guaranteed to be |
|
407 | 411 | called in the appropriate contexts for influencing transactions. |
|
408 | 412 | Also, hooks like "commit" will be called in all contexts that |
|
409 | 413 | generate a commit (eg. tag) and not just the commit command. |
|
410 | 414 | |
|
411 | 415 | Note2: Environment variables with empty values may not be passed to |
|
412 | 416 | hooks on platforms like Windows. For instance, $HG_PARENT2 will |
|
413 | 417 | not be available under Windows for non-merge changesets while being |
|
414 | 418 | set to an empty value under Unix-like systems. |
|
415 | 419 | |
|
416 | 420 | The syntax for Python hooks is as follows: |
|
417 | 421 | |
|
418 | 422 | hookname = python:modulename.submodule.callable |
|
419 | 423 | |
|
420 | 424 | Python hooks are run within the Mercurial process. Each hook is |
|
421 | 425 | called with at least three keyword arguments: a ui object (keyword |
|
422 | 426 | "ui"), a repository object (keyword "repo"), and a "hooktype" |
|
423 | 427 | keyword that tells what kind of hook is used. Arguments listed as |
|
424 | 428 | environment variables above are passed as keyword arguments, with no |
|
425 | 429 | "HG_" prefix, and names in lower case. |
|
426 | 430 | |
|
427 | 431 | If a Python hook returns a "true" value or raises an exception, this |
|
428 | 432 | is treated as failure of the hook. |
|
429 | 433 | |
|
430 | 434 | http_proxy:: |
|
431 | 435 | Used to access web-based Mercurial repositories through a HTTP |
|
432 | 436 | proxy. |
|
433 | 437 | host;; |
|
434 | 438 | Host name and (optional) port of the proxy server, for example |
|
435 | 439 | "myproxy:8000". |
|
436 | 440 | no;; |
|
437 | 441 | Optional. Comma-separated list of host names that should bypass |
|
438 | 442 | the proxy. |
|
439 | 443 | passwd;; |
|
440 | 444 | Optional. Password to authenticate with at the proxy server. |
|
441 | 445 | user;; |
|
442 | 446 | Optional. User name to authenticate with at the proxy server. |
|
443 | 447 | |
|
444 | 448 | smtp:: |
|
445 | 449 | Configuration for extensions that need to send email messages. |
|
446 | 450 | host;; |
|
447 | 451 | Host name of mail server, e.g. "mail.example.com". |
|
448 | 452 | port;; |
|
449 | 453 | Optional. Port to connect to on mail server. Default: 25. |
|
450 | 454 | tls;; |
|
451 | 455 | Optional. Whether to connect to mail server using TLS. True or |
|
452 | 456 | False. Default: False. |
|
453 | 457 | username;; |
|
454 | 458 | Optional. User name to authenticate to SMTP server with. |
|
455 | 459 | If username is specified, password must also be specified. |
|
456 | 460 | Default: none. |
|
457 | 461 | password;; |
|
458 | 462 | Optional. Password to authenticate to SMTP server with. |
|
459 | 463 | If username is specified, password must also be specified. |
|
460 | 464 | Default: none. |
|
461 | 465 | local_hostname;; |
|
462 | 466 | Optional. It's the hostname that the sender can use to identify itself |
|
463 | 467 | to the MTA. |
|
464 | 468 | |
|
465 | 469 | paths:: |
|
466 | 470 | Assigns symbolic names to repositories. The left side is the |
|
467 | 471 | symbolic name, and the right gives the directory or URL that is the |
|
468 | 472 | location of the repository. Default paths can be declared by |
|
469 | 473 | setting the following entries. |
|
470 | 474 | default;; |
|
471 | 475 | Directory or URL to use when pulling if no source is specified. |
|
472 | 476 | Default is set to repository from which the current repository |
|
473 | 477 | was cloned. |
|
474 | 478 | default-push;; |
|
475 | 479 | Optional. Directory or URL to use when pushing if no destination |
|
476 | 480 | is specified. |
|
477 | 481 | |
|
478 | 482 | profile:: |
|
479 | 483 | Configuration of profiling options, for in-depth performance |
|
480 | 484 | analysis. Mostly useful to developers. |
|
481 | 485 | enable;; |
|
482 | 486 | Enable a particular profiling mode. Useful for profiling |
|
483 | 487 | server-side processes. "lsprof" enables modern profiling. |
|
484 | 488 | "hotshot" is deprecated, and produces less reliable results. |
|
485 | 489 | Default is no profiling. |
|
486 | 490 | output;; |
|
487 | 491 | The name of a file to write profiling data to. Each occurrence of |
|
488 | 492 | "%%p" will be replaced with the current process ID (the repeated |
|
489 | 493 | "%" protects against the config parser's string interpolator). |
|
490 | 494 | Default output is to stderr. |
|
491 | 495 | |
|
492 | 496 | server:: |
|
493 | 497 | Controls generic server settings. |
|
494 | 498 | uncompressed;; |
|
495 | 499 | Whether to allow clients to clone a repo using the uncompressed |
|
496 | 500 | streaming protocol. This transfers about 40% more data than a |
|
497 | 501 | regular clone, but uses less memory and CPU on both server and |
|
498 | 502 | client. Over a LAN (100Mbps or better) or a very fast WAN, an |
|
499 | 503 | uncompressed streaming clone is a lot faster (~10x) than a regular |
|
500 | 504 | clone. Over most WAN connections (anything slower than about |
|
501 | 505 | 6Mbps), uncompressed streaming is slower, because of the extra |
|
502 | 506 | data transfer overhead. Default is False. |
|
503 | 507 | |
|
504 | 508 | trusted:: |
|
505 | 509 | For security reasons, Mercurial will not use the settings in |
|
506 | 510 | the .hg/hgrc file from a repository if it doesn't belong to a |
|
507 | 511 | trusted user or to a trusted group. The main exception is the |
|
508 | 512 | web interface, which automatically uses some safe settings, since |
|
509 | 513 | it's common to serve repositories from different users. |
|
510 | 514 | |
|
511 | 515 | This section specifies what users and groups are trusted. The |
|
512 | 516 | current user is always trusted. To trust everybody, list a user |
|
513 | 517 | or a group with name "*". |
|
514 | 518 | |
|
515 | 519 | users;; |
|
516 | 520 | Comma-separated list of trusted users. |
|
517 | 521 | groups;; |
|
518 | 522 | Comma-separated list of trusted groups. |
|
519 | 523 | |
|
520 | 524 | ui:: |
|
521 | 525 | User interface controls. |
|
522 | 526 | debug;; |
|
523 | 527 | Print debugging information. True or False. Default is False. |
|
524 | 528 | editor;; |
|
525 | 529 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
526 | 530 | fallbackencoding;; |
|
527 | 531 | Encoding to try if it's not possible to decode the changelog using |
|
528 | 532 | UTF-8. Default is ISO-8859-1. |
|
529 | 533 | ignore;; |
|
530 | 534 | A file to read per-user ignore patterns from. This file should be in |
|
531 | 535 | the same format as a repository-wide .hgignore file. This option |
|
532 | 536 | supports hook syntax, so if you want to specify multiple ignore |
|
533 | 537 | files, you can do so by setting something like |
|
534 | 538 | "ignore.other = ~/.hgignore2". For details of the ignore file |
|
535 | 539 | format, see the hgignore(5) man page. |
|
536 | 540 | interactive;; |
|
537 | 541 | Allow to prompt the user. True or False. Default is True. |
|
538 | 542 | logtemplate;; |
|
539 | 543 | Template string for commands that print changesets. |
|
540 | 544 | merge;; |
|
541 | 545 | The conflict resolution program to use during a manual merge. |
|
542 | 546 | There are some internal tools available: |
|
543 | 547 | |
|
544 | 548 | internal:local;; |
|
545 | 549 | keep the local version |
|
546 | 550 | internal:other;; |
|
547 | 551 | use the other version |
|
548 | 552 | internal:merge;; |
|
549 | 553 | use the internal non-interactive merge tool |
|
550 | 554 | internal:fail;; |
|
551 | 555 | fail to merge |
|
552 | 556 | |
|
553 | 557 | See the merge-tools section for more information on configuring tools. |
|
554 | 558 | patch;; |
|
555 | 559 | command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if |
|
556 | 560 | unset. |
|
557 | 561 | quiet;; |
|
558 | 562 | Reduce the amount of output printed. True or False. Default is False. |
|
559 | 563 | remotecmd;; |
|
560 | 564 | remote command to use for clone/push/pull operations. Default is 'hg'. |
|
561 | 565 | report_untrusted;; |
|
562 | 566 | Warn if a .hg/hgrc file is ignored due to not being owned by a |
|
563 | 567 | trusted user or group. True or False. Default is True. |
|
564 | 568 | slash;; |
|
565 | 569 | Display paths using a slash ("/") as the path separator. This only |
|
566 | 570 | makes a difference on systems where the default path separator is not |
|
567 | 571 | the slash character (e.g. Windows uses the backslash character ("\")). |
|
568 | 572 | Default is False. |
|
569 | 573 | ssh;; |
|
570 | 574 | command to use for SSH connections. Default is 'ssh'. |
|
571 | 575 | strict;; |
|
572 | 576 | Require exact command names, instead of allowing unambiguous |
|
573 | 577 | abbreviations. True or False. Default is False. |
|
574 | 578 | style;; |
|
575 | 579 | Name of style to use for command output. |
|
576 | 580 | timeout;; |
|
577 | 581 | The timeout used when a lock is held (in seconds), a negative value |
|
578 | 582 | means no timeout. Default is 600. |
|
579 | 583 | username;; |
|
580 | 584 | The committer of a changeset created when running "commit". |
|
581 | 585 | Typically a person's name and email address, e.g. "Fred Widget |
|
582 | 586 | <fred@example.com>". Default is $EMAIL or username@hostname. |
|
583 | 587 | If the username in hgrc is empty, it has to be specified manually or |
|
584 | 588 | in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username =" |
|
585 | 589 | in the system hgrc). |
|
586 | 590 | verbose;; |
|
587 | 591 | Increase the amount of output printed. True or False. Default is False. |
|
588 | 592 | |
|
589 | 593 | |
|
590 | 594 | web:: |
|
591 | 595 | Web interface configuration. |
|
592 | 596 | accesslog;; |
|
593 | 597 | Where to output the access log. Default is stdout. |
|
594 | 598 | address;; |
|
595 | 599 | Interface address to bind to. Default is all. |
|
596 | 600 | allow_archive;; |
|
597 | 601 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
598 | 602 | Default is empty. |
|
599 | 603 | allowbz2;; |
|
600 | 604 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions. |
|
601 | 605 | Default is false. |
|
602 | 606 | allowgz;; |
|
603 | 607 | (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions. |
|
604 | 608 | Default is false. |
|
605 | 609 | allowpull;; |
|
606 | 610 | Whether to allow pulling from the repository. Default is true. |
|
607 | 611 | allow_push;; |
|
608 | 612 | Whether to allow pushing to the repository. If empty or not set, |
|
609 | 613 | push is not allowed. If the special value "*", any remote user |
|
610 | 614 | can push, including unauthenticated users. Otherwise, the remote |
|
611 | 615 | user must have been authenticated, and the authenticated user name |
|
612 | 616 | must be present in this list (separated by whitespace or ","). |
|
613 | 617 | The contents of the allow_push list are examined after the |
|
614 | 618 | deny_push list. |
|
615 | 619 | allowzip;; |
|
616 | 620 | (DEPRECATED) Whether to allow .zip downloading of repo revisions. |
|
617 | 621 | Default is false. This feature creates temporary files. |
|
618 | 622 | baseurl;; |
|
619 | 623 | Base URL to use when publishing URLs in other locations, so |
|
620 | 624 | third-party tools like email notification hooks can construct URLs. |
|
621 | 625 | Example: "http://hgserver/repos/" |
|
622 | 626 | contact;; |
|
623 | 627 | Name or email address of the person in charge of the repository. |
|
624 | 628 | Defaults to ui.username or $EMAIL or "unknown" if unset or empty. |
|
625 | 629 | deny_push;; |
|
626 | 630 | Whether to deny pushing to the repository. If empty or not set, |
|
627 | 631 | push is not denied. If the special value "*", all remote users |
|
628 | 632 | are denied push. Otherwise, unauthenticated users are all denied, |
|
629 | 633 | and any authenticated user name present in this list (separated by |
|
630 | 634 | whitespace or ",") is also denied. The contents of the deny_push |
|
631 | 635 | list are examined before the allow_push list. |
|
632 | 636 | description;; |
|
633 | 637 | Textual description of the repository's purpose or contents. |
|
634 | 638 | Default is "unknown". |
|
635 | 639 | encoding;; |
|
636 | 640 | Character encoding name. |
|
637 | 641 | Example: "UTF-8" |
|
638 | 642 | errorlog;; |
|
639 | 643 | Where to output the error log. Default is stderr. |
|
640 | 644 | hidden;; |
|
641 | 645 | Whether to hide the repository in the hgwebdir index. Default is false. |
|
642 | 646 | ipv6;; |
|
643 | 647 | Whether to use IPv6. Default is false. |
|
644 | 648 | name;; |
|
645 | 649 | Repository name to use in the web interface. Default is current |
|
646 | 650 | working directory. |
|
647 | 651 | maxchanges;; |
|
648 | 652 | Maximum number of changes to list on the changelog. Default is 10. |
|
649 | 653 | maxfiles;; |
|
650 | 654 | Maximum number of files to list per changeset. Default is 10. |
|
651 | 655 | port;; |
|
652 | 656 | Port to listen on. Default is 8000. |
|
653 | 657 | prefix;; |
|
654 | 658 | Prefix path to serve from. Default is '' (server root). |
|
655 | 659 | push_ssl;; |
|
656 | 660 | Whether to require that inbound pushes be transported over SSL to |
|
657 | 661 | prevent password sniffing. Default is true. |
|
658 | 662 | staticurl;; |
|
659 | 663 | Base URL to use for static files. If unset, static files (e.g. |
|
660 | 664 | the hgicon.png favicon) will be served by the CGI script itself. |
|
661 | 665 | Use this setting to serve them directly with the HTTP server. |
|
662 | 666 | Example: "http://hgserver/static/" |
|
663 | 667 | stripes;; |
|
664 | 668 | How many lines a "zebra stripe" should span in multiline output. |
|
665 | 669 | Default is 1; set to 0 to disable. |
|
666 | 670 | style;; |
|
667 | 671 | Which template map style to use. |
|
668 | 672 | templates;; |
|
669 | 673 | Where to find the HTML templates. Default is install path. |
|
670 | 674 | |
|
671 | 675 | |
|
672 | 676 | AUTHOR |
|
673 | 677 | ------ |
|
674 | 678 | Bryan O'Sullivan <bos@serpentine.com>. |
|
675 | 679 | |
|
676 | 680 | Mercurial was written by Matt Mackall <mpm@selenic.com>. |
|
677 | 681 | |
|
678 | 682 | SEE ALSO |
|
679 | 683 | -------- |
|
680 | 684 | hg(1), hgignore(5) |
|
681 | 685 | |
|
682 | 686 | COPYING |
|
683 | 687 | ------- |
|
684 | 688 | This manual page is copyright 2005 Bryan O'Sullivan. |
|
685 | 689 | Mercurial is copyright 2005-2007 Matt Mackall. |
|
686 | 690 | Free use of this software is granted under the terms of the GNU General |
|
687 | 691 | Public License (GPL). |
@@ -1,206 +1,213 | |||
|
1 | 1 | # filemerge.py - file-level merge handling for Mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms |
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 | 8 | from node import * |
|
9 | 9 | from i18n import _ |
|
10 | import util, os, tempfile, context, simplemerge, re | |
|
10 | import util, os, tempfile, context, simplemerge, re, filecmp | |
|
11 | 11 | |
|
12 | 12 | def _toolstr(ui, tool, part, default=""): |
|
13 | 13 | return ui.config("merge-tools", tool + "." + part, default) |
|
14 | 14 | |
|
15 | 15 | def _toolbool(ui, tool, part, default=False): |
|
16 | 16 | return ui.configbool("merge-tools", tool + "." + part, default) |
|
17 | 17 | |
|
18 | 18 | def _findtool(ui, tool): |
|
19 | 19 | k = _toolstr(ui, tool, "regkey") |
|
20 | 20 | if k: |
|
21 | 21 | p = util.lookup_reg(k, _toolstr(ui, tool, "regname")) |
|
22 | 22 | if p: |
|
23 | 23 | p = util.find_exe(p + _toolstr(ui, tool, "regappend")) |
|
24 | 24 | if p: |
|
25 | 25 | return p |
|
26 | 26 | return util.find_exe(_toolstr(ui, tool, "executable", tool)) |
|
27 | 27 | |
|
28 | 28 | def _picktool(repo, ui, path, binary, symlink): |
|
29 | 29 | def check(tool, pat, symlink, binary): |
|
30 | 30 | tmsg = tool |
|
31 | 31 | if pat: |
|
32 | 32 | tmsg += " specified for " + pat |
|
33 | 33 | if pat and not _findtool(ui, tool): # skip search if not matching |
|
34 | 34 | ui.warn(_("couldn't find merge tool %s\n") % tmsg) |
|
35 | 35 | elif symlink and not _toolbool(ui, tool, "symlink"): |
|
36 | 36 | ui.warn(_("tool %s can't handle symlinks\n") % tmsg) |
|
37 | 37 | elif binary and not _toolbool(ui, tool, "binary"): |
|
38 | 38 | ui.warn(_("tool %s can't handle binary\n") % tmsg) |
|
39 | 39 | elif not util.gui() and _toolbool(ui, tool, "gui"): |
|
40 | 40 | ui.warn(_("tool %s requires a GUI\n") % tmsg) |
|
41 | 41 | else: |
|
42 | 42 | return True |
|
43 | 43 | return False |
|
44 | 44 | |
|
45 | 45 | # HGMERGE takes precedence |
|
46 | 46 | hgmerge = os.environ.get("HGMERGE") |
|
47 | 47 | if hgmerge: |
|
48 | 48 | return (hgmerge, hgmerge) |
|
49 | 49 | |
|
50 | 50 | # then patterns |
|
51 | 51 | for pat, tool in ui.configitems("merge-patterns"): |
|
52 | 52 | mf = util.matcher(repo.root, "", [pat], [], [])[1] |
|
53 | 53 | if mf(path) and check(tool, pat, symlink, False): |
|
54 | 54 | toolpath = _findtool(ui, tool) |
|
55 | 55 | return (tool, '"' + toolpath + '"') |
|
56 | 56 | |
|
57 | 57 | # then merge tools |
|
58 | 58 | tools = {} |
|
59 | 59 | for k,v in ui.configitems("merge-tools"): |
|
60 | 60 | t = k.split('.')[0] |
|
61 | 61 | if t not in tools: |
|
62 | 62 | tools[t] = int(_toolstr(ui, t, "priority", "0")) |
|
63 | 63 | tools = [(-p,t) for t,p in tools.items()] |
|
64 | 64 | tools.sort() |
|
65 | 65 | if ui.config("ui", "merge"): |
|
66 | 66 | tools.insert(0, (None, ui.config("ui", "merge"))) # highest priority |
|
67 | 67 | tools.append((None, "hgmerge")) # the old default, if found |
|
68 | 68 | for p,t in tools: |
|
69 | 69 | toolpath = _findtool(ui, t) |
|
70 | 70 | if toolpath and check(t, None, symlink, binary): |
|
71 | 71 | return (t, '"' + toolpath + '"') |
|
72 | 72 | # internal merge as last resort |
|
73 | 73 | return (not (symlink or binary) and "internal:merge" or None, None) |
|
74 | 74 | |
|
75 | 75 | def _eoltype(data): |
|
76 | 76 | "Guess the EOL type of a file" |
|
77 | 77 | if '\0' in data: # binary |
|
78 | 78 | return None |
|
79 | 79 | if '\r\n' in data: # Windows |
|
80 | 80 | return '\r\n' |
|
81 | 81 | if '\r' in data: # Old Mac |
|
82 | 82 | return '\r' |
|
83 | 83 | if '\n' in data: # UNIX |
|
84 | 84 | return '\n' |
|
85 | 85 | return None # unknown |
|
86 | 86 | |
|
87 | 87 | def _matcheol(file, origfile): |
|
88 | 88 | "Convert EOL markers in a file to match origfile" |
|
89 | 89 | tostyle = _eoltype(open(origfile, "rb").read()) |
|
90 | 90 | if tostyle: |
|
91 | 91 | data = open(file, "rb").read() |
|
92 | 92 | style = _eoltype(data) |
|
93 | 93 | if style: |
|
94 | 94 | newdata = data.replace(style, tostyle) |
|
95 | 95 | if newdata != data: |
|
96 | 96 | open(file, "wb").write(newdata) |
|
97 | 97 | |
|
98 | 98 | def filemerge(repo, fw, fd, fo, wctx, mctx): |
|
99 | 99 | """perform a 3-way merge in the working directory |
|
100 | 100 | |
|
101 | 101 | fw = original filename in the working directory |
|
102 | 102 | fd = destination filename in the working directory |
|
103 | 103 | fo = filename in other parent |
|
104 | 104 | wctx, mctx = working and merge changecontexts |
|
105 | 105 | """ |
|
106 | 106 | |
|
107 | 107 | def temp(prefix, ctx): |
|
108 | 108 | pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) |
|
109 | 109 | (fd, name) = tempfile.mkstemp(prefix=pre) |
|
110 | 110 | data = repo.wwritedata(ctx.path(), ctx.data()) |
|
111 | 111 | f = os.fdopen(fd, "wb") |
|
112 | 112 | f.write(data) |
|
113 | 113 | f.close() |
|
114 | 114 | return name |
|
115 | 115 | |
|
116 | 116 | def isbin(ctx): |
|
117 | 117 | try: |
|
118 | 118 | return util.binary(ctx.data()) |
|
119 | 119 | except IOError: |
|
120 | 120 | return False |
|
121 | 121 | |
|
122 | 122 | fco = mctx.filectx(fo) |
|
123 | 123 | if not fco.cmp(wctx.filectx(fd).data()): # files identical? |
|
124 | 124 | return None |
|
125 | 125 | |
|
126 | 126 | ui = repo.ui |
|
127 | 127 | fcm = wctx.filectx(fw) |
|
128 | 128 | fca = fcm.ancestor(fco) or repo.filectx(fw, fileid=nullrev) |
|
129 | 129 | binary = isbin(fcm) or isbin(fco) or isbin(fca) |
|
130 | 130 | symlink = fcm.islink() or fco.islink() |
|
131 | 131 | tool, toolpath = _picktool(repo, ui, fw, binary, symlink) |
|
132 | 132 | ui.debug(_("picked tool '%s' for %s (binary %s symlink %s)\n") % |
|
133 | 133 | (tool, fw, binary, symlink)) |
|
134 | 134 | |
|
135 | 135 | if not tool: |
|
136 | 136 | tool = "internal:local" |
|
137 | 137 | if ui.prompt(_(" no tool found to merge %s\n" |
|
138 | 138 | "keep (l)ocal or take (o)ther?") % fw, |
|
139 | 139 | _("[lo]"), _("l")) != _("l"): |
|
140 | 140 | tool = "internal:other" |
|
141 | 141 | if tool == "internal:local": |
|
142 | 142 | return 0 |
|
143 | 143 | if tool == "internal:other": |
|
144 | 144 | repo.wwrite(fd, fco.data(), fco.fileflags()) |
|
145 | 145 | return 0 |
|
146 | 146 | if tool == "internal:fail": |
|
147 | 147 | return 1 |
|
148 | 148 | |
|
149 | 149 | # do the actual merge |
|
150 | 150 | a = repo.wjoin(fd) |
|
151 | 151 | b = temp("base", fca) |
|
152 | 152 | c = temp("other", fco) |
|
153 | 153 | out = "" |
|
154 | 154 | back = a + ".orig" |
|
155 | 155 | util.copyfile(a, back) |
|
156 | 156 | |
|
157 | 157 | if fw != fo: |
|
158 | 158 | repo.ui.status(_("merging %s and %s\n") % (fw, fo)) |
|
159 | 159 | else: |
|
160 | 160 | repo.ui.status(_("merging %s\n") % fw) |
|
161 | 161 | repo.ui.debug(_("my %s other %s ancestor %s\n") % (fcm, fco, fca)) |
|
162 | 162 | |
|
163 | 163 | # do we attempt to simplemerge first? |
|
164 | 164 | if _toolbool(ui, tool, "premerge", not (binary or symlink)): |
|
165 | 165 | r = simplemerge.simplemerge(a, b, c, quiet=True) |
|
166 | 166 | if not r: |
|
167 | 167 | ui.debug(_(" premerge successful\n")) |
|
168 | 168 | os.unlink(back) |
|
169 | 169 | os.unlink(b) |
|
170 | 170 | os.unlink(c) |
|
171 | 171 | return 0 |
|
172 | 172 | util.copyfile(back, a) # restore from backup and try again |
|
173 | 173 | |
|
174 | 174 | env = dict(HG_FILE=fd, |
|
175 | 175 | HG_MY_NODE=str(wctx.parents()[0]), |
|
176 | 176 | HG_OTHER_NODE=str(mctx), |
|
177 | 177 | HG_MY_ISLINK=fcm.islink(), |
|
178 | 178 | HG_OTHER_ISLINK=fco.islink(), |
|
179 | 179 | HG_BASE_ISLINK=fca.islink()) |
|
180 | 180 | |
|
181 | 181 | if tool == "internal:merge": |
|
182 | 182 | r = simplemerge.simplemerge(a, b, c, label=['local', 'other']) |
|
183 | 183 | else: |
|
184 | 184 | args = _toolstr(ui, tool, "args", '$local $base $other') |
|
185 | 185 | if "$output" in args: |
|
186 | 186 | out, a = a, back # read input from backup, write to original |
|
187 | 187 | replace = dict(local=a, base=b, other=c, output=out) |
|
188 | 188 | args = re.sub("\$(local|base|other|output)", |
|
189 | 189 | lambda x: '"%s"' % replace[x.group()[1:]], args) |
|
190 | 190 | r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env) |
|
191 | 191 | |
|
192 | 192 | if not r and _toolbool(ui, tool, "checkconflicts"): |
|
193 | 193 | if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcm.data()): |
|
194 | 194 | r = 1 |
|
195 | 195 | |
|
196 | if not r and _toolbool(ui, tool, "checkchanged"): | |
|
197 | if filecmp.cmp(repo.wjoin(fd), back): | |
|
198 | if ui.prompt(_(" output file %s appears unchanged\n" | |
|
199 | "was merge successful (yn)?") % fd, | |
|
200 | _("[yn]"), _("n")) != _("y"): | |
|
201 | r = 1 | |
|
202 | ||
|
196 | 203 | if _toolbool(ui, tool, "fixeol"): |
|
197 | 204 | _matcheol(repo.wjoin(fd), back) |
|
198 | 205 | |
|
199 | 206 | if r: |
|
200 | 207 | repo.ui.warn(_("merging %s failed!\n") % fd) |
|
201 | 208 | else: |
|
202 | 209 | os.unlink(back) |
|
203 | 210 | |
|
204 | 211 | os.unlink(b) |
|
205 | 212 | os.unlink(c) |
|
206 | 213 | return r |
General Comments 0
You need to be logged in to leave comments.
Login now