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