Show More
@@ -1,774 +1,786 | |||||
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. *.rc files from a single directory are read in |
|
20 | installed. *.rc files from a single directory are read in | |
21 | alphabetical order, later ones overriding earlier ones. Where |
|
21 | alphabetical order, later ones overriding earlier ones. Where | |
22 | multiple paths are given below, settings from later paths override |
|
22 | multiple paths are given below, settings from later paths override | |
23 | earlier ones. |
|
23 | earlier ones. | |
24 |
|
24 | |||
25 | (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc:: |
|
25 | (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc:: | |
26 | (Unix) <install-root>/etc/mercurial/hgrc:: |
|
26 | (Unix) <install-root>/etc/mercurial/hgrc:: | |
27 | Per-installation configuration files, searched for in the |
|
27 | Per-installation configuration files, searched for in the | |
28 | directory where Mercurial is installed. <install-root> is the |
|
28 | directory where Mercurial is installed. <install-root> is the | |
29 | parent directory of the hg executable (or symlink) being run. |
|
29 | parent directory of the hg executable (or symlink) being run. | |
30 | For example, if installed in /shared/tools/bin/hg, Mercurial will |
|
30 | For example, if installed in /shared/tools/bin/hg, Mercurial will | |
31 | look in /shared/tools/etc/mercurial/hgrc. Options in these files |
|
31 | look in /shared/tools/etc/mercurial/hgrc. Options in these files | |
32 | apply to all Mercurial commands executed by any user in any |
|
32 | apply to all Mercurial commands executed by any user in any | |
33 | directory. |
|
33 | directory. | |
34 |
|
34 | |||
35 | (Unix) /etc/mercurial/hgrc.d/*.rc:: |
|
35 | (Unix) /etc/mercurial/hgrc.d/*.rc:: | |
36 | (Unix) /etc/mercurial/hgrc:: |
|
36 | (Unix) /etc/mercurial/hgrc:: | |
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 | (Windows) <install-dir>\Mercurial.ini:: |
|
42 | (Windows) <install-dir>\Mercurial.ini:: | |
43 | or else:: |
|
43 | or else:: | |
44 | (Windows) HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial:: |
|
44 | (Windows) HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial:: | |
45 | or else:: |
|
45 | or else:: | |
46 | (Windows) C:\Mercurial\Mercurial.ini:: |
|
46 | (Windows) C:\Mercurial\Mercurial.ini:: | |
47 | Per-installation/system configuration files, for the system on |
|
47 | Per-installation/system configuration files, for the system on | |
48 | which Mercurial is running. Options in these files apply to all |
|
48 | which Mercurial is running. Options in these files apply to all | |
49 | Mercurial commands executed by any user in any directory. |
|
49 | Mercurial commands executed by any user in any directory. | |
50 | Registry keys contain PATH-like strings, every part of which must |
|
50 | Registry keys contain PATH-like strings, every part of which must | |
51 | reference a Mercurial.ini file or be a directory where *.rc files |
|
51 | reference a Mercurial.ini file or be a directory where *.rc files | |
52 | will be read. |
|
52 | will be read. | |
53 |
|
53 | |||
54 | (Unix) $HOME/.hgrc:: |
|
54 | (Unix) $HOME/.hgrc:: | |
55 | (Windows) %HOME%\Mercurial.ini:: |
|
55 | (Windows) %HOME%\Mercurial.ini:: | |
56 | (Windows) %HOME%\.hgrc:: |
|
56 | (Windows) %HOME%\.hgrc:: | |
57 | (Windows) %USERPROFILE%\Mercurial.ini:: |
|
57 | (Windows) %USERPROFILE%\Mercurial.ini:: | |
58 | (Windows) %USERPROFILE%\.hgrc:: |
|
58 | (Windows) %USERPROFILE%\.hgrc:: | |
59 | Per-user configuration file(s), for the user running Mercurial. |
|
59 | Per-user configuration file(s), for the user running Mercurial. | |
60 | On Windows 9x, %HOME% is replaced by %APPDATA%. |
|
60 | On Windows 9x, %HOME% is replaced by %APPDATA%. | |
61 | Options in these files apply to all Mercurial commands executed |
|
61 | Options in these files apply to all Mercurial commands executed | |
62 | by this user in any directory. Options in thes files override |
|
62 | by this user in any directory. Options in thes files override | |
63 | per-installation and per-system options. |
|
63 | per-installation and per-system options. | |
64 |
|
64 | |||
65 | (Unix, Windows) <repo>/.hg/hgrc:: |
|
65 | (Unix, Windows) <repo>/.hg/hgrc:: | |
66 | Per-repository configuration options that only apply in a |
|
66 | Per-repository configuration options that only apply in a | |
67 | particular repository. This file is not version-controlled, and |
|
67 | particular repository. This file is not version-controlled, and | |
68 | will not get transferred during a "clone" operation. Options in |
|
68 | will not get transferred during a "clone" operation. Options in | |
69 | this file override options in all other configuration files. |
|
69 | this file override options in all other configuration files. | |
70 | On Unix, most of this file will be ignored if it doesn't belong |
|
70 | On Unix, most of this file will be ignored if it doesn't belong | |
71 | to a trusted user or to a trusted group. See the documentation |
|
71 | to a trusted user or to a trusted group. See the documentation | |
72 | for the trusted section below for more details. |
|
72 | for the trusted section below for more details. | |
73 |
|
73 | |||
74 | SYNTAX |
|
74 | SYNTAX | |
75 | ------ |
|
75 | ------ | |
76 |
|
76 | |||
77 | A configuration file consists of sections, led by a "[section]" header |
|
77 | A configuration file consists of sections, led by a "[section]" header | |
78 | and followed by "name: value" entries; "name=value" is also accepted. |
|
78 | and followed by "name: value" entries; "name=value" is also accepted. | |
79 |
|
79 | |||
80 | [spam] |
|
80 | [spam] | |
81 | eggs=ham |
|
81 | eggs=ham | |
82 | green= |
|
82 | green= | |
83 | eggs |
|
83 | eggs | |
84 |
|
84 | |||
85 | Each line contains one entry. If the lines that follow are indented, |
|
85 | Each line contains one entry. If the lines that follow are indented, | |
86 | they are treated as continuations of that entry. |
|
86 | they are treated as continuations of that entry. | |
87 |
|
87 | |||
88 | Leading whitespace is removed from values. Empty lines are skipped. |
|
88 | Leading whitespace is removed from values. Empty lines are skipped. | |
89 |
|
89 | |||
90 | The optional values can contain format strings which refer to other |
|
90 | The optional values can contain format strings which refer to other | |
91 | values in the same section, or values in a special DEFAULT section. |
|
91 | values in the same section, or values in a special DEFAULT section. | |
92 |
|
92 | |||
93 | Lines beginning with "#" or ";" are ignored and may be used to provide |
|
93 | Lines beginning with "#" or ";" are ignored and may be used to provide | |
94 | comments. |
|
94 | comments. | |
95 |
|
95 | |||
96 | SECTIONS |
|
96 | SECTIONS | |
97 | -------- |
|
97 | -------- | |
98 |
|
98 | |||
99 | This section describes the different sections that may appear in a |
|
99 | This section describes the different sections that may appear in a | |
100 | Mercurial "hgrc" file, the purpose of each section, its possible |
|
100 | Mercurial "hgrc" file, the purpose of each section, its possible | |
101 | keys, and their possible values. |
|
101 | keys, and their possible values. | |
102 |
|
102 | |||
103 | [[decode]] |
|
103 | [[decode]] | |
104 | decode/encode:: |
|
104 | decode/encode:: | |
105 | Filters for transforming files on checkout/checkin. This would |
|
105 | Filters for transforming files on checkout/checkin. This would | |
106 | typically be used for newline processing or other |
|
106 | typically be used for newline processing or other | |
107 | localization/canonicalization of files. |
|
107 | localization/canonicalization of files. | |
108 |
|
108 | |||
109 | Filters consist of a filter pattern followed by a filter command. |
|
109 | Filters consist of a filter pattern followed by a filter command. | |
110 | Filter patterns are globs by default, rooted at the repository |
|
110 | Filter patterns are globs by default, rooted at the repository | |
111 | root. For example, to match any file ending in ".txt" in the root |
|
111 | root. For example, to match any file ending in ".txt" in the root | |
112 | directory only, use the pattern "*.txt". To match any file ending |
|
112 | directory only, use the pattern "*.txt". To match any file ending | |
113 | in ".c" anywhere in the repository, use the pattern "**.c". |
|
113 | in ".c" anywhere in the repository, use the pattern "**.c". | |
114 |
|
114 | |||
115 | The filter command can start with a specifier, either "pipe:" or |
|
115 | The filter command can start with a specifier, either "pipe:" or | |
116 | "tempfile:". If no specifier is given, "pipe:" is used by default. |
|
116 | "tempfile:". If no specifier is given, "pipe:" is used by default. | |
117 |
|
117 | |||
118 | A "pipe:" command must accept data on stdin and return the |
|
118 | A "pipe:" command must accept data on stdin and return the | |
119 | transformed data on stdout. |
|
119 | transformed data on stdout. | |
120 |
|
120 | |||
121 | Pipe example: |
|
121 | Pipe example: | |
122 |
|
122 | |||
123 | [encode] |
|
123 | [encode] | |
124 | # uncompress gzip files on checkin to improve delta compression |
|
124 | # uncompress gzip files on checkin to improve delta compression | |
125 | # note: not necessarily a good idea, just an example |
|
125 | # note: not necessarily a good idea, just an example | |
126 | *.gz = pipe: gunzip |
|
126 | *.gz = pipe: gunzip | |
127 |
|
127 | |||
128 | [decode] |
|
128 | [decode] | |
129 | # recompress gzip files when writing them to the working dir (we |
|
129 | # recompress gzip files when writing them to the working dir (we | |
130 | # can safely omit "pipe:", because it's the default) |
|
130 | # can safely omit "pipe:", because it's the default) | |
131 | *.gz = gzip |
|
131 | *.gz = gzip | |
132 |
|
132 | |||
133 | A "tempfile:" command is a template. The string INFILE is replaced |
|
133 | A "tempfile:" command is a template. The string INFILE is replaced | |
134 | with the name of a temporary file that contains the data to be |
|
134 | with the name of a temporary file that contains the data to be | |
135 | filtered by the command. The string OUTFILE is replaced with the |
|
135 | filtered by the command. The string OUTFILE is replaced with the | |
136 | name of an empty temporary file, where the filtered data must be |
|
136 | name of an empty temporary file, where the filtered data must be | |
137 | written by the command. |
|
137 | written by the command. | |
138 |
|
138 | |||
139 | NOTE: the tempfile mechanism is recommended for Windows systems, |
|
139 | NOTE: the tempfile mechanism is recommended for Windows systems, | |
140 | where the standard shell I/O redirection operators often have |
|
140 | where the standard shell I/O redirection operators often have | |
141 | strange effects and may corrupt the contents of your files. |
|
141 | strange effects and may corrupt the contents of your files. | |
142 |
|
142 | |||
143 | The most common usage is for LF <-> CRLF translation on Windows. |
|
143 | The most common usage is for LF <-> CRLF translation on Windows. | |
144 | For this, use the "smart" convertors which check for binary files: |
|
144 | For this, use the "smart" convertors which check for binary files: | |
145 |
|
145 | |||
146 | [extensions] |
|
146 | [extensions] | |
147 | hgext.win32text = |
|
147 | hgext.win32text = | |
148 | [encode] |
|
148 | [encode] | |
149 | ** = cleverencode: |
|
149 | ** = cleverencode: | |
150 | [decode] |
|
150 | [decode] | |
151 | ** = cleverdecode: |
|
151 | ** = cleverdecode: | |
152 |
|
152 | |||
153 | or if you only want to translate certain files: |
|
153 | or if you only want to translate certain files: | |
154 |
|
154 | |||
155 | [extensions] |
|
155 | [extensions] | |
156 | hgext.win32text = |
|
156 | hgext.win32text = | |
157 | [encode] |
|
157 | [encode] | |
158 | **.txt = dumbencode: |
|
158 | **.txt = dumbencode: | |
159 | [decode] |
|
159 | [decode] | |
160 | **.txt = dumbdecode: |
|
160 | **.txt = dumbdecode: | |
161 |
|
161 | |||
162 | [[defaults]] |
|
162 | [[defaults]] | |
163 | defaults:: |
|
163 | defaults:: | |
164 | Use the [defaults] section to define command defaults, i.e. the |
|
164 | Use the [defaults] section to define command defaults, i.e. the | |
165 | default options/arguments to pass to the specified commands. |
|
165 | default options/arguments to pass to the specified commands. | |
166 |
|
166 | |||
167 | The following example makes 'hg log' run in verbose mode, and |
|
167 | The following example makes 'hg log' run in verbose mode, and | |
168 | 'hg status' show only the modified files, by default. |
|
168 | 'hg status' show only the modified files, by default. | |
169 |
|
169 | |||
170 | [defaults] |
|
170 | [defaults] | |
171 | log = -v |
|
171 | log = -v | |
172 | status = -m |
|
172 | status = -m | |
173 |
|
173 | |||
174 | The actual commands, instead of their aliases, must be used when |
|
174 | The actual commands, instead of their aliases, must be used when | |
175 | defining command defaults. The command defaults will also be |
|
175 | defining command defaults. The command defaults will also be | |
176 | applied to the aliases of the commands defined. |
|
176 | applied to the aliases of the commands defined. | |
177 |
|
177 | |||
178 | [[diff]] |
|
178 | [[diff]] | |
179 | diff:: |
|
179 | diff:: | |
180 | Settings used when displaying diffs. They are all boolean and |
|
180 | Settings used when displaying diffs. They are all boolean and | |
181 | defaults to False. |
|
181 | defaults to False. | |
182 | git;; |
|
182 | git;; | |
183 | Use git extended diff format. |
|
183 | Use git extended diff format. | |
184 | nodates;; |
|
184 | nodates;; | |
185 | Don't include dates in diff headers. |
|
185 | Don't include dates in diff headers. | |
186 | showfunc;; |
|
186 | showfunc;; | |
187 | Show which function each change is in. |
|
187 | Show which function each change is in. | |
188 | ignorews;; |
|
188 | ignorews;; | |
189 | Ignore white space when comparing lines. |
|
189 | Ignore white space when comparing lines. | |
190 | ignorewsamount;; |
|
190 | ignorewsamount;; | |
191 | Ignore changes in the amount of white space. |
|
191 | Ignore changes in the amount of white space. | |
192 | ignoreblanklines;; |
|
192 | ignoreblanklines;; | |
193 | Ignore changes whose lines are all blank. |
|
193 | Ignore changes whose lines are all blank. | |
194 |
|
194 | |||
195 | [[email]] |
|
195 | [[email]] | |
196 | email:: |
|
196 | email:: | |
197 | Settings for extensions that send email messages. |
|
197 | Settings for extensions that send email messages. | |
198 | from;; |
|
198 | from;; | |
199 | Optional. Email address to use in "From" header and SMTP envelope |
|
199 | Optional. Email address to use in "From" header and SMTP envelope | |
200 | of outgoing messages. |
|
200 | of outgoing messages. | |
201 | to;; |
|
201 | to;; | |
202 | Optional. Comma-separated list of recipients' email addresses. |
|
202 | Optional. Comma-separated list of recipients' email addresses. | |
203 | cc;; |
|
203 | cc;; | |
204 | Optional. Comma-separated list of carbon copy recipients' |
|
204 | Optional. Comma-separated list of carbon copy recipients' | |
205 | email addresses. |
|
205 | email addresses. | |
206 | bcc;; |
|
206 | bcc;; | |
207 | Optional. Comma-separated list of blind carbon copy |
|
207 | Optional. Comma-separated list of blind carbon copy | |
208 | recipients' email addresses. Cannot be set interactively. |
|
208 | recipients' email addresses. Cannot be set interactively. | |
209 | method;; |
|
209 | method;; | |
210 | Optional. Method to use to send email messages. If value is |
|
210 | Optional. Method to use to send email messages. If value is | |
211 | "smtp" (default), use SMTP (see section "[smtp]" for |
|
211 | "smtp" (default), use SMTP (see section "[smtp]" for | |
212 | configuration). Otherwise, use as name of program to run that |
|
212 | configuration). Otherwise, use as name of program to run that | |
213 | acts like sendmail (takes "-f" option for sender, list of |
|
213 | acts like sendmail (takes "-f" option for sender, list of | |
214 | recipients on command line, message on stdin). Normally, setting |
|
214 | recipients on command line, message on stdin). Normally, setting | |
215 | this to "sendmail" or "/usr/sbin/sendmail" is enough to use |
|
215 | this to "sendmail" or "/usr/sbin/sendmail" is enough to use | |
216 | sendmail to send messages. |
|
216 | sendmail to send messages. | |
217 | charsets;; |
|
217 | charsets;; | |
218 | Optional. Comma-separated list of charsets considered |
|
218 | Optional. Comma-separated list of charsets considered | |
219 | convenient for recipients. Addresses, headers, and parts not |
|
219 | convenient for recipients. Addresses, headers, and parts not | |
220 | containing patches of outgoing messages will be encoded in |
|
220 | containing patches of outgoing messages will be encoded in | |
221 | the first charset to which conversion from local encoding |
|
221 | the first charset to which conversion from local encoding | |
222 | ($HGENCODING, ui.fallbackencoding) succeeds. If correct |
|
222 | ($HGENCODING, ui.fallbackencoding) succeeds. If correct | |
223 | conversion fails, the text in question is sent as is. |
|
223 | conversion fails, the text in question is sent as is. | |
224 | Defaults to empty (explicit) list. |
|
224 | Defaults to empty (explicit) list. | |
225 |
|
225 | |||
226 | Order of outgoing email charsets: |
|
226 | Order of outgoing email charsets: | |
227 |
|
227 | |||
228 | us-ascii always first, regardless of settings |
|
228 | us-ascii always first, regardless of settings | |
229 | email.charsets in order given by user |
|
229 | email.charsets in order given by user | |
230 | ui.fallbackencoding if not in email.charsets |
|
230 | ui.fallbackencoding if not in email.charsets | |
231 | $HGENCODING if not in email.charsets |
|
231 | $HGENCODING if not in email.charsets | |
232 | utf-8 always last, regardless of settings |
|
232 | utf-8 always last, regardless of settings | |
233 |
|
233 | |||
234 | Email example: |
|
234 | Email example: | |
235 |
|
235 | |||
236 | [email] |
|
236 | [email] | |
237 | from = Joseph User <joe.user@example.com> |
|
237 | from = Joseph User <joe.user@example.com> | |
238 | method = /usr/sbin/sendmail |
|
238 | method = /usr/sbin/sendmail | |
239 | # charsets for western europeans |
|
239 | # charsets for western europeans | |
240 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
240 | # us-ascii, utf-8 omitted, as they are tried first and last | |
241 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
241 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
242 |
|
242 | |||
243 | [[extensions]] |
|
243 | [[extensions]] | |
244 | extensions:: |
|
244 | extensions:: | |
245 | Mercurial has an extension mechanism for adding new features. To |
|
245 | Mercurial has an extension mechanism for adding new features. To | |
246 | enable an extension, create an entry for it in this section. |
|
246 | enable an extension, create an entry for it in this section. | |
247 |
|
247 | |||
248 | If you know that the extension is already in Python's search path, |
|
248 | If you know that the extension is already in Python's search path, | |
249 | you can give the name of the module, followed by "=", with nothing |
|
249 | you can give the name of the module, followed by "=", with nothing | |
250 | after the "=". |
|
250 | after the "=". | |
251 |
|
251 | |||
252 | Otherwise, give a name that you choose, followed by "=", followed by |
|
252 | Otherwise, give a name that you choose, followed by "=", followed by | |
253 | the path to the ".py" file (including the file name extension) that |
|
253 | the path to the ".py" file (including the file name extension) that | |
254 | defines the extension. |
|
254 | defines the extension. | |
255 |
|
255 | |||
256 | To explicitly disable an extension that is enabled in an hgrc of |
|
256 | To explicitly disable an extension that is enabled in an hgrc of | |
257 | broader scope, prepend its path with '!', as in |
|
257 | broader scope, prepend its path with '!', as in | |
258 | 'hgext.foo = !/ext/path' or 'hgext.foo = !' when no path is supplied. |
|
258 | 'hgext.foo = !/ext/path' or 'hgext.foo = !' when no path is supplied. | |
259 |
|
259 | |||
260 | Example for ~/.hgrc: |
|
260 | Example for ~/.hgrc: | |
261 |
|
261 | |||
262 | [extensions] |
|
262 | [extensions] | |
263 | # (the mq extension will get loaded from mercurial's path) |
|
263 | # (the mq extension will get loaded from mercurial's path) | |
264 | hgext.mq = |
|
264 | hgext.mq = | |
265 | # (this extension will get loaded from the file specified) |
|
265 | # (this extension will get loaded from the file specified) | |
266 | myfeature = ~/.hgext/myfeature.py |
|
266 | myfeature = ~/.hgext/myfeature.py | |
267 |
|
267 | |||
268 | [[format]] |
|
268 | [[format]] | |
269 | format:: |
|
269 | format:: | |
270 |
|
270 | |||
271 | usestore;; |
|
271 | usestore;; | |
272 | Enable or disable the "store" repository format which improves |
|
272 | Enable or disable the "store" repository format which improves | |
273 | compatibility with systems that fold case or otherwise mangle |
|
273 | compatibility with systems that fold case or otherwise mangle | |
274 | filenames. Enabled by default. Disabling this option will allow |
|
274 | filenames. Enabled by default. Disabling this option will allow | |
275 | you to store longer filenames in some situations at the expense of |
|
275 | you to store longer filenames in some situations at the expense of | |
276 | compatibility and ensures that the on-disk format of newly created |
|
276 | compatibility and ensures that the on-disk format of newly created | |
277 | repositories will be compatible with Mercurial before version 0.9.4. |
|
277 | repositories will be compatible with Mercurial before version 0.9.4. | |
278 |
|
278 | |||
279 | usefncache;; |
|
279 | usefncache;; | |
280 | Enable or disable the "fncache" repository format which enhances |
|
280 | Enable or disable the "fncache" repository format which enhances | |
281 | the "store" repository format (which has to be enabled to use |
|
281 | the "store" repository format (which has to be enabled to use | |
282 | fncache) to allow longer filenames and avoids using Windows reserved |
|
282 | fncache) to allow longer filenames and avoids using Windows reserved | |
283 | names, e.g. "nul". Enabled by default. Disabling this option ensures |
|
283 | names, e.g. "nul". Enabled by default. Disabling this option ensures | |
284 | that the on-disk format of newly created repositories will be |
|
284 | that the on-disk format of newly created repositories will be | |
285 | compatible with Mercurial before version 1.1. |
|
285 | compatible with Mercurial before version 1.1. | |
286 |
|
286 | |||
287 | [[merge-patterns]] |
|
287 | [[merge-patterns]] | |
288 | merge-patterns:: |
|
288 | merge-patterns:: | |
289 | This section specifies merge tools to associate with particular file |
|
289 | This section specifies merge tools to associate with particular file | |
290 | patterns. Tools matched here will take precedence over the default |
|
290 | patterns. Tools matched here will take precedence over the default | |
291 | merge tool. Patterns are globs by default, rooted at the repository root. |
|
291 | merge tool. Patterns are globs by default, rooted at the repository root. | |
292 |
|
292 | |||
293 | Example: |
|
293 | Example: | |
294 |
|
294 | |||
295 | [merge-patterns] |
|
295 | [merge-patterns] | |
296 | **.c = kdiff3 |
|
296 | **.c = kdiff3 | |
297 | **.jpg = myimgmerge |
|
297 | **.jpg = myimgmerge | |
298 |
|
298 | |||
299 | [[merge-tools]] |
|
299 | [[merge-tools]] | |
300 | merge-tools:: |
|
300 | merge-tools:: | |
301 | This section configures external merge tools to use for file-level |
|
301 | This section configures external merge tools to use for file-level | |
302 | merges. |
|
302 | merges. | |
303 |
|
303 | |||
304 | Example ~/.hgrc: |
|
304 | Example ~/.hgrc: | |
305 |
|
305 | |||
306 | [merge-tools] |
|
306 | [merge-tools] | |
307 | # Override stock tool location |
|
307 | # Override stock tool location | |
308 | kdiff3.executable = ~/bin/kdiff3 |
|
308 | kdiff3.executable = ~/bin/kdiff3 | |
309 | # Specify command line |
|
309 | # Specify command line | |
310 | kdiff3.args = $base $local $other -o $output |
|
310 | kdiff3.args = $base $local $other -o $output | |
311 | # Give higher priority |
|
311 | # Give higher priority | |
312 | kdiff3.priority = 1 |
|
312 | kdiff3.priority = 1 | |
313 |
|
313 | |||
314 | # Define new tool |
|
314 | # Define new tool | |
315 | myHtmlTool.args = -m $local $other $base $output |
|
315 | myHtmlTool.args = -m $local $other $base $output | |
316 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
316 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
317 | myHtmlTool.priority = 1 |
|
317 | myHtmlTool.priority = 1 | |
318 |
|
318 | |||
319 | Supported arguments: |
|
319 | Supported arguments: | |
320 |
|
320 | |||
321 | priority;; |
|
321 | priority;; | |
322 | The priority in which to evaluate this tool. |
|
322 | The priority in which to evaluate this tool. | |
323 | Default: 0. |
|
323 | Default: 0. | |
324 | executable;; |
|
324 | executable;; | |
325 | Either just the name of the executable or its pathname. |
|
325 | Either just the name of the executable or its pathname. | |
326 | Default: the tool name. |
|
326 | Default: the tool name. | |
327 | args;; |
|
327 | args;; | |
328 | The arguments to pass to the tool executable. You can refer to the files |
|
328 | The arguments to pass to the tool executable. You can refer to the files | |
329 | being merged as well as the output file through these variables: $base, |
|
329 | being merged as well as the output file through these variables: $base, | |
330 | $local, $other, $output. |
|
330 | $local, $other, $output. | |
331 | Default: $local $base $other |
|
331 | Default: $local $base $other | |
332 | premerge;; |
|
332 | premerge;; | |
333 | Attempt to run internal non-interactive 3-way merge tool before |
|
333 | Attempt to run internal non-interactive 3-way merge tool before | |
334 | launching external tool. |
|
334 | launching external tool. | |
335 | Default: True |
|
335 | Default: True | |
336 | binary;; |
|
336 | binary;; | |
337 | This tool can merge binary files. Defaults to False, unless tool |
|
337 | This tool can merge binary files. Defaults to False, unless tool | |
338 | was selected by file pattern match. |
|
338 | was selected by file pattern match. | |
339 | symlink;; |
|
339 | symlink;; | |
340 | This tool can merge symlinks. Defaults to False, even if tool was |
|
340 | This tool can merge symlinks. Defaults to False, even if tool was | |
341 | selected by file pattern match. |
|
341 | selected by file pattern match. | |
342 | checkconflicts;; |
|
342 | checkconflicts;; | |
343 | Check whether there are conflicts even though the tool reported |
|
343 | Check whether there are conflicts even though the tool reported | |
344 | success. |
|
344 | success. | |
345 | Default: False |
|
345 | Default: False | |
346 | checkchanged;; |
|
346 | checkchanged;; | |
347 | Check whether outputs were written even though the tool reported |
|
347 | Check whether outputs were written even though the tool reported | |
348 | success. |
|
348 | success. | |
349 | Default: False |
|
349 | Default: False | |
350 | fixeol;; |
|
350 | fixeol;; | |
351 | Attempt to fix up EOL changes caused by the merge tool. |
|
351 | Attempt to fix up EOL changes caused by the merge tool. | |
352 | Default: False |
|
352 | Default: False | |
353 | gui;; |
|
353 | gui;; | |
354 | This tool requires a graphical interface to run. Default: False |
|
354 | This tool requires a graphical interface to run. Default: False | |
355 | regkey;; |
|
355 | regkey;; | |
356 | Windows registry key which describes install location of this tool. |
|
356 | Windows registry key which describes install location of this tool. | |
357 | Mercurial will search for this key first under HKEY_CURRENT_USER and |
|
357 | Mercurial will search for this key first under HKEY_CURRENT_USER and | |
358 | then under HKEY_LOCAL_MACHINE. Default: None |
|
358 | then under HKEY_LOCAL_MACHINE. Default: None | |
359 | regname;; |
|
359 | regname;; | |
360 | Name of value to read from specified registry key. Defaults to the |
|
360 | Name of value to read from specified registry key. Defaults to the | |
361 | unnamed (default) value. |
|
361 | unnamed (default) value. | |
362 | regappend;; |
|
362 | regappend;; | |
363 | String to append to the value read from the registry, typically the |
|
363 | String to append to the value read from the registry, typically the | |
364 | executable name of the tool. Default: None |
|
364 | executable name of the tool. Default: None | |
365 |
|
365 | |||
366 | [[hooks]] |
|
366 | [[hooks]] | |
367 | hooks:: |
|
367 | hooks:: | |
368 | Commands or Python functions that get automatically executed by |
|
368 | Commands or Python functions that get automatically executed by | |
369 | various actions such as starting or finishing a commit. Multiple |
|
369 | various actions such as starting or finishing a commit. Multiple | |
370 | hooks can be run for the same action by appending a suffix to the |
|
370 | hooks can be run for the same action by appending a suffix to the | |
371 | action. Overriding a site-wide hook can be done by changing its |
|
371 | action. Overriding a site-wide hook can be done by changing its | |
372 | value or setting it to an empty string. |
|
372 | value or setting it to an empty string. | |
373 |
|
373 | |||
374 | Example .hg/hgrc: |
|
374 | Example .hg/hgrc: | |
375 |
|
375 | |||
376 | [hooks] |
|
376 | [hooks] | |
377 | # do not use the site-wide hook |
|
377 | # do not use the site-wide hook | |
378 | incoming = |
|
378 | incoming = | |
379 | incoming.email = /my/email/hook |
|
379 | incoming.email = /my/email/hook | |
380 | incoming.autobuild = /my/build/hook |
|
380 | incoming.autobuild = /my/build/hook | |
381 |
|
381 | |||
382 | Most hooks are run with environment variables set that give added |
|
382 | Most hooks are run with environment variables set that give added | |
383 | useful information. For each hook below, the environment variables |
|
383 | useful information. For each hook below, the environment variables | |
384 | it is passed are listed with names of the form "$HG_foo". |
|
384 | it is passed are listed with names of the form "$HG_foo". | |
385 |
|
385 | |||
386 | changegroup;; |
|
386 | changegroup;; | |
387 | Run after a changegroup has been added via push, pull or |
|
387 | Run after a changegroup has been added via push, pull or | |
388 | unbundle. ID of the first new changeset is in $HG_NODE. URL from |
|
388 | unbundle. ID of the first new changeset is in $HG_NODE. URL from | |
389 | which changes came is in $HG_URL. |
|
389 | which changes came is in $HG_URL. | |
390 | commit;; |
|
390 | commit;; | |
391 | Run after a changeset has been created in the local repository. |
|
391 | Run after a changeset has been created in the local repository. | |
392 | ID of the newly created changeset is in $HG_NODE. Parent |
|
392 | ID of the newly created changeset is in $HG_NODE. Parent | |
393 | changeset IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
393 | changeset IDs are in $HG_PARENT1 and $HG_PARENT2. | |
394 | incoming;; |
|
394 | incoming;; | |
395 | Run after a changeset has been pulled, pushed, or unbundled into |
|
395 | Run after a changeset has been pulled, pushed, or unbundled into | |
396 | the local repository. The ID of the newly arrived changeset is in |
|
396 | the local repository. The ID of the newly arrived changeset is in | |
397 | $HG_NODE. URL that was source of changes came is in $HG_URL. |
|
397 | $HG_NODE. URL that was source of changes came is in $HG_URL. | |
398 | outgoing;; |
|
398 | outgoing;; | |
399 | Run after sending changes from local repository to another. ID of |
|
399 | Run after sending changes from local repository to another. ID of | |
400 | first changeset sent is in $HG_NODE. Source of operation is in |
|
400 | first changeset sent is in $HG_NODE. Source of operation is in | |
401 | $HG_SOURCE; see "preoutgoing" hook for description. |
|
401 | $HG_SOURCE; see "preoutgoing" hook for description. | |
402 | post-<command>;; |
|
402 | post-<command>;; | |
403 | Run after successful invocations of the associated command. The |
|
403 | Run after successful invocations of the associated command. The | |
404 | contents of the command line are passed as $HG_ARGS and the result |
|
404 | contents of the command line are passed as $HG_ARGS and the result | |
405 | code in $HG_RESULT. Hook failure is ignored. |
|
405 | code in $HG_RESULT. Hook failure is ignored. | |
406 | pre-<command>;; |
|
406 | pre-<command>;; | |
407 | Run before executing the associated command. The contents of the |
|
407 | Run before executing the associated command. The contents of the | |
408 | command line are passed as $HG_ARGS. If the hook returns failure, |
|
408 | command line are passed as $HG_ARGS. If the hook returns failure, | |
409 | the command doesn't execute and Mercurial returns the failure code. |
|
409 | the command doesn't execute and Mercurial returns the failure code. | |
410 | prechangegroup;; |
|
410 | prechangegroup;; | |
411 | Run before a changegroup is added via push, pull or unbundle. |
|
411 | Run before a changegroup is added via push, pull or unbundle. | |
412 | Exit status 0 allows the changegroup to proceed. Non-zero status |
|
412 | Exit status 0 allows the changegroup to proceed. Non-zero status | |
413 | will cause the push, pull or unbundle to fail. URL from which |
|
413 | will cause the push, pull or unbundle to fail. URL from which | |
414 | changes will come is in $HG_URL. |
|
414 | changes will come is in $HG_URL. | |
415 | precommit;; |
|
415 | precommit;; | |
416 | Run before starting a local commit. Exit status 0 allows the |
|
416 | Run before starting a local commit. Exit status 0 allows the | |
417 | commit to proceed. Non-zero status will cause the commit to fail. |
|
417 | commit to proceed. Non-zero status will cause the commit to fail. | |
418 | Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
418 | Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2. | |
419 | preoutgoing;; |
|
419 | preoutgoing;; | |
420 | Run before collecting changes to send from the local repository to |
|
420 | Run before collecting changes to send from the local repository to | |
421 | another. Non-zero status will cause failure. This lets you |
|
421 | another. Non-zero status will cause failure. This lets you | |
422 | prevent pull over http or ssh. Also prevents against local pull, |
|
422 | prevent pull over http or ssh. Also prevents against local pull, | |
423 | push (outbound) or bundle commands, but not effective, since you |
|
423 | push (outbound) or bundle commands, but not effective, since you | |
424 | can just copy files instead then. Source of operation is in |
|
424 | can just copy files instead then. Source of operation is in | |
425 | $HG_SOURCE. If "serve", operation is happening on behalf of |
|
425 | $HG_SOURCE. If "serve", operation is happening on behalf of | |
426 | remote ssh or http repository. If "push", "pull" or "bundle", |
|
426 | remote ssh or http repository. If "push", "pull" or "bundle", | |
427 | operation is happening on behalf of repository on same system. |
|
427 | operation is happening on behalf of repository on same system. | |
428 | pretag;; |
|
428 | pretag;; | |
429 | Run before creating a tag. Exit status 0 allows the tag to be |
|
429 | Run before creating a tag. Exit status 0 allows the tag to be | |
430 | created. Non-zero status will cause the tag to fail. ID of |
|
430 | created. Non-zero status will cause the tag to fail. ID of | |
431 | changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag |
|
431 | changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag | |
432 | is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
432 | is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. | |
433 | pretxnchangegroup;; |
|
433 | pretxnchangegroup;; | |
434 | Run after a changegroup has been added via push, pull or unbundle, |
|
434 | Run after a changegroup has been added via push, pull or unbundle, | |
435 | but before the transaction has been committed. Changegroup is |
|
435 | but before the transaction has been committed. Changegroup is | |
436 | visible to hook program. This lets you validate incoming changes |
|
436 | visible to hook program. This lets you validate incoming changes | |
437 | before accepting them. Passed the ID of the first new changeset |
|
437 | before accepting them. Passed the ID of the first new changeset | |
438 | in $HG_NODE. Exit status 0 allows the transaction to commit. |
|
438 | in $HG_NODE. Exit status 0 allows the transaction to commit. | |
439 | Non-zero status will cause the transaction to be rolled back and |
|
439 | Non-zero status will cause the transaction to be rolled back and | |
440 | the push, pull or unbundle will fail. URL that was source of |
|
440 | the push, pull or unbundle will fail. URL that was source of | |
441 | changes is in $HG_URL. |
|
441 | changes is in $HG_URL. | |
442 | pretxncommit;; |
|
442 | pretxncommit;; | |
443 | Run after a changeset has been created but the transaction not yet |
|
443 | Run after a changeset has been created but the transaction not yet | |
444 | committed. Changeset is visible to hook program. This lets you |
|
444 | committed. Changeset is visible to hook program. This lets you | |
445 | validate commit message and changes. Exit status 0 allows the |
|
445 | validate commit message and changes. Exit status 0 allows the | |
446 | commit to proceed. Non-zero status will cause the transaction to |
|
446 | commit to proceed. Non-zero status will cause the transaction to | |
447 | be rolled back. ID of changeset is in $HG_NODE. Parent changeset |
|
447 | be rolled back. ID of changeset is in $HG_NODE. Parent changeset | |
448 | IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
448 | IDs are in $HG_PARENT1 and $HG_PARENT2. | |
449 | preupdate;; |
|
449 | preupdate;; | |
450 | Run before updating the working directory. Exit status 0 allows |
|
450 | Run before updating the working directory. Exit status 0 allows | |
451 | the update to proceed. Non-zero status will prevent the update. |
|
451 | the update to proceed. Non-zero status will prevent the update. | |
452 | Changeset ID of first new parent is in $HG_PARENT1. If merge, ID |
|
452 | Changeset ID of first new parent is in $HG_PARENT1. If merge, ID | |
453 | of second new parent is in $HG_PARENT2. |
|
453 | of second new parent is in $HG_PARENT2. | |
454 | tag;; |
|
454 | tag;; | |
455 | Run after a tag is created. ID of tagged changeset is in |
|
455 | Run after a tag is created. ID of tagged changeset is in | |
456 | $HG_NODE. Name of tag is in $HG_TAG. Tag is local if |
|
456 | $HG_NODE. Name of tag is in $HG_TAG. Tag is local if | |
457 | $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
457 | $HG_LOCAL=1, in repo if $HG_LOCAL=0. | |
458 | update;; |
|
458 | update;; | |
459 | Run after updating the working directory. Changeset ID of first |
|
459 | Run after updating the working directory. Changeset ID of first | |
460 | new parent is in $HG_PARENT1. If merge, ID of second new parent |
|
460 | new parent is in $HG_PARENT1. If merge, ID of second new parent | |
461 | is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update |
|
461 | is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update | |
462 | failed (e.g. because conflicts not resolved), $HG_ERROR=1. |
|
462 | failed (e.g. because conflicts not resolved), $HG_ERROR=1. | |
463 |
|
463 | |||
464 | Note: it is generally better to use standard hooks rather than the |
|
464 | Note: it is generally better to use standard hooks rather than the | |
465 | generic pre- and post- command hooks as they are guaranteed to be |
|
465 | generic pre- and post- command hooks as they are guaranteed to be | |
466 | called in the appropriate contexts for influencing transactions. |
|
466 | called in the appropriate contexts for influencing transactions. | |
467 | Also, hooks like "commit" will be called in all contexts that |
|
467 | Also, hooks like "commit" will be called in all contexts that | |
468 | generate a commit (eg. tag) and not just the commit command. |
|
468 | generate a commit (eg. tag) and not just the commit command. | |
469 |
|
469 | |||
470 | Note2: Environment variables with empty values may not be passed to |
|
470 | Note2: Environment variables with empty values may not be passed to | |
471 | hooks on platforms like Windows. For instance, $HG_PARENT2 will |
|
471 | hooks on platforms like Windows. For instance, $HG_PARENT2 will | |
472 | not be available under Windows for non-merge changesets while being |
|
472 | not be available under Windows for non-merge changesets while being | |
473 | set to an empty value under Unix-like systems. |
|
473 | set to an empty value under Unix-like systems. | |
474 |
|
474 | |||
475 | The syntax for Python hooks is as follows: |
|
475 | The syntax for Python hooks is as follows: | |
476 |
|
476 | |||
477 | hookname = python:modulename.submodule.callable |
|
477 | hookname = python:modulename.submodule.callable | |
478 | hookname = python:/path/to/python/module.py:callable |
|
478 | hookname = python:/path/to/python/module.py:callable | |
479 |
|
479 | |||
480 | Python hooks are run within the Mercurial process. Each hook is |
|
480 | Python hooks are run within the Mercurial process. Each hook is | |
481 | called with at least three keyword arguments: a ui object (keyword |
|
481 | called with at least three keyword arguments: a ui object (keyword | |
482 | "ui"), a repository object (keyword "repo"), and a "hooktype" |
|
482 | "ui"), a repository object (keyword "repo"), and a "hooktype" | |
483 | keyword that tells what kind of hook is used. Arguments listed as |
|
483 | keyword that tells what kind of hook is used. Arguments listed as | |
484 | environment variables above are passed as keyword arguments, with no |
|
484 | environment variables above are passed as keyword arguments, with no | |
485 | "HG_" prefix, and names in lower case. |
|
485 | "HG_" prefix, and names in lower case. | |
486 |
|
486 | |||
487 | If a Python hook returns a "true" value or raises an exception, this |
|
487 | If a Python hook returns a "true" value or raises an exception, this | |
488 | is treated as failure of the hook. |
|
488 | is treated as failure of the hook. | |
489 |
|
489 | |||
490 | [[http_proxy]] |
|
490 | [[http_proxy]] | |
491 | http_proxy:: |
|
491 | http_proxy:: | |
492 | Used to access web-based Mercurial repositories through a HTTP |
|
492 | Used to access web-based Mercurial repositories through a HTTP | |
493 | proxy. |
|
493 | proxy. | |
494 | host;; |
|
494 | host;; | |
495 | Host name and (optional) port of the proxy server, for example |
|
495 | Host name and (optional) port of the proxy server, for example | |
496 | "myproxy:8000". |
|
496 | "myproxy:8000". | |
497 | no;; |
|
497 | no;; | |
498 | Optional. Comma-separated list of host names that should bypass |
|
498 | Optional. Comma-separated list of host names that should bypass | |
499 | the proxy. |
|
499 | the proxy. | |
500 | passwd;; |
|
500 | passwd;; | |
501 | Optional. Password to authenticate with at the proxy server. |
|
501 | Optional. Password to authenticate with at the proxy server. | |
502 | user;; |
|
502 | user;; | |
503 | Optional. User name to authenticate with at the proxy server. |
|
503 | Optional. User name to authenticate with at the proxy server. | |
504 |
|
504 | |||
505 | [[smtp]] |
|
505 | [[smtp]] | |
506 | smtp:: |
|
506 | smtp:: | |
507 | Configuration for extensions that need to send email messages. |
|
507 | Configuration for extensions that need to send email messages. | |
508 | host;; |
|
508 | host;; | |
509 | Host name of mail server, e.g. "mail.example.com". |
|
509 | Host name of mail server, e.g. "mail.example.com". | |
510 | port;; |
|
510 | port;; | |
511 | Optional. Port to connect to on mail server. Default: 25. |
|
511 | Optional. Port to connect to on mail server. Default: 25. | |
512 | tls;; |
|
512 | tls;; | |
513 | Optional. Whether to connect to mail server using TLS. True or |
|
513 | Optional. Whether to connect to mail server using TLS. True or | |
514 | False. Default: False. |
|
514 | False. Default: False. | |
515 | username;; |
|
515 | username;; | |
516 | Optional. User name to authenticate to SMTP server with. |
|
516 | Optional. User name to authenticate to SMTP server with. | |
517 | If username is specified, password must also be specified. |
|
517 | If username is specified, password must also be specified. | |
518 | Default: none. |
|
518 | Default: none. | |
519 | password;; |
|
519 | password;; | |
520 | Optional. Password to authenticate to SMTP server with. |
|
520 | Optional. Password to authenticate to SMTP server with. | |
521 | If username is specified, password must also be specified. |
|
521 | If username is specified, password must also be specified. | |
522 | Default: none. |
|
522 | Default: none. | |
523 | local_hostname;; |
|
523 | local_hostname;; | |
524 | Optional. It's the hostname that the sender can use to identify itself |
|
524 | Optional. It's the hostname that the sender can use to identify itself | |
525 | to the MTA. |
|
525 | to the MTA. | |
526 |
|
526 | |||
527 | [[paths]] |
|
527 | [[paths]] | |
528 | paths:: |
|
528 | paths:: | |
529 | Assigns symbolic names to repositories. The left side is the |
|
529 | Assigns symbolic names to repositories. The left side is the | |
530 | symbolic name, and the right gives the directory or URL that is the |
|
530 | symbolic name, and the right gives the directory or URL that is the | |
531 | location of the repository. Default paths can be declared by |
|
531 | location of the repository. Default paths can be declared by | |
532 | setting the following entries. |
|
532 | setting the following entries. | |
533 | default;; |
|
533 | default;; | |
534 | Directory or URL to use when pulling if no source is specified. |
|
534 | Directory or URL to use when pulling if no source is specified. | |
535 | Default is set to repository from which the current repository |
|
535 | Default is set to repository from which the current repository | |
536 | was cloned. |
|
536 | was cloned. | |
537 | default-push;; |
|
537 | default-push;; | |
538 | Optional. Directory or URL to use when pushing if no destination |
|
538 | Optional. Directory or URL to use when pushing if no destination | |
539 | is specified. |
|
539 | is specified. | |
540 |
|
540 | |||
|
541 | [[profiling]] | |||
|
542 | profiling:: | |||
|
543 | Specifies profiling format and file output. | |||
|
544 | In this section description, 'profiling data' stands for the raw data | |||
|
545 | collected during profiling, while 'profiling report' stands for a | |||
|
546 | statistical text report generated from the profiling data. | |||
|
547 | The profiling is done using lsprof. | |||
|
548 | output;; | |||
|
549 | File path where profiling data or report should be saved. | |||
|
550 | If the file exists, it is replaced. | |||
|
551 | Default: None, data is printed on stderr | |||
|
552 | ||||
541 | [[server]] |
|
553 | [[server]] | |
542 | server:: |
|
554 | server:: | |
543 | Controls generic server settings. |
|
555 | Controls generic server settings. | |
544 | uncompressed;; |
|
556 | uncompressed;; | |
545 | Whether to allow clients to clone a repo using the uncompressed |
|
557 | Whether to allow clients to clone a repo using the uncompressed | |
546 | streaming protocol. This transfers about 40% more data than a |
|
558 | streaming protocol. This transfers about 40% more data than a | |
547 | regular clone, but uses less memory and CPU on both server and |
|
559 | regular clone, but uses less memory and CPU on both server and | |
548 | client. Over a LAN (100Mbps or better) or a very fast WAN, an |
|
560 | client. Over a LAN (100Mbps or better) or a very fast WAN, an | |
549 | uncompressed streaming clone is a lot faster (~10x) than a regular |
|
561 | uncompressed streaming clone is a lot faster (~10x) than a regular | |
550 | clone. Over most WAN connections (anything slower than about |
|
562 | clone. Over most WAN connections (anything slower than about | |
551 | 6Mbps), uncompressed streaming is slower, because of the extra |
|
563 | 6Mbps), uncompressed streaming is slower, because of the extra | |
552 | data transfer overhead. Default is False. |
|
564 | data transfer overhead. Default is False. | |
553 |
|
565 | |||
554 | [[trusted]] |
|
566 | [[trusted]] | |
555 | trusted:: |
|
567 | trusted:: | |
556 | For security reasons, Mercurial will not use the settings in |
|
568 | For security reasons, Mercurial will not use the settings in | |
557 | the .hg/hgrc file from a repository if it doesn't belong to a |
|
569 | the .hg/hgrc file from a repository if it doesn't belong to a | |
558 | trusted user or to a trusted group. The main exception is the |
|
570 | trusted user or to a trusted group. The main exception is the | |
559 | web interface, which automatically uses some safe settings, since |
|
571 | web interface, which automatically uses some safe settings, since | |
560 | it's common to serve repositories from different users. |
|
572 | it's common to serve repositories from different users. | |
561 |
|
573 | |||
562 | This section specifies what users and groups are trusted. The |
|
574 | This section specifies what users and groups are trusted. The | |
563 | current user is always trusted. To trust everybody, list a user |
|
575 | current user is always trusted. To trust everybody, list a user | |
564 | or a group with name "*". |
|
576 | or a group with name "*". | |
565 |
|
577 | |||
566 | users;; |
|
578 | users;; | |
567 | Comma-separated list of trusted users. |
|
579 | Comma-separated list of trusted users. | |
568 | groups;; |
|
580 | groups;; | |
569 | Comma-separated list of trusted groups. |
|
581 | Comma-separated list of trusted groups. | |
570 |
|
582 | |||
571 | [[ui]] |
|
583 | [[ui]] | |
572 | ui:: |
|
584 | ui:: | |
573 | User interface controls. |
|
585 | User interface controls. | |
574 | archivemeta;; |
|
586 | archivemeta;; | |
575 | Whether to include the .hg_archival.txt file containing metadata |
|
587 | Whether to include the .hg_archival.txt file containing metadata | |
576 | (hashes for the repository base and for tip) in archives created by |
|
588 | (hashes for the repository base and for tip) in archives created by | |
577 | the hg archive command or downloaded via hgweb. |
|
589 | the hg archive command or downloaded via hgweb. | |
578 | Default is true. |
|
590 | Default is true. | |
579 | askusername;; |
|
591 | askusername;; | |
580 | Whether to prompt for a username when committing. If True, and |
|
592 | Whether to prompt for a username when committing. If True, and | |
581 | neither $HGUSER nor $EMAIL has been specified, then the user will |
|
593 | neither $HGUSER nor $EMAIL has been specified, then the user will | |
582 | be prompted to enter a username. If no username is entered, the |
|
594 | be prompted to enter a username. If no username is entered, the | |
583 | default USER@HOST is used instead. |
|
595 | default USER@HOST is used instead. | |
584 | Default is False. |
|
596 | Default is False. | |
585 | debug;; |
|
597 | debug;; | |
586 | Print debugging information. True or False. Default is False. |
|
598 | Print debugging information. True or False. Default is False. | |
587 | editor;; |
|
599 | editor;; | |
588 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
600 | The editor to use during a commit. Default is $EDITOR or "vi". | |
589 | fallbackencoding;; |
|
601 | fallbackencoding;; | |
590 | Encoding to try if it's not possible to decode the changelog using |
|
602 | Encoding to try if it's not possible to decode the changelog using | |
591 | UTF-8. Default is ISO-8859-1. |
|
603 | UTF-8. Default is ISO-8859-1. | |
592 | ignore;; |
|
604 | ignore;; | |
593 | A file to read per-user ignore patterns from. This file should be in |
|
605 | A file to read per-user ignore patterns from. This file should be in | |
594 | the same format as a repository-wide .hgignore file. This option |
|
606 | the same format as a repository-wide .hgignore file. This option | |
595 | supports hook syntax, so if you want to specify multiple ignore |
|
607 | supports hook syntax, so if you want to specify multiple ignore | |
596 | files, you can do so by setting something like |
|
608 | files, you can do so by setting something like | |
597 | "ignore.other = ~/.hgignore2". For details of the ignore file |
|
609 | "ignore.other = ~/.hgignore2". For details of the ignore file | |
598 | format, see the hgignore(5) man page. |
|
610 | format, see the hgignore(5) man page. | |
599 | interactive;; |
|
611 | interactive;; | |
600 | Allow to prompt the user. True or False. Default is True. |
|
612 | Allow to prompt the user. True or False. Default is True. | |
601 | logtemplate;; |
|
613 | logtemplate;; | |
602 | Template string for commands that print changesets. |
|
614 | Template string for commands that print changesets. | |
603 | merge;; |
|
615 | merge;; | |
604 | The conflict resolution program to use during a manual merge. |
|
616 | The conflict resolution program to use during a manual merge. | |
605 | There are some internal tools available: |
|
617 | There are some internal tools available: | |
606 |
|
618 | |||
607 | internal:local;; |
|
619 | internal:local;; | |
608 | keep the local version |
|
620 | keep the local version | |
609 | internal:other;; |
|
621 | internal:other;; | |
610 | use the other version |
|
622 | use the other version | |
611 | internal:merge;; |
|
623 | internal:merge;; | |
612 | use the internal non-interactive merge tool |
|
624 | use the internal non-interactive merge tool | |
613 | internal:fail;; |
|
625 | internal:fail;; | |
614 | fail to merge |
|
626 | fail to merge | |
615 |
|
627 | |||
616 | See the merge-tools section for more information on configuring tools. |
|
628 | See the merge-tools section for more information on configuring tools. | |
617 |
|
629 | |||
618 | patch;; |
|
630 | patch;; | |
619 | command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if |
|
631 | command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if | |
620 | unset. |
|
632 | unset. | |
621 | quiet;; |
|
633 | quiet;; | |
622 | Reduce the amount of output printed. True or False. Default is False. |
|
634 | Reduce the amount of output printed. True or False. Default is False. | |
623 | remotecmd;; |
|
635 | remotecmd;; | |
624 | remote command to use for clone/push/pull operations. Default is 'hg'. |
|
636 | remote command to use for clone/push/pull operations. Default is 'hg'. | |
625 | report_untrusted;; |
|
637 | report_untrusted;; | |
626 | Warn if a .hg/hgrc file is ignored due to not being owned by a |
|
638 | Warn if a .hg/hgrc file is ignored due to not being owned by a | |
627 | trusted user or group. True or False. Default is True. |
|
639 | trusted user or group. True or False. Default is True. | |
628 | slash;; |
|
640 | slash;; | |
629 | Display paths using a slash ("/") as the path separator. This only |
|
641 | Display paths using a slash ("/") as the path separator. This only | |
630 | makes a difference on systems where the default path separator is not |
|
642 | makes a difference on systems where the default path separator is not | |
631 | the slash character (e.g. Windows uses the backslash character ("\")). |
|
643 | the slash character (e.g. Windows uses the backslash character ("\")). | |
632 | Default is False. |
|
644 | Default is False. | |
633 | ssh;; |
|
645 | ssh;; | |
634 | command to use for SSH connections. Default is 'ssh'. |
|
646 | command to use for SSH connections. Default is 'ssh'. | |
635 | strict;; |
|
647 | strict;; | |
636 | Require exact command names, instead of allowing unambiguous |
|
648 | Require exact command names, instead of allowing unambiguous | |
637 | abbreviations. True or False. Default is False. |
|
649 | abbreviations. True or False. Default is False. | |
638 | style;; |
|
650 | style;; | |
639 | Name of style to use for command output. |
|
651 | Name of style to use for command output. | |
640 | timeout;; |
|
652 | timeout;; | |
641 | The timeout used when a lock is held (in seconds), a negative value |
|
653 | The timeout used when a lock is held (in seconds), a negative value | |
642 | means no timeout. Default is 600. |
|
654 | means no timeout. Default is 600. | |
643 | username;; |
|
655 | username;; | |
644 | The committer of a changeset created when running "commit". |
|
656 | The committer of a changeset created when running "commit". | |
645 | Typically a person's name and email address, e.g. "Fred Widget |
|
657 | Typically a person's name and email address, e.g. "Fred Widget | |
646 | <fred@example.com>". Default is $EMAIL or username@hostname. |
|
658 | <fred@example.com>". Default is $EMAIL or username@hostname. | |
647 | If the username in hgrc is empty, it has to be specified manually or |
|
659 | If the username in hgrc is empty, it has to be specified manually or | |
648 | in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username =" |
|
660 | in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username =" | |
649 | in the system hgrc). |
|
661 | in the system hgrc). | |
650 | verbose;; |
|
662 | verbose;; | |
651 | Increase the amount of output printed. True or False. Default is False. |
|
663 | Increase the amount of output printed. True or False. Default is False. | |
652 |
|
664 | |||
653 |
|
665 | |||
654 | [[web]] |
|
666 | [[web]] | |
655 | web:: |
|
667 | web:: | |
656 | Web interface configuration. |
|
668 | Web interface configuration. | |
657 | accesslog;; |
|
669 | accesslog;; | |
658 | Where to output the access log. Default is stdout. |
|
670 | Where to output the access log. Default is stdout. | |
659 | address;; |
|
671 | address;; | |
660 | Interface address to bind to. Default is all. |
|
672 | Interface address to bind to. Default is all. | |
661 | allow_archive;; |
|
673 | allow_archive;; | |
662 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
674 | List of archive format (bz2, gz, zip) allowed for downloading. | |
663 | Default is empty. |
|
675 | Default is empty. | |
664 | allowbz2;; |
|
676 | allowbz2;; | |
665 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions. |
|
677 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions. | |
666 | Default is false. |
|
678 | Default is false. | |
667 | allowgz;; |
|
679 | allowgz;; | |
668 | (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions. |
|
680 | (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions. | |
669 | Default is false. |
|
681 | Default is false. | |
670 | allowpull;; |
|
682 | allowpull;; | |
671 | Whether to allow pulling from the repository. Default is true. |
|
683 | Whether to allow pulling from the repository. Default is true. | |
672 | allow_push;; |
|
684 | allow_push;; | |
673 | Whether to allow pushing to the repository. If empty or not set, |
|
685 | Whether to allow pushing to the repository. If empty or not set, | |
674 | push is not allowed. If the special value "*", any remote user |
|
686 | push is not allowed. If the special value "*", any remote user | |
675 | can push, including unauthenticated users. Otherwise, the remote |
|
687 | can push, including unauthenticated users. Otherwise, the remote | |
676 | user must have been authenticated, and the authenticated user name |
|
688 | user must have been authenticated, and the authenticated user name | |
677 | must be present in this list (separated by whitespace or ","). |
|
689 | must be present in this list (separated by whitespace or ","). | |
678 | The contents of the allow_push list are examined after the |
|
690 | The contents of the allow_push list are examined after the | |
679 | deny_push list. |
|
691 | deny_push list. | |
680 | allow_read;; |
|
692 | allow_read;; | |
681 | If the user has not already been denied repository access due to the |
|
693 | If the user has not already been denied repository access due to the | |
682 | contents of deny_read, this list determines whether to grant repository |
|
694 | contents of deny_read, this list determines whether to grant repository | |
683 | access to the user. If this list is not empty, and the user is |
|
695 | access to the user. If this list is not empty, and the user is | |
684 | unauthenticated or not present in the list (separated by whitespace or ","), |
|
696 | unauthenticated or not present in the list (separated by whitespace or ","), | |
685 | then access is denied for the user. If the list is empty or not set, then |
|
697 | then access is denied for the user. If the list is empty or not set, then | |
686 | access is permitted to all users by default. Setting allow_read to the |
|
698 | access is permitted to all users by default. Setting allow_read to the | |
687 | special value "*" is equivalent to it not being set (i.e. access is |
|
699 | special value "*" is equivalent to it not being set (i.e. access is | |
688 | permitted to all users). The contents of the allow_read list are examined |
|
700 | permitted to all users). The contents of the allow_read list are examined | |
689 | after the deny_read list. |
|
701 | after the deny_read list. | |
690 | allowzip;; |
|
702 | allowzip;; | |
691 | (DEPRECATED) Whether to allow .zip downloading of repo revisions. |
|
703 | (DEPRECATED) Whether to allow .zip downloading of repo revisions. | |
692 | Default is false. This feature creates temporary files. |
|
704 | Default is false. This feature creates temporary files. | |
693 | baseurl;; |
|
705 | baseurl;; | |
694 | Base URL to use when publishing URLs in other locations, so |
|
706 | Base URL to use when publishing URLs in other locations, so | |
695 | third-party tools like email notification hooks can construct URLs. |
|
707 | third-party tools like email notification hooks can construct URLs. | |
696 | Example: "http://hgserver/repos/" |
|
708 | Example: "http://hgserver/repos/" | |
697 | contact;; |
|
709 | contact;; | |
698 | Name or email address of the person in charge of the repository. |
|
710 | Name or email address of the person in charge of the repository. | |
699 | Defaults to ui.username or $EMAIL or "unknown" if unset or empty. |
|
711 | Defaults to ui.username or $EMAIL or "unknown" if unset or empty. | |
700 | deny_push;; |
|
712 | deny_push;; | |
701 | Whether to deny pushing to the repository. If empty or not set, |
|
713 | Whether to deny pushing to the repository. If empty or not set, | |
702 | push is not denied. If the special value "*", all remote users |
|
714 | push is not denied. If the special value "*", all remote users | |
703 | are denied push. Otherwise, unauthenticated users are all denied, |
|
715 | are denied push. Otherwise, unauthenticated users are all denied, | |
704 | and any authenticated user name present in this list (separated by |
|
716 | and any authenticated user name present in this list (separated by | |
705 | whitespace or ",") is also denied. The contents of the deny_push |
|
717 | whitespace or ",") is also denied. The contents of the deny_push | |
706 | list are examined before the allow_push list. |
|
718 | list are examined before the allow_push list. | |
707 | deny_read;; |
|
719 | deny_read;; | |
708 | Whether to deny reading/viewing of the repository. If this list is not |
|
720 | Whether to deny reading/viewing of the repository. If this list is not | |
709 | empty, unauthenticated users are all denied, and any authenticated user name |
|
721 | empty, unauthenticated users are all denied, and any authenticated user name | |
710 | present in this list (separated by whitespace or ",") is also denied access |
|
722 | present in this list (separated by whitespace or ",") is also denied access | |
711 | to the repository. If set to the special value "*", all remote users are |
|
723 | to the repository. If set to the special value "*", all remote users are | |
712 | denied access (rarely needed ;). If deny_read is empty or not set, the |
|
724 | denied access (rarely needed ;). If deny_read is empty or not set, the | |
713 | determination of repository access depends on the presence and content of |
|
725 | determination of repository access depends on the presence and content of | |
714 | the allow_read list (see description). If both deny_read and allow_read are |
|
726 | the allow_read list (see description). If both deny_read and allow_read are | |
715 | empty or not set, then access is permitted to all users by default. If the |
|
727 | empty or not set, then access is permitted to all users by default. If the | |
716 | repository is being served via hgwebdir, denied users will not be able to |
|
728 | repository is being served via hgwebdir, denied users will not be able to | |
717 | see it in the list of repositories. The contents of the deny_read list have |
|
729 | see it in the list of repositories. The contents of the deny_read list have | |
718 | priority over (are examined before) the contents of the allow_read list. |
|
730 | priority over (are examined before) the contents of the allow_read list. | |
719 | description;; |
|
731 | description;; | |
720 | Textual description of the repository's purpose or contents. |
|
732 | Textual description of the repository's purpose or contents. | |
721 | Default is "unknown". |
|
733 | Default is "unknown". | |
722 | encoding;; |
|
734 | encoding;; | |
723 | Character encoding name. |
|
735 | Character encoding name. | |
724 | Example: "UTF-8" |
|
736 | Example: "UTF-8" | |
725 | errorlog;; |
|
737 | errorlog;; | |
726 | Where to output the error log. Default is stderr. |
|
738 | Where to output the error log. Default is stderr. | |
727 | hidden;; |
|
739 | hidden;; | |
728 | Whether to hide the repository in the hgwebdir index. Default is false. |
|
740 | Whether to hide the repository in the hgwebdir index. Default is false. | |
729 | ipv6;; |
|
741 | ipv6;; | |
730 | Whether to use IPv6. Default is false. |
|
742 | Whether to use IPv6. Default is false. | |
731 | name;; |
|
743 | name;; | |
732 | Repository name to use in the web interface. Default is current |
|
744 | Repository name to use in the web interface. Default is current | |
733 | working directory. |
|
745 | working directory. | |
734 | maxchanges;; |
|
746 | maxchanges;; | |
735 | Maximum number of changes to list on the changelog. Default is 10. |
|
747 | Maximum number of changes to list on the changelog. Default is 10. | |
736 | maxfiles;; |
|
748 | maxfiles;; | |
737 | Maximum number of files to list per changeset. Default is 10. |
|
749 | Maximum number of files to list per changeset. Default is 10. | |
738 | port;; |
|
750 | port;; | |
739 | Port to listen on. Default is 8000. |
|
751 | Port to listen on. Default is 8000. | |
740 | prefix;; |
|
752 | prefix;; | |
741 | Prefix path to serve from. Default is '' (server root). |
|
753 | Prefix path to serve from. Default is '' (server root). | |
742 | push_ssl;; |
|
754 | push_ssl;; | |
743 | Whether to require that inbound pushes be transported over SSL to |
|
755 | Whether to require that inbound pushes be transported over SSL to | |
744 | prevent password sniffing. Default is true. |
|
756 | prevent password sniffing. Default is true. | |
745 | staticurl;; |
|
757 | staticurl;; | |
746 | Base URL to use for static files. If unset, static files (e.g. |
|
758 | Base URL to use for static files. If unset, static files (e.g. | |
747 | the hgicon.png favicon) will be served by the CGI script itself. |
|
759 | the hgicon.png favicon) will be served by the CGI script itself. | |
748 | Use this setting to serve them directly with the HTTP server. |
|
760 | Use this setting to serve them directly with the HTTP server. | |
749 | Example: "http://hgserver/static/" |
|
761 | Example: "http://hgserver/static/" | |
750 | stripes;; |
|
762 | stripes;; | |
751 | How many lines a "zebra stripe" should span in multiline output. |
|
763 | How many lines a "zebra stripe" should span in multiline output. | |
752 | Default is 1; set to 0 to disable. |
|
764 | Default is 1; set to 0 to disable. | |
753 | style;; |
|
765 | style;; | |
754 | Which template map style to use. |
|
766 | Which template map style to use. | |
755 | templates;; |
|
767 | templates;; | |
756 | Where to find the HTML templates. Default is install path. |
|
768 | Where to find the HTML templates. Default is install path. | |
757 |
|
769 | |||
758 |
|
770 | |||
759 | AUTHOR |
|
771 | AUTHOR | |
760 | ------ |
|
772 | ------ | |
761 | Bryan O'Sullivan <bos@serpentine.com>. |
|
773 | Bryan O'Sullivan <bos@serpentine.com>. | |
762 |
|
774 | |||
763 | Mercurial was written by Matt Mackall <mpm@selenic.com>. |
|
775 | Mercurial was written by Matt Mackall <mpm@selenic.com>. | |
764 |
|
776 | |||
765 | SEE ALSO |
|
777 | SEE ALSO | |
766 | -------- |
|
778 | -------- | |
767 | hg(1), hgignore(5) |
|
779 | hg(1), hgignore(5) | |
768 |
|
780 | |||
769 | COPYING |
|
781 | COPYING | |
770 | ------- |
|
782 | ------- | |
771 | This manual page is copyright 2005 Bryan O'Sullivan. |
|
783 | This manual page is copyright 2005 Bryan O'Sullivan. | |
772 | Mercurial is copyright 2005-2007 Matt Mackall. |
|
784 | Mercurial is copyright 2005-2007 Matt Mackall. | |
773 | Free use of this software is granted under the terms of the GNU General |
|
785 | Free use of this software is granted under the terms of the GNU General | |
774 | Public License (GPL). |
|
786 | Public License (GPL). |
@@ -1,398 +1,410 | |||||
1 | # dispatch.py - command dispatching for mercurial |
|
1 | # dispatch.py - command dispatching for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms |
|
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 i18n import _ |
|
8 | from i18n import _ | |
9 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time |
|
9 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time | |
10 | import util, commands, hg, fancyopts, extensions, hook, error |
|
10 | import util, commands, hg, fancyopts, extensions, hook, error | |
11 | import cmdutil, encoding |
|
11 | import cmdutil, encoding | |
12 | import ui as _ui |
|
12 | import ui as _ui | |
13 |
|
13 | |||
14 | def run(): |
|
14 | def run(): | |
15 | "run the command in sys.argv" |
|
15 | "run the command in sys.argv" | |
16 | sys.exit(dispatch(sys.argv[1:])) |
|
16 | sys.exit(dispatch(sys.argv[1:])) | |
17 |
|
17 | |||
18 | def dispatch(args): |
|
18 | def dispatch(args): | |
19 | "run the command specified in args" |
|
19 | "run the command specified in args" | |
20 | try: |
|
20 | try: | |
21 | u = _ui.ui(traceback='--traceback' in args) |
|
21 | u = _ui.ui(traceback='--traceback' in args) | |
22 | except util.Abort, inst: |
|
22 | except util.Abort, inst: | |
23 | sys.stderr.write(_("abort: %s\n") % inst) |
|
23 | sys.stderr.write(_("abort: %s\n") % inst) | |
24 | return -1 |
|
24 | return -1 | |
25 | return _runcatch(u, args) |
|
25 | return _runcatch(u, args) | |
26 |
|
26 | |||
27 | def _runcatch(ui, args): |
|
27 | def _runcatch(ui, args): | |
28 | def catchterm(*args): |
|
28 | def catchterm(*args): | |
29 | raise error.SignalInterrupt |
|
29 | raise error.SignalInterrupt | |
30 |
|
30 | |||
31 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
31 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | |
32 | num = getattr(signal, name, None) |
|
32 | num = getattr(signal, name, None) | |
33 | if num: signal.signal(num, catchterm) |
|
33 | if num: signal.signal(num, catchterm) | |
34 |
|
34 | |||
35 | try: |
|
35 | try: | |
36 | try: |
|
36 | try: | |
37 | # enter the debugger before command execution |
|
37 | # enter the debugger before command execution | |
38 | if '--debugger' in args: |
|
38 | if '--debugger' in args: | |
39 | pdb.set_trace() |
|
39 | pdb.set_trace() | |
40 | try: |
|
40 | try: | |
41 | return _dispatch(ui, args) |
|
41 | return _dispatch(ui, args) | |
42 | finally: |
|
42 | finally: | |
43 | ui.flush() |
|
43 | ui.flush() | |
44 | except: |
|
44 | except: | |
45 | # enter the debugger when we hit an exception |
|
45 | # enter the debugger when we hit an exception | |
46 | if '--debugger' in args: |
|
46 | if '--debugger' in args: | |
47 | pdb.post_mortem(sys.exc_info()[2]) |
|
47 | pdb.post_mortem(sys.exc_info()[2]) | |
48 | ui.print_exc() |
|
48 | ui.print_exc() | |
49 | raise |
|
49 | raise | |
50 |
|
50 | |||
51 | # Global exception handling, alphabetically |
|
51 | # Global exception handling, alphabetically | |
52 | # Mercurial-specific first, followed by built-in and library exceptions |
|
52 | # Mercurial-specific first, followed by built-in and library exceptions | |
53 | except error.AmbiguousCommand, inst: |
|
53 | except error.AmbiguousCommand, inst: | |
54 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
54 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % | |
55 | (inst.args[0], " ".join(inst.args[1]))) |
|
55 | (inst.args[0], " ".join(inst.args[1]))) | |
56 | except error.LockHeld, inst: |
|
56 | except error.LockHeld, inst: | |
57 | if inst.errno == errno.ETIMEDOUT: |
|
57 | if inst.errno == errno.ETIMEDOUT: | |
58 | reason = _('timed out waiting for lock held by %s') % inst.locker |
|
58 | reason = _('timed out waiting for lock held by %s') % inst.locker | |
59 | else: |
|
59 | else: | |
60 | reason = _('lock held by %s') % inst.locker |
|
60 | reason = _('lock held by %s') % inst.locker | |
61 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
|
61 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) | |
62 | except error.LockUnavailable, inst: |
|
62 | except error.LockUnavailable, inst: | |
63 | ui.warn(_("abort: could not lock %s: %s\n") % |
|
63 | ui.warn(_("abort: could not lock %s: %s\n") % | |
64 | (inst.desc or inst.filename, inst.strerror)) |
|
64 | (inst.desc or inst.filename, inst.strerror)) | |
65 | except error.ParseError, inst: |
|
65 | except error.ParseError, inst: | |
66 | if inst.args[0]: |
|
66 | if inst.args[0]: | |
67 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
|
67 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) | |
68 | commands.help_(ui, inst.args[0]) |
|
68 | commands.help_(ui, inst.args[0]) | |
69 | else: |
|
69 | else: | |
70 | ui.warn(_("hg: %s\n") % inst.args[1]) |
|
70 | ui.warn(_("hg: %s\n") % inst.args[1]) | |
71 | commands.help_(ui, 'shortlist') |
|
71 | commands.help_(ui, 'shortlist') | |
72 | except error.RepoError, inst: |
|
72 | except error.RepoError, inst: | |
73 | ui.warn(_("abort: %s!\n") % inst) |
|
73 | ui.warn(_("abort: %s!\n") % inst) | |
74 | except error.ResponseError, inst: |
|
74 | except error.ResponseError, inst: | |
75 | ui.warn(_("abort: %s") % inst.args[0]) |
|
75 | ui.warn(_("abort: %s") % inst.args[0]) | |
76 | if not isinstance(inst.args[1], basestring): |
|
76 | if not isinstance(inst.args[1], basestring): | |
77 | ui.warn(" %r\n" % (inst.args[1],)) |
|
77 | ui.warn(" %r\n" % (inst.args[1],)) | |
78 | elif not inst.args[1]: |
|
78 | elif not inst.args[1]: | |
79 | ui.warn(_(" empty string\n")) |
|
79 | ui.warn(_(" empty string\n")) | |
80 | else: |
|
80 | else: | |
81 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) |
|
81 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) | |
82 | except error.RevlogError, inst: |
|
82 | except error.RevlogError, inst: | |
83 | ui.warn(_("abort: %s!\n") % inst) |
|
83 | ui.warn(_("abort: %s!\n") % inst) | |
84 | except error.SignalInterrupt: |
|
84 | except error.SignalInterrupt: | |
85 | ui.warn(_("killed!\n")) |
|
85 | ui.warn(_("killed!\n")) | |
86 | except error.UnknownCommand, inst: |
|
86 | except error.UnknownCommand, inst: | |
87 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
|
87 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) | |
88 | commands.help_(ui, 'shortlist') |
|
88 | commands.help_(ui, 'shortlist') | |
89 | except util.Abort, inst: |
|
89 | except util.Abort, inst: | |
90 | ui.warn(_("abort: %s\n") % inst) |
|
90 | ui.warn(_("abort: %s\n") % inst) | |
91 | except ImportError, inst: |
|
91 | except ImportError, inst: | |
92 | m = str(inst).split()[-1] |
|
92 | m = str(inst).split()[-1] | |
93 | ui.warn(_("abort: could not import module %s!\n") % m) |
|
93 | ui.warn(_("abort: could not import module %s!\n") % m) | |
94 | if m in "mpatch bdiff".split(): |
|
94 | if m in "mpatch bdiff".split(): | |
95 | ui.warn(_("(did you forget to compile extensions?)\n")) |
|
95 | ui.warn(_("(did you forget to compile extensions?)\n")) | |
96 | elif m in "zlib".split(): |
|
96 | elif m in "zlib".split(): | |
97 | ui.warn(_("(is your Python install correct?)\n")) |
|
97 | ui.warn(_("(is your Python install correct?)\n")) | |
98 | except IOError, inst: |
|
98 | except IOError, inst: | |
99 | if hasattr(inst, "code"): |
|
99 | if hasattr(inst, "code"): | |
100 | ui.warn(_("abort: %s\n") % inst) |
|
100 | ui.warn(_("abort: %s\n") % inst) | |
101 | elif hasattr(inst, "reason"): |
|
101 | elif hasattr(inst, "reason"): | |
102 | try: # usually it is in the form (errno, strerror) |
|
102 | try: # usually it is in the form (errno, strerror) | |
103 | reason = inst.reason.args[1] |
|
103 | reason = inst.reason.args[1] | |
104 | except: # it might be anything, for example a string |
|
104 | except: # it might be anything, for example a string | |
105 | reason = inst.reason |
|
105 | reason = inst.reason | |
106 | ui.warn(_("abort: error: %s\n") % reason) |
|
106 | ui.warn(_("abort: error: %s\n") % reason) | |
107 | elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE: |
|
107 | elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE: | |
108 | if ui.debugflag: |
|
108 | if ui.debugflag: | |
109 | ui.warn(_("broken pipe\n")) |
|
109 | ui.warn(_("broken pipe\n")) | |
110 | elif getattr(inst, "strerror", None): |
|
110 | elif getattr(inst, "strerror", None): | |
111 | if getattr(inst, "filename", None): |
|
111 | if getattr(inst, "filename", None): | |
112 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
112 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
113 | else: |
|
113 | else: | |
114 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
114 | ui.warn(_("abort: %s\n") % inst.strerror) | |
115 | else: |
|
115 | else: | |
116 | raise |
|
116 | raise | |
117 | except OSError, inst: |
|
117 | except OSError, inst: | |
118 | if getattr(inst, "filename", None): |
|
118 | if getattr(inst, "filename", None): | |
119 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
119 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
120 | else: |
|
120 | else: | |
121 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
121 | ui.warn(_("abort: %s\n") % inst.strerror) | |
122 | except KeyboardInterrupt: |
|
122 | except KeyboardInterrupt: | |
123 | try: |
|
123 | try: | |
124 | ui.warn(_("interrupted!\n")) |
|
124 | ui.warn(_("interrupted!\n")) | |
125 | except IOError, inst: |
|
125 | except IOError, inst: | |
126 | if inst.errno == errno.EPIPE: |
|
126 | if inst.errno == errno.EPIPE: | |
127 | if ui.debugflag: |
|
127 | if ui.debugflag: | |
128 | ui.warn(_("\nbroken pipe\n")) |
|
128 | ui.warn(_("\nbroken pipe\n")) | |
129 | else: |
|
129 | else: | |
130 | raise |
|
130 | raise | |
131 | except MemoryError: |
|
131 | except MemoryError: | |
132 | ui.warn(_("abort: out of memory\n")) |
|
132 | ui.warn(_("abort: out of memory\n")) | |
133 | except SystemExit, inst: |
|
133 | except SystemExit, inst: | |
134 | # Commands shouldn't sys.exit directly, but give a return code. |
|
134 | # Commands shouldn't sys.exit directly, but give a return code. | |
135 | # Just in case catch this and and pass exit code to caller. |
|
135 | # Just in case catch this and and pass exit code to caller. | |
136 | return inst.code |
|
136 | return inst.code | |
137 | except socket.error, inst: |
|
137 | except socket.error, inst: | |
138 | ui.warn(_("abort: %s\n") % inst.args[-1]) |
|
138 | ui.warn(_("abort: %s\n") % inst.args[-1]) | |
139 | except: |
|
139 | except: | |
140 | ui.warn(_("** unknown exception encountered, details follow\n")) |
|
140 | ui.warn(_("** unknown exception encountered, details follow\n")) | |
141 | ui.warn(_("** report bug details to " |
|
141 | ui.warn(_("** report bug details to " | |
142 | "http://www.selenic.com/mercurial/bts\n")) |
|
142 | "http://www.selenic.com/mercurial/bts\n")) | |
143 | ui.warn(_("** or mercurial@selenic.com\n")) |
|
143 | ui.warn(_("** or mercurial@selenic.com\n")) | |
144 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") |
|
144 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") | |
145 | % util.version()) |
|
145 | % util.version()) | |
146 | ui.warn(_("** Extensions loaded: %s\n") |
|
146 | ui.warn(_("** Extensions loaded: %s\n") | |
147 | % ", ".join([x[0] for x in extensions.extensions()])) |
|
147 | % ", ".join([x[0] for x in extensions.extensions()])) | |
148 | raise |
|
148 | raise | |
149 |
|
149 | |||
150 | return -1 |
|
150 | return -1 | |
151 |
|
151 | |||
152 | def _findrepo(p): |
|
152 | def _findrepo(p): | |
153 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
153 | while not os.path.isdir(os.path.join(p, ".hg")): | |
154 | oldp, p = p, os.path.dirname(p) |
|
154 | oldp, p = p, os.path.dirname(p) | |
155 | if p == oldp: |
|
155 | if p == oldp: | |
156 | return None |
|
156 | return None | |
157 |
|
157 | |||
158 | return p |
|
158 | return p | |
159 |
|
159 | |||
160 | def _parse(ui, args): |
|
160 | def _parse(ui, args): | |
161 | options = {} |
|
161 | options = {} | |
162 | cmdoptions = {} |
|
162 | cmdoptions = {} | |
163 |
|
163 | |||
164 | try: |
|
164 | try: | |
165 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
165 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
166 | except fancyopts.getopt.GetoptError, inst: |
|
166 | except fancyopts.getopt.GetoptError, inst: | |
167 | raise error.ParseError(None, inst) |
|
167 | raise error.ParseError(None, inst) | |
168 |
|
168 | |||
169 | if args: |
|
169 | if args: | |
170 | cmd, args = args[0], args[1:] |
|
170 | cmd, args = args[0], args[1:] | |
171 | aliases, i = cmdutil.findcmd(cmd, commands.table, |
|
171 | aliases, i = cmdutil.findcmd(cmd, commands.table, | |
172 | ui.config("ui", "strict")) |
|
172 | ui.config("ui", "strict")) | |
173 | cmd = aliases[0] |
|
173 | cmd = aliases[0] | |
174 | defaults = ui.config("defaults", cmd) |
|
174 | defaults = ui.config("defaults", cmd) | |
175 | if defaults: |
|
175 | if defaults: | |
176 | args = shlex.split(defaults) + args |
|
176 | args = shlex.split(defaults) + args | |
177 | c = list(i[1]) |
|
177 | c = list(i[1]) | |
178 | else: |
|
178 | else: | |
179 | cmd = None |
|
179 | cmd = None | |
180 | c = [] |
|
180 | c = [] | |
181 |
|
181 | |||
182 | # combine global options into local |
|
182 | # combine global options into local | |
183 | for o in commands.globalopts: |
|
183 | for o in commands.globalopts: | |
184 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
184 | c.append((o[0], o[1], options[o[1]], o[3])) | |
185 |
|
185 | |||
186 | try: |
|
186 | try: | |
187 | args = fancyopts.fancyopts(args, c, cmdoptions, True) |
|
187 | args = fancyopts.fancyopts(args, c, cmdoptions, True) | |
188 | except fancyopts.getopt.GetoptError, inst: |
|
188 | except fancyopts.getopt.GetoptError, inst: | |
189 | raise error.ParseError(cmd, inst) |
|
189 | raise error.ParseError(cmd, inst) | |
190 |
|
190 | |||
191 | # separate global options back out |
|
191 | # separate global options back out | |
192 | for o in commands.globalopts: |
|
192 | for o in commands.globalopts: | |
193 | n = o[1] |
|
193 | n = o[1] | |
194 | options[n] = cmdoptions[n] |
|
194 | options[n] = cmdoptions[n] | |
195 | del cmdoptions[n] |
|
195 | del cmdoptions[n] | |
196 |
|
196 | |||
197 | return (cmd, cmd and i[0] or None, args, options, cmdoptions) |
|
197 | return (cmd, cmd and i[0] or None, args, options, cmdoptions) | |
198 |
|
198 | |||
199 | def _parseconfig(config): |
|
199 | def _parseconfig(config): | |
200 | """parse the --config options from the command line""" |
|
200 | """parse the --config options from the command line""" | |
201 | parsed = [] |
|
201 | parsed = [] | |
202 | for cfg in config: |
|
202 | for cfg in config: | |
203 | try: |
|
203 | try: | |
204 | name, value = cfg.split('=', 1) |
|
204 | name, value = cfg.split('=', 1) | |
205 | section, name = name.split('.', 1) |
|
205 | section, name = name.split('.', 1) | |
206 | if not section or not name: |
|
206 | if not section or not name: | |
207 | raise IndexError |
|
207 | raise IndexError | |
208 | parsed.append((section, name, value)) |
|
208 | parsed.append((section, name, value)) | |
209 | except (IndexError, ValueError): |
|
209 | except (IndexError, ValueError): | |
210 | raise util.Abort(_('malformed --config option: %s') % cfg) |
|
210 | raise util.Abort(_('malformed --config option: %s') % cfg) | |
211 | return parsed |
|
211 | return parsed | |
212 |
|
212 | |||
213 | def _earlygetopt(aliases, args): |
|
213 | def _earlygetopt(aliases, args): | |
214 | """Return list of values for an option (or aliases). |
|
214 | """Return list of values for an option (or aliases). | |
215 |
|
215 | |||
216 | The values are listed in the order they appear in args. |
|
216 | The values are listed in the order they appear in args. | |
217 | The options and values are removed from args. |
|
217 | The options and values are removed from args. | |
218 | """ |
|
218 | """ | |
219 | try: |
|
219 | try: | |
220 | argcount = args.index("--") |
|
220 | argcount = args.index("--") | |
221 | except ValueError: |
|
221 | except ValueError: | |
222 | argcount = len(args) |
|
222 | argcount = len(args) | |
223 | shortopts = [opt for opt in aliases if len(opt) == 2] |
|
223 | shortopts = [opt for opt in aliases if len(opt) == 2] | |
224 | values = [] |
|
224 | values = [] | |
225 | pos = 0 |
|
225 | pos = 0 | |
226 | while pos < argcount: |
|
226 | while pos < argcount: | |
227 | if args[pos] in aliases: |
|
227 | if args[pos] in aliases: | |
228 | if pos + 1 >= argcount: |
|
228 | if pos + 1 >= argcount: | |
229 | # ignore and let getopt report an error if there is no value |
|
229 | # ignore and let getopt report an error if there is no value | |
230 | break |
|
230 | break | |
231 | del args[pos] |
|
231 | del args[pos] | |
232 | values.append(args.pop(pos)) |
|
232 | values.append(args.pop(pos)) | |
233 | argcount -= 2 |
|
233 | argcount -= 2 | |
234 | elif args[pos][:2] in shortopts: |
|
234 | elif args[pos][:2] in shortopts: | |
235 | # short option can have no following space, e.g. hg log -Rfoo |
|
235 | # short option can have no following space, e.g. hg log -Rfoo | |
236 | values.append(args.pop(pos)[2:]) |
|
236 | values.append(args.pop(pos)[2:]) | |
237 | argcount -= 1 |
|
237 | argcount -= 1 | |
238 | else: |
|
238 | else: | |
239 | pos += 1 |
|
239 | pos += 1 | |
240 | return values |
|
240 | return values | |
241 |
|
241 | |||
242 | def runcommand(lui, repo, cmd, fullargs, ui, options, d): |
|
242 | def runcommand(lui, repo, cmd, fullargs, ui, options, d): | |
243 | # run pre-hook, and abort if it fails |
|
243 | # run pre-hook, and abort if it fails | |
244 | ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs)) |
|
244 | ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs)) | |
245 | if ret: |
|
245 | if ret: | |
246 | return ret |
|
246 | return ret | |
247 | ret = _runcommand(ui, options, cmd, d) |
|
247 | ret = _runcommand(ui, options, cmd, d) | |
248 | # run post-hook, passing command result |
|
248 | # run post-hook, passing command result | |
249 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
|
249 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), | |
250 | result = ret) |
|
250 | result = ret) | |
251 | return ret |
|
251 | return ret | |
252 |
|
252 | |||
253 | _loaded = {} |
|
253 | _loaded = {} | |
254 | def _dispatch(ui, args): |
|
254 | def _dispatch(ui, args): | |
255 | # read --config before doing anything else |
|
255 | # read --config before doing anything else | |
256 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
256 | # (e.g. to change trust settings for reading .hg/hgrc) | |
257 | config = _earlygetopt(['--config'], args) |
|
257 | config = _earlygetopt(['--config'], args) | |
258 | if config: |
|
258 | if config: | |
259 | ui.updateopts(config=_parseconfig(config)) |
|
259 | ui.updateopts(config=_parseconfig(config)) | |
260 |
|
260 | |||
261 | # check for cwd |
|
261 | # check for cwd | |
262 | cwd = _earlygetopt(['--cwd'], args) |
|
262 | cwd = _earlygetopt(['--cwd'], args) | |
263 | if cwd: |
|
263 | if cwd: | |
264 | os.chdir(cwd[-1]) |
|
264 | os.chdir(cwd[-1]) | |
265 |
|
265 | |||
266 | # read the local repository .hgrc into a local ui object |
|
266 | # read the local repository .hgrc into a local ui object | |
267 | path = _findrepo(os.getcwd()) or "" |
|
267 | path = _findrepo(os.getcwd()) or "" | |
268 | if not path: |
|
268 | if not path: | |
269 | lui = ui |
|
269 | lui = ui | |
270 | if path: |
|
270 | if path: | |
271 | try: |
|
271 | try: | |
272 | lui = _ui.ui(parentui=ui) |
|
272 | lui = _ui.ui(parentui=ui) | |
273 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
|
273 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) | |
274 | except IOError: |
|
274 | except IOError: | |
275 | pass |
|
275 | pass | |
276 |
|
276 | |||
277 | # now we can expand paths, even ones in .hg/hgrc |
|
277 | # now we can expand paths, even ones in .hg/hgrc | |
278 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) |
|
278 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) | |
279 | if rpath: |
|
279 | if rpath: | |
280 | path = lui.expandpath(rpath[-1]) |
|
280 | path = lui.expandpath(rpath[-1]) | |
281 | lui = _ui.ui(parentui=ui) |
|
281 | lui = _ui.ui(parentui=ui) | |
282 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
|
282 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) | |
283 |
|
283 | |||
284 | extensions.loadall(lui) |
|
284 | extensions.loadall(lui) | |
285 | for name, module in extensions.extensions(): |
|
285 | for name, module in extensions.extensions(): | |
286 | if name in _loaded: |
|
286 | if name in _loaded: | |
287 | continue |
|
287 | continue | |
288 |
|
288 | |||
289 | # setup extensions |
|
289 | # setup extensions | |
290 | # TODO this should be generalized to scheme, where extensions can |
|
290 | # TODO this should be generalized to scheme, where extensions can | |
291 | # redepend on other extensions. then we should toposort them, and |
|
291 | # redepend on other extensions. then we should toposort them, and | |
292 | # do initialization in correct order |
|
292 | # do initialization in correct order | |
293 | extsetup = getattr(module, 'extsetup', None) |
|
293 | extsetup = getattr(module, 'extsetup', None) | |
294 | if extsetup: |
|
294 | if extsetup: | |
295 | extsetup() |
|
295 | extsetup() | |
296 |
|
296 | |||
297 | cmdtable = getattr(module, 'cmdtable', {}) |
|
297 | cmdtable = getattr(module, 'cmdtable', {}) | |
298 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] |
|
298 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] | |
299 | if overrides: |
|
299 | if overrides: | |
300 | ui.warn(_("extension '%s' overrides commands: %s\n") |
|
300 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
301 | % (name, " ".join(overrides))) |
|
301 | % (name, " ".join(overrides))) | |
302 | commands.table.update(cmdtable) |
|
302 | commands.table.update(cmdtable) | |
303 | _loaded[name] = 1 |
|
303 | _loaded[name] = 1 | |
304 | # check for fallback encoding |
|
304 | # check for fallback encoding | |
305 | fallback = lui.config('ui', 'fallbackencoding') |
|
305 | fallback = lui.config('ui', 'fallbackencoding') | |
306 | if fallback: |
|
306 | if fallback: | |
307 | encoding.fallbackencoding = fallback |
|
307 | encoding.fallbackencoding = fallback | |
308 |
|
308 | |||
309 | fullargs = args |
|
309 | fullargs = args | |
310 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
310 | cmd, func, args, options, cmdoptions = _parse(lui, args) | |
311 |
|
311 | |||
312 | if options["config"]: |
|
312 | if options["config"]: | |
313 | raise util.Abort(_("Option --config may not be abbreviated!")) |
|
313 | raise util.Abort(_("Option --config may not be abbreviated!")) | |
314 | if options["cwd"]: |
|
314 | if options["cwd"]: | |
315 | raise util.Abort(_("Option --cwd may not be abbreviated!")) |
|
315 | raise util.Abort(_("Option --cwd may not be abbreviated!")) | |
316 | if options["repository"]: |
|
316 | if options["repository"]: | |
317 | raise util.Abort(_( |
|
317 | raise util.Abort(_( | |
318 | "Option -R has to be separated from other options (i.e. not -qR) " |
|
318 | "Option -R has to be separated from other options (i.e. not -qR) " | |
319 | "and --repository may only be abbreviated as --repo!")) |
|
319 | "and --repository may only be abbreviated as --repo!")) | |
320 |
|
320 | |||
321 | if options["encoding"]: |
|
321 | if options["encoding"]: | |
322 | encoding.encoding = options["encoding"] |
|
322 | encoding.encoding = options["encoding"] | |
323 | if options["encodingmode"]: |
|
323 | if options["encodingmode"]: | |
324 | encoding.encodingmode = options["encodingmode"] |
|
324 | encoding.encodingmode = options["encodingmode"] | |
325 | if options["time"]: |
|
325 | if options["time"]: | |
326 | def get_times(): |
|
326 | def get_times(): | |
327 | t = os.times() |
|
327 | t = os.times() | |
328 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
|
328 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() | |
329 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
329 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
330 | return t |
|
330 | return t | |
331 | s = get_times() |
|
331 | s = get_times() | |
332 | def print_time(): |
|
332 | def print_time(): | |
333 | t = get_times() |
|
333 | t = get_times() | |
334 | ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
334 | ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % | |
335 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
335 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |
336 | atexit.register(print_time) |
|
336 | atexit.register(print_time) | |
337 |
|
337 | |||
338 | ui.updateopts(options["verbose"], options["debug"], options["quiet"], |
|
338 | ui.updateopts(options["verbose"], options["debug"], options["quiet"], | |
339 | not options["noninteractive"], options["traceback"]) |
|
339 | not options["noninteractive"], options["traceback"]) | |
340 |
|
340 | |||
341 | if options['help']: |
|
341 | if options['help']: | |
342 | return commands.help_(ui, cmd, options['version']) |
|
342 | return commands.help_(ui, cmd, options['version']) | |
343 | elif options['version']: |
|
343 | elif options['version']: | |
344 | return commands.version_(ui) |
|
344 | return commands.version_(ui) | |
345 | elif not cmd: |
|
345 | elif not cmd: | |
346 | return commands.help_(ui, 'shortlist') |
|
346 | return commands.help_(ui, 'shortlist') | |
347 |
|
347 | |||
348 | repo = None |
|
348 | repo = None | |
349 | if cmd not in commands.norepo.split(): |
|
349 | if cmd not in commands.norepo.split(): | |
350 | try: |
|
350 | try: | |
351 | repo = hg.repository(ui, path=path) |
|
351 | repo = hg.repository(ui, path=path) | |
352 | ui = repo.ui |
|
352 | ui = repo.ui | |
353 | if not repo.local(): |
|
353 | if not repo.local(): | |
354 | raise util.Abort(_("repository '%s' is not local") % path) |
|
354 | raise util.Abort(_("repository '%s' is not local") % path) | |
355 | ui.setconfig("bundle", "mainreporoot", repo.root) |
|
355 | ui.setconfig("bundle", "mainreporoot", repo.root) | |
356 | except error.RepoError: |
|
356 | except error.RepoError: | |
357 | if cmd not in commands.optionalrepo.split(): |
|
357 | if cmd not in commands.optionalrepo.split(): | |
358 | if args and not path: # try to infer -R from command args |
|
358 | if args and not path: # try to infer -R from command args | |
359 | repos = map(_findrepo, args) |
|
359 | repos = map(_findrepo, args) | |
360 | guess = repos[0] |
|
360 | guess = repos[0] | |
361 | if guess and repos.count(guess) == len(repos): |
|
361 | if guess and repos.count(guess) == len(repos): | |
362 | return _dispatch(ui, ['--repository', guess] + fullargs) |
|
362 | return _dispatch(ui, ['--repository', guess] + fullargs) | |
363 | if not path: |
|
363 | if not path: | |
364 | raise error.RepoError(_("There is no Mercurial repository" |
|
364 | raise error.RepoError(_("There is no Mercurial repository" | |
365 | " here (.hg not found)")) |
|
365 | " here (.hg not found)")) | |
366 | raise |
|
366 | raise | |
367 | args.insert(0, repo) |
|
367 | args.insert(0, repo) | |
368 | elif rpath: |
|
368 | elif rpath: | |
369 | ui.warn("warning: --repository ignored\n") |
|
369 | ui.warn("warning: --repository ignored\n") | |
370 |
|
370 | |||
371 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) |
|
371 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) | |
372 | return runcommand(lui, repo, cmd, fullargs, ui, options, d) |
|
372 | return runcommand(lui, repo, cmd, fullargs, ui, options, d) | |
373 |
|
373 | |||
374 | def _runcommand(ui, options, cmd, cmdfunc): |
|
374 | def _runcommand(ui, options, cmd, cmdfunc): | |
375 | def checkargs(): |
|
375 | def checkargs(): | |
376 | try: |
|
376 | try: | |
377 | return cmdfunc() |
|
377 | return cmdfunc() | |
378 | except error.SignatureError: |
|
378 | except error.SignatureError: | |
379 | raise error.ParseError(cmd, _("invalid arguments")) |
|
379 | raise error.ParseError(cmd, _("invalid arguments")) | |
380 |
|
380 | |||
381 | if options['profile']: |
|
381 | if options['profile']: | |
|
382 | output = ui.config('profiling', 'output') | |||
|
383 | ||||
|
384 | if output: | |||
|
385 | path = os.path.expanduser(output) | |||
|
386 | path = ui.expandpath(path) | |||
|
387 | ostream = open(path, 'wb') | |||
|
388 | else: | |||
|
389 | ostream = sys.stderr | |||
|
390 | ||||
382 | try: |
|
391 | try: | |
383 | from mercurial import lsprof |
|
392 | from mercurial import lsprof | |
384 | except ImportError: |
|
393 | except ImportError: | |
385 | raise util.Abort(_( |
|
394 | raise util.Abort(_( | |
386 | 'lsprof not available - install from ' |
|
395 | 'lsprof not available - install from ' | |
387 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
|
396 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) | |
388 | p = lsprof.Profiler() |
|
397 | p = lsprof.Profiler() | |
389 | p.enable(subcalls=True) |
|
398 | p.enable(subcalls=True) | |
390 | try: |
|
399 | try: | |
391 | return checkargs() |
|
400 | return checkargs() | |
392 | finally: |
|
401 | finally: | |
393 | p.disable() |
|
402 | p.disable() | |
394 | stats = lsprof.Stats(p.getstats()) |
|
403 | stats = lsprof.Stats(p.getstats()) | |
395 | stats.sort() |
|
404 | stats.sort() | |
396 |
stats.pprint(top=10, file= |
|
405 | stats.pprint(top=10, file=ostream, climit=5) | |
|
406 | ||||
|
407 | if output: | |||
|
408 | ostream.close() | |||
397 | else: |
|
409 | else: | |
398 | return checkargs() |
|
410 | return checkargs() |
@@ -1,9 +1,18 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | echo % test --time |
|
3 | echo % test --time | |
4 | hg --time help -q help 2>&1 | grep Time > /dev/null || echo --time failed |
|
4 | hg --time help -q help 2>&1 | grep Time > /dev/null || echo --time failed | |
5 |
|
5 | |||
|
6 | hg init a | |||
|
7 | cd a | |||
|
8 | ||||
6 | echo % test --profile |
|
9 | echo % test --profile | |
7 | if "$TESTDIR/hghave" -q lsprof; then |
|
10 | if "$TESTDIR/hghave" -q lsprof; then | |
8 |
hg --profile |
|
11 | hg --profile st 2>../out || echo --profile failed | |
|
12 | grep CallCount < ../out > /dev/null || echo wrong --profile | |||
|
13 | ||||
|
14 | hg --profile --config profiling.output=../out st 2>&1 \ | |||
|
15 | || echo --profile + output to file failed | |||
|
16 | grep CallCount < ../out > /dev/null \ | |||
|
17 | || echo wrong --profile output when saving to a file | |||
9 | fi |
|
18 | fi |
General Comments 0
You need to be logged in to leave comments.
Login now