##// END OF EJS Templates
hgweb: support for deny_read/allow_read options...
Mark Edgington -
r7336:2dc86871 default
parent child Browse files
Show More
@@ -1,751 +1,773 b''
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 (ui.encoding, ui.fallbackencoding) succeeds. If correct
222 (ui.encoding, 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 ui.encoding if not in email.charsets
231 ui.encoding 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
478
479 Python hooks are run within the Mercurial process. Each hook is
479 Python hooks are run within the Mercurial process. Each hook is
480 called with at least three keyword arguments: a ui object (keyword
480 called with at least three keyword arguments: a ui object (keyword
481 "ui"), a repository object (keyword "repo"), and a "hooktype"
481 "ui"), a repository object (keyword "repo"), and a "hooktype"
482 keyword that tells what kind of hook is used. Arguments listed as
482 keyword that tells what kind of hook is used. Arguments listed as
483 environment variables above are passed as keyword arguments, with no
483 environment variables above are passed as keyword arguments, with no
484 "HG_" prefix, and names in lower case.
484 "HG_" prefix, and names in lower case.
485
485
486 If a Python hook returns a "true" value or raises an exception, this
486 If a Python hook returns a "true" value or raises an exception, this
487 is treated as failure of the hook.
487 is treated as failure of the hook.
488
488
489 [[http_proxy]]
489 [[http_proxy]]
490 http_proxy::
490 http_proxy::
491 Used to access web-based Mercurial repositories through a HTTP
491 Used to access web-based Mercurial repositories through a HTTP
492 proxy.
492 proxy.
493 host;;
493 host;;
494 Host name and (optional) port of the proxy server, for example
494 Host name and (optional) port of the proxy server, for example
495 "myproxy:8000".
495 "myproxy:8000".
496 no;;
496 no;;
497 Optional. Comma-separated list of host names that should bypass
497 Optional. Comma-separated list of host names that should bypass
498 the proxy.
498 the proxy.
499 passwd;;
499 passwd;;
500 Optional. Password to authenticate with at the proxy server.
500 Optional. Password to authenticate with at the proxy server.
501 user;;
501 user;;
502 Optional. User name to authenticate with at the proxy server.
502 Optional. User name to authenticate with at the proxy server.
503
503
504 [[smtp]]
504 [[smtp]]
505 smtp::
505 smtp::
506 Configuration for extensions that need to send email messages.
506 Configuration for extensions that need to send email messages.
507 host;;
507 host;;
508 Host name of mail server, e.g. "mail.example.com".
508 Host name of mail server, e.g. "mail.example.com".
509 port;;
509 port;;
510 Optional. Port to connect to on mail server. Default: 25.
510 Optional. Port to connect to on mail server. Default: 25.
511 tls;;
511 tls;;
512 Optional. Whether to connect to mail server using TLS. True or
512 Optional. Whether to connect to mail server using TLS. True or
513 False. Default: False.
513 False. Default: False.
514 username;;
514 username;;
515 Optional. User name to authenticate to SMTP server with.
515 Optional. User name to authenticate to SMTP server with.
516 If username is specified, password must also be specified.
516 If username is specified, password must also be specified.
517 Default: none.
517 Default: none.
518 password;;
518 password;;
519 Optional. Password to authenticate to SMTP server with.
519 Optional. Password to authenticate to SMTP server with.
520 If username is specified, password must also be specified.
520 If username is specified, password must also be specified.
521 Default: none.
521 Default: none.
522 local_hostname;;
522 local_hostname;;
523 Optional. It's the hostname that the sender can use to identify itself
523 Optional. It's the hostname that the sender can use to identify itself
524 to the MTA.
524 to the MTA.
525
525
526 [[paths]]
526 [[paths]]
527 paths::
527 paths::
528 Assigns symbolic names to repositories. The left side is the
528 Assigns symbolic names to repositories. The left side is the
529 symbolic name, and the right gives the directory or URL that is the
529 symbolic name, and the right gives the directory or URL that is the
530 location of the repository. Default paths can be declared by
530 location of the repository. Default paths can be declared by
531 setting the following entries.
531 setting the following entries.
532 default;;
532 default;;
533 Directory or URL to use when pulling if no source is specified.
533 Directory or URL to use when pulling if no source is specified.
534 Default is set to repository from which the current repository
534 Default is set to repository from which the current repository
535 was cloned.
535 was cloned.
536 default-push;;
536 default-push;;
537 Optional. Directory or URL to use when pushing if no destination
537 Optional. Directory or URL to use when pushing if no destination
538 is specified.
538 is specified.
539
539
540 [[server]]
540 [[server]]
541 server::
541 server::
542 Controls generic server settings.
542 Controls generic server settings.
543 uncompressed;;
543 uncompressed;;
544 Whether to allow clients to clone a repo using the uncompressed
544 Whether to allow clients to clone a repo using the uncompressed
545 streaming protocol. This transfers about 40% more data than a
545 streaming protocol. This transfers about 40% more data than a
546 regular clone, but uses less memory and CPU on both server and
546 regular clone, but uses less memory and CPU on both server and
547 client. Over a LAN (100Mbps or better) or a very fast WAN, an
547 client. Over a LAN (100Mbps or better) or a very fast WAN, an
548 uncompressed streaming clone is a lot faster (~10x) than a regular
548 uncompressed streaming clone is a lot faster (~10x) than a regular
549 clone. Over most WAN connections (anything slower than about
549 clone. Over most WAN connections (anything slower than about
550 6Mbps), uncompressed streaming is slower, because of the extra
550 6Mbps), uncompressed streaming is slower, because of the extra
551 data transfer overhead. Default is False.
551 data transfer overhead. Default is False.
552
552
553 [[trusted]]
553 [[trusted]]
554 trusted::
554 trusted::
555 For security reasons, Mercurial will not use the settings in
555 For security reasons, Mercurial will not use the settings in
556 the .hg/hgrc file from a repository if it doesn't belong to a
556 the .hg/hgrc file from a repository if it doesn't belong to a
557 trusted user or to a trusted group. The main exception is the
557 trusted user or to a trusted group. The main exception is the
558 web interface, which automatically uses some safe settings, since
558 web interface, which automatically uses some safe settings, since
559 it's common to serve repositories from different users.
559 it's common to serve repositories from different users.
560
560
561 This section specifies what users and groups are trusted. The
561 This section specifies what users and groups are trusted. The
562 current user is always trusted. To trust everybody, list a user
562 current user is always trusted. To trust everybody, list a user
563 or a group with name "*".
563 or a group with name "*".
564
564
565 users;;
565 users;;
566 Comma-separated list of trusted users.
566 Comma-separated list of trusted users.
567 groups;;
567 groups;;
568 Comma-separated list of trusted groups.
568 Comma-separated list of trusted groups.
569
569
570 [[ui]]
570 [[ui]]
571 ui::
571 ui::
572 User interface controls.
572 User interface controls.
573 archivemeta;;
573 archivemeta;;
574 Whether to include the .hg_archival.txt file containing metadata
574 Whether to include the .hg_archival.txt file containing metadata
575 (hashes for the repository base and for tip) in archives created by
575 (hashes for the repository base and for tip) in archives created by
576 the hg archive command or downloaded via hgweb.
576 the hg archive command or downloaded via hgweb.
577 Default is true.
577 Default is true.
578 askusername;;
578 askusername;;
579 Whether to prompt for a username when committing. If True, and
579 Whether to prompt for a username when committing. If True, and
580 neither $HGUSER nor $EMAIL has been specified, then the user will
580 neither $HGUSER nor $EMAIL has been specified, then the user will
581 be prompted to enter a username. If no username is entered, the
581 be prompted to enter a username. If no username is entered, the
582 default USER@HOST is used instead.
582 default USER@HOST is used instead.
583 Default is False.
583 Default is False.
584 debug;;
584 debug;;
585 Print debugging information. True or False. Default is False.
585 Print debugging information. True or False. Default is False.
586 editor;;
586 editor;;
587 The editor to use during a commit. Default is $EDITOR or "vi".
587 The editor to use during a commit. Default is $EDITOR or "vi".
588 fallbackencoding;;
588 fallbackencoding;;
589 Encoding to try if it's not possible to decode the changelog using
589 Encoding to try if it's not possible to decode the changelog using
590 UTF-8. Default is ISO-8859-1.
590 UTF-8. Default is ISO-8859-1.
591 ignore;;
591 ignore;;
592 A file to read per-user ignore patterns from. This file should be in
592 A file to read per-user ignore patterns from. This file should be in
593 the same format as a repository-wide .hgignore file. This option
593 the same format as a repository-wide .hgignore file. This option
594 supports hook syntax, so if you want to specify multiple ignore
594 supports hook syntax, so if you want to specify multiple ignore
595 files, you can do so by setting something like
595 files, you can do so by setting something like
596 "ignore.other = ~/.hgignore2". For details of the ignore file
596 "ignore.other = ~/.hgignore2". For details of the ignore file
597 format, see the hgignore(5) man page.
597 format, see the hgignore(5) man page.
598 interactive;;
598 interactive;;
599 Allow to prompt the user. True or False. Default is True.
599 Allow to prompt the user. True or False. Default is True.
600 logtemplate;;
600 logtemplate;;
601 Template string for commands that print changesets.
601 Template string for commands that print changesets.
602 merge;;
602 merge;;
603 The conflict resolution program to use during a manual merge.
603 The conflict resolution program to use during a manual merge.
604 There are some internal tools available:
604 There are some internal tools available:
605
605
606 internal:local;;
606 internal:local;;
607 keep the local version
607 keep the local version
608 internal:other;;
608 internal:other;;
609 use the other version
609 use the other version
610 internal:merge;;
610 internal:merge;;
611 use the internal non-interactive merge tool
611 use the internal non-interactive merge tool
612 internal:fail;;
612 internal:fail;;
613 fail to merge
613 fail to merge
614
614
615 See the merge-tools section for more information on configuring tools.
615 See the merge-tools section for more information on configuring tools.
616
616
617 patch;;
617 patch;;
618 command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if
618 command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if
619 unset.
619 unset.
620 quiet;;
620 quiet;;
621 Reduce the amount of output printed. True or False. Default is False.
621 Reduce the amount of output printed. True or False. Default is False.
622 remotecmd;;
622 remotecmd;;
623 remote command to use for clone/push/pull operations. Default is 'hg'.
623 remote command to use for clone/push/pull operations. Default is 'hg'.
624 report_untrusted;;
624 report_untrusted;;
625 Warn if a .hg/hgrc file is ignored due to not being owned by a
625 Warn if a .hg/hgrc file is ignored due to not being owned by a
626 trusted user or group. True or False. Default is True.
626 trusted user or group. True or False. Default is True.
627 slash;;
627 slash;;
628 Display paths using a slash ("/") as the path separator. This only
628 Display paths using a slash ("/") as the path separator. This only
629 makes a difference on systems where the default path separator is not
629 makes a difference on systems where the default path separator is not
630 the slash character (e.g. Windows uses the backslash character ("\")).
630 the slash character (e.g. Windows uses the backslash character ("\")).
631 Default is False.
631 Default is False.
632 ssh;;
632 ssh;;
633 command to use for SSH connections. Default is 'ssh'.
633 command to use for SSH connections. Default is 'ssh'.
634 strict;;
634 strict;;
635 Require exact command names, instead of allowing unambiguous
635 Require exact command names, instead of allowing unambiguous
636 abbreviations. True or False. Default is False.
636 abbreviations. True or False. Default is False.
637 style;;
637 style;;
638 Name of style to use for command output.
638 Name of style to use for command output.
639 timeout;;
639 timeout;;
640 The timeout used when a lock is held (in seconds), a negative value
640 The timeout used when a lock is held (in seconds), a negative value
641 means no timeout. Default is 600.
641 means no timeout. Default is 600.
642 username;;
642 username;;
643 The committer of a changeset created when running "commit".
643 The committer of a changeset created when running "commit".
644 Typically a person's name and email address, e.g. "Fred Widget
644 Typically a person's name and email address, e.g. "Fred Widget
645 <fred@example.com>". Default is $EMAIL or username@hostname.
645 <fred@example.com>". Default is $EMAIL or username@hostname.
646 If the username in hgrc is empty, it has to be specified manually or
646 If the username in hgrc is empty, it has to be specified manually or
647 in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username ="
647 in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username ="
648 in the system hgrc).
648 in the system hgrc).
649 verbose;;
649 verbose;;
650 Increase the amount of output printed. True or False. Default is False.
650 Increase the amount of output printed. True or False. Default is False.
651
651
652
652
653 [[web]]
653 [[web]]
654 web::
654 web::
655 Web interface configuration.
655 Web interface configuration.
656 accesslog;;
656 accesslog;;
657 Where to output the access log. Default is stdout.
657 Where to output the access log. Default is stdout.
658 address;;
658 address;;
659 Interface address to bind to. Default is all.
659 Interface address to bind to. Default is all.
660 allow_archive;;
660 allow_archive;;
661 List of archive format (bz2, gz, zip) allowed for downloading.
661 List of archive format (bz2, gz, zip) allowed for downloading.
662 Default is empty.
662 Default is empty.
663 allowbz2;;
663 allowbz2;;
664 (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions.
664 (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions.
665 Default is false.
665 Default is false.
666 allowgz;;
666 allowgz;;
667 (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions.
667 (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions.
668 Default is false.
668 Default is false.
669 allowpull;;
669 allowpull;;
670 Whether to allow pulling from the repository. Default is true.
670 Whether to allow pulling from the repository. Default is true.
671 allow_push;;
671 allow_push;;
672 Whether to allow pushing to the repository. If empty or not set,
672 Whether to allow pushing to the repository. If empty or not set,
673 push is not allowed. If the special value "*", any remote user
673 push is not allowed. If the special value "*", any remote user
674 can push, including unauthenticated users. Otherwise, the remote
674 can push, including unauthenticated users. Otherwise, the remote
675 user must have been authenticated, and the authenticated user name
675 user must have been authenticated, and the authenticated user name
676 must be present in this list (separated by whitespace or ",").
676 must be present in this list (separated by whitespace or ",").
677 The contents of the allow_push list are examined after the
677 The contents of the allow_push list are examined after the
678 deny_push list.
678 deny_push list.
679 allow_read;;
680 If the user has not already been denied repository access due to the
681 contents of deny_read, this list determines whether to grant repository
682 access to the user. If this list is not empty, and the user is
683 unauthenticated or not present in the list (separated by whitespace or ","),
684 then access is denied for the user. If the list is empty or not set, then
685 access is permitted to all users by default. Setting allow_read to the
686 special value "*" is equivalent to it not being set (i.e. access is
687 permitted to all users). The contents of the allow_read list are examined
688 after the deny_read list.
679 allowzip;;
689 allowzip;;
680 (DEPRECATED) Whether to allow .zip downloading of repo revisions.
690 (DEPRECATED) Whether to allow .zip downloading of repo revisions.
681 Default is false. This feature creates temporary files.
691 Default is false. This feature creates temporary files.
682 baseurl;;
692 baseurl;;
683 Base URL to use when publishing URLs in other locations, so
693 Base URL to use when publishing URLs in other locations, so
684 third-party tools like email notification hooks can construct URLs.
694 third-party tools like email notification hooks can construct URLs.
685 Example: "http://hgserver/repos/"
695 Example: "http://hgserver/repos/"
686 contact;;
696 contact;;
687 Name or email address of the person in charge of the repository.
697 Name or email address of the person in charge of the repository.
688 Defaults to ui.username or $EMAIL or "unknown" if unset or empty.
698 Defaults to ui.username or $EMAIL or "unknown" if unset or empty.
689 deny_push;;
699 deny_push;;
690 Whether to deny pushing to the repository. If empty or not set,
700 Whether to deny pushing to the repository. If empty or not set,
691 push is not denied. If the special value "*", all remote users
701 push is not denied. If the special value "*", all remote users
692 are denied push. Otherwise, unauthenticated users are all denied,
702 are denied push. Otherwise, unauthenticated users are all denied,
693 and any authenticated user name present in this list (separated by
703 and any authenticated user name present in this list (separated by
694 whitespace or ",") is also denied. The contents of the deny_push
704 whitespace or ",") is also denied. The contents of the deny_push
695 list are examined before the allow_push list.
705 list are examined before the allow_push list.
706 deny_read;;
707 Whether to deny reading/viewing of the repository. If this list is not
708 empty, unauthenticated users are all denied, and any authenticated user name
709 present in this list (separated by whitespace or ",") is also denied access
710 to the repository. If set to the special value "*", all remote users are
711 denied access (rarely needed ;). If deny_read is empty or not set, the
712 determination of repository access depends on the presence and content of
713 the allow_read list (see description). If both deny_read and allow_read are
714 empty or not set, then access is permitted to all users by default. If the
715 repository is being served via hgwebdir, denied users will not be able to
716 see it in the list of repositories. The contents of the deny_read list have
717 priority over (are examined before) the contents of the allow_read list.
696 description;;
718 description;;
697 Textual description of the repository's purpose or contents.
719 Textual description of the repository's purpose or contents.
698 Default is "unknown".
720 Default is "unknown".
699 encoding;;
721 encoding;;
700 Character encoding name.
722 Character encoding name.
701 Example: "UTF-8"
723 Example: "UTF-8"
702 errorlog;;
724 errorlog;;
703 Where to output the error log. Default is stderr.
725 Where to output the error log. Default is stderr.
704 hidden;;
726 hidden;;
705 Whether to hide the repository in the hgwebdir index. Default is false.
727 Whether to hide the repository in the hgwebdir index. Default is false.
706 ipv6;;
728 ipv6;;
707 Whether to use IPv6. Default is false.
729 Whether to use IPv6. Default is false.
708 name;;
730 name;;
709 Repository name to use in the web interface. Default is current
731 Repository name to use in the web interface. Default is current
710 working directory.
732 working directory.
711 maxchanges;;
733 maxchanges;;
712 Maximum number of changes to list on the changelog. Default is 10.
734 Maximum number of changes to list on the changelog. Default is 10.
713 maxfiles;;
735 maxfiles;;
714 Maximum number of files to list per changeset. Default is 10.
736 Maximum number of files to list per changeset. Default is 10.
715 port;;
737 port;;
716 Port to listen on. Default is 8000.
738 Port to listen on. Default is 8000.
717 prefix;;
739 prefix;;
718 Prefix path to serve from. Default is '' (server root).
740 Prefix path to serve from. Default is '' (server root).
719 push_ssl;;
741 push_ssl;;
720 Whether to require that inbound pushes be transported over SSL to
742 Whether to require that inbound pushes be transported over SSL to
721 prevent password sniffing. Default is true.
743 prevent password sniffing. Default is true.
722 staticurl;;
744 staticurl;;
723 Base URL to use for static files. If unset, static files (e.g.
745 Base URL to use for static files. If unset, static files (e.g.
724 the hgicon.png favicon) will be served by the CGI script itself.
746 the hgicon.png favicon) will be served by the CGI script itself.
725 Use this setting to serve them directly with the HTTP server.
747 Use this setting to serve them directly with the HTTP server.
726 Example: "http://hgserver/static/"
748 Example: "http://hgserver/static/"
727 stripes;;
749 stripes;;
728 How many lines a "zebra stripe" should span in multiline output.
750 How many lines a "zebra stripe" should span in multiline output.
729 Default is 1; set to 0 to disable.
751 Default is 1; set to 0 to disable.
730 style;;
752 style;;
731 Which template map style to use.
753 Which template map style to use.
732 templates;;
754 templates;;
733 Where to find the HTML templates. Default is install path.
755 Where to find the HTML templates. Default is install path.
734
756
735
757
736 AUTHOR
758 AUTHOR
737 ------
759 ------
738 Bryan O'Sullivan <bos@serpentine.com>.
760 Bryan O'Sullivan <bos@serpentine.com>.
739
761
740 Mercurial was written by Matt Mackall <mpm@selenic.com>.
762 Mercurial was written by Matt Mackall <mpm@selenic.com>.
741
763
742 SEE ALSO
764 SEE ALSO
743 --------
765 --------
744 hg(1), hgignore(5)
766 hg(1), hgignore(5)
745
767
746 COPYING
768 COPYING
747 -------
769 -------
748 This manual page is copyright 2005 Bryan O'Sullivan.
770 This manual page is copyright 2005 Bryan O'Sullivan.
749 Mercurial is copyright 2005-2007 Matt Mackall.
771 Mercurial is copyright 2005-2007 Matt Mackall.
750 Free use of this software is granted under the terms of the GNU General
772 Free use of this software is granted under the terms of the GNU General
751 Public License (GPL).
773 Public License (GPL).
@@ -1,308 +1,321 b''
1 # hgweb/hgweb_mod.py - Web interface for a repository.
1 # hgweb/hgweb_mod.py - Web interface for a repository.
2 #
2 #
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
5 #
5 #
6 # This software may be used and distributed according to the terms
6 # This software may be used and distributed according to the terms
7 # of the GNU General Public License, incorporated herein by reference.
7 # of the GNU General Public License, incorporated herein by reference.
8
8
9 import os, mimetypes
9 import os, mimetypes
10 from mercurial.node import hex, nullid
10 from mercurial.node import hex, nullid
11 from mercurial.repo import RepoError
11 from mercurial.repo import RepoError
12 from mercurial import ui, hg, util, hook
12 from mercurial import ui, hg, util, hook
13 from mercurial import revlog, templater, templatefilters
13 from mercurial import revlog, templater, templatefilters
14 from common import get_mtime, style_map, ErrorResponse
14 from common import get_mtime, style_map, ErrorResponse
15 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
16 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
16 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
17 from request import wsgirequest
17 from request import wsgirequest
18 import webcommands, protocol, webutil
18 import webcommands, protocol, webutil
19
19
20 perms = {
20 perms = {
21 'changegroup': 'pull',
21 'changegroup': 'pull',
22 'changegroupsubset': 'pull',
22 'changegroupsubset': 'pull',
23 'unbundle': 'push',
23 'unbundle': 'push',
24 'stream_out': 'pull',
24 'stream_out': 'pull',
25 }
25 }
26
26
27 class hgweb(object):
27 class hgweb(object):
28 def __init__(self, repo, name=None):
28 def __init__(self, repo, name=None):
29 if isinstance(repo, str):
29 if isinstance(repo, str):
30 parentui = ui.ui(report_untrusted=False, interactive=False)
30 parentui = ui.ui(report_untrusted=False, interactive=False)
31 self.repo = hg.repository(parentui, repo)
31 self.repo = hg.repository(parentui, repo)
32 else:
32 else:
33 self.repo = repo
33 self.repo = repo
34
34
35 hook.redirect(True)
35 hook.redirect(True)
36 self.mtime = -1
36 self.mtime = -1
37 self.reponame = name
37 self.reponame = name
38 self.archives = 'zip', 'gz', 'bz2'
38 self.archives = 'zip', 'gz', 'bz2'
39 self.stripecount = 1
39 self.stripecount = 1
40 # a repo owner may set web.templates in .hg/hgrc to get any file
40 # a repo owner may set web.templates in .hg/hgrc to get any file
41 # readable by the user running the CGI script
41 # readable by the user running the CGI script
42 self.templatepath = self.config("web", "templates",
42 self.templatepath = self.config("web", "templates",
43 templater.templatepath(),
43 templater.templatepath(),
44 untrusted=False)
44 untrusted=False)
45
45
46 # The CGI scripts are often run by a user different from the repo owner.
46 # The CGI scripts are often run by a user different from the repo owner.
47 # Trust the settings from the .hg/hgrc files by default.
47 # Trust the settings from the .hg/hgrc files by default.
48 def config(self, section, name, default=None, untrusted=True):
48 def config(self, section, name, default=None, untrusted=True):
49 return self.repo.ui.config(section, name, default,
49 return self.repo.ui.config(section, name, default,
50 untrusted=untrusted)
50 untrusted=untrusted)
51
51
52 def configbool(self, section, name, default=False, untrusted=True):
52 def configbool(self, section, name, default=False, untrusted=True):
53 return self.repo.ui.configbool(section, name, default,
53 return self.repo.ui.configbool(section, name, default,
54 untrusted=untrusted)
54 untrusted=untrusted)
55
55
56 def configlist(self, section, name, default=None, untrusted=True):
56 def configlist(self, section, name, default=None, untrusted=True):
57 return self.repo.ui.configlist(section, name, default,
57 return self.repo.ui.configlist(section, name, default,
58 untrusted=untrusted)
58 untrusted=untrusted)
59
59
60 def refresh(self):
60 def refresh(self):
61 mtime = get_mtime(self.repo.root)
61 mtime = get_mtime(self.repo.root)
62 if mtime != self.mtime:
62 if mtime != self.mtime:
63 self.mtime = mtime
63 self.mtime = mtime
64 self.repo = hg.repository(self.repo.ui, self.repo.root)
64 self.repo = hg.repository(self.repo.ui, self.repo.root)
65 self.maxchanges = int(self.config("web", "maxchanges", 10))
65 self.maxchanges = int(self.config("web", "maxchanges", 10))
66 self.stripecount = int(self.config("web", "stripes", 1))
66 self.stripecount = int(self.config("web", "stripes", 1))
67 self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
67 self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
68 self.maxfiles = int(self.config("web", "maxfiles", 10))
68 self.maxfiles = int(self.config("web", "maxfiles", 10))
69 self.allowpull = self.configbool("web", "allowpull", True)
69 self.allowpull = self.configbool("web", "allowpull", True)
70 self.encoding = self.config("web", "encoding", util._encoding)
70 self.encoding = self.config("web", "encoding", util._encoding)
71
71
72 def run(self):
72 def run(self):
73 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
73 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
74 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
74 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
75 import mercurial.hgweb.wsgicgi as wsgicgi
75 import mercurial.hgweb.wsgicgi as wsgicgi
76 wsgicgi.launch(self)
76 wsgicgi.launch(self)
77
77
78 def __call__(self, env, respond):
78 def __call__(self, env, respond):
79 req = wsgirequest(env, respond)
79 req = wsgirequest(env, respond)
80 return self.run_wsgi(req)
80 return self.run_wsgi(req)
81
81
82 def run_wsgi(self, req):
82 def run_wsgi(self, req):
83
83
84 self.refresh()
84 self.refresh()
85
85
86 # process this if it's a protocol request
86 # process this if it's a protocol request
87 # protocol bits don't need to create any URLs
87 # protocol bits don't need to create any URLs
88 # and the clients always use the old URL structure
88 # and the clients always use the old URL structure
89
89
90 cmd = req.form.get('cmd', [''])[0]
90 cmd = req.form.get('cmd', [''])[0]
91 if cmd and cmd in protocol.__all__:
91 if cmd and cmd in protocol.__all__:
92 try:
92 try:
93 if cmd in perms:
93 if cmd in perms:
94 try:
94 try:
95 self.check_perm(req, perms[cmd])
95 self.check_perm(req, perms[cmd])
96 except ErrorResponse, inst:
96 except ErrorResponse, inst:
97 if cmd == 'unbundle':
97 if cmd == 'unbundle':
98 req.drain()
98 req.drain()
99 raise
99 raise
100 method = getattr(protocol, cmd)
100 method = getattr(protocol, cmd)
101 return method(self.repo, req)
101 return method(self.repo, req)
102 except ErrorResponse, inst:
102 except ErrorResponse, inst:
103 req.respond(inst.code, protocol.HGTYPE)
103 req.respond(inst.code, protocol.HGTYPE)
104 if not inst.message:
104 if not inst.message:
105 return []
105 return []
106 return '0\n%s\n' % inst.message,
106 return '0\n%s\n' % inst.message,
107
107
108 # work with CGI variables to create coherent structure
108 # work with CGI variables to create coherent structure
109 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
109 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
110
110
111 req.url = req.env['SCRIPT_NAME']
111 req.url = req.env['SCRIPT_NAME']
112 if not req.url.endswith('/'):
112 if not req.url.endswith('/'):
113 req.url += '/'
113 req.url += '/'
114 if 'REPO_NAME' in req.env:
114 if 'REPO_NAME' in req.env:
115 req.url += req.env['REPO_NAME'] + '/'
115 req.url += req.env['REPO_NAME'] + '/'
116
116
117 if 'PATH_INFO' in req.env:
117 if 'PATH_INFO' in req.env:
118 parts = req.env['PATH_INFO'].strip('/').split('/')
118 parts = req.env['PATH_INFO'].strip('/').split('/')
119 repo_parts = req.env.get('REPO_NAME', '').split('/')
119 repo_parts = req.env.get('REPO_NAME', '').split('/')
120 if parts[:len(repo_parts)] == repo_parts:
120 if parts[:len(repo_parts)] == repo_parts:
121 parts = parts[len(repo_parts):]
121 parts = parts[len(repo_parts):]
122 query = '/'.join(parts)
122 query = '/'.join(parts)
123 else:
123 else:
124 query = req.env['QUERY_STRING'].split('&', 1)[0]
124 query = req.env['QUERY_STRING'].split('&', 1)[0]
125 query = query.split(';', 1)[0]
125 query = query.split(';', 1)[0]
126
126
127 # translate user-visible url structure to internal structure
127 # translate user-visible url structure to internal structure
128
128
129 args = query.split('/', 2)
129 args = query.split('/', 2)
130 if 'cmd' not in req.form and args and args[0]:
130 if 'cmd' not in req.form and args and args[0]:
131
131
132 cmd = args.pop(0)
132 cmd = args.pop(0)
133 style = cmd.rfind('-')
133 style = cmd.rfind('-')
134 if style != -1:
134 if style != -1:
135 req.form['style'] = [cmd[:style]]
135 req.form['style'] = [cmd[:style]]
136 cmd = cmd[style+1:]
136 cmd = cmd[style+1:]
137
137
138 # avoid accepting e.g. style parameter as command
138 # avoid accepting e.g. style parameter as command
139 if hasattr(webcommands, cmd):
139 if hasattr(webcommands, cmd):
140 req.form['cmd'] = [cmd]
140 req.form['cmd'] = [cmd]
141 else:
141 else:
142 cmd = ''
142 cmd = ''
143
143
144 if cmd == 'static':
144 if cmd == 'static':
145 req.form['file'] = ['/'.join(args)]
145 req.form['file'] = ['/'.join(args)]
146 else:
146 else:
147 if args and args[0]:
147 if args and args[0]:
148 node = args.pop(0)
148 node = args.pop(0)
149 req.form['node'] = [node]
149 req.form['node'] = [node]
150 if args:
150 if args:
151 req.form['file'] = args
151 req.form['file'] = args
152
152
153 if cmd == 'archive':
153 if cmd == 'archive':
154 fn = req.form['node'][0]
154 fn = req.form['node'][0]
155 for type_, spec in self.archive_specs.iteritems():
155 for type_, spec in self.archive_specs.iteritems():
156 ext = spec[2]
156 ext = spec[2]
157 if fn.endswith(ext):
157 if fn.endswith(ext):
158 req.form['node'] = [fn[:-len(ext)]]
158 req.form['node'] = [fn[:-len(ext)]]
159 req.form['type'] = [type_]
159 req.form['type'] = [type_]
160
160
161 # process the web interface request
161 # process the web interface request
162
162
163 try:
163 try:
164
165 tmpl = self.templater(req)
164 tmpl = self.templater(req)
166 ctype = tmpl('mimetype', encoding=self.encoding)
165 ctype = tmpl('mimetype', encoding=self.encoding)
167 ctype = templater.stringify(ctype)
166 ctype = templater.stringify(ctype)
168
167
168 # check allow_read / deny_read config options
169 self.check_perm(req, None)
170
169 if cmd == '':
171 if cmd == '':
170 req.form['cmd'] = [tmpl.cache['default']]
172 req.form['cmd'] = [tmpl.cache['default']]
171 cmd = req.form['cmd'][0]
173 cmd = req.form['cmd'][0]
172
174
173 if cmd not in webcommands.__all__:
175 if cmd not in webcommands.__all__:
174 msg = 'no such method: %s' % cmd
176 msg = 'no such method: %s' % cmd
175 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
177 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
176 elif cmd == 'file' and 'raw' in req.form.get('style', []):
178 elif cmd == 'file' and 'raw' in req.form.get('style', []):
177 self.ctype = ctype
179 self.ctype = ctype
178 content = webcommands.rawfile(self, req, tmpl)
180 content = webcommands.rawfile(self, req, tmpl)
179 else:
181 else:
180 content = getattr(webcommands, cmd)(self, req, tmpl)
182 content = getattr(webcommands, cmd)(self, req, tmpl)
181 req.respond(HTTP_OK, ctype)
183 req.respond(HTTP_OK, ctype)
182
184
183 return ''.join(content),
185 return ''.join(content),
184
186
185 except revlog.LookupError, err:
187 except revlog.LookupError, err:
186 req.respond(HTTP_NOT_FOUND, ctype)
188 req.respond(HTTP_NOT_FOUND, ctype)
187 msg = str(err)
189 msg = str(err)
188 if 'manifest' not in msg:
190 if 'manifest' not in msg:
189 msg = 'revision not found: %s' % err.name
191 msg = 'revision not found: %s' % err.name
190 return ''.join(tmpl('error', error=msg)),
192 return ''.join(tmpl('error', error=msg)),
191 except (RepoError, revlog.RevlogError), inst:
193 except (RepoError, revlog.RevlogError), inst:
192 req.respond(HTTP_SERVER_ERROR, ctype)
194 req.respond(HTTP_SERVER_ERROR, ctype)
193 return ''.join(tmpl('error', error=str(inst))),
195 return ''.join(tmpl('error', error=str(inst))),
194 except ErrorResponse, inst:
196 except ErrorResponse, inst:
195 req.respond(inst.code, ctype)
197 req.respond(inst.code, ctype)
196 return ''.join(tmpl('error', error=inst.message)),
198 return ''.join(tmpl('error', error=inst.message)),
197
199
198 def templater(self, req):
200 def templater(self, req):
199
201
200 # determine scheme, port and server name
202 # determine scheme, port and server name
201 # this is needed to create absolute urls
203 # this is needed to create absolute urls
202
204
203 proto = req.env.get('wsgi.url_scheme')
205 proto = req.env.get('wsgi.url_scheme')
204 if proto == 'https':
206 if proto == 'https':
205 proto = 'https'
207 proto = 'https'
206 default_port = "443"
208 default_port = "443"
207 else:
209 else:
208 proto = 'http'
210 proto = 'http'
209 default_port = "80"
211 default_port = "80"
210
212
211 port = req.env["SERVER_PORT"]
213 port = req.env["SERVER_PORT"]
212 port = port != default_port and (":" + port) or ""
214 port = port != default_port and (":" + port) or ""
213 urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
215 urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
214 staticurl = self.config("web", "staticurl") or req.url + 'static/'
216 staticurl = self.config("web", "staticurl") or req.url + 'static/'
215 if not staticurl.endswith('/'):
217 if not staticurl.endswith('/'):
216 staticurl += '/'
218 staticurl += '/'
217
219
218 # some functions for the templater
220 # some functions for the templater
219
221
220 def header(**map):
222 def header(**map):
221 yield tmpl('header', encoding=self.encoding, **map)
223 yield tmpl('header', encoding=self.encoding, **map)
222
224
223 def footer(**map):
225 def footer(**map):
224 yield tmpl("footer", **map)
226 yield tmpl("footer", **map)
225
227
226 def motd(**map):
228 def motd(**map):
227 yield self.config("web", "motd", "")
229 yield self.config("web", "motd", "")
228
230
229 def sessionvars(**map):
231 def sessionvars(**map):
230 fields = []
232 fields = []
231 if 'style' in req.form:
233 if 'style' in req.form:
232 style = req.form['style'][0]
234 style = req.form['style'][0]
233 if style != self.config('web', 'style', ''):
235 if style != self.config('web', 'style', ''):
234 fields.append(('style', style))
236 fields.append(('style', style))
235
237
236 separator = req.url[-1] == '?' and ';' or '?'
238 separator = req.url[-1] == '?' and ';' or '?'
237 for name, value in fields:
239 for name, value in fields:
238 yield dict(name=name, value=value, separator=separator)
240 yield dict(name=name, value=value, separator=separator)
239 separator = ';'
241 separator = ';'
240
242
241 # figure out which style to use
243 # figure out which style to use
242
244
243 style = self.config("web", "style", "")
245 style = self.config("web", "style", "")
244 if 'style' in req.form:
246 if 'style' in req.form:
245 style = req.form['style'][0]
247 style = req.form['style'][0]
246 mapfile = style_map(self.templatepath, style)
248 mapfile = style_map(self.templatepath, style)
247
249
248 if not self.reponame:
250 if not self.reponame:
249 self.reponame = (self.config("web", "name")
251 self.reponame = (self.config("web", "name")
250 or req.env.get('REPO_NAME')
252 or req.env.get('REPO_NAME')
251 or req.url.strip('/') or self.repo.root)
253 or req.url.strip('/') or self.repo.root)
252
254
253 # create the templater
255 # create the templater
254
256
255 tmpl = templater.templater(mapfile, templatefilters.filters,
257 tmpl = templater.templater(mapfile, templatefilters.filters,
256 defaults={"url": req.url,
258 defaults={"url": req.url,
257 "staticurl": staticurl,
259 "staticurl": staticurl,
258 "urlbase": urlbase,
260 "urlbase": urlbase,
259 "repo": self.reponame,
261 "repo": self.reponame,
260 "header": header,
262 "header": header,
261 "footer": footer,
263 "footer": footer,
262 "motd": motd,
264 "motd": motd,
263 "sessionvars": sessionvars
265 "sessionvars": sessionvars
264 })
266 })
265 return tmpl
267 return tmpl
266
268
267 def archivelist(self, nodeid):
269 def archivelist(self, nodeid):
268 allowed = self.configlist("web", "allow_archive")
270 allowed = self.configlist("web", "allow_archive")
269 for i, spec in self.archive_specs.iteritems():
271 for i, spec in self.archive_specs.iteritems():
270 if i in allowed or self.configbool("web", "allow" + i):
272 if i in allowed or self.configbool("web", "allow" + i):
271 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
273 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
272
274
273 archive_specs = {
275 archive_specs = {
274 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
276 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
275 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
277 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
276 'zip': ('application/zip', 'zip', '.zip', None),
278 'zip': ('application/zip', 'zip', '.zip', None),
277 }
279 }
278
280
279 def check_perm(self, req, op):
281 def check_perm(self, req, op):
280 '''Check permission for operation based on request data (including
282 '''Check permission for operation based on request data (including
281 authentication info. Return true if op allowed, else false.'''
283 authentication info). Return if op allowed, else raise an ErrorResponse
284 exception.'''
285
286 user = req.env.get('REMOTE_USER')
287
288 deny_read = self.configlist('web', 'deny_read')
289 if deny_read and (not user or deny_read == ['*'] or user in deny_read):
290 raise ErrorResponse(HTTP_UNAUTHORIZED, 'read not authorized')
291
292 allow_read = self.configlist('web', 'allow_read')
293 result = (not allow_read) or (allow_read == ['*']) or (user in allow_read)
294 if not result:
295 raise ErrorResponse(HTTP_UNAUTHORIZED, 'read not authorized')
282
296
283 if op == 'pull' and not self.allowpull:
297 if op == 'pull' and not self.allowpull:
284 raise ErrorResponse(HTTP_OK, '')
298 raise ErrorResponse(HTTP_OK, '')
285 elif op == 'pull':
299 # op is None when checking allow/deny_read permissions for a web-browser request
300 elif op == 'pull' or op is None:
286 return
301 return
287
302
288 # enforce that you can only push using POST requests
303 # enforce that you can only push using POST requests
289 if req.env['REQUEST_METHOD'] != 'POST':
304 if req.env['REQUEST_METHOD'] != 'POST':
290 msg = 'push requires POST request'
305 msg = 'push requires POST request'
291 raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg)
306 raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg)
292
307
293 # require ssl by default for pushing, auth info cannot be sniffed
308 # require ssl by default for pushing, auth info cannot be sniffed
294 # and replayed
309 # and replayed
295 scheme = req.env.get('wsgi.url_scheme')
310 scheme = req.env.get('wsgi.url_scheme')
296 if self.configbool('web', 'push_ssl', True) and scheme != 'https':
311 if self.configbool('web', 'push_ssl', True) and scheme != 'https':
297 raise ErrorResponse(HTTP_OK, 'ssl required')
312 raise ErrorResponse(HTTP_OK, 'ssl required')
298
313
299 user = req.env.get('REMOTE_USER')
300
301 deny = self.configlist('web', 'deny_push')
314 deny = self.configlist('web', 'deny_push')
302 if deny and (not user or deny == ['*'] or user in deny):
315 if deny and (not user or deny == ['*'] or user in deny):
303 raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
316 raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
304
317
305 allow = self.configlist('web', 'allow_push')
318 allow = self.configlist('web', 'allow_push')
306 result = allow and (allow == ['*'] or user in allow)
319 result = allow and (allow == ['*'] or user in allow)
307 if not result:
320 if not result:
308 raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
321 raise ErrorResponse(HTTP_UNAUTHORIZED, 'push not authorized')
@@ -1,284 +1,309 b''
1 # hgweb/hgwebdir_mod.py - Web interface for a directory of repositories.
1 # hgweb/hgwebdir_mod.py - Web interface for a directory of repositories.
2 #
2 #
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
5 #
5 #
6 # This software may be used and distributed according to the terms
6 # This software may be used and distributed according to the terms
7 # of the GNU General Public License, incorporated herein by reference.
7 # of the GNU General Public License, incorporated herein by reference.
8
8
9 import os
9 import os
10 from mercurial.i18n import _
10 from mercurial.i18n import _
11 from mercurial.repo import RepoError
11 from mercurial.repo import RepoError
12 from mercurial import ui, hg, util, templater, templatefilters
12 from mercurial import ui, hg, util, templater, templatefilters
13 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\
13 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 from hgweb_mod import hgweb
15 from hgweb_mod import hgweb
16 from request import wsgirequest
16 from request import wsgirequest
17
17
18 # This is a stopgap
18 # This is a stopgap
19 class hgwebdir(object):
19 class hgwebdir(object):
20 def __init__(self, config, parentui=None):
20 def __init__(self, config, parentui=None):
21 def cleannames(items):
21 def cleannames(items):
22 return [(util.pconvert(name).strip('/'), path)
22 return [(util.pconvert(name).strip('/'), path)
23 for name, path in items]
23 for name, path in items]
24
24
25 self.parentui = parentui or ui.ui(report_untrusted=False,
25 self.parentui = parentui or ui.ui(report_untrusted=False,
26 interactive = False)
26 interactive = False)
27 self.motd = None
27 self.motd = None
28 self.style = None
28 self.style = None
29 self.stripecount = None
29 self.stripecount = None
30 self.repos_sorted = ('name', False)
30 self.repos_sorted = ('name', False)
31 self._baseurl = None
31 self._baseurl = None
32 if isinstance(config, (list, tuple)):
32 if isinstance(config, (list, tuple)):
33 self.repos = cleannames(config)
33 self.repos = cleannames(config)
34 self.repos_sorted = ('', False)
34 self.repos_sorted = ('', False)
35 elif isinstance(config, dict):
35 elif isinstance(config, dict):
36 self.repos = util.sort(cleannames(config.items()))
36 self.repos = util.sort(cleannames(config.items()))
37 else:
37 else:
38 if isinstance(config, util.configparser):
38 if isinstance(config, util.configparser):
39 cp = config
39 cp = config
40 else:
40 else:
41 cp = util.configparser()
41 cp = util.configparser()
42 cp.read(config)
42 cp.read(config)
43 self.repos = []
43 self.repos = []
44 if cp.has_section('web'):
44 if cp.has_section('web'):
45 if cp.has_option('web', 'motd'):
45 if cp.has_option('web', 'motd'):
46 self.motd = cp.get('web', 'motd')
46 self.motd = cp.get('web', 'motd')
47 if cp.has_option('web', 'style'):
47 if cp.has_option('web', 'style'):
48 self.style = cp.get('web', 'style')
48 self.style = cp.get('web', 'style')
49 if cp.has_option('web', 'stripes'):
49 if cp.has_option('web', 'stripes'):
50 self.stripecount = int(cp.get('web', 'stripes'))
50 self.stripecount = int(cp.get('web', 'stripes'))
51 if cp.has_option('web', 'baseurl'):
51 if cp.has_option('web', 'baseurl'):
52 self._baseurl = cp.get('web', 'baseurl')
52 self._baseurl = cp.get('web', 'baseurl')
53 if cp.has_section('paths'):
53 if cp.has_section('paths'):
54 self.repos.extend(cleannames(cp.items('paths')))
54 self.repos.extend(cleannames(cp.items('paths')))
55 if cp.has_section('collections'):
55 if cp.has_section('collections'):
56 for prefix, root in cp.items('collections'):
56 for prefix, root in cp.items('collections'):
57 for path in util.walkrepos(root, followsym=True):
57 for path in util.walkrepos(root, followsym=True):
58 repo = os.path.normpath(path)
58 repo = os.path.normpath(path)
59 name = repo
59 name = repo
60 if name.startswith(prefix):
60 if name.startswith(prefix):
61 name = name[len(prefix):]
61 name = name[len(prefix):]
62 self.repos.append((name.lstrip(os.sep), repo))
62 self.repos.append((name.lstrip(os.sep), repo))
63 self.repos.sort()
63 self.repos.sort()
64
64
65 def run(self):
65 def run(self):
66 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
66 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
67 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
67 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
68 import mercurial.hgweb.wsgicgi as wsgicgi
68 import mercurial.hgweb.wsgicgi as wsgicgi
69 wsgicgi.launch(self)
69 wsgicgi.launch(self)
70
70
71 def __call__(self, env, respond):
71 def __call__(self, env, respond):
72 req = wsgirequest(env, respond)
72 req = wsgirequest(env, respond)
73 return self.run_wsgi(req)
73 return self.run_wsgi(req)
74
74
75 def read_allowed(self, ui, req):
76 """Check allow_read and deny_read config options of a repo's ui object
77 to determine user permissions. By default, with neither option set (or
78 both empty), allow all users to read the repo. There are two ways a
79 user can be denied read access: (1) deny_read is not empty, and the
80 user is unauthenticated or deny_read contains user (or *), and (2)
81 allow_read is not empty and the user is not in allow_read. Return True
82 if user is allowed to read the repo, else return False."""
83
84 user = req.env.get('REMOTE_USER')
85
86 deny_read = ui.configlist('web', 'deny_read', default=None, untrusted=True)
87 if deny_read and (not user or deny_read == ['*'] or user in deny_read):
88 return False
89
90 allow_read = ui.configlist('web', 'allow_read', default=None, untrusted=True)
91 # by default, allow reading if no allow_read option has been set
92 if (not allow_read) or (allow_read == ['*']) or (user in allow_read):
93 return True
94
95 return False
96
75 def run_wsgi(self, req):
97 def run_wsgi(self, req):
76
98
77 try:
99 try:
78 try:
100 try:
79
101
80 virtual = req.env.get("PATH_INFO", "").strip('/')
102 virtual = req.env.get("PATH_INFO", "").strip('/')
81 tmpl = self.templater(req)
103 tmpl = self.templater(req)
82 ctype = tmpl('mimetype', encoding=util._encoding)
104 ctype = tmpl('mimetype', encoding=util._encoding)
83 ctype = templater.stringify(ctype)
105 ctype = templater.stringify(ctype)
84
106
85 # a static file
107 # a static file
86 if virtual.startswith('static/') or 'static' in req.form:
108 if virtual.startswith('static/') or 'static' in req.form:
87 if virtual.startswith('static/'):
109 if virtual.startswith('static/'):
88 fname = virtual[7:]
110 fname = virtual[7:]
89 else:
111 else:
90 fname = req.form['static'][0]
112 fname = req.form['static'][0]
91 static = templater.templatepath('static')
113 static = templater.templatepath('static')
92 return staticfile(static, fname, req)
114 return staticfile(static, fname, req)
93
115
94 # top-level index
116 # top-level index
95 elif not virtual:
117 elif not virtual:
96 req.respond(HTTP_OK, ctype)
118 req.respond(HTTP_OK, ctype)
97 return ''.join(self.makeindex(req, tmpl)),
119 return ''.join(self.makeindex(req, tmpl)),
98
120
99 # nested indexes and hgwebs
121 # nested indexes and hgwebs
100
122
101 repos = dict(self.repos)
123 repos = dict(self.repos)
102 while virtual:
124 while virtual:
103 real = repos.get(virtual)
125 real = repos.get(virtual)
104 if real:
126 if real:
105 req.env['REPO_NAME'] = virtual
127 req.env['REPO_NAME'] = virtual
106 try:
128 try:
107 repo = hg.repository(self.parentui, real)
129 repo = hg.repository(self.parentui, real)
108 return hgweb(repo).run_wsgi(req)
130 return hgweb(repo).run_wsgi(req)
109 except IOError, inst:
131 except IOError, inst:
110 msg = inst.strerror
132 msg = inst.strerror
111 raise ErrorResponse(HTTP_SERVER_ERROR, msg)
133 raise ErrorResponse(HTTP_SERVER_ERROR, msg)
112 except RepoError, inst:
134 except RepoError, inst:
113 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
135 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
114
136
115 # browse subdirectories
137 # browse subdirectories
116 subdir = virtual + '/'
138 subdir = virtual + '/'
117 if [r for r in repos if r.startswith(subdir)]:
139 if [r for r in repos if r.startswith(subdir)]:
118 req.respond(HTTP_OK, ctype)
140 req.respond(HTTP_OK, ctype)
119 return ''.join(self.makeindex(req, tmpl, subdir)),
141 return ''.join(self.makeindex(req, tmpl, subdir)),
120
142
121 up = virtual.rfind('/')
143 up = virtual.rfind('/')
122 if up < 0:
144 if up < 0:
123 break
145 break
124 virtual = virtual[:up]
146 virtual = virtual[:up]
125
147
126 # prefixes not found
148 # prefixes not found
127 req.respond(HTTP_NOT_FOUND, ctype)
149 req.respond(HTTP_NOT_FOUND, ctype)
128 return ''.join(tmpl("notfound", repo=virtual)),
150 return ''.join(tmpl("notfound", repo=virtual)),
129
151
130 except ErrorResponse, err:
152 except ErrorResponse, err:
131 req.respond(err.code, ctype)
153 req.respond(err.code, ctype)
132 return ''.join(tmpl('error', error=err.message or '')),
154 return ''.join(tmpl('error', error=err.message or '')),
133 finally:
155 finally:
134 tmpl = None
156 tmpl = None
135
157
136 def makeindex(self, req, tmpl, subdir=""):
158 def makeindex(self, req, tmpl, subdir=""):
137
159
138 def archivelist(ui, nodeid, url):
160 def archivelist(ui, nodeid, url):
139 allowed = ui.configlist("web", "allow_archive", untrusted=True)
161 allowed = ui.configlist("web", "allow_archive", untrusted=True)
140 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
162 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
141 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
163 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
142 untrusted=True):
164 untrusted=True):
143 yield {"type" : i[0], "extension": i[1],
165 yield {"type" : i[0], "extension": i[1],
144 "node": nodeid, "url": url}
166 "node": nodeid, "url": url}
145
167
146 def entries(sortcolumn="", descending=False, subdir="", **map):
168 def entries(sortcolumn="", descending=False, subdir="", **map):
147 def sessionvars(**map):
169 def sessionvars(**map):
148 fields = []
170 fields = []
149 if 'style' in req.form:
171 if 'style' in req.form:
150 style = req.form['style'][0]
172 style = req.form['style'][0]
151 if style != get('web', 'style', ''):
173 if style != get('web', 'style', ''):
152 fields.append(('style', style))
174 fields.append(('style', style))
153
175
154 separator = url[-1] == '?' and ';' or '?'
176 separator = url[-1] == '?' and ';' or '?'
155 for name, value in fields:
177 for name, value in fields:
156 yield dict(name=name, value=value, separator=separator)
178 yield dict(name=name, value=value, separator=separator)
157 separator = ';'
179 separator = ';'
158
180
159 rows = []
181 rows = []
160 parity = paritygen(self.stripecount)
182 parity = paritygen(self.stripecount)
161 for name, path in self.repos:
183 for name, path in self.repos:
162 if not name.startswith(subdir):
184 if not name.startswith(subdir):
163 continue
185 continue
164 name = name[len(subdir):]
186 name = name[len(subdir):]
165
187
166 u = ui.ui(parentui=self.parentui)
188 u = ui.ui(parentui=self.parentui)
167 try:
189 try:
168 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
190 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
169 except Exception, e:
191 except Exception, e:
170 u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
192 u.warn(_('error reading %s/.hg/hgrc: %s\n') % (path, e))
171 continue
193 continue
172 def get(section, name, default=None):
194 def get(section, name, default=None):
173 return u.config(section, name, default, untrusted=True)
195 return u.config(section, name, default, untrusted=True)
174
196
175 if u.configbool("web", "hidden", untrusted=True):
197 if u.configbool("web", "hidden", untrusted=True):
176 continue
198 continue
177
199
200 if not self.read_allowed(u, req):
201 continue
202
178 parts = [name]
203 parts = [name]
179 if 'PATH_INFO' in req.env:
204 if 'PATH_INFO' in req.env:
180 parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
205 parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
181 if req.env['SCRIPT_NAME']:
206 if req.env['SCRIPT_NAME']:
182 parts.insert(0, req.env['SCRIPT_NAME'])
207 parts.insert(0, req.env['SCRIPT_NAME'])
183 url = ('/'.join(parts).replace("//", "/")) + '/'
208 url = ('/'.join(parts).replace("//", "/")) + '/'
184
209
185 # update time with local timezone
210 # update time with local timezone
186 try:
211 try:
187 d = (get_mtime(path), util.makedate()[1])
212 d = (get_mtime(path), util.makedate()[1])
188 except OSError:
213 except OSError:
189 continue
214 continue
190
215
191 contact = get_contact(get)
216 contact = get_contact(get)
192 description = get("web", "description", "")
217 description = get("web", "description", "")
193 name = get("web", "name", name)
218 name = get("web", "name", name)
194 row = dict(contact=contact or "unknown",
219 row = dict(contact=contact or "unknown",
195 contact_sort=contact.upper() or "unknown",
220 contact_sort=contact.upper() or "unknown",
196 name=name,
221 name=name,
197 name_sort=name,
222 name_sort=name,
198 url=url,
223 url=url,
199 description=description or "unknown",
224 description=description or "unknown",
200 description_sort=description.upper() or "unknown",
225 description_sort=description.upper() or "unknown",
201 lastchange=d,
226 lastchange=d,
202 lastchange_sort=d[1]-d[0],
227 lastchange_sort=d[1]-d[0],
203 sessionvars=sessionvars,
228 sessionvars=sessionvars,
204 archives=archivelist(u, "tip", url))
229 archives=archivelist(u, "tip", url))
205 if (not sortcolumn
230 if (not sortcolumn
206 or (sortcolumn, descending) == self.repos_sorted):
231 or (sortcolumn, descending) == self.repos_sorted):
207 # fast path for unsorted output
232 # fast path for unsorted output
208 row['parity'] = parity.next()
233 row['parity'] = parity.next()
209 yield row
234 yield row
210 else:
235 else:
211 rows.append((row["%s_sort" % sortcolumn], row))
236 rows.append((row["%s_sort" % sortcolumn], row))
212 if rows:
237 if rows:
213 rows.sort()
238 rows.sort()
214 if descending:
239 if descending:
215 rows.reverse()
240 rows.reverse()
216 for key, row in rows:
241 for key, row in rows:
217 row['parity'] = parity.next()
242 row['parity'] = parity.next()
218 yield row
243 yield row
219
244
220 sortable = ["name", "description", "contact", "lastchange"]
245 sortable = ["name", "description", "contact", "lastchange"]
221 sortcolumn, descending = self.repos_sorted
246 sortcolumn, descending = self.repos_sorted
222 if 'sort' in req.form:
247 if 'sort' in req.form:
223 sortcolumn = req.form['sort'][0]
248 sortcolumn = req.form['sort'][0]
224 descending = sortcolumn.startswith('-')
249 descending = sortcolumn.startswith('-')
225 if descending:
250 if descending:
226 sortcolumn = sortcolumn[1:]
251 sortcolumn = sortcolumn[1:]
227 if sortcolumn not in sortable:
252 if sortcolumn not in sortable:
228 sortcolumn = ""
253 sortcolumn = ""
229
254
230 sort = [("sort_%s" % column,
255 sort = [("sort_%s" % column,
231 "%s%s" % ((not descending and column == sortcolumn)
256 "%s%s" % ((not descending and column == sortcolumn)
232 and "-" or "", column))
257 and "-" or "", column))
233 for column in sortable]
258 for column in sortable]
234
259
235 if self._baseurl is not None:
260 if self._baseurl is not None:
236 req.env['SCRIPT_NAME'] = self._baseurl
261 req.env['SCRIPT_NAME'] = self._baseurl
237
262
238 return tmpl("index", entries=entries, subdir=subdir,
263 return tmpl("index", entries=entries, subdir=subdir,
239 sortcolumn=sortcolumn, descending=descending,
264 sortcolumn=sortcolumn, descending=descending,
240 **dict(sort))
265 **dict(sort))
241
266
242 def templater(self, req):
267 def templater(self, req):
243
268
244 def header(**map):
269 def header(**map):
245 yield tmpl('header', encoding=util._encoding, **map)
270 yield tmpl('header', encoding=util._encoding, **map)
246
271
247 def footer(**map):
272 def footer(**map):
248 yield tmpl("footer", **map)
273 yield tmpl("footer", **map)
249
274
250 def motd(**map):
275 def motd(**map):
251 if self.motd is not None:
276 if self.motd is not None:
252 yield self.motd
277 yield self.motd
253 else:
278 else:
254 yield config('web', 'motd', '')
279 yield config('web', 'motd', '')
255
280
256 def config(section, name, default=None, untrusted=True):
281 def config(section, name, default=None, untrusted=True):
257 return self.parentui.config(section, name, default, untrusted)
282 return self.parentui.config(section, name, default, untrusted)
258
283
259 if self._baseurl is not None:
284 if self._baseurl is not None:
260 req.env['SCRIPT_NAME'] = self._baseurl
285 req.env['SCRIPT_NAME'] = self._baseurl
261
286
262 url = req.env.get('SCRIPT_NAME', '')
287 url = req.env.get('SCRIPT_NAME', '')
263 if not url.endswith('/'):
288 if not url.endswith('/'):
264 url += '/'
289 url += '/'
265
290
266 staticurl = config('web', 'staticurl') or url + 'static/'
291 staticurl = config('web', 'staticurl') or url + 'static/'
267 if not staticurl.endswith('/'):
292 if not staticurl.endswith('/'):
268 staticurl += '/'
293 staticurl += '/'
269
294
270 style = self.style
295 style = self.style
271 if style is None:
296 if style is None:
272 style = config('web', 'style', '')
297 style = config('web', 'style', '')
273 if 'style' in req.form:
298 if 'style' in req.form:
274 style = req.form['style'][0]
299 style = req.form['style'][0]
275 if self.stripecount is None:
300 if self.stripecount is None:
276 self.stripecount = int(config('web', 'stripes', 1))
301 self.stripecount = int(config('web', 'stripes', 1))
277 mapfile = style_map(templater.templatepath(), style)
302 mapfile = style_map(templater.templatepath(), style)
278 tmpl = templater.templater(mapfile, templatefilters.filters,
303 tmpl = templater.templater(mapfile, templatefilters.filters,
279 defaults={"header": header,
304 defaults={"header": header,
280 "footer": footer,
305 "footer": footer,
281 "motd": motd,
306 "motd": motd,
282 "url": url,
307 "url": url,
283 "staticurl": staticurl})
308 "staticurl": staticurl})
284 return tmpl
309 return tmpl
General Comments 0
You need to be logged in to leave comments. Login now