Show More
@@ -1,730 +1,724 b'' | |||||
1 | # patchbomb.py - sending Mercurial changesets as patch emails |
|
1 | # patchbomb.py - sending Mercurial changesets as patch emails | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others |
|
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | '''command to send changesets as (a series of) patch emails |
|
8 | '''command to send changesets as (a series of) patch emails | |
9 |
|
9 | |||
10 | The series is started off with a "[PATCH 0 of N]" introduction, which |
|
10 | The series is started off with a "[PATCH 0 of N]" introduction, which | |
11 | describes the series as a whole. |
|
11 | describes the series as a whole. | |
12 |
|
12 | |||
13 | Each patch email has a Subject line of "[PATCH M of N] ...", using the |
|
13 | Each patch email has a Subject line of "[PATCH M of N] ...", using the | |
14 | first line of the changeset description as the subject text. The |
|
14 | first line of the changeset description as the subject text. The | |
15 | message contains two or three body parts: |
|
15 | message contains two or three body parts: | |
16 |
|
16 | |||
17 | - The changeset description. |
|
17 | - The changeset description. | |
18 | - [Optional] The result of running diffstat on the patch. |
|
18 | - [Optional] The result of running diffstat on the patch. | |
19 | - The patch itself, as generated by :hg:`export`. |
|
19 | - The patch itself, as generated by :hg:`export`. | |
20 |
|
20 | |||
21 | Each message refers to the first in the series using the In-Reply-To |
|
21 | Each message refers to the first in the series using the In-Reply-To | |
22 | and References headers, so they will show up as a sequence in threaded |
|
22 | and References headers, so they will show up as a sequence in threaded | |
23 | mail and news readers, and in mail archives. |
|
23 | mail and news readers, and in mail archives. | |
24 |
|
24 | |||
25 | To configure other defaults, add a section like this to your |
|
25 | To configure other defaults, add a section like this to your | |
26 | configuration file:: |
|
26 | configuration file:: | |
27 |
|
27 | |||
28 | [email] |
|
28 | [email] | |
29 | from = My Name <my@email> |
|
29 | from = My Name <my@email> | |
30 | to = recipient1, recipient2, ... |
|
30 | to = recipient1, recipient2, ... | |
31 | cc = cc1, cc2, ... |
|
31 | cc = cc1, cc2, ... | |
32 | bcc = bcc1, bcc2, ... |
|
32 | bcc = bcc1, bcc2, ... | |
33 | reply-to = address1, address2, ... |
|
33 | reply-to = address1, address2, ... | |
34 |
|
34 | |||
35 | Use ``[patchbomb]`` as configuration section name if you need to |
|
35 | Use ``[patchbomb]`` as configuration section name if you need to | |
36 | override global ``[email]`` address settings. |
|
36 | override global ``[email]`` address settings. | |
37 |
|
37 | |||
38 | Then you can use the :hg:`email` command to mail a series of |
|
38 | Then you can use the :hg:`email` command to mail a series of | |
39 | changesets as a patchbomb. |
|
39 | changesets as a patchbomb. | |
40 |
|
40 | |||
41 | You can also either configure the method option in the email section |
|
41 | You can also either configure the method option in the email section | |
42 | to be a sendmail compatible mailer or fill out the [smtp] section so |
|
42 | to be a sendmail compatible mailer or fill out the [smtp] section so | |
43 | that the patchbomb extension can automatically send patchbombs |
|
43 | that the patchbomb extension can automatically send patchbombs | |
44 | directly from the commandline. See the [email] and [smtp] sections in |
|
44 | directly from the commandline. See the [email] and [smtp] sections in | |
45 | hgrc(5) for details. |
|
45 | hgrc(5) for details. | |
46 |
|
46 | |||
47 | By default, :hg:`email` will prompt for a ``To`` or ``CC`` header if |
|
47 | By default, :hg:`email` will prompt for a ``To`` or ``CC`` header if | |
48 | you do not supply one via configuration or the command line. You can |
|
48 | you do not supply one via configuration or the command line. You can | |
49 | override this to never prompt by configuring an empty value:: |
|
49 | override this to never prompt by configuring an empty value:: | |
50 |
|
50 | |||
51 | [email] |
|
51 | [email] | |
52 | cc = |
|
52 | cc = | |
53 |
|
53 | |||
54 | You can control the default inclusion of an introduction message with the |
|
54 | You can control the default inclusion of an introduction message with the | |
55 | ``patchbomb.intro`` configuration option. The configuration is always |
|
55 | ``patchbomb.intro`` configuration option. The configuration is always | |
56 | overwritten by command line flags like --intro and --desc:: |
|
56 | overwritten by command line flags like --intro and --desc:: | |
57 |
|
57 | |||
58 | [patchbomb] |
|
58 | [patchbomb] | |
59 | intro=auto # include introduction message if more than 1 patch (default) |
|
59 | intro=auto # include introduction message if more than 1 patch (default) | |
60 | intro=never # never include an introduction message |
|
60 | intro=never # never include an introduction message | |
61 | intro=always # always include an introduction message |
|
61 | intro=always # always include an introduction message | |
62 |
|
62 | |||
63 | You can set patchbomb to always ask for confirmation by setting |
|
63 | You can set patchbomb to always ask for confirmation by setting | |
64 | ``patchbomb.confirm`` to true. |
|
64 | ``patchbomb.confirm`` to true. | |
65 | ''' |
|
65 | ''' | |
66 | from __future__ import absolute_import |
|
66 | from __future__ import absolute_import | |
67 |
|
67 | |||
68 | import email as emailmod |
|
68 | import email as emailmod | |
69 | import errno |
|
69 | import errno | |
70 | import os |
|
70 | import os | |
71 | import socket |
|
71 | import socket | |
72 | import tempfile |
|
72 | import tempfile | |
73 |
|
73 | |||
74 | from mercurial.i18n import _ |
|
74 | from mercurial.i18n import _ | |
75 | from mercurial import ( |
|
75 | from mercurial import ( | |
76 | cmdutil, |
|
76 | cmdutil, | |
77 | commands, |
|
77 | commands, | |
78 | error, |
|
78 | error, | |
79 | hg, |
|
79 | hg, | |
80 | mail, |
|
80 | mail, | |
81 | node as nodemod, |
|
81 | node as nodemod, | |
82 | patch, |
|
82 | patch, | |
83 | scmutil, |
|
83 | scmutil, | |
84 | util, |
|
84 | util, | |
85 | ) |
|
85 | ) | |
86 | stringio = util.stringio |
|
86 | stringio = util.stringio | |
87 |
|
87 | |||
88 | cmdtable = {} |
|
88 | cmdtable = {} | |
89 | command = cmdutil.command(cmdtable) |
|
89 | command = cmdutil.command(cmdtable) | |
90 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
90 | # Note for extension authors: ONLY specify testedwith = 'internal' for | |
91 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
91 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
92 | # be specifying the version(s) of Mercurial they are tested with, or |
|
92 | # be specifying the version(s) of Mercurial they are tested with, or | |
93 | # leave the attribute unspecified. |
|
93 | # leave the attribute unspecified. | |
94 | testedwith = 'internal' |
|
94 | testedwith = 'internal' | |
95 |
|
95 | |||
96 | def _addpullheader(seq, ctx): |
|
96 | def _addpullheader(seq, ctx): | |
97 | """Add a header pointing to a public URL where the changeset is available |
|
97 | """Add a header pointing to a public URL where the changeset is available | |
98 | """ |
|
98 | """ | |
99 | repo = ctx.repo() |
|
99 | repo = ctx.repo() | |
100 | # experimental config: patchbomb.publicurl |
|
100 | # experimental config: patchbomb.publicurl | |
101 | # waiting for some logic that check that the changeset are available on the |
|
101 | # waiting for some logic that check that the changeset are available on the | |
102 | # destination before patchbombing anything. |
|
102 | # destination before patchbombing anything. | |
103 | pullurl = repo.ui.config('patchbomb', 'publicurl') |
|
103 | pullurl = repo.ui.config('patchbomb', 'publicurl') | |
104 | if pullurl is not None: |
|
104 | if pullurl is not None: | |
105 | return ('Available At %s\n' |
|
105 | return ('Available At %s\n' | |
106 | '# hg pull %s -r %s' % (pullurl, pullurl, ctx)) |
|
106 | '# hg pull %s -r %s' % (pullurl, pullurl, ctx)) | |
107 | return None |
|
107 | return None | |
108 |
|
108 | |||
109 | def uisetup(ui): |
|
109 | def uisetup(ui): | |
110 | cmdutil.extraexport.append('pullurl') |
|
110 | cmdutil.extraexport.append('pullurl') | |
111 | cmdutil.extraexportmap['pullurl'] = _addpullheader |
|
111 | cmdutil.extraexportmap['pullurl'] = _addpullheader | |
112 |
|
112 | |||
113 |
|
113 | |||
114 | def prompt(ui, prompt, default=None, rest=':'): |
|
114 | def prompt(ui, prompt, default=None, rest=':'): | |
115 | if default: |
|
115 | if default: | |
116 | prompt += ' [%s]' % default |
|
116 | prompt += ' [%s]' % default | |
117 | return ui.prompt(prompt + rest, default) |
|
117 | return ui.prompt(prompt + rest, default) | |
118 |
|
118 | |||
119 | def introwanted(ui, opts, number): |
|
119 | def introwanted(ui, opts, number): | |
120 | '''is an introductory message apparently wanted?''' |
|
120 | '''is an introductory message apparently wanted?''' | |
121 | introconfig = ui.config('patchbomb', 'intro', 'auto') |
|
121 | introconfig = ui.config('patchbomb', 'intro', 'auto') | |
122 | if opts.get('intro') or opts.get('desc'): |
|
122 | if opts.get('intro') or opts.get('desc'): | |
123 | intro = True |
|
123 | intro = True | |
124 | elif introconfig == 'always': |
|
124 | elif introconfig == 'always': | |
125 | intro = True |
|
125 | intro = True | |
126 | elif introconfig == 'never': |
|
126 | elif introconfig == 'never': | |
127 | intro = False |
|
127 | intro = False | |
128 | elif introconfig == 'auto': |
|
128 | elif introconfig == 'auto': | |
129 | intro = 1 < number |
|
129 | intro = 1 < number | |
130 | else: |
|
130 | else: | |
131 | ui.write_err(_('warning: invalid patchbomb.intro value "%s"\n') |
|
131 | ui.write_err(_('warning: invalid patchbomb.intro value "%s"\n') | |
132 | % introconfig) |
|
132 | % introconfig) | |
133 | ui.write_err(_('(should be one of always, never, auto)\n')) |
|
133 | ui.write_err(_('(should be one of always, never, auto)\n')) | |
134 | intro = 1 < number |
|
134 | intro = 1 < number | |
135 | return intro |
|
135 | return intro | |
136 |
|
136 | |||
137 | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, numbered, |
|
137 | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, numbered, | |
138 | patchname=None): |
|
138 | patchname=None): | |
139 |
|
139 | |||
140 | desc = [] |
|
140 | desc = [] | |
141 | node = None |
|
141 | node = None | |
142 | body = '' |
|
142 | body = '' | |
143 |
|
143 | |||
144 | for line in patchlines: |
|
144 | for line in patchlines: | |
145 | if line.startswith('#'): |
|
145 | if line.startswith('#'): | |
146 | if line.startswith('# Node ID'): |
|
146 | if line.startswith('# Node ID'): | |
147 | node = line.split()[-1] |
|
147 | node = line.split()[-1] | |
148 | continue |
|
148 | continue | |
149 | if line.startswith('diff -r') or line.startswith('diff --git'): |
|
149 | if line.startswith('diff -r') or line.startswith('diff --git'): | |
150 | break |
|
150 | break | |
151 | desc.append(line) |
|
151 | desc.append(line) | |
152 |
|
152 | |||
153 | if not patchname and not node: |
|
153 | if not patchname and not node: | |
154 | raise ValueError |
|
154 | raise ValueError | |
155 |
|
155 | |||
156 | if opts.get('attach') and not opts.get('body'): |
|
156 | if opts.get('attach') and not opts.get('body'): | |
157 | body = ('\n'.join(desc[1:]).strip() or |
|
157 | body = ('\n'.join(desc[1:]).strip() or | |
158 | 'Patch subject is complete summary.') |
|
158 | 'Patch subject is complete summary.') | |
159 | body += '\n\n\n' |
|
159 | body += '\n\n\n' | |
160 |
|
160 | |||
161 | if opts.get('plain'): |
|
161 | if opts.get('plain'): | |
162 | while patchlines and patchlines[0].startswith('# '): |
|
162 | while patchlines and patchlines[0].startswith('# '): | |
163 | patchlines.pop(0) |
|
163 | patchlines.pop(0) | |
164 | if patchlines: |
|
164 | if patchlines: | |
165 | patchlines.pop(0) |
|
165 | patchlines.pop(0) | |
166 | while patchlines and not patchlines[0].strip(): |
|
166 | while patchlines and not patchlines[0].strip(): | |
167 | patchlines.pop(0) |
|
167 | patchlines.pop(0) | |
168 |
|
168 | |||
169 | ds = patch.diffstat(patchlines, git=opts.get('git')) |
|
169 | ds = patch.diffstat(patchlines, git=opts.get('git')) | |
170 | if opts.get('diffstat'): |
|
170 | if opts.get('diffstat'): | |
171 | body += ds + '\n\n' |
|
171 | body += ds + '\n\n' | |
172 |
|
172 | |||
173 | addattachment = opts.get('attach') or opts.get('inline') |
|
173 | addattachment = opts.get('attach') or opts.get('inline') | |
174 | if not addattachment or opts.get('body'): |
|
174 | if not addattachment or opts.get('body'): | |
175 | body += '\n'.join(patchlines) |
|
175 | body += '\n'.join(patchlines) | |
176 |
|
176 | |||
177 | if addattachment: |
|
177 | if addattachment: | |
178 | msg = emailmod.MIMEMultipart.MIMEMultipart() |
|
178 | msg = emailmod.MIMEMultipart.MIMEMultipart() | |
179 | if body: |
|
179 | if body: | |
180 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
|
180 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | |
181 | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', |
|
181 | p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', | |
182 | opts.get('test')) |
|
182 | opts.get('test')) | |
183 | binnode = nodemod.bin(node) |
|
183 | binnode = nodemod.bin(node) | |
184 | # if node is mq patch, it will have the patch file's name as a tag |
|
184 | # if node is mq patch, it will have the patch file's name as a tag | |
185 | if not patchname: |
|
185 | if not patchname: | |
186 | patchtags = [t for t in repo.nodetags(binnode) |
|
186 | patchtags = [t for t in repo.nodetags(binnode) | |
187 | if t.endswith('.patch') or t.endswith('.diff')] |
|
187 | if t.endswith('.patch') or t.endswith('.diff')] | |
188 | if patchtags: |
|
188 | if patchtags: | |
189 | patchname = patchtags[0] |
|
189 | patchname = patchtags[0] | |
190 | elif total > 1: |
|
190 | elif total > 1: | |
191 | patchname = cmdutil.makefilename(repo, '%b-%n.patch', |
|
191 | patchname = cmdutil.makefilename(repo, '%b-%n.patch', | |
192 | binnode, seqno=idx, |
|
192 | binnode, seqno=idx, | |
193 | total=total) |
|
193 | total=total) | |
194 | else: |
|
194 | else: | |
195 | patchname = cmdutil.makefilename(repo, '%b.patch', binnode) |
|
195 | patchname = cmdutil.makefilename(repo, '%b.patch', binnode) | |
196 | disposition = 'inline' |
|
196 | disposition = 'inline' | |
197 | if opts.get('attach'): |
|
197 | if opts.get('attach'): | |
198 | disposition = 'attachment' |
|
198 | disposition = 'attachment' | |
199 | p['Content-Disposition'] = disposition + '; filename=' + patchname |
|
199 | p['Content-Disposition'] = disposition + '; filename=' + patchname | |
200 | msg.attach(p) |
|
200 | msg.attach(p) | |
201 | else: |
|
201 | else: | |
202 | msg = mail.mimetextpatch(body, display=opts.get('test')) |
|
202 | msg = mail.mimetextpatch(body, display=opts.get('test')) | |
203 |
|
203 | |||
204 | flag = ' '.join(opts.get('flag')) |
|
204 | flag = ' '.join(opts.get('flag')) | |
205 | if flag: |
|
205 | if flag: | |
206 | flag = ' ' + flag |
|
206 | flag = ' ' + flag | |
207 |
|
207 | |||
208 | subj = desc[0].strip().rstrip('. ') |
|
208 | subj = desc[0].strip().rstrip('. ') | |
209 | if not numbered: |
|
209 | if not numbered: | |
210 | subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) |
|
210 | subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) | |
211 | else: |
|
211 | else: | |
212 | tlen = len(str(total)) |
|
212 | tlen = len(str(total)) | |
213 | subj = '[PATCH %0*d of %d%s] %s' % (tlen, idx, total, flag, subj) |
|
213 | subj = '[PATCH %0*d of %d%s] %s' % (tlen, idx, total, flag, subj) | |
214 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) |
|
214 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) | |
215 | msg['X-Mercurial-Node'] = node |
|
215 | msg['X-Mercurial-Node'] = node | |
216 | msg['X-Mercurial-Series-Index'] = '%i' % idx |
|
216 | msg['X-Mercurial-Series-Index'] = '%i' % idx | |
217 | msg['X-Mercurial-Series-Total'] = '%i' % total |
|
217 | msg['X-Mercurial-Series-Total'] = '%i' % total | |
218 | return msg, subj, ds |
|
218 | return msg, subj, ds | |
219 |
|
219 | |||
220 | def _getpatches(repo, revs, **opts): |
|
220 | def _getpatches(repo, revs, **opts): | |
221 | """return a list of patches for a list of revisions |
|
221 | """return a list of patches for a list of revisions | |
222 |
|
222 | |||
223 | Each patch in the list is itself a list of lines. |
|
223 | Each patch in the list is itself a list of lines. | |
224 | """ |
|
224 | """ | |
225 | ui = repo.ui |
|
225 | ui = repo.ui | |
226 | prev = repo['.'].rev() |
|
226 | prev = repo['.'].rev() | |
227 | for r in revs: |
|
227 | for r in revs: | |
228 | if r == prev and (repo[None].files() or repo[None].deleted()): |
|
228 | if r == prev and (repo[None].files() or repo[None].deleted()): | |
229 | ui.warn(_('warning: working directory has ' |
|
229 | ui.warn(_('warning: working directory has ' | |
230 | 'uncommitted changes\n')) |
|
230 | 'uncommitted changes\n')) | |
231 | output = stringio() |
|
231 | output = stringio() | |
232 | cmdutil.export(repo, [r], fp=output, |
|
232 | cmdutil.export(repo, [r], fp=output, | |
233 | opts=patch.difffeatureopts(ui, opts, git=True)) |
|
233 | opts=patch.difffeatureopts(ui, opts, git=True)) | |
234 | yield output.getvalue().split('\n') |
|
234 | yield output.getvalue().split('\n') | |
235 | def _getbundle(repo, dest, **opts): |
|
235 | def _getbundle(repo, dest, **opts): | |
236 | """return a bundle containing changesets missing in "dest" |
|
236 | """return a bundle containing changesets missing in "dest" | |
237 |
|
237 | |||
238 | The `opts` keyword-arguments are the same as the one accepted by the |
|
238 | The `opts` keyword-arguments are the same as the one accepted by the | |
239 | `bundle` command. |
|
239 | `bundle` command. | |
240 |
|
240 | |||
241 | The bundle is a returned as a single in-memory binary blob. |
|
241 | The bundle is a returned as a single in-memory binary blob. | |
242 | """ |
|
242 | """ | |
243 | ui = repo.ui |
|
243 | ui = repo.ui | |
244 | tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-') |
|
244 | tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-') | |
245 | tmpfn = os.path.join(tmpdir, 'bundle') |
|
245 | tmpfn = os.path.join(tmpdir, 'bundle') | |
246 | btype = ui.config('patchbomb', 'bundletype') |
|
246 | btype = ui.config('patchbomb', 'bundletype') | |
247 | if btype: |
|
247 | if btype: | |
248 | opts['type'] = btype |
|
248 | opts['type'] = btype | |
249 | try: |
|
249 | try: | |
250 | commands.bundle(ui, repo, tmpfn, dest, **opts) |
|
250 | commands.bundle(ui, repo, tmpfn, dest, **opts) | |
251 | return util.readfile(tmpfn) |
|
251 | return util.readfile(tmpfn) | |
252 | finally: |
|
252 | finally: | |
253 | try: |
|
253 | try: | |
254 | os.unlink(tmpfn) |
|
254 | os.unlink(tmpfn) | |
255 | except OSError: |
|
255 | except OSError: | |
256 | pass |
|
256 | pass | |
257 | os.rmdir(tmpdir) |
|
257 | os.rmdir(tmpdir) | |
258 |
|
258 | |||
259 | def _getdescription(repo, defaultbody, sender, **opts): |
|
259 | def _getdescription(repo, defaultbody, sender, **opts): | |
260 | """obtain the body of the introduction message and return it |
|
260 | """obtain the body of the introduction message and return it | |
261 |
|
261 | |||
262 | This is also used for the body of email with an attached bundle. |
|
262 | This is also used for the body of email with an attached bundle. | |
263 |
|
263 | |||
264 | The body can be obtained either from the command line option or entered by |
|
264 | The body can be obtained either from the command line option or entered by | |
265 | the user through the editor. |
|
265 | the user through the editor. | |
266 | """ |
|
266 | """ | |
267 | ui = repo.ui |
|
267 | ui = repo.ui | |
268 | if opts.get('desc'): |
|
268 | if opts.get('desc'): | |
269 | body = open(opts.get('desc')).read() |
|
269 | body = open(opts.get('desc')).read() | |
270 | else: |
|
270 | else: | |
271 | ui.write(_('\nWrite the introductory message for the ' |
|
271 | ui.write(_('\nWrite the introductory message for the ' | |
272 | 'patch series.\n\n')) |
|
272 | 'patch series.\n\n')) | |
273 | body = ui.edit(defaultbody, sender) |
|
273 | body = ui.edit(defaultbody, sender) | |
274 | # Save series description in case sendmail fails |
|
274 | # Save series description in case sendmail fails | |
275 | msgfile = repo.vfs('last-email.txt', 'wb') |
|
275 | msgfile = repo.vfs('last-email.txt', 'wb') | |
276 | msgfile.write(body) |
|
276 | msgfile.write(body) | |
277 | msgfile.close() |
|
277 | msgfile.close() | |
278 | return body |
|
278 | return body | |
279 |
|
279 | |||
280 | def _getbundlemsgs(repo, sender, bundle, **opts): |
|
280 | def _getbundlemsgs(repo, sender, bundle, **opts): | |
281 | """Get the full email for sending a given bundle |
|
281 | """Get the full email for sending a given bundle | |
282 |
|
282 | |||
283 | This function returns a list of "email" tuples (subject, content, None). |
|
283 | This function returns a list of "email" tuples (subject, content, None). | |
284 | The list is always one message long in that case. |
|
284 | The list is always one message long in that case. | |
285 | """ |
|
285 | """ | |
286 | ui = repo.ui |
|
286 | ui = repo.ui | |
287 | _charsets = mail._charsets(ui) |
|
287 | _charsets = mail._charsets(ui) | |
288 | subj = (opts.get('subject') |
|
288 | subj = (opts.get('subject') | |
289 | or prompt(ui, 'Subject:', 'A bundle for your repository')) |
|
289 | or prompt(ui, 'Subject:', 'A bundle for your repository')) | |
290 |
|
290 | |||
291 | body = _getdescription(repo, '', sender, **opts) |
|
291 | body = _getdescription(repo, '', sender, **opts) | |
292 | msg = emailmod.MIMEMultipart.MIMEMultipart() |
|
292 | msg = emailmod.MIMEMultipart.MIMEMultipart() | |
293 | if body: |
|
293 | if body: | |
294 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
|
294 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) | |
295 | datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') |
|
295 | datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') | |
296 | datapart.set_payload(bundle) |
|
296 | datapart.set_payload(bundle) | |
297 | bundlename = '%s.hg' % opts.get('bundlename', 'bundle') |
|
297 | bundlename = '%s.hg' % opts.get('bundlename', 'bundle') | |
298 | datapart.add_header('Content-Disposition', 'attachment', |
|
298 | datapart.add_header('Content-Disposition', 'attachment', | |
299 | filename=bundlename) |
|
299 | filename=bundlename) | |
300 | emailmod.Encoders.encode_base64(datapart) |
|
300 | emailmod.Encoders.encode_base64(datapart) | |
301 | msg.attach(datapart) |
|
301 | msg.attach(datapart) | |
302 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) |
|
302 | msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) | |
303 | return [(msg, subj, None)] |
|
303 | return [(msg, subj, None)] | |
304 |
|
304 | |||
305 | def _makeintro(repo, sender, patches, **opts): |
|
305 | def _makeintro(repo, sender, patches, **opts): | |
306 | """make an introduction email, asking the user for content if needed |
|
306 | """make an introduction email, asking the user for content if needed | |
307 |
|
307 | |||
308 | email is returned as (subject, body, cumulative-diffstat)""" |
|
308 | email is returned as (subject, body, cumulative-diffstat)""" | |
309 | ui = repo.ui |
|
309 | ui = repo.ui | |
310 | _charsets = mail._charsets(ui) |
|
310 | _charsets = mail._charsets(ui) | |
311 | tlen = len(str(len(patches))) |
|
311 | tlen = len(str(len(patches))) | |
312 |
|
312 | |||
313 | flag = opts.get('flag') or '' |
|
313 | flag = opts.get('flag') or '' | |
314 | if flag: |
|
314 | if flag: | |
315 | flag = ' ' + ' '.join(flag) |
|
315 | flag = ' ' + ' '.join(flag) | |
316 | prefix = '[PATCH %0*d of %d%s]' % (tlen, 0, len(patches), flag) |
|
316 | prefix = '[PATCH %0*d of %d%s]' % (tlen, 0, len(patches), flag) | |
317 |
|
317 | |||
318 | subj = (opts.get('subject') or |
|
318 | subj = (opts.get('subject') or | |
319 | prompt(ui, '(optional) Subject: ', rest=prefix, default='')) |
|
319 | prompt(ui, '(optional) Subject: ', rest=prefix, default='')) | |
320 | if not subj: |
|
320 | if not subj: | |
321 | return None # skip intro if the user doesn't bother |
|
321 | return None # skip intro if the user doesn't bother | |
322 |
|
322 | |||
323 | subj = prefix + ' ' + subj |
|
323 | subj = prefix + ' ' + subj | |
324 |
|
324 | |||
325 | body = '' |
|
325 | body = '' | |
326 | if opts.get('diffstat'): |
|
326 | if opts.get('diffstat'): | |
327 | # generate a cumulative diffstat of the whole patch series |
|
327 | # generate a cumulative diffstat of the whole patch series | |
328 | diffstat = patch.diffstat(sum(patches, [])) |
|
328 | diffstat = patch.diffstat(sum(patches, [])) | |
329 | body = '\n' + diffstat |
|
329 | body = '\n' + diffstat | |
330 | else: |
|
330 | else: | |
331 | diffstat = None |
|
331 | diffstat = None | |
332 |
|
332 | |||
333 | body = _getdescription(repo, body, sender, **opts) |
|
333 | body = _getdescription(repo, body, sender, **opts) | |
334 | msg = mail.mimeencode(ui, body, _charsets, opts.get('test')) |
|
334 | msg = mail.mimeencode(ui, body, _charsets, opts.get('test')) | |
335 | msg['Subject'] = mail.headencode(ui, subj, _charsets, |
|
335 | msg['Subject'] = mail.headencode(ui, subj, _charsets, | |
336 | opts.get('test')) |
|
336 | opts.get('test')) | |
337 | return (msg, subj, diffstat) |
|
337 | return (msg, subj, diffstat) | |
338 |
|
338 | |||
339 | def _getpatchmsgs(repo, sender, patches, patchnames=None, **opts): |
|
339 | def _getpatchmsgs(repo, sender, patches, patchnames=None, **opts): | |
340 | """return a list of emails from a list of patches |
|
340 | """return a list of emails from a list of patches | |
341 |
|
341 | |||
342 | This involves introduction message creation if necessary. |
|
342 | This involves introduction message creation if necessary. | |
343 |
|
343 | |||
344 | This function returns a list of "email" tuples (subject, content, None). |
|
344 | This function returns a list of "email" tuples (subject, content, None). | |
345 | """ |
|
345 | """ | |
346 | ui = repo.ui |
|
346 | ui = repo.ui | |
347 | _charsets = mail._charsets(ui) |
|
347 | _charsets = mail._charsets(ui) | |
348 | msgs = [] |
|
348 | msgs = [] | |
349 |
|
349 | |||
350 | ui.write(_('this patch series consists of %d patches.\n\n') |
|
350 | ui.write(_('this patch series consists of %d patches.\n\n') | |
351 | % len(patches)) |
|
351 | % len(patches)) | |
352 |
|
352 | |||
353 | # build the intro message, or skip it if the user declines |
|
353 | # build the intro message, or skip it if the user declines | |
354 | if introwanted(ui, opts, len(patches)): |
|
354 | if introwanted(ui, opts, len(patches)): | |
355 | msg = _makeintro(repo, sender, patches, **opts) |
|
355 | msg = _makeintro(repo, sender, patches, **opts) | |
356 | if msg: |
|
356 | if msg: | |
357 | msgs.append(msg) |
|
357 | msgs.append(msg) | |
358 |
|
358 | |||
359 | # are we going to send more than one message? |
|
359 | # are we going to send more than one message? | |
360 | numbered = len(msgs) + len(patches) > 1 |
|
360 | numbered = len(msgs) + len(patches) > 1 | |
361 |
|
361 | |||
362 | # now generate the actual patch messages |
|
362 | # now generate the actual patch messages | |
363 | name = None |
|
363 | name = None | |
364 | for i, p in enumerate(patches): |
|
364 | for i, p in enumerate(patches): | |
365 | if patchnames: |
|
365 | if patchnames: | |
366 | name = patchnames[i] |
|
366 | name = patchnames[i] | |
367 | msg = makepatch(ui, repo, p, opts, _charsets, i + 1, |
|
367 | msg = makepatch(ui, repo, p, opts, _charsets, i + 1, | |
368 | len(patches), numbered, name) |
|
368 | len(patches), numbered, name) | |
369 | msgs.append(msg) |
|
369 | msgs.append(msg) | |
370 |
|
370 | |||
371 | return msgs |
|
371 | return msgs | |
372 |
|
372 | |||
373 | def _getoutgoing(repo, dest, revs): |
|
373 | def _getoutgoing(repo, dest, revs): | |
374 | '''Return the revisions present locally but not in dest''' |
|
374 | '''Return the revisions present locally but not in dest''' | |
375 | ui = repo.ui |
|
375 | ui = repo.ui | |
376 | url = ui.expandpath(dest or 'default-push', dest or 'default') |
|
376 | url = ui.expandpath(dest or 'default-push', dest or 'default') | |
377 | url = hg.parseurl(url)[0] |
|
377 | url = hg.parseurl(url)[0] | |
378 | ui.status(_('comparing with %s\n') % util.hidepassword(url)) |
|
378 | ui.status(_('comparing with %s\n') % util.hidepassword(url)) | |
379 |
|
379 | |||
380 | revs = [r for r in revs if r >= 0] |
|
380 | revs = [r for r in revs if r >= 0] | |
381 | if not revs: |
|
381 | if not revs: | |
382 | revs = [len(repo) - 1] |
|
382 | revs = [len(repo) - 1] | |
383 | revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs) |
|
383 | revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs) | |
384 | if not revs: |
|
384 | if not revs: | |
385 | ui.status(_("no changes found\n")) |
|
385 | ui.status(_("no changes found\n")) | |
386 | return revs |
|
386 | return revs | |
387 |
|
387 | |||
388 | emailopts = [ |
|
388 | emailopts = [ | |
389 | ('', 'body', None, _('send patches as inline message text (default)')), |
|
389 | ('', 'body', None, _('send patches as inline message text (default)')), | |
390 | ('a', 'attach', None, _('send patches as attachments')), |
|
390 | ('a', 'attach', None, _('send patches as attachments')), | |
391 | ('i', 'inline', None, _('send patches as inline attachments')), |
|
391 | ('i', 'inline', None, _('send patches as inline attachments')), | |
392 | ('', 'bcc', [], _('email addresses of blind carbon copy recipients')), |
|
392 | ('', 'bcc', [], _('email addresses of blind carbon copy recipients')), | |
393 | ('c', 'cc', [], _('email addresses of copy recipients')), |
|
393 | ('c', 'cc', [], _('email addresses of copy recipients')), | |
394 | ('', 'confirm', None, _('ask for confirmation before sending')), |
|
394 | ('', 'confirm', None, _('ask for confirmation before sending')), | |
395 | ('d', 'diffstat', None, _('add diffstat output to messages')), |
|
395 | ('d', 'diffstat', None, _('add diffstat output to messages')), | |
396 | ('', 'date', '', _('use the given date as the sending date')), |
|
396 | ('', 'date', '', _('use the given date as the sending date')), | |
397 | ('', 'desc', '', _('use the given file as the series description')), |
|
397 | ('', 'desc', '', _('use the given file as the series description')), | |
398 | ('f', 'from', '', _('email address of sender')), |
|
398 | ('f', 'from', '', _('email address of sender')), | |
399 | ('n', 'test', None, _('print messages that would be sent')), |
|
399 | ('n', 'test', None, _('print messages that would be sent')), | |
400 | ('m', 'mbox', '', _('write messages to mbox file instead of sending them')), |
|
400 | ('m', 'mbox', '', _('write messages to mbox file instead of sending them')), | |
401 | ('', 'reply-to', [], _('email addresses replies should be sent to')), |
|
401 | ('', 'reply-to', [], _('email addresses replies should be sent to')), | |
402 | ('s', 'subject', '', _('subject of first message (intro or single patch)')), |
|
402 | ('s', 'subject', '', _('subject of first message (intro or single patch)')), | |
403 | ('', 'in-reply-to', '', _('message identifier to reply to')), |
|
403 | ('', 'in-reply-to', '', _('message identifier to reply to')), | |
404 | ('', 'flag', [], _('flags to add in subject prefixes')), |
|
404 | ('', 'flag', [], _('flags to add in subject prefixes')), | |
405 | ('t', 'to', [], _('email addresses of recipients'))] |
|
405 | ('t', 'to', [], _('email addresses of recipients'))] | |
406 |
|
406 | |||
407 | @command('email', |
|
407 | @command('email', | |
408 | [('g', 'git', None, _('use git extended diff format')), |
|
408 | [('g', 'git', None, _('use git extended diff format')), | |
409 | ('', 'plain', None, _('omit hg patch header')), |
|
409 | ('', 'plain', None, _('omit hg patch header')), | |
410 | ('o', 'outgoing', None, |
|
410 | ('o', 'outgoing', None, | |
411 | _('send changes not found in the target repository')), |
|
411 | _('send changes not found in the target repository')), | |
412 | ('b', 'bundle', None, _('send changes not in target as a binary bundle')), |
|
412 | ('b', 'bundle', None, _('send changes not in target as a binary bundle')), | |
413 | ('', 'bundlename', 'bundle', |
|
413 | ('', 'bundlename', 'bundle', | |
414 | _('name of the bundle attachment file'), _('NAME')), |
|
414 | _('name of the bundle attachment file'), _('NAME')), | |
415 | ('r', 'rev', [], _('a revision to send'), _('REV')), |
|
415 | ('r', 'rev', [], _('a revision to send'), _('REV')), | |
416 | ('', 'force', None, _('run even when remote repository is unrelated ' |
|
416 | ('', 'force', None, _('run even when remote repository is unrelated ' | |
417 | '(with -b/--bundle)')), |
|
417 | '(with -b/--bundle)')), | |
418 | ('', 'base', [], _('a base changeset to specify instead of a destination ' |
|
418 | ('', 'base', [], _('a base changeset to specify instead of a destination ' | |
419 | '(with -b/--bundle)'), _('REV')), |
|
419 | '(with -b/--bundle)'), _('REV')), | |
420 | ('', 'intro', None, _('send an introduction email for a single patch')), |
|
420 | ('', 'intro', None, _('send an introduction email for a single patch')), | |
421 | ] + emailopts + commands.remoteopts, |
|
421 | ] + emailopts + commands.remoteopts, | |
422 | _('hg email [OPTION]... [DEST]...')) |
|
422 | _('hg email [OPTION]... [DEST]...')) | |
423 | def email(ui, repo, *revs, **opts): |
|
423 | def email(ui, repo, *revs, **opts): | |
424 | '''send changesets by email |
|
424 | '''send changesets by email | |
425 |
|
425 | |||
426 | By default, diffs are sent in the format generated by |
|
426 | By default, diffs are sent in the format generated by | |
427 | :hg:`export`, one per message. The series starts with a "[PATCH 0 |
|
427 | :hg:`export`, one per message. The series starts with a "[PATCH 0 | |
428 | of N]" introduction, which describes the series as a whole. |
|
428 | of N]" introduction, which describes the series as a whole. | |
429 |
|
429 | |||
430 | Each patch email has a Subject line of "[PATCH M of N] ...", using |
|
430 | Each patch email has a Subject line of "[PATCH M of N] ...", using | |
431 | the first line of the changeset description as the subject text. |
|
431 | the first line of the changeset description as the subject text. | |
432 | The message contains two or three parts. First, the changeset |
|
432 | The message contains two or three parts. First, the changeset | |
433 | description. |
|
433 | description. | |
434 |
|
434 | |||
435 | With the -d/--diffstat option, if the diffstat program is |
|
435 | With the -d/--diffstat option, if the diffstat program is | |
436 | installed, the result of running diffstat on the patch is inserted. |
|
436 | installed, the result of running diffstat on the patch is inserted. | |
437 |
|
437 | |||
438 | Finally, the patch itself, as generated by :hg:`export`. |
|
438 | Finally, the patch itself, as generated by :hg:`export`. | |
439 |
|
439 | |||
440 | With the -d/--diffstat or --confirm options, you will be presented |
|
440 | With the -d/--diffstat or --confirm options, you will be presented | |
441 | with a final summary of all messages and asked for confirmation before |
|
441 | with a final summary of all messages and asked for confirmation before | |
442 | the messages are sent. |
|
442 | the messages are sent. | |
443 |
|
443 | |||
444 | By default the patch is included as text in the email body for |
|
444 | By default the patch is included as text in the email body for | |
445 | easy reviewing. Using the -a/--attach option will instead create |
|
445 | easy reviewing. Using the -a/--attach option will instead create | |
446 | an attachment for the patch. With -i/--inline an inline attachment |
|
446 | an attachment for the patch. With -i/--inline an inline attachment | |
447 | will be created. You can include a patch both as text in the email |
|
447 | will be created. You can include a patch both as text in the email | |
448 | body and as a regular or an inline attachment by combining the |
|
448 | body and as a regular or an inline attachment by combining the | |
449 | -a/--attach or -i/--inline with the --body option. |
|
449 | -a/--attach or -i/--inline with the --body option. | |
450 |
|
450 | |||
451 | With -o/--outgoing, emails will be generated for patches not found |
|
451 | With -o/--outgoing, emails will be generated for patches not found | |
452 | in the destination repository (or only those which are ancestors |
|
452 | in the destination repository (or only those which are ancestors | |
453 | of the specified revisions if any are provided) |
|
453 | of the specified revisions if any are provided) | |
454 |
|
454 | |||
455 | With -b/--bundle, changesets are selected as for --outgoing, but a |
|
455 | With -b/--bundle, changesets are selected as for --outgoing, but a | |
456 | single email containing a binary Mercurial bundle as an attachment |
|
456 | single email containing a binary Mercurial bundle as an attachment | |
457 | will be sent. Use the ``patchbomb.bundletype`` config option to |
|
457 | will be sent. Use the ``patchbomb.bundletype`` config option to | |
458 | control the bundle type as with :hg:`bundle --type`. |
|
458 | control the bundle type as with :hg:`bundle --type`. | |
459 |
|
459 | |||
460 | With -m/--mbox, instead of previewing each patchbomb message in a |
|
460 | With -m/--mbox, instead of previewing each patchbomb message in a | |
461 | pager or sending the messages directly, it will create a UNIX |
|
461 | pager or sending the messages directly, it will create a UNIX | |
462 | mailbox file with the patch emails. This mailbox file can be |
|
462 | mailbox file with the patch emails. This mailbox file can be | |
463 | previewed with any mail user agent which supports UNIX mbox |
|
463 | previewed with any mail user agent which supports UNIX mbox | |
464 | files. |
|
464 | files. | |
465 |
|
465 | |||
466 | With -n/--test, all steps will run, but mail will not be sent. |
|
466 | With -n/--test, all steps will run, but mail will not be sent. | |
467 | You will be prompted for an email recipient address, a subject and |
|
467 | You will be prompted for an email recipient address, a subject and | |
468 | an introductory message describing the patches of your patchbomb. |
|
468 | an introductory message describing the patches of your patchbomb. | |
469 | Then when all is done, patchbomb messages are displayed. If the |
|
469 | Then when all is done, patchbomb messages are displayed. If the | |
470 | PAGER environment variable is set, your pager will be fired up once |
|
470 | PAGER environment variable is set, your pager will be fired up once | |
471 | for each patchbomb message, so you can verify everything is alright. |
|
471 | for each patchbomb message, so you can verify everything is alright. | |
472 |
|
472 | |||
473 | In case email sending fails, you will find a backup of your series |
|
473 | In case email sending fails, you will find a backup of your series | |
474 | introductory message in ``.hg/last-email.txt``. |
|
474 | introductory message in ``.hg/last-email.txt``. | |
475 |
|
475 | |||
476 | The default behavior of this command can be customized through |
|
476 | The default behavior of this command can be customized through | |
477 | configuration. (See :hg:`help patchbomb` for details) |
|
477 | configuration. (See :hg:`help patchbomb` for details) | |
478 |
|
478 | |||
479 | Examples:: |
|
479 | Examples:: | |
480 |
|
480 | |||
481 | hg email -r 3000 # send patch 3000 only |
|
481 | hg email -r 3000 # send patch 3000 only | |
482 | hg email -r 3000 -r 3001 # send patches 3000 and 3001 |
|
482 | hg email -r 3000 -r 3001 # send patches 3000 and 3001 | |
483 | hg email -r 3000:3005 # send patches 3000 through 3005 |
|
483 | hg email -r 3000:3005 # send patches 3000 through 3005 | |
484 | hg email 3000 # send patch 3000 (deprecated) |
|
484 | hg email 3000 # send patch 3000 (deprecated) | |
485 |
|
485 | |||
486 | hg email -o # send all patches not in default |
|
486 | hg email -o # send all patches not in default | |
487 | hg email -o DEST # send all patches not in DEST |
|
487 | hg email -o DEST # send all patches not in DEST | |
488 | hg email -o -r 3000 # send all ancestors of 3000 not in default |
|
488 | hg email -o -r 3000 # send all ancestors of 3000 not in default | |
489 | hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST |
|
489 | hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST | |
490 |
|
490 | |||
491 | hg email -b # send bundle of all patches not in default |
|
491 | hg email -b # send bundle of all patches not in default | |
492 | hg email -b DEST # send bundle of all patches not in DEST |
|
492 | hg email -b DEST # send bundle of all patches not in DEST | |
493 | hg email -b -r 3000 # bundle of all ancestors of 3000 not in default |
|
493 | hg email -b -r 3000 # bundle of all ancestors of 3000 not in default | |
494 | hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST |
|
494 | hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST | |
495 |
|
495 | |||
496 | hg email -o -m mbox && # generate an mbox file... |
|
496 | hg email -o -m mbox && # generate an mbox file... | |
497 | mutt -R -f mbox # ... and view it with mutt |
|
497 | mutt -R -f mbox # ... and view it with mutt | |
498 | hg email -o -m mbox && # generate an mbox file ... |
|
498 | hg email -o -m mbox && # generate an mbox file ... | |
499 | formail -s sendmail \\ # ... and use formail to send from the mbox |
|
499 | formail -s sendmail \\ # ... and use formail to send from the mbox | |
500 | -bm -t < mbox # ... using sendmail |
|
500 | -bm -t < mbox # ... using sendmail | |
501 |
|
501 | |||
502 | Before using this command, you will need to enable email in your |
|
502 | Before using this command, you will need to enable email in your | |
503 | hgrc. See the [email] section in hgrc(5) for details. |
|
503 | hgrc. See the [email] section in hgrc(5) for details. | |
504 | ''' |
|
504 | ''' | |
505 |
|
505 | |||
506 | _charsets = mail._charsets(ui) |
|
506 | _charsets = mail._charsets(ui) | |
507 |
|
507 | |||
508 | bundle = opts.get('bundle') |
|
508 | bundle = opts.get('bundle') | |
509 | date = opts.get('date') |
|
509 | date = opts.get('date') | |
510 | mbox = opts.get('mbox') |
|
510 | mbox = opts.get('mbox') | |
511 | outgoing = opts.get('outgoing') |
|
511 | outgoing = opts.get('outgoing') | |
512 | rev = opts.get('rev') |
|
512 | rev = opts.get('rev') | |
513 | # internal option used by pbranches |
|
513 | # internal option used by pbranches | |
514 | patches = opts.get('patches') |
|
514 | patches = opts.get('patches') | |
515 |
|
515 | |||
516 | if not (opts.get('test') or mbox): |
|
516 | if not (opts.get('test') or mbox): | |
517 | # really sending |
|
517 | # really sending | |
518 | mail.validateconfig(ui) |
|
518 | mail.validateconfig(ui) | |
519 |
|
519 | |||
520 | if not (revs or rev or outgoing or bundle or patches): |
|
520 | if not (revs or rev or outgoing or bundle or patches): | |
521 | raise error.Abort(_('specify at least one changeset with -r or -o')) |
|
521 | raise error.Abort(_('specify at least one changeset with -r or -o')) | |
522 |
|
522 | |||
523 | if outgoing and bundle: |
|
523 | if outgoing and bundle: | |
524 | raise error.Abort(_("--outgoing mode always on with --bundle;" |
|
524 | raise error.Abort(_("--outgoing mode always on with --bundle;" | |
525 | " do not re-specify --outgoing")) |
|
525 | " do not re-specify --outgoing")) | |
526 |
|
526 | |||
527 | if outgoing or bundle: |
|
527 | if outgoing or bundle: | |
528 | if len(revs) > 1: |
|
528 | if len(revs) > 1: | |
529 | raise error.Abort(_("too many destinations")) |
|
529 | raise error.Abort(_("too many destinations")) | |
530 | if revs: |
|
530 | if revs: | |
531 | dest = revs[0] |
|
531 | dest = revs[0] | |
532 | else: |
|
532 | else: | |
533 | dest = None |
|
533 | dest = None | |
534 | revs = [] |
|
534 | revs = [] | |
535 |
|
535 | |||
536 | if rev: |
|
536 | if rev: | |
537 | if revs: |
|
537 | if revs: | |
538 | raise error.Abort(_('use only one form to specify the revision')) |
|
538 | raise error.Abort(_('use only one form to specify the revision')) | |
539 | revs = rev |
|
539 | revs = rev | |
540 |
|
540 | |||
541 | revs = scmutil.revrange(repo, revs) |
|
541 | revs = scmutil.revrange(repo, revs) | |
542 | if outgoing: |
|
542 | if outgoing: | |
543 | revs = _getoutgoing(repo, dest, revs) |
|
543 | revs = _getoutgoing(repo, dest, revs) | |
544 | if bundle: |
|
544 | if bundle: | |
545 | opts['revs'] = [str(r) for r in revs] |
|
545 | opts['revs'] = [str(r) for r in revs] | |
546 |
|
546 | |||
547 | # check if revision exist on the public destination |
|
547 | # check if revision exist on the public destination | |
548 | publicurl = repo.ui.config('patchbomb', 'publicurl') |
|
548 | publicurl = repo.ui.config('patchbomb', 'publicurl') | |
549 | if publicurl is not None: |
|
549 | if publicurl is not None: | |
550 | repo.ui.debug('checking that revision exist in the public repo') |
|
550 | repo.ui.debug('checking that revision exist in the public repo') | |
551 | try: |
|
551 | try: | |
552 | publicpeer = hg.peer(repo, {}, publicurl) |
|
552 | publicpeer = hg.peer(repo, {}, publicurl) | |
553 | except error.RepoError: |
|
553 | except error.RepoError: | |
554 | repo.ui.write_err(_('unable to access public repo: %s\n') |
|
554 | repo.ui.write_err(_('unable to access public repo: %s\n') | |
555 | % publicurl) |
|
555 | % publicurl) | |
556 | raise |
|
556 | raise | |
557 | if not publicpeer.capable('known'): |
|
557 | if not publicpeer.capable('known'): | |
558 | repo.ui.debug('skipping existence checks: public repo too old') |
|
558 | repo.ui.debug('skipping existence checks: public repo too old') | |
559 | else: |
|
559 | else: | |
560 | out = [repo[r] for r in revs] |
|
560 | out = [repo[r] for r in revs] | |
561 | known = publicpeer.known(h.node() for h in out) |
|
561 | known = publicpeer.known(h.node() for h in out) | |
562 | missing = [] |
|
562 | missing = [] | |
563 | for idx, h in enumerate(out): |
|
563 | for idx, h in enumerate(out): | |
564 | if not known[idx]: |
|
564 | if not known[idx]: | |
565 | missing.append(h) |
|
565 | missing.append(h) | |
566 | if missing: |
|
566 | if missing: | |
567 | if 1 < len(missing): |
|
567 | if 1 < len(missing): | |
568 | msg = _('public "%s" is missing %s and %i others') |
|
568 | msg = _('public "%s" is missing %s and %i others') | |
569 | msg %= (publicurl, missing[0], len(missing) - 1) |
|
569 | msg %= (publicurl, missing[0], len(missing) - 1) | |
570 | else: |
|
570 | else: | |
571 | msg = _('public url %s is missing %s') |
|
571 | msg = _('public url %s is missing %s') | |
572 | msg %= (publicurl, missing[0]) |
|
572 | msg %= (publicurl, missing[0]) | |
573 | revhint = ' '.join('-r %s' % h |
|
573 | revhint = ' '.join('-r %s' % h | |
574 | for h in repo.set('heads(%ld)', missing)) |
|
574 | for h in repo.set('heads(%ld)', missing)) | |
575 | hint = _("use 'hg push %s %s'") % (publicurl, revhint) |
|
575 | hint = _("use 'hg push %s %s'") % (publicurl, revhint) | |
576 | raise error.Abort(msg, hint=hint) |
|
576 | raise error.Abort(msg, hint=hint) | |
577 |
|
577 | |||
578 | # start |
|
578 | # start | |
579 | if date: |
|
579 | if date: | |
580 | start_time = util.parsedate(date) |
|
580 | start_time = util.parsedate(date) | |
581 | else: |
|
581 | else: | |
582 | start_time = util.makedate() |
|
582 | start_time = util.makedate() | |
583 |
|
583 | |||
584 | def genmsgid(id): |
|
584 | def genmsgid(id): | |
585 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) |
|
585 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) | |
586 |
|
586 | |||
587 | # deprecated config: patchbomb.from |
|
587 | # deprecated config: patchbomb.from | |
588 | sender = (opts.get('from') or ui.config('email', 'from') or |
|
588 | sender = (opts.get('from') or ui.config('email', 'from') or | |
589 | ui.config('patchbomb', 'from') or |
|
589 | ui.config('patchbomb', 'from') or | |
590 | prompt(ui, 'From', ui.username())) |
|
590 | prompt(ui, 'From', ui.username())) | |
591 |
|
591 | |||
592 | if patches: |
|
592 | if patches: | |
593 | msgs = _getpatchmsgs(repo, sender, patches, opts.get('patchnames'), |
|
593 | msgs = _getpatchmsgs(repo, sender, patches, opts.get('patchnames'), | |
594 | **opts) |
|
594 | **opts) | |
595 | elif bundle: |
|
595 | elif bundle: | |
596 | bundledata = _getbundle(repo, dest, **opts) |
|
596 | bundledata = _getbundle(repo, dest, **opts) | |
597 | bundleopts = opts.copy() |
|
597 | bundleopts = opts.copy() | |
598 | bundleopts.pop('bundle', None) # already processed |
|
598 | bundleopts.pop('bundle', None) # already processed | |
599 | msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts) |
|
599 | msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts) | |
600 | else: |
|
600 | else: | |
601 | _patches = list(_getpatches(repo, revs, **opts)) |
|
601 | _patches = list(_getpatches(repo, revs, **opts)) | |
602 | msgs = _getpatchmsgs(repo, sender, _patches, **opts) |
|
602 | msgs = _getpatchmsgs(repo, sender, _patches, **opts) | |
603 |
|
603 | |||
604 | showaddrs = [] |
|
604 | showaddrs = [] | |
605 |
|
605 | |||
606 | def getaddrs(header, ask=False, default=None): |
|
606 | def getaddrs(header, ask=False, default=None): | |
607 | configkey = header.lower() |
|
607 | configkey = header.lower() | |
608 | opt = header.replace('-', '_').lower() |
|
608 | opt = header.replace('-', '_').lower() | |
609 | addrs = opts.get(opt) |
|
609 | addrs = opts.get(opt) | |
610 | if addrs: |
|
610 | if addrs: | |
611 | showaddrs.append('%s: %s' % (header, ', '.join(addrs))) |
|
611 | showaddrs.append('%s: %s' % (header, ', '.join(addrs))) | |
612 | return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) |
|
612 | return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) | |
613 |
|
613 | |||
614 | # not on the command line: fallback to config and then maybe ask |
|
614 | # not on the command line: fallback to config and then maybe ask | |
615 | addr = (ui.config('email', configkey) or |
|
615 | addr = (ui.config('email', configkey) or | |
616 | ui.config('patchbomb', configkey)) |
|
616 | ui.config('patchbomb', configkey)) | |
617 | if not addr: |
|
617 | if not addr: | |
618 | specified = (ui.hasconfig('email', configkey) or |
|
618 | specified = (ui.hasconfig('email', configkey) or | |
619 | ui.hasconfig('patchbomb', configkey)) |
|
619 | ui.hasconfig('patchbomb', configkey)) | |
620 | if not specified and ask: |
|
620 | if not specified and ask: | |
621 | addr = prompt(ui, header, default=default) |
|
621 | addr = prompt(ui, header, default=default) | |
622 | if addr: |
|
622 | if addr: | |
623 | showaddrs.append('%s: %s' % (header, addr)) |
|
623 | showaddrs.append('%s: %s' % (header, addr)) | |
624 | return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) |
|
624 | return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) | |
625 | else: |
|
625 | else: | |
626 | return default |
|
626 | return default | |
627 |
|
627 | |||
628 | to = getaddrs('To', ask=True) |
|
628 | to = getaddrs('To', ask=True) | |
629 | if not to: |
|
629 | if not to: | |
630 | # we can get here in non-interactive mode |
|
630 | # we can get here in non-interactive mode | |
631 | raise error.Abort(_('no recipient addresses provided')) |
|
631 | raise error.Abort(_('no recipient addresses provided')) | |
632 | cc = getaddrs('Cc', ask=True, default='') or [] |
|
632 | cc = getaddrs('Cc', ask=True, default='') or [] | |
633 | bcc = getaddrs('Bcc') or [] |
|
633 | bcc = getaddrs('Bcc') or [] | |
634 | replyto = getaddrs('Reply-To') |
|
634 | replyto = getaddrs('Reply-To') | |
635 |
|
635 | |||
636 | confirm = ui.configbool('patchbomb', 'confirm') |
|
636 | confirm = ui.configbool('patchbomb', 'confirm') | |
637 | confirm |= bool(opts.get('diffstat') or opts.get('confirm')) |
|
637 | confirm |= bool(opts.get('diffstat') or opts.get('confirm')) | |
638 |
|
638 | |||
639 | if confirm: |
|
639 | if confirm: | |
640 | ui.write(_('\nFinal summary:\n\n'), label='patchbomb.finalsummary') |
|
640 | ui.write(_('\nFinal summary:\n\n'), label='patchbomb.finalsummary') | |
641 | ui.write(('From: %s\n' % sender), label='patchbomb.from') |
|
641 | ui.write(('From: %s\n' % sender), label='patchbomb.from') | |
642 | for addr in showaddrs: |
|
642 | for addr in showaddrs: | |
643 | ui.write('%s\n' % addr, label='patchbomb.to') |
|
643 | ui.write('%s\n' % addr, label='patchbomb.to') | |
644 | for m, subj, ds in msgs: |
|
644 | for m, subj, ds in msgs: | |
645 | ui.write(('Subject: %s\n' % subj), label='patchbomb.subject') |
|
645 | ui.write(('Subject: %s\n' % subj), label='patchbomb.subject') | |
646 | if ds: |
|
646 | if ds: | |
647 | ui.write(ds, label='patchbomb.diffstats') |
|
647 | ui.write(ds, label='patchbomb.diffstats') | |
648 | ui.write('\n') |
|
648 | ui.write('\n') | |
649 | if ui.promptchoice(_('are you sure you want to send (yn)?' |
|
649 | if ui.promptchoice(_('are you sure you want to send (yn)?' | |
650 | '$$ &Yes $$ &No')): |
|
650 | '$$ &Yes $$ &No')): | |
651 | raise error.Abort(_('patchbomb canceled')) |
|
651 | raise error.Abort(_('patchbomb canceled')) | |
652 |
|
652 | |||
653 | ui.write('\n') |
|
653 | ui.write('\n') | |
654 |
|
654 | |||
655 | parent = opts.get('in_reply_to') or None |
|
655 | parent = opts.get('in_reply_to') or None | |
656 | # angle brackets may be omitted, they're not semantically part of the msg-id |
|
656 | # angle brackets may be omitted, they're not semantically part of the msg-id | |
657 | if parent is not None: |
|
657 | if parent is not None: | |
658 | if not parent.startswith('<'): |
|
658 | if not parent.startswith('<'): | |
659 | parent = '<' + parent |
|
659 | parent = '<' + parent | |
660 | if not parent.endswith('>'): |
|
660 | if not parent.endswith('>'): | |
661 | parent += '>' |
|
661 | parent += '>' | |
662 |
|
662 | |||
663 | sender_addr = emailmod.Utils.parseaddr(sender)[1] |
|
663 | sender_addr = emailmod.Utils.parseaddr(sender)[1] | |
664 | sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) |
|
664 | sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) | |
665 | sendmail = None |
|
665 | sendmail = None | |
666 | firstpatch = None |
|
666 | firstpatch = None | |
667 | for i, (m, subj, ds) in enumerate(msgs): |
|
667 | for i, (m, subj, ds) in enumerate(msgs): | |
668 | try: |
|
668 | try: | |
669 | m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) |
|
669 | m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) | |
670 | if not firstpatch: |
|
670 | if not firstpatch: | |
671 | firstpatch = m['Message-Id'] |
|
671 | firstpatch = m['Message-Id'] | |
672 | m['X-Mercurial-Series-Id'] = firstpatch |
|
672 | m['X-Mercurial-Series-Id'] = firstpatch | |
673 | except TypeError: |
|
673 | except TypeError: | |
674 | m['Message-Id'] = genmsgid('patchbomb') |
|
674 | m['Message-Id'] = genmsgid('patchbomb') | |
675 | if parent: |
|
675 | if parent: | |
676 | m['In-Reply-To'] = parent |
|
676 | m['In-Reply-To'] = parent | |
677 | m['References'] = parent |
|
677 | m['References'] = parent | |
678 | if not parent or 'X-Mercurial-Node' not in m: |
|
678 | if not parent or 'X-Mercurial-Node' not in m: | |
679 | parent = m['Message-Id'] |
|
679 | parent = m['Message-Id'] | |
680 |
|
680 | |||
681 | m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() |
|
681 | m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version() | |
682 | m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True) |
|
682 | m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True) | |
683 |
|
683 | |||
684 | start_time = (start_time[0] + 1, start_time[1]) |
|
684 | start_time = (start_time[0] + 1, start_time[1]) | |
685 | m['From'] = sender |
|
685 | m['From'] = sender | |
686 | m['To'] = ', '.join(to) |
|
686 | m['To'] = ', '.join(to) | |
687 | if cc: |
|
687 | if cc: | |
688 | m['Cc'] = ', '.join(cc) |
|
688 | m['Cc'] = ', '.join(cc) | |
689 | if bcc: |
|
689 | if bcc: | |
690 | m['Bcc'] = ', '.join(bcc) |
|
690 | m['Bcc'] = ', '.join(bcc) | |
691 | if replyto: |
|
691 | if replyto: | |
692 | m['Reply-To'] = ', '.join(replyto) |
|
692 | m['Reply-To'] = ', '.join(replyto) | |
693 | if opts.get('test'): |
|
693 | if opts.get('test'): | |
694 | ui.status(_('displaying '), subj, ' ...\n') |
|
694 | ui.status(_('displaying '), subj, ' ...\n') | |
695 | ui.flush() |
|
695 | ui.flush() | |
696 | if 'PAGER' in os.environ and not ui.plain(): |
|
696 | if 'PAGER' in os.environ and not ui.plain(): | |
697 | fp = util.popen(os.environ['PAGER'], 'w') |
|
697 | fp = util.popen(os.environ['PAGER'], 'w') | |
698 | else: |
|
698 | else: | |
699 | fp = ui |
|
699 | fp = ui | |
700 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) |
|
700 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) | |
701 | try: |
|
701 | try: | |
702 | generator.flatten(m, 0) |
|
702 | generator.flatten(m, 0) | |
703 | fp.write('\n') |
|
703 | fp.write('\n') | |
704 | except IOError as inst: |
|
704 | except IOError as inst: | |
705 | if inst.errno != errno.EPIPE: |
|
705 | if inst.errno != errno.EPIPE: | |
706 | raise |
|
706 | raise | |
707 | if fp is not ui: |
|
707 | if fp is not ui: | |
708 | fp.close() |
|
708 | fp.close() | |
709 | else: |
|
709 | else: | |
710 | if not sendmail: |
|
710 | if not sendmail: | |
711 | verifycert = ui.config('smtp', 'verifycert', 'strict') |
|
|||
712 | if opts.get('insecure'): |
|
|||
713 | ui.setconfig('smtp', 'verifycert', 'loose', 'patchbomb') |
|
|||
714 | try: |
|
|||
715 |
|
|
711 | sendmail = mail.connect(ui, mbox=mbox) | |
716 | finally: |
|
|||
717 | ui.setconfig('smtp', 'verifycert', verifycert, 'patchbomb') |
|
|||
718 | ui.status(_('sending '), subj, ' ...\n') |
|
712 | ui.status(_('sending '), subj, ' ...\n') | |
719 | ui.progress(_('sending'), i, item=subj, total=len(msgs), |
|
713 | ui.progress(_('sending'), i, item=subj, total=len(msgs), | |
720 | unit=_('emails')) |
|
714 | unit=_('emails')) | |
721 | if not mbox: |
|
715 | if not mbox: | |
722 | # Exim does not remove the Bcc field |
|
716 | # Exim does not remove the Bcc field | |
723 | del m['Bcc'] |
|
717 | del m['Bcc'] | |
724 | fp = stringio() |
|
718 | fp = stringio() | |
725 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) |
|
719 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) | |
726 | generator.flatten(m, 0) |
|
720 | generator.flatten(m, 0) | |
727 | sendmail(sender_addr, to + bcc + cc, fp.getvalue()) |
|
721 | sendmail(sender_addr, to + bcc + cc, fp.getvalue()) | |
728 |
|
722 | |||
729 | ui.progress(_('writing'), None) |
|
723 | ui.progress(_('writing'), None) | |
730 | ui.progress(_('sending'), None) |
|
724 | ui.progress(_('sending'), None) |
@@ -1,2127 +1,2117 b'' | |||||
1 | The Mercurial system uses a set of configuration files to control |
|
1 | The Mercurial system uses a set of configuration files to control | |
2 | aspects of its behavior. |
|
2 | aspects of its behavior. | |
3 |
|
3 | |||
4 | Troubleshooting |
|
4 | Troubleshooting | |
5 | =============== |
|
5 | =============== | |
6 |
|
6 | |||
7 | If you're having problems with your configuration, |
|
7 | If you're having problems with your configuration, | |
8 | :hg:`config --debug` can help you understand what is introducing |
|
8 | :hg:`config --debug` can help you understand what is introducing | |
9 | a setting into your environment. |
|
9 | a setting into your environment. | |
10 |
|
10 | |||
11 | See :hg:`help config.syntax` and :hg:`help config.files` |
|
11 | See :hg:`help config.syntax` and :hg:`help config.files` | |
12 | for information about how and where to override things. |
|
12 | for information about how and where to override things. | |
13 |
|
13 | |||
14 | Structure |
|
14 | Structure | |
15 | ========= |
|
15 | ========= | |
16 |
|
16 | |||
17 | The configuration files use a simple ini-file format. A configuration |
|
17 | The configuration files use a simple ini-file format. A configuration | |
18 | file consists of sections, led by a ``[section]`` header and followed |
|
18 | file consists of sections, led by a ``[section]`` header and followed | |
19 | by ``name = value`` entries:: |
|
19 | by ``name = value`` entries:: | |
20 |
|
20 | |||
21 | [ui] |
|
21 | [ui] | |
22 | username = Firstname Lastname <firstname.lastname@example.net> |
|
22 | username = Firstname Lastname <firstname.lastname@example.net> | |
23 | verbose = True |
|
23 | verbose = True | |
24 |
|
24 | |||
25 | The above entries will be referred to as ``ui.username`` and |
|
25 | The above entries will be referred to as ``ui.username`` and | |
26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. |
|
26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. | |
27 |
|
27 | |||
28 | Files |
|
28 | Files | |
29 | ===== |
|
29 | ===== | |
30 |
|
30 | |||
31 | Mercurial reads configuration data from several files, if they exist. |
|
31 | Mercurial reads configuration data from several files, if they exist. | |
32 | These files do not exist by default and you will have to create the |
|
32 | These files do not exist by default and you will have to create the | |
33 | appropriate configuration files yourself: |
|
33 | appropriate configuration files yourself: | |
34 |
|
34 | |||
35 | Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
35 | Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
36 |
|
36 | |||
37 | Global configuration like the username setting is typically put into: |
|
37 | Global configuration like the username setting is typically put into: | |
38 |
|
38 | |||
39 | .. container:: windows |
|
39 | .. container:: windows | |
40 |
|
40 | |||
41 | - ``%USERPROFILE%\mercurial.ini`` (on Windows) |
|
41 | - ``%USERPROFILE%\mercurial.ini`` (on Windows) | |
42 |
|
42 | |||
43 | .. container:: unix.plan9 |
|
43 | .. container:: unix.plan9 | |
44 |
|
44 | |||
45 | - ``$HOME/.hgrc`` (on Unix, Plan9) |
|
45 | - ``$HOME/.hgrc`` (on Unix, Plan9) | |
46 |
|
46 | |||
47 | The names of these files depend on the system on which Mercurial is |
|
47 | The names of these files depend on the system on which Mercurial is | |
48 | installed. ``*.rc`` files from a single directory are read in |
|
48 | installed. ``*.rc`` files from a single directory are read in | |
49 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
49 | alphabetical order, later ones overriding earlier ones. Where multiple | |
50 | paths are given below, settings from earlier paths override later |
|
50 | paths are given below, settings from earlier paths override later | |
51 | ones. |
|
51 | ones. | |
52 |
|
52 | |||
53 | .. container:: verbose.unix |
|
53 | .. container:: verbose.unix | |
54 |
|
54 | |||
55 | On Unix, the following files are consulted: |
|
55 | On Unix, the following files are consulted: | |
56 |
|
56 | |||
57 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
57 | - ``<repo>/.hg/hgrc`` (per-repository) | |
58 | - ``$HOME/.hgrc`` (per-user) |
|
58 | - ``$HOME/.hgrc`` (per-user) | |
59 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
59 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) | |
60 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
60 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) | |
61 | - ``/etc/mercurial/hgrc`` (per-system) |
|
61 | - ``/etc/mercurial/hgrc`` (per-system) | |
62 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
62 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) | |
63 | - ``<internal>/default.d/*.rc`` (defaults) |
|
63 | - ``<internal>/default.d/*.rc`` (defaults) | |
64 |
|
64 | |||
65 | .. container:: verbose.windows |
|
65 | .. container:: verbose.windows | |
66 |
|
66 | |||
67 | On Windows, the following files are consulted: |
|
67 | On Windows, the following files are consulted: | |
68 |
|
68 | |||
69 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
69 | - ``<repo>/.hg/hgrc`` (per-repository) | |
70 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
70 | - ``%USERPROFILE%\.hgrc`` (per-user) | |
71 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
71 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) | |
72 | - ``%HOME%\.hgrc`` (per-user) |
|
72 | - ``%HOME%\.hgrc`` (per-user) | |
73 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
73 | - ``%HOME%\Mercurial.ini`` (per-user) | |
74 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
74 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) | |
75 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
75 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) | |
76 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
76 | - ``<install-dir>\Mercurial.ini`` (per-installation) | |
77 | - ``<internal>/default.d/*.rc`` (defaults) |
|
77 | - ``<internal>/default.d/*.rc`` (defaults) | |
78 |
|
78 | |||
79 | .. note:: |
|
79 | .. note:: | |
80 |
|
80 | |||
81 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
81 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
82 | is used when running 32-bit Python on 64-bit Windows. |
|
82 | is used when running 32-bit Python on 64-bit Windows. | |
83 |
|
83 | |||
84 | .. container:: windows |
|
84 | .. container:: windows | |
85 |
|
85 | |||
86 | On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. |
|
86 | On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. | |
87 |
|
87 | |||
88 | .. container:: verbose.plan9 |
|
88 | .. container:: verbose.plan9 | |
89 |
|
89 | |||
90 | On Plan9, the following files are consulted: |
|
90 | On Plan9, the following files are consulted: | |
91 |
|
91 | |||
92 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
92 | - ``<repo>/.hg/hgrc`` (per-repository) | |
93 | - ``$home/lib/hgrc`` (per-user) |
|
93 | - ``$home/lib/hgrc`` (per-user) | |
94 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
94 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) | |
95 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
95 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) | |
96 | - ``/lib/mercurial/hgrc`` (per-system) |
|
96 | - ``/lib/mercurial/hgrc`` (per-system) | |
97 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
97 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) | |
98 | - ``<internal>/default.d/*.rc`` (defaults) |
|
98 | - ``<internal>/default.d/*.rc`` (defaults) | |
99 |
|
99 | |||
100 | Per-repository configuration options only apply in a |
|
100 | Per-repository configuration options only apply in a | |
101 | particular repository. This file is not version-controlled, and |
|
101 | particular repository. This file is not version-controlled, and | |
102 | will not get transferred during a "clone" operation. Options in |
|
102 | will not get transferred during a "clone" operation. Options in | |
103 | this file override options in all other configuration files. |
|
103 | this file override options in all other configuration files. | |
104 |
|
104 | |||
105 | .. container:: unix.plan9 |
|
105 | .. container:: unix.plan9 | |
106 |
|
106 | |||
107 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
107 | On Plan 9 and Unix, most of this file will be ignored if it doesn't | |
108 | belong to a trusted user or to a trusted group. See |
|
108 | belong to a trusted user or to a trusted group. See | |
109 | :hg:`help config.trusted` for more details. |
|
109 | :hg:`help config.trusted` for more details. | |
110 |
|
110 | |||
111 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
111 | Per-user configuration file(s) are for the user running Mercurial. Options | |
112 | in these files apply to all Mercurial commands executed by this user in any |
|
112 | in these files apply to all Mercurial commands executed by this user in any | |
113 | directory. Options in these files override per-system and per-installation |
|
113 | directory. Options in these files override per-system and per-installation | |
114 | options. |
|
114 | options. | |
115 |
|
115 | |||
116 | Per-installation configuration files are searched for in the |
|
116 | Per-installation configuration files are searched for in the | |
117 | directory where Mercurial is installed. ``<install-root>`` is the |
|
117 | directory where Mercurial is installed. ``<install-root>`` is the | |
118 | parent directory of the **hg** executable (or symlink) being run. |
|
118 | parent directory of the **hg** executable (or symlink) being run. | |
119 |
|
119 | |||
120 | .. container:: unix.plan9 |
|
120 | .. container:: unix.plan9 | |
121 |
|
121 | |||
122 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
122 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial | |
123 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
123 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these | |
124 | files apply to all Mercurial commands executed by any user in any |
|
124 | files apply to all Mercurial commands executed by any user in any | |
125 | directory. |
|
125 | directory. | |
126 |
|
126 | |||
127 | Per-installation configuration files are for the system on |
|
127 | Per-installation configuration files are for the system on | |
128 | which Mercurial is running. Options in these files apply to all |
|
128 | which Mercurial is running. Options in these files apply to all | |
129 | Mercurial commands executed by any user in any directory. Registry |
|
129 | Mercurial commands executed by any user in any directory. Registry | |
130 | keys contain PATH-like strings, every part of which must reference |
|
130 | keys contain PATH-like strings, every part of which must reference | |
131 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
131 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
132 | be read. Mercurial checks each of these locations in the specified |
|
132 | be read. Mercurial checks each of these locations in the specified | |
133 | order until one or more configuration files are detected. |
|
133 | order until one or more configuration files are detected. | |
134 |
|
134 | |||
135 | Per-system configuration files are for the system on which Mercurial |
|
135 | Per-system configuration files are for the system on which Mercurial | |
136 | is running. Options in these files apply to all Mercurial commands |
|
136 | is running. Options in these files apply to all Mercurial commands | |
137 | executed by any user in any directory. Options in these files |
|
137 | executed by any user in any directory. Options in these files | |
138 | override per-installation options. |
|
138 | override per-installation options. | |
139 |
|
139 | |||
140 | Mercurial comes with some default configuration. The default configuration |
|
140 | Mercurial comes with some default configuration. The default configuration | |
141 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
141 | files are installed with Mercurial and will be overwritten on upgrades. Default | |
142 | configuration files should never be edited by users or administrators but can |
|
142 | configuration files should never be edited by users or administrators but can | |
143 | be overridden in other configuration files. So far the directory only contains |
|
143 | be overridden in other configuration files. So far the directory only contains | |
144 | merge tool configuration but packagers can also put other default configuration |
|
144 | merge tool configuration but packagers can also put other default configuration | |
145 | there. |
|
145 | there. | |
146 |
|
146 | |||
147 | Syntax |
|
147 | Syntax | |
148 | ====== |
|
148 | ====== | |
149 |
|
149 | |||
150 | A configuration file consists of sections, led by a ``[section]`` header |
|
150 | A configuration file consists of sections, led by a ``[section]`` header | |
151 | and followed by ``name = value`` entries (sometimes called |
|
151 | and followed by ``name = value`` entries (sometimes called | |
152 | ``configuration keys``):: |
|
152 | ``configuration keys``):: | |
153 |
|
153 | |||
154 | [spam] |
|
154 | [spam] | |
155 | eggs=ham |
|
155 | eggs=ham | |
156 | green= |
|
156 | green= | |
157 | eggs |
|
157 | eggs | |
158 |
|
158 | |||
159 | Each line contains one entry. If the lines that follow are indented, |
|
159 | Each line contains one entry. If the lines that follow are indented, | |
160 | they are treated as continuations of that entry. Leading whitespace is |
|
160 | they are treated as continuations of that entry. Leading whitespace is | |
161 | removed from values. Empty lines are skipped. Lines beginning with |
|
161 | removed from values. Empty lines are skipped. Lines beginning with | |
162 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
162 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
163 |
|
163 | |||
164 | Configuration keys can be set multiple times, in which case Mercurial |
|
164 | Configuration keys can be set multiple times, in which case Mercurial | |
165 | will use the value that was configured last. As an example:: |
|
165 | will use the value that was configured last. As an example:: | |
166 |
|
166 | |||
167 | [spam] |
|
167 | [spam] | |
168 | eggs=large |
|
168 | eggs=large | |
169 | ham=serrano |
|
169 | ham=serrano | |
170 | eggs=small |
|
170 | eggs=small | |
171 |
|
171 | |||
172 | This would set the configuration key named ``eggs`` to ``small``. |
|
172 | This would set the configuration key named ``eggs`` to ``small``. | |
173 |
|
173 | |||
174 | It is also possible to define a section multiple times. A section can |
|
174 | It is also possible to define a section multiple times. A section can | |
175 | be redefined on the same and/or on different configuration files. For |
|
175 | be redefined on the same and/or on different configuration files. For | |
176 | example:: |
|
176 | example:: | |
177 |
|
177 | |||
178 | [foo] |
|
178 | [foo] | |
179 | eggs=large |
|
179 | eggs=large | |
180 | ham=serrano |
|
180 | ham=serrano | |
181 | eggs=small |
|
181 | eggs=small | |
182 |
|
182 | |||
183 | [bar] |
|
183 | [bar] | |
184 | eggs=ham |
|
184 | eggs=ham | |
185 | green= |
|
185 | green= | |
186 | eggs |
|
186 | eggs | |
187 |
|
187 | |||
188 | [foo] |
|
188 | [foo] | |
189 | ham=prosciutto |
|
189 | ham=prosciutto | |
190 | eggs=medium |
|
190 | eggs=medium | |
191 | bread=toasted |
|
191 | bread=toasted | |
192 |
|
192 | |||
193 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
193 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
194 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
194 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
195 | respectively. As you can see there only thing that matters is the last |
|
195 | respectively. As you can see there only thing that matters is the last | |
196 | value that was set for each of the configuration keys. |
|
196 | value that was set for each of the configuration keys. | |
197 |
|
197 | |||
198 | If a configuration key is set multiple times in different |
|
198 | If a configuration key is set multiple times in different | |
199 | configuration files the final value will depend on the order in which |
|
199 | configuration files the final value will depend on the order in which | |
200 | the different configuration files are read, with settings from earlier |
|
200 | the different configuration files are read, with settings from earlier | |
201 | paths overriding later ones as described on the ``Files`` section |
|
201 | paths overriding later ones as described on the ``Files`` section | |
202 | above. |
|
202 | above. | |
203 |
|
203 | |||
204 | A line of the form ``%include file`` will include ``file`` into the |
|
204 | A line of the form ``%include file`` will include ``file`` into the | |
205 | current configuration file. The inclusion is recursive, which means |
|
205 | current configuration file. The inclusion is recursive, which means | |
206 | that included files can include other files. Filenames are relative to |
|
206 | that included files can include other files. Filenames are relative to | |
207 | the configuration file in which the ``%include`` directive is found. |
|
207 | the configuration file in which the ``%include`` directive is found. | |
208 | Environment variables and ``~user`` constructs are expanded in |
|
208 | Environment variables and ``~user`` constructs are expanded in | |
209 | ``file``. This lets you do something like:: |
|
209 | ``file``. This lets you do something like:: | |
210 |
|
210 | |||
211 | %include ~/.hgrc.d/$HOST.rc |
|
211 | %include ~/.hgrc.d/$HOST.rc | |
212 |
|
212 | |||
213 | to include a different configuration file on each computer you use. |
|
213 | to include a different configuration file on each computer you use. | |
214 |
|
214 | |||
215 | A line with ``%unset name`` will remove ``name`` from the current |
|
215 | A line with ``%unset name`` will remove ``name`` from the current | |
216 | section, if it has been set previously. |
|
216 | section, if it has been set previously. | |
217 |
|
217 | |||
218 | The values are either free-form text strings, lists of text strings, |
|
218 | The values are either free-form text strings, lists of text strings, | |
219 | or Boolean values. Boolean values can be set to true using any of "1", |
|
219 | or Boolean values. Boolean values can be set to true using any of "1", | |
220 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
220 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
221 | (all case insensitive). |
|
221 | (all case insensitive). | |
222 |
|
222 | |||
223 | List values are separated by whitespace or comma, except when values are |
|
223 | List values are separated by whitespace or comma, except when values are | |
224 | placed in double quotation marks:: |
|
224 | placed in double quotation marks:: | |
225 |
|
225 | |||
226 | allow_read = "John Doe, PhD", brian, betty |
|
226 | allow_read = "John Doe, PhD", brian, betty | |
227 |
|
227 | |||
228 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
228 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
229 | quotation marks at the beginning of a word is counted as a quotation |
|
229 | quotation marks at the beginning of a word is counted as a quotation | |
230 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
230 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
231 |
|
231 | |||
232 | Sections |
|
232 | Sections | |
233 | ======== |
|
233 | ======== | |
234 |
|
234 | |||
235 | This section describes the different sections that may appear in a |
|
235 | This section describes the different sections that may appear in a | |
236 | Mercurial configuration file, the purpose of each section, its possible |
|
236 | Mercurial configuration file, the purpose of each section, its possible | |
237 | keys, and their possible values. |
|
237 | keys, and their possible values. | |
238 |
|
238 | |||
239 | ``alias`` |
|
239 | ``alias`` | |
240 | --------- |
|
240 | --------- | |
241 |
|
241 | |||
242 | Defines command aliases. |
|
242 | Defines command aliases. | |
243 |
|
243 | |||
244 | Aliases allow you to define your own commands in terms of other |
|
244 | Aliases allow you to define your own commands in terms of other | |
245 | commands (or aliases), optionally including arguments. Positional |
|
245 | commands (or aliases), optionally including arguments. Positional | |
246 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
246 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition | |
247 | are expanded by Mercurial before execution. Positional arguments not |
|
247 | are expanded by Mercurial before execution. Positional arguments not | |
248 | already used by ``$N`` in the definition are put at the end of the |
|
248 | already used by ``$N`` in the definition are put at the end of the | |
249 | command to be executed. |
|
249 | command to be executed. | |
250 |
|
250 | |||
251 | Alias definitions consist of lines of the form:: |
|
251 | Alias definitions consist of lines of the form:: | |
252 |
|
252 | |||
253 | <alias> = <command> [<argument>]... |
|
253 | <alias> = <command> [<argument>]... | |
254 |
|
254 | |||
255 | For example, this definition:: |
|
255 | For example, this definition:: | |
256 |
|
256 | |||
257 | latest = log --limit 5 |
|
257 | latest = log --limit 5 | |
258 |
|
258 | |||
259 | creates a new command ``latest`` that shows only the five most recent |
|
259 | creates a new command ``latest`` that shows only the five most recent | |
260 | changesets. You can define subsequent aliases using earlier ones:: |
|
260 | changesets. You can define subsequent aliases using earlier ones:: | |
261 |
|
261 | |||
262 | stable5 = latest -b stable |
|
262 | stable5 = latest -b stable | |
263 |
|
263 | |||
264 | .. note:: |
|
264 | .. note:: | |
265 |
|
265 | |||
266 | It is possible to create aliases with the same names as |
|
266 | It is possible to create aliases with the same names as | |
267 | existing commands, which will then override the original |
|
267 | existing commands, which will then override the original | |
268 | definitions. This is almost always a bad idea! |
|
268 | definitions. This is almost always a bad idea! | |
269 |
|
269 | |||
270 | An alias can start with an exclamation point (``!``) to make it a |
|
270 | An alias can start with an exclamation point (``!``) to make it a | |
271 | shell alias. A shell alias is executed with the shell and will let you |
|
271 | shell alias. A shell alias is executed with the shell and will let you | |
272 | run arbitrary commands. As an example, :: |
|
272 | run arbitrary commands. As an example, :: | |
273 |
|
273 | |||
274 | echo = !echo $@ |
|
274 | echo = !echo $@ | |
275 |
|
275 | |||
276 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
276 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
277 | terminal. A better example might be:: |
|
277 | terminal. A better example might be:: | |
278 |
|
278 | |||
279 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm |
|
279 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm | |
280 |
|
280 | |||
281 | which will make ``hg purge`` delete all unknown files in the |
|
281 | which will make ``hg purge`` delete all unknown files in the | |
282 | repository in the same manner as the purge extension. |
|
282 | repository in the same manner as the purge extension. | |
283 |
|
283 | |||
284 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
284 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
285 | expand to the command arguments. Unmatched arguments are |
|
285 | expand to the command arguments. Unmatched arguments are | |
286 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
286 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
287 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
287 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
288 | arguments quoted individually and separated by a space. These expansions |
|
288 | arguments quoted individually and separated by a space. These expansions | |
289 | happen before the command is passed to the shell. |
|
289 | happen before the command is passed to the shell. | |
290 |
|
290 | |||
291 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
291 | Shell aliases are executed in an environment where ``$HG`` expands to | |
292 | the path of the Mercurial that was used to execute the alias. This is |
|
292 | the path of the Mercurial that was used to execute the alias. This is | |
293 | useful when you want to call further Mercurial commands in a shell |
|
293 | useful when you want to call further Mercurial commands in a shell | |
294 | alias, as was done above for the purge alias. In addition, |
|
294 | alias, as was done above for the purge alias. In addition, | |
295 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
295 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
296 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
296 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
297 |
|
297 | |||
298 | .. note:: |
|
298 | .. note:: | |
299 |
|
299 | |||
300 | Some global configuration options such as ``-R`` are |
|
300 | Some global configuration options such as ``-R`` are | |
301 | processed before shell aliases and will thus not be passed to |
|
301 | processed before shell aliases and will thus not be passed to | |
302 | aliases. |
|
302 | aliases. | |
303 |
|
303 | |||
304 |
|
304 | |||
305 | ``annotate`` |
|
305 | ``annotate`` | |
306 | ------------ |
|
306 | ------------ | |
307 |
|
307 | |||
308 | Settings used when displaying file annotations. All values are |
|
308 | Settings used when displaying file annotations. All values are | |
309 | Booleans and default to False. See :hg:`help config.diff` for |
|
309 | Booleans and default to False. See :hg:`help config.diff` for | |
310 | related options for the diff command. |
|
310 | related options for the diff command. | |
311 |
|
311 | |||
312 | ``ignorews`` |
|
312 | ``ignorews`` | |
313 | Ignore white space when comparing lines. |
|
313 | Ignore white space when comparing lines. | |
314 |
|
314 | |||
315 | ``ignorewsamount`` |
|
315 | ``ignorewsamount`` | |
316 | Ignore changes in the amount of white space. |
|
316 | Ignore changes in the amount of white space. | |
317 |
|
317 | |||
318 | ``ignoreblanklines`` |
|
318 | ``ignoreblanklines`` | |
319 | Ignore changes whose lines are all blank. |
|
319 | Ignore changes whose lines are all blank. | |
320 |
|
320 | |||
321 |
|
321 | |||
322 | ``auth`` |
|
322 | ``auth`` | |
323 | -------- |
|
323 | -------- | |
324 |
|
324 | |||
325 | Authentication credentials for HTTP authentication. This section |
|
325 | Authentication credentials for HTTP authentication. This section | |
326 | allows you to store usernames and passwords for use when logging |
|
326 | allows you to store usernames and passwords for use when logging | |
327 | *into* HTTP servers. See :hg:`help config.web` if |
|
327 | *into* HTTP servers. See :hg:`help config.web` if | |
328 | you want to configure *who* can login to your HTTP server. |
|
328 | you want to configure *who* can login to your HTTP server. | |
329 |
|
329 | |||
330 | Each line has the following format:: |
|
330 | Each line has the following format:: | |
331 |
|
331 | |||
332 | <name>.<argument> = <value> |
|
332 | <name>.<argument> = <value> | |
333 |
|
333 | |||
334 | where ``<name>`` is used to group arguments into authentication |
|
334 | where ``<name>`` is used to group arguments into authentication | |
335 | entries. Example:: |
|
335 | entries. Example:: | |
336 |
|
336 | |||
337 | foo.prefix = hg.intevation.de/mercurial |
|
337 | foo.prefix = hg.intevation.de/mercurial | |
338 | foo.username = foo |
|
338 | foo.username = foo | |
339 | foo.password = bar |
|
339 | foo.password = bar | |
340 | foo.schemes = http https |
|
340 | foo.schemes = http https | |
341 |
|
341 | |||
342 | bar.prefix = secure.example.org |
|
342 | bar.prefix = secure.example.org | |
343 | bar.key = path/to/file.key |
|
343 | bar.key = path/to/file.key | |
344 | bar.cert = path/to/file.cert |
|
344 | bar.cert = path/to/file.cert | |
345 | bar.schemes = https |
|
345 | bar.schemes = https | |
346 |
|
346 | |||
347 | Supported arguments: |
|
347 | Supported arguments: | |
348 |
|
348 | |||
349 | ``prefix`` |
|
349 | ``prefix`` | |
350 | Either ``*`` or a URI prefix with or without the scheme part. |
|
350 | Either ``*`` or a URI prefix with or without the scheme part. | |
351 | The authentication entry with the longest matching prefix is used |
|
351 | The authentication entry with the longest matching prefix is used | |
352 | (where ``*`` matches everything and counts as a match of length |
|
352 | (where ``*`` matches everything and counts as a match of length | |
353 | 1). If the prefix doesn't include a scheme, the match is performed |
|
353 | 1). If the prefix doesn't include a scheme, the match is performed | |
354 | against the URI with its scheme stripped as well, and the schemes |
|
354 | against the URI with its scheme stripped as well, and the schemes | |
355 | argument, q.v., is then subsequently consulted. |
|
355 | argument, q.v., is then subsequently consulted. | |
356 |
|
356 | |||
357 | ``username`` |
|
357 | ``username`` | |
358 | Optional. Username to authenticate with. If not given, and the |
|
358 | Optional. Username to authenticate with. If not given, and the | |
359 | remote site requires basic or digest authentication, the user will |
|
359 | remote site requires basic or digest authentication, the user will | |
360 | be prompted for it. Environment variables are expanded in the |
|
360 | be prompted for it. Environment variables are expanded in the | |
361 | username letting you do ``foo.username = $USER``. If the URI |
|
361 | username letting you do ``foo.username = $USER``. If the URI | |
362 | includes a username, only ``[auth]`` entries with a matching |
|
362 | includes a username, only ``[auth]`` entries with a matching | |
363 | username or without a username will be considered. |
|
363 | username or without a username will be considered. | |
364 |
|
364 | |||
365 | ``password`` |
|
365 | ``password`` | |
366 | Optional. Password to authenticate with. If not given, and the |
|
366 | Optional. Password to authenticate with. If not given, and the | |
367 | remote site requires basic or digest authentication, the user |
|
367 | remote site requires basic or digest authentication, the user | |
368 | will be prompted for it. |
|
368 | will be prompted for it. | |
369 |
|
369 | |||
370 | ``key`` |
|
370 | ``key`` | |
371 | Optional. PEM encoded client certificate key file. Environment |
|
371 | Optional. PEM encoded client certificate key file. Environment | |
372 | variables are expanded in the filename. |
|
372 | variables are expanded in the filename. | |
373 |
|
373 | |||
374 | ``cert`` |
|
374 | ``cert`` | |
375 | Optional. PEM encoded client certificate chain file. Environment |
|
375 | Optional. PEM encoded client certificate chain file. Environment | |
376 | variables are expanded in the filename. |
|
376 | variables are expanded in the filename. | |
377 |
|
377 | |||
378 | ``schemes`` |
|
378 | ``schemes`` | |
379 | Optional. Space separated list of URI schemes to use this |
|
379 | Optional. Space separated list of URI schemes to use this | |
380 | authentication entry with. Only used if the prefix doesn't include |
|
380 | authentication entry with. Only used if the prefix doesn't include | |
381 | a scheme. Supported schemes are http and https. They will match |
|
381 | a scheme. Supported schemes are http and https. They will match | |
382 | static-http and static-https respectively, as well. |
|
382 | static-http and static-https respectively, as well. | |
383 | (default: https) |
|
383 | (default: https) | |
384 |
|
384 | |||
385 | If no suitable authentication entry is found, the user is prompted |
|
385 | If no suitable authentication entry is found, the user is prompted | |
386 | for credentials as usual if required by the remote. |
|
386 | for credentials as usual if required by the remote. | |
387 |
|
387 | |||
388 |
|
388 | |||
389 | ``committemplate`` |
|
389 | ``committemplate`` | |
390 | ------------------ |
|
390 | ------------------ | |
391 |
|
391 | |||
392 | ``changeset`` |
|
392 | ``changeset`` | |
393 | String: configuration in this section is used as the template to |
|
393 | String: configuration in this section is used as the template to | |
394 | customize the text shown in the editor when committing. |
|
394 | customize the text shown in the editor when committing. | |
395 |
|
395 | |||
396 | In addition to pre-defined template keywords, commit log specific one |
|
396 | In addition to pre-defined template keywords, commit log specific one | |
397 | below can be used for customization: |
|
397 | below can be used for customization: | |
398 |
|
398 | |||
399 | ``extramsg`` |
|
399 | ``extramsg`` | |
400 | String: Extra message (typically 'Leave message empty to abort |
|
400 | String: Extra message (typically 'Leave message empty to abort | |
401 | commit.'). This may be changed by some commands or extensions. |
|
401 | commit.'). This may be changed by some commands or extensions. | |
402 |
|
402 | |||
403 | For example, the template configuration below shows as same text as |
|
403 | For example, the template configuration below shows as same text as | |
404 | one shown by default:: |
|
404 | one shown by default:: | |
405 |
|
405 | |||
406 | [committemplate] |
|
406 | [committemplate] | |
407 | changeset = {desc}\n\n |
|
407 | changeset = {desc}\n\n | |
408 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
408 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
409 | HG: {extramsg} |
|
409 | HG: {extramsg} | |
410 | HG: -- |
|
410 | HG: -- | |
411 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
411 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
412 | "HG: branch merge\n") |
|
412 | "HG: branch merge\n") | |
413 | }HG: branch '{branch}'\n{if(activebookmark, |
|
413 | }HG: branch '{branch}'\n{if(activebookmark, | |
414 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
414 | "HG: bookmark '{activebookmark}'\n") }{subrepos % | |
415 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
415 | "HG: subrepo {subrepo}\n" }{file_adds % | |
416 | "HG: added {file}\n" }{file_mods % |
|
416 | "HG: added {file}\n" }{file_mods % | |
417 | "HG: changed {file}\n" }{file_dels % |
|
417 | "HG: changed {file}\n" }{file_dels % | |
418 | "HG: removed {file}\n" }{if(files, "", |
|
418 | "HG: removed {file}\n" }{if(files, "", | |
419 | "HG: no files changed\n")} |
|
419 | "HG: no files changed\n")} | |
420 |
|
420 | |||
421 | .. note:: |
|
421 | .. note:: | |
422 |
|
422 | |||
423 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
423 | For some problematic encodings (see :hg:`help win32mbcs` for | |
424 | detail), this customization should be configured carefully, to |
|
424 | detail), this customization should be configured carefully, to | |
425 | avoid showing broken characters. |
|
425 | avoid showing broken characters. | |
426 |
|
426 | |||
427 | For example, if a multibyte character ending with backslash (0x5c) is |
|
427 | For example, if a multibyte character ending with backslash (0x5c) is | |
428 | followed by the ASCII character 'n' in the customized template, |
|
428 | followed by the ASCII character 'n' in the customized template, | |
429 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
429 | the sequence of backslash and 'n' is treated as line-feed unexpectedly | |
430 | (and the multibyte character is broken, too). |
|
430 | (and the multibyte character is broken, too). | |
431 |
|
431 | |||
432 | Customized template is used for commands below (``--edit`` may be |
|
432 | Customized template is used for commands below (``--edit`` may be | |
433 | required): |
|
433 | required): | |
434 |
|
434 | |||
435 | - :hg:`backout` |
|
435 | - :hg:`backout` | |
436 | - :hg:`commit` |
|
436 | - :hg:`commit` | |
437 | - :hg:`fetch` (for merge commit only) |
|
437 | - :hg:`fetch` (for merge commit only) | |
438 | - :hg:`graft` |
|
438 | - :hg:`graft` | |
439 | - :hg:`histedit` |
|
439 | - :hg:`histedit` | |
440 | - :hg:`import` |
|
440 | - :hg:`import` | |
441 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
441 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
442 | - :hg:`rebase` |
|
442 | - :hg:`rebase` | |
443 | - :hg:`shelve` |
|
443 | - :hg:`shelve` | |
444 | - :hg:`sign` |
|
444 | - :hg:`sign` | |
445 | - :hg:`tag` |
|
445 | - :hg:`tag` | |
446 | - :hg:`transplant` |
|
446 | - :hg:`transplant` | |
447 |
|
447 | |||
448 | Configuring items below instead of ``changeset`` allows showing |
|
448 | Configuring items below instead of ``changeset`` allows showing | |
449 | customized message only for specific actions, or showing different |
|
449 | customized message only for specific actions, or showing different | |
450 | messages for each action. |
|
450 | messages for each action. | |
451 |
|
451 | |||
452 | - ``changeset.backout`` for :hg:`backout` |
|
452 | - ``changeset.backout`` for :hg:`backout` | |
453 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
453 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges | |
454 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
454 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other | |
455 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
455 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges | |
456 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
456 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other | |
457 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
457 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
458 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
458 | - ``changeset.gpg.sign`` for :hg:`sign` | |
459 | - ``changeset.graft`` for :hg:`graft` |
|
459 | - ``changeset.graft`` for :hg:`graft` | |
460 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
460 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
461 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
461 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
462 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
462 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
463 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
463 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
464 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
464 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
465 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
465 | - ``changeset.import.normal.merge`` for :hg:`import` on merges | |
466 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
466 | - ``changeset.import.normal.normal`` for :hg:`import` on other | |
467 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
467 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
468 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
468 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
469 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
469 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
470 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
470 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
471 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
471 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges | |
472 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
472 | - ``changeset.rebase.normal`` for :hg:`rebase` on other | |
473 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
473 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
474 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
474 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
475 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
475 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
476 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
476 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges | |
477 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
477 | - ``changeset.transplant.normal`` for :hg:`transplant` on other | |
478 |
|
478 | |||
479 | These dot-separated lists of names are treated as hierarchical ones. |
|
479 | These dot-separated lists of names are treated as hierarchical ones. | |
480 | For example, ``changeset.tag.remove`` customizes the commit message |
|
480 | For example, ``changeset.tag.remove`` customizes the commit message | |
481 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
481 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
482 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
482 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
483 |
|
483 | |||
484 | When the external editor is invoked for a commit, the corresponding |
|
484 | When the external editor is invoked for a commit, the corresponding | |
485 | dot-separated list of names without the ``changeset.`` prefix |
|
485 | dot-separated list of names without the ``changeset.`` prefix | |
486 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
486 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment | |
487 | variable. |
|
487 | variable. | |
488 |
|
488 | |||
489 | In this section, items other than ``changeset`` can be referred from |
|
489 | In this section, items other than ``changeset`` can be referred from | |
490 | others. For example, the configuration to list committed files up |
|
490 | others. For example, the configuration to list committed files up | |
491 | below can be referred as ``{listupfiles}``:: |
|
491 | below can be referred as ``{listupfiles}``:: | |
492 |
|
492 | |||
493 | [committemplate] |
|
493 | [committemplate] | |
494 | listupfiles = {file_adds % |
|
494 | listupfiles = {file_adds % | |
495 | "HG: added {file}\n" }{file_mods % |
|
495 | "HG: added {file}\n" }{file_mods % | |
496 | "HG: changed {file}\n" }{file_dels % |
|
496 | "HG: changed {file}\n" }{file_dels % | |
497 | "HG: removed {file}\n" }{if(files, "", |
|
497 | "HG: removed {file}\n" }{if(files, "", | |
498 | "HG: no files changed\n")} |
|
498 | "HG: no files changed\n")} | |
499 |
|
499 | |||
500 | ``decode/encode`` |
|
500 | ``decode/encode`` | |
501 | ----------------- |
|
501 | ----------------- | |
502 |
|
502 | |||
503 | Filters for transforming files on checkout/checkin. This would |
|
503 | Filters for transforming files on checkout/checkin. This would | |
504 | typically be used for newline processing or other |
|
504 | typically be used for newline processing or other | |
505 | localization/canonicalization of files. |
|
505 | localization/canonicalization of files. | |
506 |
|
506 | |||
507 | Filters consist of a filter pattern followed by a filter command. |
|
507 | Filters consist of a filter pattern followed by a filter command. | |
508 | Filter patterns are globs by default, rooted at the repository root. |
|
508 | Filter patterns are globs by default, rooted at the repository root. | |
509 | For example, to match any file ending in ``.txt`` in the root |
|
509 | For example, to match any file ending in ``.txt`` in the root | |
510 | directory only, use the pattern ``*.txt``. To match any file ending |
|
510 | directory only, use the pattern ``*.txt``. To match any file ending | |
511 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
511 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
512 | For each file only the first matching filter applies. |
|
512 | For each file only the first matching filter applies. | |
513 |
|
513 | |||
514 | The filter command can start with a specifier, either ``pipe:`` or |
|
514 | The filter command can start with a specifier, either ``pipe:`` or | |
515 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
515 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
516 |
|
516 | |||
517 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
517 | A ``pipe:`` command must accept data on stdin and return the transformed | |
518 | data on stdout. |
|
518 | data on stdout. | |
519 |
|
519 | |||
520 | Pipe example:: |
|
520 | Pipe example:: | |
521 |
|
521 | |||
522 | [encode] |
|
522 | [encode] | |
523 | # uncompress gzip files on checkin to improve delta compression |
|
523 | # uncompress gzip files on checkin to improve delta compression | |
524 | # note: not necessarily a good idea, just an example |
|
524 | # note: not necessarily a good idea, just an example | |
525 | *.gz = pipe: gunzip |
|
525 | *.gz = pipe: gunzip | |
526 |
|
526 | |||
527 | [decode] |
|
527 | [decode] | |
528 | # recompress gzip files when writing them to the working dir (we |
|
528 | # recompress gzip files when writing them to the working dir (we | |
529 | # can safely omit "pipe:", because it's the default) |
|
529 | # can safely omit "pipe:", because it's the default) | |
530 | *.gz = gzip |
|
530 | *.gz = gzip | |
531 |
|
531 | |||
532 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
532 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
533 | with the name of a temporary file that contains the data to be |
|
533 | with the name of a temporary file that contains the data to be | |
534 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
534 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
535 | of an empty temporary file, where the filtered data must be written by |
|
535 | of an empty temporary file, where the filtered data must be written by | |
536 | the command. |
|
536 | the command. | |
537 |
|
537 | |||
538 | .. container:: windows |
|
538 | .. container:: windows | |
539 |
|
539 | |||
540 | .. note:: |
|
540 | .. note:: | |
541 |
|
541 | |||
542 | The tempfile mechanism is recommended for Windows systems, |
|
542 | The tempfile mechanism is recommended for Windows systems, | |
543 | where the standard shell I/O redirection operators often have |
|
543 | where the standard shell I/O redirection operators often have | |
544 | strange effects and may corrupt the contents of your files. |
|
544 | strange effects and may corrupt the contents of your files. | |
545 |
|
545 | |||
546 | This filter mechanism is used internally by the ``eol`` extension to |
|
546 | This filter mechanism is used internally by the ``eol`` extension to | |
547 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
547 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
548 | format. We suggest you use the ``eol`` extension for convenience. |
|
548 | format. We suggest you use the ``eol`` extension for convenience. | |
549 |
|
549 | |||
550 |
|
550 | |||
551 | ``defaults`` |
|
551 | ``defaults`` | |
552 | ------------ |
|
552 | ------------ | |
553 |
|
553 | |||
554 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
554 | (defaults are deprecated. Don't use them. Use aliases instead.) | |
555 |
|
555 | |||
556 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
556 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
557 | default options/arguments to pass to the specified commands. |
|
557 | default options/arguments to pass to the specified commands. | |
558 |
|
558 | |||
559 | The following example makes :hg:`log` run in verbose mode, and |
|
559 | The following example makes :hg:`log` run in verbose mode, and | |
560 | :hg:`status` show only the modified files, by default:: |
|
560 | :hg:`status` show only the modified files, by default:: | |
561 |
|
561 | |||
562 | [defaults] |
|
562 | [defaults] | |
563 | log = -v |
|
563 | log = -v | |
564 | status = -m |
|
564 | status = -m | |
565 |
|
565 | |||
566 | The actual commands, instead of their aliases, must be used when |
|
566 | The actual commands, instead of their aliases, must be used when | |
567 | defining command defaults. The command defaults will also be applied |
|
567 | defining command defaults. The command defaults will also be applied | |
568 | to the aliases of the commands defined. |
|
568 | to the aliases of the commands defined. | |
569 |
|
569 | |||
570 |
|
570 | |||
571 | ``diff`` |
|
571 | ``diff`` | |
572 | -------- |
|
572 | -------- | |
573 |
|
573 | |||
574 | Settings used when displaying diffs. Everything except for ``unified`` |
|
574 | Settings used when displaying diffs. Everything except for ``unified`` | |
575 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
575 | is a Boolean and defaults to False. See :hg:`help config.annotate` | |
576 | for related options for the annotate command. |
|
576 | for related options for the annotate command. | |
577 |
|
577 | |||
578 | ``git`` |
|
578 | ``git`` | |
579 | Use git extended diff format. |
|
579 | Use git extended diff format. | |
580 |
|
580 | |||
581 | ``nobinary`` |
|
581 | ``nobinary`` | |
582 | Omit git binary patches. |
|
582 | Omit git binary patches. | |
583 |
|
583 | |||
584 | ``nodates`` |
|
584 | ``nodates`` | |
585 | Don't include dates in diff headers. |
|
585 | Don't include dates in diff headers. | |
586 |
|
586 | |||
587 | ``noprefix`` |
|
587 | ``noprefix`` | |
588 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
588 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. | |
589 |
|
589 | |||
590 | ``showfunc`` |
|
590 | ``showfunc`` | |
591 | Show which function each change is in. |
|
591 | Show which function each change is in. | |
592 |
|
592 | |||
593 | ``ignorews`` |
|
593 | ``ignorews`` | |
594 | Ignore white space when comparing lines. |
|
594 | Ignore white space when comparing lines. | |
595 |
|
595 | |||
596 | ``ignorewsamount`` |
|
596 | ``ignorewsamount`` | |
597 | Ignore changes in the amount of white space. |
|
597 | Ignore changes in the amount of white space. | |
598 |
|
598 | |||
599 | ``ignoreblanklines`` |
|
599 | ``ignoreblanklines`` | |
600 | Ignore changes whose lines are all blank. |
|
600 | Ignore changes whose lines are all blank. | |
601 |
|
601 | |||
602 | ``unified`` |
|
602 | ``unified`` | |
603 | Number of lines of context to show. |
|
603 | Number of lines of context to show. | |
604 |
|
604 | |||
605 | ``email`` |
|
605 | ``email`` | |
606 | --------- |
|
606 | --------- | |
607 |
|
607 | |||
608 | Settings for extensions that send email messages. |
|
608 | Settings for extensions that send email messages. | |
609 |
|
609 | |||
610 | ``from`` |
|
610 | ``from`` | |
611 | Optional. Email address to use in "From" header and SMTP envelope |
|
611 | Optional. Email address to use in "From" header and SMTP envelope | |
612 | of outgoing messages. |
|
612 | of outgoing messages. | |
613 |
|
613 | |||
614 | ``to`` |
|
614 | ``to`` | |
615 | Optional. Comma-separated list of recipients' email addresses. |
|
615 | Optional. Comma-separated list of recipients' email addresses. | |
616 |
|
616 | |||
617 | ``cc`` |
|
617 | ``cc`` | |
618 | Optional. Comma-separated list of carbon copy recipients' |
|
618 | Optional. Comma-separated list of carbon copy recipients' | |
619 | email addresses. |
|
619 | email addresses. | |
620 |
|
620 | |||
621 | ``bcc`` |
|
621 | ``bcc`` | |
622 | Optional. Comma-separated list of blind carbon copy recipients' |
|
622 | Optional. Comma-separated list of blind carbon copy recipients' | |
623 | email addresses. |
|
623 | email addresses. | |
624 |
|
624 | |||
625 | ``method`` |
|
625 | ``method`` | |
626 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
626 | Optional. Method to use to send email messages. If value is ``smtp`` | |
627 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
627 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
628 | Otherwise, use as name of program to run that acts like sendmail |
|
628 | Otherwise, use as name of program to run that acts like sendmail | |
629 | (takes ``-f`` option for sender, list of recipients on command line, |
|
629 | (takes ``-f`` option for sender, list of recipients on command line, | |
630 | message on stdin). Normally, setting this to ``sendmail`` or |
|
630 | message on stdin). Normally, setting this to ``sendmail`` or | |
631 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
631 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
632 |
|
632 | |||
633 | ``charsets`` |
|
633 | ``charsets`` | |
634 | Optional. Comma-separated list of character sets considered |
|
634 | Optional. Comma-separated list of character sets considered | |
635 | convenient for recipients. Addresses, headers, and parts not |
|
635 | convenient for recipients. Addresses, headers, and parts not | |
636 | containing patches of outgoing messages will be encoded in the |
|
636 | containing patches of outgoing messages will be encoded in the | |
637 | first character set to which conversion from local encoding |
|
637 | first character set to which conversion from local encoding | |
638 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
638 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
639 | conversion fails, the text in question is sent as is. |
|
639 | conversion fails, the text in question is sent as is. | |
640 | (default: '') |
|
640 | (default: '') | |
641 |
|
641 | |||
642 | Order of outgoing email character sets: |
|
642 | Order of outgoing email character sets: | |
643 |
|
643 | |||
644 | 1. ``us-ascii``: always first, regardless of settings |
|
644 | 1. ``us-ascii``: always first, regardless of settings | |
645 | 2. ``email.charsets``: in order given by user |
|
645 | 2. ``email.charsets``: in order given by user | |
646 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
646 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
647 | 4. ``$HGENCODING``: if not in email.charsets |
|
647 | 4. ``$HGENCODING``: if not in email.charsets | |
648 | 5. ``utf-8``: always last, regardless of settings |
|
648 | 5. ``utf-8``: always last, regardless of settings | |
649 |
|
649 | |||
650 | Email example:: |
|
650 | Email example:: | |
651 |
|
651 | |||
652 | [email] |
|
652 | [email] | |
653 | from = Joseph User <joe.user@example.com> |
|
653 | from = Joseph User <joe.user@example.com> | |
654 | method = /usr/sbin/sendmail |
|
654 | method = /usr/sbin/sendmail | |
655 | # charsets for western Europeans |
|
655 | # charsets for western Europeans | |
656 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
656 | # us-ascii, utf-8 omitted, as they are tried first and last | |
657 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
657 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
658 |
|
658 | |||
659 |
|
659 | |||
660 | ``extensions`` |
|
660 | ``extensions`` | |
661 | -------------- |
|
661 | -------------- | |
662 |
|
662 | |||
663 | Mercurial has an extension mechanism for adding new features. To |
|
663 | Mercurial has an extension mechanism for adding new features. To | |
664 | enable an extension, create an entry for it in this section. |
|
664 | enable an extension, create an entry for it in this section. | |
665 |
|
665 | |||
666 | If you know that the extension is already in Python's search path, |
|
666 | If you know that the extension is already in Python's search path, | |
667 | you can give the name of the module, followed by ``=``, with nothing |
|
667 | you can give the name of the module, followed by ``=``, with nothing | |
668 | after the ``=``. |
|
668 | after the ``=``. | |
669 |
|
669 | |||
670 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
670 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
671 | the path to the ``.py`` file (including the file name extension) that |
|
671 | the path to the ``.py`` file (including the file name extension) that | |
672 | defines the extension. |
|
672 | defines the extension. | |
673 |
|
673 | |||
674 | To explicitly disable an extension that is enabled in an hgrc of |
|
674 | To explicitly disable an extension that is enabled in an hgrc of | |
675 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
675 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
676 | or ``foo = !`` when path is not supplied. |
|
676 | or ``foo = !`` when path is not supplied. | |
677 |
|
677 | |||
678 | Example for ``~/.hgrc``:: |
|
678 | Example for ``~/.hgrc``:: | |
679 |
|
679 | |||
680 | [extensions] |
|
680 | [extensions] | |
681 | # (the color extension will get loaded from Mercurial's path) |
|
681 | # (the color extension will get loaded from Mercurial's path) | |
682 | color = |
|
682 | color = | |
683 | # (this extension will get loaded from the file specified) |
|
683 | # (this extension will get loaded from the file specified) | |
684 | myfeature = ~/.hgext/myfeature.py |
|
684 | myfeature = ~/.hgext/myfeature.py | |
685 |
|
685 | |||
686 |
|
686 | |||
687 | ``format`` |
|
687 | ``format`` | |
688 | ---------- |
|
688 | ---------- | |
689 |
|
689 | |||
690 | ``usegeneraldelta`` |
|
690 | ``usegeneraldelta`` | |
691 | Enable or disable the "generaldelta" repository format which improves |
|
691 | Enable or disable the "generaldelta" repository format which improves | |
692 | repository compression by allowing "revlog" to store delta against arbitrary |
|
692 | repository compression by allowing "revlog" to store delta against arbitrary | |
693 | revision instead of the previous stored one. This provides significant |
|
693 | revision instead of the previous stored one. This provides significant | |
694 | improvement for repositories with branches. |
|
694 | improvement for repositories with branches. | |
695 |
|
695 | |||
696 | Repositories with this on-disk format require Mercurial version 1.9. |
|
696 | Repositories with this on-disk format require Mercurial version 1.9. | |
697 |
|
697 | |||
698 | Enabled by default. |
|
698 | Enabled by default. | |
699 |
|
699 | |||
700 | ``dotencode`` |
|
700 | ``dotencode`` | |
701 | Enable or disable the "dotencode" repository format which enhances |
|
701 | Enable or disable the "dotencode" repository format which enhances | |
702 | the "fncache" repository format (which has to be enabled to use |
|
702 | the "fncache" repository format (which has to be enabled to use | |
703 | dotencode) to avoid issues with filenames starting with ._ on |
|
703 | dotencode) to avoid issues with filenames starting with ._ on | |
704 | Mac OS X and spaces on Windows. |
|
704 | Mac OS X and spaces on Windows. | |
705 |
|
705 | |||
706 | Repositories with this on-disk format require Mercurial version 1.7. |
|
706 | Repositories with this on-disk format require Mercurial version 1.7. | |
707 |
|
707 | |||
708 | Enabled by default. |
|
708 | Enabled by default. | |
709 |
|
709 | |||
710 | ``usefncache`` |
|
710 | ``usefncache`` | |
711 | Enable or disable the "fncache" repository format which enhances |
|
711 | Enable or disable the "fncache" repository format which enhances | |
712 | the "store" repository format (which has to be enabled to use |
|
712 | the "store" repository format (which has to be enabled to use | |
713 | fncache) to allow longer filenames and avoids using Windows |
|
713 | fncache) to allow longer filenames and avoids using Windows | |
714 | reserved names, e.g. "nul". |
|
714 | reserved names, e.g. "nul". | |
715 |
|
715 | |||
716 | Repositories with this on-disk format require Mercurial version 1.1. |
|
716 | Repositories with this on-disk format require Mercurial version 1.1. | |
717 |
|
717 | |||
718 | Enabled by default. |
|
718 | Enabled by default. | |
719 |
|
719 | |||
720 | ``usestore`` |
|
720 | ``usestore`` | |
721 | Enable or disable the "store" repository format which improves |
|
721 | Enable or disable the "store" repository format which improves | |
722 | compatibility with systems that fold case or otherwise mangle |
|
722 | compatibility with systems that fold case or otherwise mangle | |
723 | filenames. Disabling this option will allow you to store longer filenames |
|
723 | filenames. Disabling this option will allow you to store longer filenames | |
724 | in some situations at the expense of compatibility. |
|
724 | in some situations at the expense of compatibility. | |
725 |
|
725 | |||
726 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
726 | Repositories with this on-disk format require Mercurial version 0.9.4. | |
727 |
|
727 | |||
728 | Enabled by default. |
|
728 | Enabled by default. | |
729 |
|
729 | |||
730 | ``graph`` |
|
730 | ``graph`` | |
731 | --------- |
|
731 | --------- | |
732 |
|
732 | |||
733 | Web graph view configuration. This section let you change graph |
|
733 | Web graph view configuration. This section let you change graph | |
734 | elements display properties by branches, for instance to make the |
|
734 | elements display properties by branches, for instance to make the | |
735 | ``default`` branch stand out. |
|
735 | ``default`` branch stand out. | |
736 |
|
736 | |||
737 | Each line has the following format:: |
|
737 | Each line has the following format:: | |
738 |
|
738 | |||
739 | <branch>.<argument> = <value> |
|
739 | <branch>.<argument> = <value> | |
740 |
|
740 | |||
741 | where ``<branch>`` is the name of the branch being |
|
741 | where ``<branch>`` is the name of the branch being | |
742 | customized. Example:: |
|
742 | customized. Example:: | |
743 |
|
743 | |||
744 | [graph] |
|
744 | [graph] | |
745 | # 2px width |
|
745 | # 2px width | |
746 | default.width = 2 |
|
746 | default.width = 2 | |
747 | # red color |
|
747 | # red color | |
748 | default.color = FF0000 |
|
748 | default.color = FF0000 | |
749 |
|
749 | |||
750 | Supported arguments: |
|
750 | Supported arguments: | |
751 |
|
751 | |||
752 | ``width`` |
|
752 | ``width`` | |
753 | Set branch edges width in pixels. |
|
753 | Set branch edges width in pixels. | |
754 |
|
754 | |||
755 | ``color`` |
|
755 | ``color`` | |
756 | Set branch edges color in hexadecimal RGB notation. |
|
756 | Set branch edges color in hexadecimal RGB notation. | |
757 |
|
757 | |||
758 | ``hooks`` |
|
758 | ``hooks`` | |
759 | --------- |
|
759 | --------- | |
760 |
|
760 | |||
761 | Commands or Python functions that get automatically executed by |
|
761 | Commands or Python functions that get automatically executed by | |
762 | various actions such as starting or finishing a commit. Multiple |
|
762 | various actions such as starting or finishing a commit. Multiple | |
763 | hooks can be run for the same action by appending a suffix to the |
|
763 | hooks can be run for the same action by appending a suffix to the | |
764 | action. Overriding a site-wide hook can be done by changing its |
|
764 | action. Overriding a site-wide hook can be done by changing its | |
765 | value or setting it to an empty string. Hooks can be prioritized |
|
765 | value or setting it to an empty string. Hooks can be prioritized | |
766 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
766 | by adding a prefix of ``priority.`` to the hook name on a new line | |
767 | and setting the priority. The default priority is 0. |
|
767 | and setting the priority. The default priority is 0. | |
768 |
|
768 | |||
769 | Example ``.hg/hgrc``:: |
|
769 | Example ``.hg/hgrc``:: | |
770 |
|
770 | |||
771 | [hooks] |
|
771 | [hooks] | |
772 | # update working directory after adding changesets |
|
772 | # update working directory after adding changesets | |
773 | changegroup.update = hg update |
|
773 | changegroup.update = hg update | |
774 | # do not use the site-wide hook |
|
774 | # do not use the site-wide hook | |
775 | incoming = |
|
775 | incoming = | |
776 | incoming.email = /my/email/hook |
|
776 | incoming.email = /my/email/hook | |
777 | incoming.autobuild = /my/build/hook |
|
777 | incoming.autobuild = /my/build/hook | |
778 | # force autobuild hook to run before other incoming hooks |
|
778 | # force autobuild hook to run before other incoming hooks | |
779 | priority.incoming.autobuild = 1 |
|
779 | priority.incoming.autobuild = 1 | |
780 |
|
780 | |||
781 | Most hooks are run with environment variables set that give useful |
|
781 | Most hooks are run with environment variables set that give useful | |
782 | additional information. For each hook below, the environment |
|
782 | additional information. For each hook below, the environment | |
783 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
783 | variables it is passed are listed with names of the form ``$HG_foo``. | |
784 |
|
784 | |||
785 | ``changegroup`` |
|
785 | ``changegroup`` | |
786 | Run after a changegroup has been added via push, pull or unbundle. ID of the |
|
786 | Run after a changegroup has been added via push, pull or unbundle. ID of the | |
787 | first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL |
|
787 | first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL | |
788 | from which changes came is in ``$HG_URL``. |
|
788 | from which changes came is in ``$HG_URL``. | |
789 |
|
789 | |||
790 | ``commit`` |
|
790 | ``commit`` | |
791 | Run after a changeset has been created in the local repository. ID |
|
791 | Run after a changeset has been created in the local repository. ID | |
792 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
792 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
793 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
793 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
794 |
|
794 | |||
795 | ``incoming`` |
|
795 | ``incoming`` | |
796 | Run after a changeset has been pulled, pushed, or unbundled into |
|
796 | Run after a changeset has been pulled, pushed, or unbundled into | |
797 | the local repository. The ID of the newly arrived changeset is in |
|
797 | the local repository. The ID of the newly arrived changeset is in | |
798 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
798 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
799 |
|
799 | |||
800 | ``outgoing`` |
|
800 | ``outgoing`` | |
801 | Run after sending changes from local repository to another. ID of |
|
801 | Run after sending changes from local repository to another. ID of | |
802 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
802 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
803 | ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook. |
|
803 | ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook. | |
804 |
|
804 | |||
805 | ``post-<command>`` |
|
805 | ``post-<command>`` | |
806 | Run after successful invocations of the associated command. The |
|
806 | Run after successful invocations of the associated command. The | |
807 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
807 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
808 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
808 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
809 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
809 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
810 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
810 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
811 | dictionary of options (with unspecified options set to their defaults). |
|
811 | dictionary of options (with unspecified options set to their defaults). | |
812 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
812 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
813 |
|
813 | |||
814 | ``fail-<command>`` |
|
814 | ``fail-<command>`` | |
815 | Run after a failed invocation of an associated command. The contents |
|
815 | Run after a failed invocation of an associated command. The contents | |
816 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
816 | of the command line are passed as ``$HG_ARGS``. Parsed command line | |
817 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
817 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain | |
818 | string representations of the python data internally passed to |
|
818 | string representations of the python data internally passed to | |
819 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
819 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified | |
820 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
820 | options set to their defaults). ``$HG_PATS`` is a list of arguments. | |
821 | Hook failure is ignored. |
|
821 | Hook failure is ignored. | |
822 |
|
822 | |||
823 | ``pre-<command>`` |
|
823 | ``pre-<command>`` | |
824 | Run before executing the associated command. The contents of the |
|
824 | Run before executing the associated command. The contents of the | |
825 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
825 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
826 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
826 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
827 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
827 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
828 | is a dictionary of options (with unspecified options set to their |
|
828 | is a dictionary of options (with unspecified options set to their | |
829 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
829 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
830 | failure, the command doesn't execute and Mercurial returns the failure |
|
830 | failure, the command doesn't execute and Mercurial returns the failure | |
831 | code. |
|
831 | code. | |
832 |
|
832 | |||
833 | ``prechangegroup`` |
|
833 | ``prechangegroup`` | |
834 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
834 | Run before a changegroup is added via push, pull or unbundle. Exit | |
835 | status 0 allows the changegroup to proceed. Non-zero status will |
|
835 | status 0 allows the changegroup to proceed. Non-zero status will | |
836 | cause the push, pull or unbundle to fail. URL from which changes |
|
836 | cause the push, pull or unbundle to fail. URL from which changes | |
837 | will come is in ``$HG_URL``. |
|
837 | will come is in ``$HG_URL``. | |
838 |
|
838 | |||
839 | ``precommit`` |
|
839 | ``precommit`` | |
840 | Run before starting a local commit. Exit status 0 allows the |
|
840 | Run before starting a local commit. Exit status 0 allows the | |
841 | commit to proceed. Non-zero status will cause the commit to fail. |
|
841 | commit to proceed. Non-zero status will cause the commit to fail. | |
842 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
842 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
843 |
|
843 | |||
844 | ``prelistkeys`` |
|
844 | ``prelistkeys`` | |
845 | Run before listing pushkeys (like bookmarks) in the |
|
845 | Run before listing pushkeys (like bookmarks) in the | |
846 | repository. Non-zero status will cause failure. The key namespace is |
|
846 | repository. Non-zero status will cause failure. The key namespace is | |
847 | in ``$HG_NAMESPACE``. |
|
847 | in ``$HG_NAMESPACE``. | |
848 |
|
848 | |||
849 | ``preoutgoing`` |
|
849 | ``preoutgoing`` | |
850 | Run before collecting changes to send from the local repository to |
|
850 | Run before collecting changes to send from the local repository to | |
851 | another. Non-zero status will cause failure. This lets you prevent |
|
851 | another. Non-zero status will cause failure. This lets you prevent | |
852 | pull over HTTP or SSH. Also prevents against local pull, push |
|
852 | pull over HTTP or SSH. Also prevents against local pull, push | |
853 | (outbound) or bundle commands, but not effective, since you can |
|
853 | (outbound) or bundle commands, but not effective, since you can | |
854 | just copy files instead then. Source of operation is in |
|
854 | just copy files instead then. Source of operation is in | |
855 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
855 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
856 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
856 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
857 | is happening on behalf of repository on same system. |
|
857 | is happening on behalf of repository on same system. | |
858 |
|
858 | |||
859 | ``prepushkey`` |
|
859 | ``prepushkey`` | |
860 | Run before a pushkey (like a bookmark) is added to the |
|
860 | Run before a pushkey (like a bookmark) is added to the | |
861 | repository. Non-zero status will cause the key to be rejected. The |
|
861 | repository. Non-zero status will cause the key to be rejected. The | |
862 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
862 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
863 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
863 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
864 | ``$HG_NEW``. |
|
864 | ``$HG_NEW``. | |
865 |
|
865 | |||
866 | ``pretag`` |
|
866 | ``pretag`` | |
867 | Run before creating a tag. Exit status 0 allows the tag to be |
|
867 | Run before creating a tag. Exit status 0 allows the tag to be | |
868 | created. Non-zero status will cause the tag to fail. ID of |
|
868 | created. Non-zero status will cause the tag to fail. ID of | |
869 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
869 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
870 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
870 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
871 |
|
871 | |||
872 | ``pretxnopen`` |
|
872 | ``pretxnopen`` | |
873 | Run before any new repository transaction is open. The reason for the |
|
873 | Run before any new repository transaction is open. The reason for the | |
874 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the |
|
874 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the | |
875 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
875 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the | |
876 | transaction from being opened. |
|
876 | transaction from being opened. | |
877 |
|
877 | |||
878 | ``pretxnclose`` |
|
878 | ``pretxnclose`` | |
879 | Run right before the transaction is actually finalized. Any repository change |
|
879 | Run right before the transaction is actually finalized. Any repository change | |
880 | will be visible to the hook program. This lets you validate the transaction |
|
880 | will be visible to the hook program. This lets you validate the transaction | |
881 | content or change it. Exit status 0 allows the commit to proceed. Non-zero |
|
881 | content or change it. Exit status 0 allows the commit to proceed. Non-zero | |
882 | status will cause the transaction to be rolled back. The reason for the |
|
882 | status will cause the transaction to be rolled back. The reason for the | |
883 | transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for |
|
883 | transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for | |
884 | the transaction will be in ``HG_TXNID``. The rest of the available data will |
|
884 | the transaction will be in ``HG_TXNID``. The rest of the available data will | |
885 | vary according the transaction type. New changesets will add ``$HG_NODE`` (id |
|
885 | vary according the transaction type. New changesets will add ``$HG_NODE`` (id | |
886 | of the first added changeset), ``$HG_NODE_LAST`` (id of the last added |
|
886 | of the first added changeset), ``$HG_NODE_LAST`` (id of the last added | |
887 | changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases |
|
887 | changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases | |
888 | changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc. |
|
888 | changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc. | |
889 |
|
889 | |||
890 | ``txnclose`` |
|
890 | ``txnclose`` | |
891 | Run after any repository transaction has been committed. At this |
|
891 | Run after any repository transaction has been committed. At this | |
892 | point, the transaction can no longer be rolled back. The hook will run |
|
892 | point, the transaction can no longer be rolled back. The hook will run | |
893 | after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for |
|
893 | after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for | |
894 | details about available variables. |
|
894 | details about available variables. | |
895 |
|
895 | |||
896 | ``txnabort`` |
|
896 | ``txnabort`` | |
897 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
897 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` | |
898 | docs for details about available variables. |
|
898 | docs for details about available variables. | |
899 |
|
899 | |||
900 | ``pretxnchangegroup`` |
|
900 | ``pretxnchangegroup`` | |
901 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
901 | Run after a changegroup has been added via push, pull or unbundle, but before | |
902 | the transaction has been committed. Changegroup is visible to hook program. |
|
902 | the transaction has been committed. Changegroup is visible to hook program. | |
903 | This lets you validate incoming changes before accepting them. Passed the ID |
|
903 | This lets you validate incoming changes before accepting them. Passed the ID | |
904 | of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. |
|
904 | of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. | |
905 | Exit status 0 allows the transaction to commit. Non-zero status will cause |
|
905 | Exit status 0 allows the transaction to commit. Non-zero status will cause | |
906 | the transaction to be rolled back and the push, pull or unbundle will fail. |
|
906 | the transaction to be rolled back and the push, pull or unbundle will fail. | |
907 | URL that was source of changes is in ``$HG_URL``. |
|
907 | URL that was source of changes is in ``$HG_URL``. | |
908 |
|
908 | |||
909 | ``pretxncommit`` |
|
909 | ``pretxncommit`` | |
910 | Run after a changeset has been created but the transaction not yet |
|
910 | Run after a changeset has been created but the transaction not yet | |
911 | committed. Changeset is visible to hook program. This lets you |
|
911 | committed. Changeset is visible to hook program. This lets you | |
912 | validate commit message and changes. Exit status 0 allows the |
|
912 | validate commit message and changes. Exit status 0 allows the | |
913 | commit to proceed. Non-zero status will cause the transaction to |
|
913 | commit to proceed. Non-zero status will cause the transaction to | |
914 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
914 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
915 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
915 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
916 |
|
916 | |||
917 | ``preupdate`` |
|
917 | ``preupdate`` | |
918 | Run before updating the working directory. Exit status 0 allows |
|
918 | Run before updating the working directory. Exit status 0 allows | |
919 | the update to proceed. Non-zero status will prevent the update. |
|
919 | the update to proceed. Non-zero status will prevent the update. | |
920 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
920 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
921 | of second new parent is in ``$HG_PARENT2``. |
|
921 | of second new parent is in ``$HG_PARENT2``. | |
922 |
|
922 | |||
923 | ``listkeys`` |
|
923 | ``listkeys`` | |
924 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
924 | Run after listing pushkeys (like bookmarks) in the repository. The | |
925 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
925 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
926 | dictionary containing the keys and values. |
|
926 | dictionary containing the keys and values. | |
927 |
|
927 | |||
928 | ``pushkey`` |
|
928 | ``pushkey`` | |
929 | Run after a pushkey (like a bookmark) is added to the |
|
929 | Run after a pushkey (like a bookmark) is added to the | |
930 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
930 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
931 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
931 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
932 | value is in ``$HG_NEW``. |
|
932 | value is in ``$HG_NEW``. | |
933 |
|
933 | |||
934 | ``tag`` |
|
934 | ``tag`` | |
935 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
935 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
936 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
936 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
937 | repository if ``$HG_LOCAL=0``. |
|
937 | repository if ``$HG_LOCAL=0``. | |
938 |
|
938 | |||
939 | ``update`` |
|
939 | ``update`` | |
940 | Run after updating the working directory. Changeset ID of first |
|
940 | Run after updating the working directory. Changeset ID of first | |
941 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
941 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
942 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
942 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
943 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
943 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
944 |
|
944 | |||
945 | .. note:: |
|
945 | .. note:: | |
946 |
|
946 | |||
947 | It is generally better to use standard hooks rather than the |
|
947 | It is generally better to use standard hooks rather than the | |
948 | generic pre- and post- command hooks as they are guaranteed to be |
|
948 | generic pre- and post- command hooks as they are guaranteed to be | |
949 | called in the appropriate contexts for influencing transactions. |
|
949 | called in the appropriate contexts for influencing transactions. | |
950 | Also, hooks like "commit" will be called in all contexts that |
|
950 | Also, hooks like "commit" will be called in all contexts that | |
951 | generate a commit (e.g. tag) and not just the commit command. |
|
951 | generate a commit (e.g. tag) and not just the commit command. | |
952 |
|
952 | |||
953 | .. note:: |
|
953 | .. note:: | |
954 |
|
954 | |||
955 | Environment variables with empty values may not be passed to |
|
955 | Environment variables with empty values may not be passed to | |
956 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
956 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
957 | will have an empty value under Unix-like platforms for non-merge |
|
957 | will have an empty value under Unix-like platforms for non-merge | |
958 | changesets, while it will not be available at all under Windows. |
|
958 | changesets, while it will not be available at all under Windows. | |
959 |
|
959 | |||
960 | The syntax for Python hooks is as follows:: |
|
960 | The syntax for Python hooks is as follows:: | |
961 |
|
961 | |||
962 | hookname = python:modulename.submodule.callable |
|
962 | hookname = python:modulename.submodule.callable | |
963 | hookname = python:/path/to/python/module.py:callable |
|
963 | hookname = python:/path/to/python/module.py:callable | |
964 |
|
964 | |||
965 | Python hooks are run within the Mercurial process. Each hook is |
|
965 | Python hooks are run within the Mercurial process. Each hook is | |
966 | called with at least three keyword arguments: a ui object (keyword |
|
966 | called with at least three keyword arguments: a ui object (keyword | |
967 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
967 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
968 | keyword that tells what kind of hook is used. Arguments listed as |
|
968 | keyword that tells what kind of hook is used. Arguments listed as | |
969 | environment variables above are passed as keyword arguments, with no |
|
969 | environment variables above are passed as keyword arguments, with no | |
970 | ``HG_`` prefix, and names in lower case. |
|
970 | ``HG_`` prefix, and names in lower case. | |
971 |
|
971 | |||
972 | If a Python hook returns a "true" value or raises an exception, this |
|
972 | If a Python hook returns a "true" value or raises an exception, this | |
973 | is treated as a failure. |
|
973 | is treated as a failure. | |
974 |
|
974 | |||
975 |
|
975 | |||
976 | ``hostfingerprints`` |
|
976 | ``hostfingerprints`` | |
977 | -------------------- |
|
977 | -------------------- | |
978 |
|
978 | |||
979 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
979 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) | |
980 |
|
980 | |||
981 | Fingerprints of the certificates of known HTTPS servers. |
|
981 | Fingerprints of the certificates of known HTTPS servers. | |
982 |
|
982 | |||
983 | A HTTPS connection to a server with a fingerprint configured here will |
|
983 | A HTTPS connection to a server with a fingerprint configured here will | |
984 | only succeed if the servers certificate matches the fingerprint. |
|
984 | only succeed if the servers certificate matches the fingerprint. | |
985 | This is very similar to how ssh known hosts works. |
|
985 | This is very similar to how ssh known hosts works. | |
986 |
|
986 | |||
987 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
987 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
988 | Multiple values can be specified (separated by spaces or commas). This can |
|
988 | Multiple values can be specified (separated by spaces or commas). This can | |
989 | be used to define both old and new fingerprints while a host transitions |
|
989 | be used to define both old and new fingerprints while a host transitions | |
990 | to a new certificate. |
|
990 | to a new certificate. | |
991 |
|
991 | |||
992 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
992 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
993 |
|
993 | |||
994 | For example:: |
|
994 | For example:: | |
995 |
|
995 | |||
996 | [hostfingerprints] |
|
996 | [hostfingerprints] | |
997 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
997 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
998 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
998 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
999 |
|
999 | |||
1000 | ``hostsecurity`` |
|
1000 | ``hostsecurity`` | |
1001 | ---------------- |
|
1001 | ---------------- | |
1002 |
|
1002 | |||
1003 | Used to specify per-host security settings. |
|
1003 | Used to specify per-host security settings. | |
1004 |
|
1004 | |||
1005 | Options in this section have the form ``hostname``:``setting``. This allows |
|
1005 | Options in this section have the form ``hostname``:``setting``. This allows | |
1006 | multiple settings to be defined on a per-host basis. |
|
1006 | multiple settings to be defined on a per-host basis. | |
1007 |
|
1007 | |||
1008 | The following per-host settings can be defined. |
|
1008 | The following per-host settings can be defined. | |
1009 |
|
1009 | |||
1010 | ``fingerprints`` |
|
1010 | ``fingerprints`` | |
1011 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1011 | A list of hashes of the DER encoded peer/remote certificate. Values have | |
1012 | the form ``algorithm``:``fingerprint``. e.g. |
|
1012 | the form ``algorithm``:``fingerprint``. e.g. | |
1013 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1013 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. | |
1014 |
|
1014 | |||
1015 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1015 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, | |
1016 | ``sha512``. |
|
1016 | ``sha512``. | |
1017 |
|
1017 | |||
1018 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1018 | Use of ``sha256`` or ``sha512`` is preferred. | |
1019 |
|
1019 | |||
1020 | If a fingerprint is specified, the CA chain is not validated for this |
|
1020 | If a fingerprint is specified, the CA chain is not validated for this | |
1021 | host and Mercurial will require the remote certificate to match one |
|
1021 | host and Mercurial will require the remote certificate to match one | |
1022 | of the fingerprints specified. This means if the server updates its |
|
1022 | of the fingerprints specified. This means if the server updates its | |
1023 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1023 | certificate, Mercurial will abort until a new fingerprint is defined. | |
1024 | This can provide stronger security than traditional CA-based validation |
|
1024 | This can provide stronger security than traditional CA-based validation | |
1025 | at the expense of convenience. |
|
1025 | at the expense of convenience. | |
1026 |
|
1026 | |||
1027 | For example:: |
|
1027 | For example:: | |
1028 |
|
1028 | |||
1029 | [hostsecurity] |
|
1029 | [hostsecurity] | |
1030 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1030 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 | |
1031 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1031 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
1032 |
|
1032 | |||
1033 | ``http_proxy`` |
|
1033 | ``http_proxy`` | |
1034 | -------------- |
|
1034 | -------------- | |
1035 |
|
1035 | |||
1036 | Used to access web-based Mercurial repositories through a HTTP |
|
1036 | Used to access web-based Mercurial repositories through a HTTP | |
1037 | proxy. |
|
1037 | proxy. | |
1038 |
|
1038 | |||
1039 | ``host`` |
|
1039 | ``host`` | |
1040 | Host name and (optional) port of the proxy server, for example |
|
1040 | Host name and (optional) port of the proxy server, for example | |
1041 | "myproxy:8000". |
|
1041 | "myproxy:8000". | |
1042 |
|
1042 | |||
1043 | ``no`` |
|
1043 | ``no`` | |
1044 | Optional. Comma-separated list of host names that should bypass |
|
1044 | Optional. Comma-separated list of host names that should bypass | |
1045 | the proxy. |
|
1045 | the proxy. | |
1046 |
|
1046 | |||
1047 | ``passwd`` |
|
1047 | ``passwd`` | |
1048 | Optional. Password to authenticate with at the proxy server. |
|
1048 | Optional. Password to authenticate with at the proxy server. | |
1049 |
|
1049 | |||
1050 | ``user`` |
|
1050 | ``user`` | |
1051 | Optional. User name to authenticate with at the proxy server. |
|
1051 | Optional. User name to authenticate with at the proxy server. | |
1052 |
|
1052 | |||
1053 | ``always`` |
|
1053 | ``always`` | |
1054 | Optional. Always use the proxy, even for localhost and any entries |
|
1054 | Optional. Always use the proxy, even for localhost and any entries | |
1055 | in ``http_proxy.no``. (default: False) |
|
1055 | in ``http_proxy.no``. (default: False) | |
1056 |
|
1056 | |||
1057 | ``merge`` |
|
1057 | ``merge`` | |
1058 | --------- |
|
1058 | --------- | |
1059 |
|
1059 | |||
1060 | This section specifies behavior during merges and updates. |
|
1060 | This section specifies behavior during merges and updates. | |
1061 |
|
1061 | |||
1062 | ``checkignored`` |
|
1062 | ``checkignored`` | |
1063 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1063 | Controls behavior when an ignored file on disk has the same name as a tracked | |
1064 | file in the changeset being merged or updated to, and has different |
|
1064 | file in the changeset being merged or updated to, and has different | |
1065 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1065 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, | |
1066 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1066 | abort on such files. With ``warn``, warn on such files and back them up as | |
1067 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1067 | ``.orig``. With ``ignore``, don't print a warning and back them up as | |
1068 | ``.orig``. (default: ``abort``) |
|
1068 | ``.orig``. (default: ``abort``) | |
1069 |
|
1069 | |||
1070 | ``checkunknown`` |
|
1070 | ``checkunknown`` | |
1071 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1071 | Controls behavior when an unknown file that isn't ignored has the same name | |
1072 | as a tracked file in the changeset being merged or updated to, and has |
|
1072 | as a tracked file in the changeset being merged or updated to, and has | |
1073 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1073 | different contents. Similar to ``merge.checkignored``, except for files that | |
1074 | are not ignored. (default: ``abort``) |
|
1074 | are not ignored. (default: ``abort``) | |
1075 |
|
1075 | |||
1076 | ``merge-patterns`` |
|
1076 | ``merge-patterns`` | |
1077 | ------------------ |
|
1077 | ------------------ | |
1078 |
|
1078 | |||
1079 | This section specifies merge tools to associate with particular file |
|
1079 | This section specifies merge tools to associate with particular file | |
1080 | patterns. Tools matched here will take precedence over the default |
|
1080 | patterns. Tools matched here will take precedence over the default | |
1081 | merge tool. Patterns are globs by default, rooted at the repository |
|
1081 | merge tool. Patterns are globs by default, rooted at the repository | |
1082 | root. |
|
1082 | root. | |
1083 |
|
1083 | |||
1084 | Example:: |
|
1084 | Example:: | |
1085 |
|
1085 | |||
1086 | [merge-patterns] |
|
1086 | [merge-patterns] | |
1087 | **.c = kdiff3 |
|
1087 | **.c = kdiff3 | |
1088 | **.jpg = myimgmerge |
|
1088 | **.jpg = myimgmerge | |
1089 |
|
1089 | |||
1090 | ``merge-tools`` |
|
1090 | ``merge-tools`` | |
1091 | --------------- |
|
1091 | --------------- | |
1092 |
|
1092 | |||
1093 | This section configures external merge tools to use for file-level |
|
1093 | This section configures external merge tools to use for file-level | |
1094 | merges. This section has likely been preconfigured at install time. |
|
1094 | merges. This section has likely been preconfigured at install time. | |
1095 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1095 | Use :hg:`config merge-tools` to check the existing configuration. | |
1096 | Also see :hg:`help merge-tools` for more details. |
|
1096 | Also see :hg:`help merge-tools` for more details. | |
1097 |
|
1097 | |||
1098 | Example ``~/.hgrc``:: |
|
1098 | Example ``~/.hgrc``:: | |
1099 |
|
1099 | |||
1100 | [merge-tools] |
|
1100 | [merge-tools] | |
1101 | # Override stock tool location |
|
1101 | # Override stock tool location | |
1102 | kdiff3.executable = ~/bin/kdiff3 |
|
1102 | kdiff3.executable = ~/bin/kdiff3 | |
1103 | # Specify command line |
|
1103 | # Specify command line | |
1104 | kdiff3.args = $base $local $other -o $output |
|
1104 | kdiff3.args = $base $local $other -o $output | |
1105 | # Give higher priority |
|
1105 | # Give higher priority | |
1106 | kdiff3.priority = 1 |
|
1106 | kdiff3.priority = 1 | |
1107 |
|
1107 | |||
1108 | # Changing the priority of preconfigured tool |
|
1108 | # Changing the priority of preconfigured tool | |
1109 | meld.priority = 0 |
|
1109 | meld.priority = 0 | |
1110 |
|
1110 | |||
1111 | # Disable a preconfigured tool |
|
1111 | # Disable a preconfigured tool | |
1112 | vimdiff.disabled = yes |
|
1112 | vimdiff.disabled = yes | |
1113 |
|
1113 | |||
1114 | # Define new tool |
|
1114 | # Define new tool | |
1115 | myHtmlTool.args = -m $local $other $base $output |
|
1115 | myHtmlTool.args = -m $local $other $base $output | |
1116 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1116 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
1117 | myHtmlTool.priority = 1 |
|
1117 | myHtmlTool.priority = 1 | |
1118 |
|
1118 | |||
1119 | Supported arguments: |
|
1119 | Supported arguments: | |
1120 |
|
1120 | |||
1121 | ``priority`` |
|
1121 | ``priority`` | |
1122 | The priority in which to evaluate this tool. |
|
1122 | The priority in which to evaluate this tool. | |
1123 | (default: 0) |
|
1123 | (default: 0) | |
1124 |
|
1124 | |||
1125 | ``executable`` |
|
1125 | ``executable`` | |
1126 | Either just the name of the executable or its pathname. |
|
1126 | Either just the name of the executable or its pathname. | |
1127 |
|
1127 | |||
1128 | .. container:: windows |
|
1128 | .. container:: windows | |
1129 |
|
1129 | |||
1130 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1130 | On Windows, the path can use environment variables with ${ProgramFiles} | |
1131 | syntax. |
|
1131 | syntax. | |
1132 |
|
1132 | |||
1133 | (default: the tool name) |
|
1133 | (default: the tool name) | |
1134 |
|
1134 | |||
1135 | ``args`` |
|
1135 | ``args`` | |
1136 | The arguments to pass to the tool executable. You can refer to the |
|
1136 | The arguments to pass to the tool executable. You can refer to the | |
1137 | files being merged as well as the output file through these |
|
1137 | files being merged as well as the output file through these | |
1138 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1138 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning | |
1139 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1139 | of ``$local`` and ``$other`` can vary depending on which action is being | |
1140 | performed. During and update or merge, ``$local`` represents the original |
|
1140 | performed. During and update or merge, ``$local`` represents the original | |
1141 | state of the file, while ``$other`` represents the commit you are updating |
|
1141 | state of the file, while ``$other`` represents the commit you are updating | |
1142 | to or the commit you are merging with. During a rebase ``$local`` |
|
1142 | to or the commit you are merging with. During a rebase ``$local`` | |
1143 | represents the destination of the rebase, and ``$other`` represents the |
|
1143 | represents the destination of the rebase, and ``$other`` represents the | |
1144 | commit being rebased. |
|
1144 | commit being rebased. | |
1145 | (default: ``$local $base $other``) |
|
1145 | (default: ``$local $base $other``) | |
1146 |
|
1146 | |||
1147 | ``premerge`` |
|
1147 | ``premerge`` | |
1148 | Attempt to run internal non-interactive 3-way merge tool before |
|
1148 | Attempt to run internal non-interactive 3-way merge tool before | |
1149 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1149 | launching external tool. Options are ``true``, ``false``, ``keep`` or | |
1150 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1150 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the | |
1151 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1151 | premerge fails. The ``keep-merge3`` will do the same but include information | |
1152 | about the base of the merge in the marker (see internal :merge3 in |
|
1152 | about the base of the merge in the marker (see internal :merge3 in | |
1153 | :hg:`help merge-tools`). |
|
1153 | :hg:`help merge-tools`). | |
1154 | (default: True) |
|
1154 | (default: True) | |
1155 |
|
1155 | |||
1156 | ``binary`` |
|
1156 | ``binary`` | |
1157 | This tool can merge binary files. (default: False, unless tool |
|
1157 | This tool can merge binary files. (default: False, unless tool | |
1158 | was selected by file pattern match) |
|
1158 | was selected by file pattern match) | |
1159 |
|
1159 | |||
1160 | ``symlink`` |
|
1160 | ``symlink`` | |
1161 | This tool can merge symlinks. (default: False) |
|
1161 | This tool can merge symlinks. (default: False) | |
1162 |
|
1162 | |||
1163 | ``check`` |
|
1163 | ``check`` | |
1164 | A list of merge success-checking options: |
|
1164 | A list of merge success-checking options: | |
1165 |
|
1165 | |||
1166 | ``changed`` |
|
1166 | ``changed`` | |
1167 | Ask whether merge was successful when the merged file shows no changes. |
|
1167 | Ask whether merge was successful when the merged file shows no changes. | |
1168 | ``conflicts`` |
|
1168 | ``conflicts`` | |
1169 | Check whether there are conflicts even though the tool reported success. |
|
1169 | Check whether there are conflicts even though the tool reported success. | |
1170 | ``prompt`` |
|
1170 | ``prompt`` | |
1171 | Always prompt for merge success, regardless of success reported by tool. |
|
1171 | Always prompt for merge success, regardless of success reported by tool. | |
1172 |
|
1172 | |||
1173 | ``fixeol`` |
|
1173 | ``fixeol`` | |
1174 | Attempt to fix up EOL changes caused by the merge tool. |
|
1174 | Attempt to fix up EOL changes caused by the merge tool. | |
1175 | (default: False) |
|
1175 | (default: False) | |
1176 |
|
1176 | |||
1177 | ``gui`` |
|
1177 | ``gui`` | |
1178 | This tool requires a graphical interface to run. (default: False) |
|
1178 | This tool requires a graphical interface to run. (default: False) | |
1179 |
|
1179 | |||
1180 | .. container:: windows |
|
1180 | .. container:: windows | |
1181 |
|
1181 | |||
1182 | ``regkey`` |
|
1182 | ``regkey`` | |
1183 | Windows registry key which describes install location of this |
|
1183 | Windows registry key which describes install location of this | |
1184 | tool. Mercurial will search for this key first under |
|
1184 | tool. Mercurial will search for this key first under | |
1185 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1185 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
1186 | (default: None) |
|
1186 | (default: None) | |
1187 |
|
1187 | |||
1188 | ``regkeyalt`` |
|
1188 | ``regkeyalt`` | |
1189 | An alternate Windows registry key to try if the first key is not |
|
1189 | An alternate Windows registry key to try if the first key is not | |
1190 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1190 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
1191 | semantics of the primary key. The most common use for this key |
|
1191 | semantics of the primary key. The most common use for this key | |
1192 | is to search for 32bit applications on 64bit operating systems. |
|
1192 | is to search for 32bit applications on 64bit operating systems. | |
1193 | (default: None) |
|
1193 | (default: None) | |
1194 |
|
1194 | |||
1195 | ``regname`` |
|
1195 | ``regname`` | |
1196 | Name of value to read from specified registry key. |
|
1196 | Name of value to read from specified registry key. | |
1197 | (default: the unnamed (default) value) |
|
1197 | (default: the unnamed (default) value) | |
1198 |
|
1198 | |||
1199 | ``regappend`` |
|
1199 | ``regappend`` | |
1200 | String to append to the value read from the registry, typically |
|
1200 | String to append to the value read from the registry, typically | |
1201 | the executable name of the tool. |
|
1201 | the executable name of the tool. | |
1202 | (default: None) |
|
1202 | (default: None) | |
1203 |
|
1203 | |||
1204 |
|
1204 | |||
1205 | ``patch`` |
|
1205 | ``patch`` | |
1206 | --------- |
|
1206 | --------- | |
1207 |
|
1207 | |||
1208 | Settings used when applying patches, for instance through the 'import' |
|
1208 | Settings used when applying patches, for instance through the 'import' | |
1209 | command or with Mercurial Queues extension. |
|
1209 | command or with Mercurial Queues extension. | |
1210 |
|
1210 | |||
1211 | ``eol`` |
|
1211 | ``eol`` | |
1212 | When set to 'strict' patch content and patched files end of lines |
|
1212 | When set to 'strict' patch content and patched files end of lines | |
1213 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1213 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1214 | lines are ignored when patching and the result line endings are |
|
1214 | lines are ignored when patching and the result line endings are | |
1215 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1215 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1216 | ``auto``, end of lines are again ignored while patching but line |
|
1216 | ``auto``, end of lines are again ignored while patching but line | |
1217 | endings in patched files are normalized to their original setting |
|
1217 | endings in patched files are normalized to their original setting | |
1218 | on a per-file basis. If target file does not exist or has no end |
|
1218 | on a per-file basis. If target file does not exist or has no end | |
1219 | of line, patch line endings are preserved. |
|
1219 | of line, patch line endings are preserved. | |
1220 | (default: strict) |
|
1220 | (default: strict) | |
1221 |
|
1221 | |||
1222 | ``fuzz`` |
|
1222 | ``fuzz`` | |
1223 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1223 | The number of lines of 'fuzz' to allow when applying patches. This | |
1224 | controls how much context the patcher is allowed to ignore when |
|
1224 | controls how much context the patcher is allowed to ignore when | |
1225 | trying to apply a patch. |
|
1225 | trying to apply a patch. | |
1226 | (default: 2) |
|
1226 | (default: 2) | |
1227 |
|
1227 | |||
1228 | ``paths`` |
|
1228 | ``paths`` | |
1229 | --------- |
|
1229 | --------- | |
1230 |
|
1230 | |||
1231 | Assigns symbolic names and behavior to repositories. |
|
1231 | Assigns symbolic names and behavior to repositories. | |
1232 |
|
1232 | |||
1233 | Options are symbolic names defining the URL or directory that is the |
|
1233 | Options are symbolic names defining the URL or directory that is the | |
1234 | location of the repository. Example:: |
|
1234 | location of the repository. Example:: | |
1235 |
|
1235 | |||
1236 | [paths] |
|
1236 | [paths] | |
1237 | my_server = https://example.com/my_repo |
|
1237 | my_server = https://example.com/my_repo | |
1238 | local_path = /home/me/repo |
|
1238 | local_path = /home/me/repo | |
1239 |
|
1239 | |||
1240 | These symbolic names can be used from the command line. To pull |
|
1240 | These symbolic names can be used from the command line. To pull | |
1241 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1241 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: | |
1242 | :hg:`push local_path`. |
|
1242 | :hg:`push local_path`. | |
1243 |
|
1243 | |||
1244 | Options containing colons (``:``) denote sub-options that can influence |
|
1244 | Options containing colons (``:``) denote sub-options that can influence | |
1245 | behavior for that specific path. Example:: |
|
1245 | behavior for that specific path. Example:: | |
1246 |
|
1246 | |||
1247 | [paths] |
|
1247 | [paths] | |
1248 | my_server = https://example.com/my_path |
|
1248 | my_server = https://example.com/my_path | |
1249 | my_server:pushurl = ssh://example.com/my_path |
|
1249 | my_server:pushurl = ssh://example.com/my_path | |
1250 |
|
1250 | |||
1251 | The following sub-options can be defined: |
|
1251 | The following sub-options can be defined: | |
1252 |
|
1252 | |||
1253 | ``pushurl`` |
|
1253 | ``pushurl`` | |
1254 | The URL to use for push operations. If not defined, the location |
|
1254 | The URL to use for push operations. If not defined, the location | |
1255 | defined by the path's main entry is used. |
|
1255 | defined by the path's main entry is used. | |
1256 |
|
1256 | |||
1257 | The following special named paths exist: |
|
1257 | The following special named paths exist: | |
1258 |
|
1258 | |||
1259 | ``default`` |
|
1259 | ``default`` | |
1260 | The URL or directory to use when no source or remote is specified. |
|
1260 | The URL or directory to use when no source or remote is specified. | |
1261 |
|
1261 | |||
1262 | :hg:`clone` will automatically define this path to the location the |
|
1262 | :hg:`clone` will automatically define this path to the location the | |
1263 | repository was cloned from. |
|
1263 | repository was cloned from. | |
1264 |
|
1264 | |||
1265 | ``default-push`` |
|
1265 | ``default-push`` | |
1266 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1266 | (deprecated) The URL or directory for the default :hg:`push` location. | |
1267 | ``default:pushurl`` should be used instead. |
|
1267 | ``default:pushurl`` should be used instead. | |
1268 |
|
1268 | |||
1269 | ``phases`` |
|
1269 | ``phases`` | |
1270 | ---------- |
|
1270 | ---------- | |
1271 |
|
1271 | |||
1272 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1272 | Specifies default handling of phases. See :hg:`help phases` for more | |
1273 | information about working with phases. |
|
1273 | information about working with phases. | |
1274 |
|
1274 | |||
1275 | ``publish`` |
|
1275 | ``publish`` | |
1276 | Controls draft phase behavior when working as a server. When true, |
|
1276 | Controls draft phase behavior when working as a server. When true, | |
1277 | pushed changesets are set to public in both client and server and |
|
1277 | pushed changesets are set to public in both client and server and | |
1278 | pulled or cloned changesets are set to public in the client. |
|
1278 | pulled or cloned changesets are set to public in the client. | |
1279 | (default: True) |
|
1279 | (default: True) | |
1280 |
|
1280 | |||
1281 | ``new-commit`` |
|
1281 | ``new-commit`` | |
1282 | Phase of newly-created commits. |
|
1282 | Phase of newly-created commits. | |
1283 | (default: draft) |
|
1283 | (default: draft) | |
1284 |
|
1284 | |||
1285 | ``checksubrepos`` |
|
1285 | ``checksubrepos`` | |
1286 | Check the phase of the current revision of each subrepository. Allowed |
|
1286 | Check the phase of the current revision of each subrepository. Allowed | |
1287 | values are "ignore", "follow" and "abort". For settings other than |
|
1287 | values are "ignore", "follow" and "abort". For settings other than | |
1288 | "ignore", the phase of the current revision of each subrepository is |
|
1288 | "ignore", the phase of the current revision of each subrepository is | |
1289 | checked before committing the parent repository. If any of those phases is |
|
1289 | checked before committing the parent repository. If any of those phases is | |
1290 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1290 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1291 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1291 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1292 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1292 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1293 | used for the parent repository commit (if set to "follow"). |
|
1293 | used for the parent repository commit (if set to "follow"). | |
1294 | (default: follow) |
|
1294 | (default: follow) | |
1295 |
|
1295 | |||
1296 |
|
1296 | |||
1297 | ``profiling`` |
|
1297 | ``profiling`` | |
1298 | ------------- |
|
1298 | ------------- | |
1299 |
|
1299 | |||
1300 | Specifies profiling type, format, and file output. Two profilers are |
|
1300 | Specifies profiling type, format, and file output. Two profilers are | |
1301 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1301 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1302 | profiler (named ``stat``). |
|
1302 | profiler (named ``stat``). | |
1303 |
|
1303 | |||
1304 | In this section description, 'profiling data' stands for the raw data |
|
1304 | In this section description, 'profiling data' stands for the raw data | |
1305 | collected during profiling, while 'profiling report' stands for a |
|
1305 | collected during profiling, while 'profiling report' stands for a | |
1306 | statistical text report generated from the profiling data. The |
|
1306 | statistical text report generated from the profiling data. The | |
1307 | profiling is done using lsprof. |
|
1307 | profiling is done using lsprof. | |
1308 |
|
1308 | |||
1309 | ``type`` |
|
1309 | ``type`` | |
1310 | The type of profiler to use. |
|
1310 | The type of profiler to use. | |
1311 | (default: ls) |
|
1311 | (default: ls) | |
1312 |
|
1312 | |||
1313 | ``ls`` |
|
1313 | ``ls`` | |
1314 | Use Python's built-in instrumenting profiler. This profiler |
|
1314 | Use Python's built-in instrumenting profiler. This profiler | |
1315 | works on all platforms, but each line number it reports is the |
|
1315 | works on all platforms, but each line number it reports is the | |
1316 | first line of a function. This restriction makes it difficult to |
|
1316 | first line of a function. This restriction makes it difficult to | |
1317 | identify the expensive parts of a non-trivial function. |
|
1317 | identify the expensive parts of a non-trivial function. | |
1318 | ``stat`` |
|
1318 | ``stat`` | |
1319 | Use a third-party statistical profiler, statprof. This profiler |
|
1319 | Use a third-party statistical profiler, statprof. This profiler | |
1320 | currently runs only on Unix systems, and is most useful for |
|
1320 | currently runs only on Unix systems, and is most useful for | |
1321 | profiling commands that run for longer than about 0.1 seconds. |
|
1321 | profiling commands that run for longer than about 0.1 seconds. | |
1322 |
|
1322 | |||
1323 | ``format`` |
|
1323 | ``format`` | |
1324 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1324 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1325 | (default: text) |
|
1325 | (default: text) | |
1326 |
|
1326 | |||
1327 | ``text`` |
|
1327 | ``text`` | |
1328 | Generate a profiling report. When saving to a file, it should be |
|
1328 | Generate a profiling report. When saving to a file, it should be | |
1329 | noted that only the report is saved, and the profiling data is |
|
1329 | noted that only the report is saved, and the profiling data is | |
1330 | not kept. |
|
1330 | not kept. | |
1331 | ``kcachegrind`` |
|
1331 | ``kcachegrind`` | |
1332 | Format profiling data for kcachegrind use: when saving to a |
|
1332 | Format profiling data for kcachegrind use: when saving to a | |
1333 | file, the generated file can directly be loaded into |
|
1333 | file, the generated file can directly be loaded into | |
1334 | kcachegrind. |
|
1334 | kcachegrind. | |
1335 |
|
1335 | |||
1336 | ``frequency`` |
|
1336 | ``frequency`` | |
1337 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1337 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1338 | (default: 1000) |
|
1338 | (default: 1000) | |
1339 |
|
1339 | |||
1340 | ``output`` |
|
1340 | ``output`` | |
1341 | File path where profiling data or report should be saved. If the |
|
1341 | File path where profiling data or report should be saved. If the | |
1342 | file exists, it is replaced. (default: None, data is printed on |
|
1342 | file exists, it is replaced. (default: None, data is printed on | |
1343 | stderr) |
|
1343 | stderr) | |
1344 |
|
1344 | |||
1345 | ``sort`` |
|
1345 | ``sort`` | |
1346 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1346 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1347 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1347 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1348 | ``inlinetime``. |
|
1348 | ``inlinetime``. | |
1349 | (default: inlinetime) |
|
1349 | (default: inlinetime) | |
1350 |
|
1350 | |||
1351 | ``limit`` |
|
1351 | ``limit`` | |
1352 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1352 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1353 | (default: 30) |
|
1353 | (default: 30) | |
1354 |
|
1354 | |||
1355 | ``nested`` |
|
1355 | ``nested`` | |
1356 | Show at most this number of lines of drill-down info after each main entry. |
|
1356 | Show at most this number of lines of drill-down info after each main entry. | |
1357 | This can help explain the difference between Total and Inline. |
|
1357 | This can help explain the difference between Total and Inline. | |
1358 | Specific to the ``ls`` instrumenting profiler. |
|
1358 | Specific to the ``ls`` instrumenting profiler. | |
1359 | (default: 5) |
|
1359 | (default: 5) | |
1360 |
|
1360 | |||
1361 | ``progress`` |
|
1361 | ``progress`` | |
1362 | ------------ |
|
1362 | ------------ | |
1363 |
|
1363 | |||
1364 | Mercurial commands can draw progress bars that are as informative as |
|
1364 | Mercurial commands can draw progress bars that are as informative as | |
1365 | possible. Some progress bars only offer indeterminate information, while others |
|
1365 | possible. Some progress bars only offer indeterminate information, while others | |
1366 | have a definite end point. |
|
1366 | have a definite end point. | |
1367 |
|
1367 | |||
1368 | ``delay`` |
|
1368 | ``delay`` | |
1369 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1369 | Number of seconds (float) before showing the progress bar. (default: 3) | |
1370 |
|
1370 | |||
1371 | ``changedelay`` |
|
1371 | ``changedelay`` | |
1372 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1372 | Minimum delay before showing a new topic. When set to less than 3 * refresh, | |
1373 | that value will be used instead. (default: 1) |
|
1373 | that value will be used instead. (default: 1) | |
1374 |
|
1374 | |||
1375 | ``refresh`` |
|
1375 | ``refresh`` | |
1376 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1376 | Time in seconds between refreshes of the progress bar. (default: 0.1) | |
1377 |
|
1377 | |||
1378 | ``format`` |
|
1378 | ``format`` | |
1379 | Format of the progress bar. |
|
1379 | Format of the progress bar. | |
1380 |
|
1380 | |||
1381 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1381 | Valid entries for the format field are ``topic``, ``bar``, ``number``, | |
1382 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1382 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the | |
1383 | last 20 characters of the item, but this can be changed by adding either |
|
1383 | last 20 characters of the item, but this can be changed by adding either | |
1384 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1384 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the | |
1385 | first num characters. |
|
1385 | first num characters. | |
1386 |
|
1386 | |||
1387 | (default: topic bar number estimate) |
|
1387 | (default: topic bar number estimate) | |
1388 |
|
1388 | |||
1389 | ``width`` |
|
1389 | ``width`` | |
1390 | If set, the maximum width of the progress information (that is, min(width, |
|
1390 | If set, the maximum width of the progress information (that is, min(width, | |
1391 | term width) will be used). |
|
1391 | term width) will be used). | |
1392 |
|
1392 | |||
1393 | ``clear-complete`` |
|
1393 | ``clear-complete`` | |
1394 | Clear the progress bar after it's done. (default: True) |
|
1394 | Clear the progress bar after it's done. (default: True) | |
1395 |
|
1395 | |||
1396 | ``disable`` |
|
1396 | ``disable`` | |
1397 | If true, don't show a progress bar. |
|
1397 | If true, don't show a progress bar. | |
1398 |
|
1398 | |||
1399 | ``assume-tty`` |
|
1399 | ``assume-tty`` | |
1400 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1400 | If true, ALWAYS show a progress bar, unless disable is given. | |
1401 |
|
1401 | |||
1402 | ``rebase`` |
|
1402 | ``rebase`` | |
1403 | ---------- |
|
1403 | ---------- | |
1404 |
|
1404 | |||
1405 | ``allowdivergence`` |
|
1405 | ``allowdivergence`` | |
1406 | Default to False, when True allow creating divergence when performing |
|
1406 | Default to False, when True allow creating divergence when performing | |
1407 | rebase of obsolete changesets. |
|
1407 | rebase of obsolete changesets. | |
1408 |
|
1408 | |||
1409 | ``revsetalias`` |
|
1409 | ``revsetalias`` | |
1410 | --------------- |
|
1410 | --------------- | |
1411 |
|
1411 | |||
1412 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1412 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1413 |
|
1413 | |||
1414 | ``server`` |
|
1414 | ``server`` | |
1415 | ---------- |
|
1415 | ---------- | |
1416 |
|
1416 | |||
1417 | Controls generic server settings. |
|
1417 | Controls generic server settings. | |
1418 |
|
1418 | |||
1419 | ``uncompressed`` |
|
1419 | ``uncompressed`` | |
1420 | Whether to allow clients to clone a repository using the |
|
1420 | Whether to allow clients to clone a repository using the | |
1421 | uncompressed streaming protocol. This transfers about 40% more |
|
1421 | uncompressed streaming protocol. This transfers about 40% more | |
1422 | data than a regular clone, but uses less memory and CPU on both |
|
1422 | data than a regular clone, but uses less memory and CPU on both | |
1423 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1423 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1424 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1424 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1425 | regular clone. Over most WAN connections (anything slower than |
|
1425 | regular clone. Over most WAN connections (anything slower than | |
1426 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1426 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1427 | extra data transfer overhead. This mode will also temporarily hold |
|
1427 | extra data transfer overhead. This mode will also temporarily hold | |
1428 | the write lock while determining what data to transfer. |
|
1428 | the write lock while determining what data to transfer. | |
1429 | (default: True) |
|
1429 | (default: True) | |
1430 |
|
1430 | |||
1431 | ``preferuncompressed`` |
|
1431 | ``preferuncompressed`` | |
1432 | When set, clients will try to use the uncompressed streaming |
|
1432 | When set, clients will try to use the uncompressed streaming | |
1433 | protocol. (default: False) |
|
1433 | protocol. (default: False) | |
1434 |
|
1434 | |||
1435 | ``validate`` |
|
1435 | ``validate`` | |
1436 | Whether to validate the completeness of pushed changesets by |
|
1436 | Whether to validate the completeness of pushed changesets by | |
1437 | checking that all new file revisions specified in manifests are |
|
1437 | checking that all new file revisions specified in manifests are | |
1438 | present. (default: False) |
|
1438 | present. (default: False) | |
1439 |
|
1439 | |||
1440 | ``maxhttpheaderlen`` |
|
1440 | ``maxhttpheaderlen`` | |
1441 | Instruct HTTP clients not to send request headers longer than this |
|
1441 | Instruct HTTP clients not to send request headers longer than this | |
1442 | many bytes. (default: 1024) |
|
1442 | many bytes. (default: 1024) | |
1443 |
|
1443 | |||
1444 | ``bundle1`` |
|
1444 | ``bundle1`` | |
1445 | Whether to allow clients to push and pull using the legacy bundle1 |
|
1445 | Whether to allow clients to push and pull using the legacy bundle1 | |
1446 | exchange format. (default: True) |
|
1446 | exchange format. (default: True) | |
1447 |
|
1447 | |||
1448 | ``bundle1gd`` |
|
1448 | ``bundle1gd`` | |
1449 | Like ``bundle1`` but only used if the repository is using the |
|
1449 | Like ``bundle1`` but only used if the repository is using the | |
1450 | *generaldelta* storage format. (default: True) |
|
1450 | *generaldelta* storage format. (default: True) | |
1451 |
|
1451 | |||
1452 | ``bundle1.push`` |
|
1452 | ``bundle1.push`` | |
1453 | Whether to allow clients to push using the legacy bundle1 exchange |
|
1453 | Whether to allow clients to push using the legacy bundle1 exchange | |
1454 | format. (default: True) |
|
1454 | format. (default: True) | |
1455 |
|
1455 | |||
1456 | ``bundle1gd.push`` |
|
1456 | ``bundle1gd.push`` | |
1457 | Like ``bundle1.push`` but only used if the repository is using the |
|
1457 | Like ``bundle1.push`` but only used if the repository is using the | |
1458 | *generaldelta* storage format. (default: True) |
|
1458 | *generaldelta* storage format. (default: True) | |
1459 |
|
1459 | |||
1460 | ``bundle1.pull`` |
|
1460 | ``bundle1.pull`` | |
1461 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
1461 | Whether to allow clients to pull using the legacy bundle1 exchange | |
1462 | format. (default: True) |
|
1462 | format. (default: True) | |
1463 |
|
1463 | |||
1464 | ``bundle1gd.pull`` |
|
1464 | ``bundle1gd.pull`` | |
1465 | Like ``bundle1.pull`` but only used if the repository is using the |
|
1465 | Like ``bundle1.pull`` but only used if the repository is using the | |
1466 | *generaldelta* storage format. (default: True) |
|
1466 | *generaldelta* storage format. (default: True) | |
1467 |
|
1467 | |||
1468 | Large repositories using the *generaldelta* storage format should |
|
1468 | Large repositories using the *generaldelta* storage format should | |
1469 | consider setting this option because converting *generaldelta* |
|
1469 | consider setting this option because converting *generaldelta* | |
1470 | repositories to the exchange format required by the bundle1 data |
|
1470 | repositories to the exchange format required by the bundle1 data | |
1471 | format can consume a lot of CPU. |
|
1471 | format can consume a lot of CPU. | |
1472 |
|
1472 | |||
1473 | ``smtp`` |
|
1473 | ``smtp`` | |
1474 | -------- |
|
1474 | -------- | |
1475 |
|
1475 | |||
1476 | Configuration for extensions that need to send email messages. |
|
1476 | Configuration for extensions that need to send email messages. | |
1477 |
|
1477 | |||
1478 | ``host`` |
|
1478 | ``host`` | |
1479 | Host name of mail server, e.g. "mail.example.com". |
|
1479 | Host name of mail server, e.g. "mail.example.com". | |
1480 |
|
1480 | |||
1481 | ``port`` |
|
1481 | ``port`` | |
1482 | Optional. Port to connect to on mail server. (default: 465 if |
|
1482 | Optional. Port to connect to on mail server. (default: 465 if | |
1483 | ``tls`` is smtps; 25 otherwise) |
|
1483 | ``tls`` is smtps; 25 otherwise) | |
1484 |
|
1484 | |||
1485 | ``tls`` |
|
1485 | ``tls`` | |
1486 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1486 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1487 | smtps or none. (default: none) |
|
1487 | smtps or none. (default: none) | |
1488 |
|
1488 | |||
1489 | ``verifycert`` |
|
|||
1490 | Optional. Verification for the certificate of mail server, when |
|
|||
1491 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
|||
1492 | "strict" or "loose", the certificate is verified as same as the |
|
|||
1493 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
|||
1494 | ``[web] cacerts`` also). For "strict", sending email is also |
|
|||
1495 | aborted, if there is no configuration for mail server in |
|
|||
1496 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
|||
1497 | :hg:`email` overwrites this as "loose". (default: strict) |
|
|||
1498 |
|
||||
1499 | ``username`` |
|
1489 | ``username`` | |
1500 | Optional. User name for authenticating with the SMTP server. |
|
1490 | Optional. User name for authenticating with the SMTP server. | |
1501 | (default: None) |
|
1491 | (default: None) | |
1502 |
|
1492 | |||
1503 | ``password`` |
|
1493 | ``password`` | |
1504 | Optional. Password for authenticating with the SMTP server. If not |
|
1494 | Optional. Password for authenticating with the SMTP server. If not | |
1505 | specified, interactive sessions will prompt the user for a |
|
1495 | specified, interactive sessions will prompt the user for a | |
1506 | password; non-interactive sessions will fail. (default: None) |
|
1496 | password; non-interactive sessions will fail. (default: None) | |
1507 |
|
1497 | |||
1508 | ``local_hostname`` |
|
1498 | ``local_hostname`` | |
1509 | Optional. The hostname that the sender can use to identify |
|
1499 | Optional. The hostname that the sender can use to identify | |
1510 | itself to the MTA. |
|
1500 | itself to the MTA. | |
1511 |
|
1501 | |||
1512 |
|
1502 | |||
1513 | ``subpaths`` |
|
1503 | ``subpaths`` | |
1514 | ------------ |
|
1504 | ------------ | |
1515 |
|
1505 | |||
1516 | Subrepository source URLs can go stale if a remote server changes name |
|
1506 | Subrepository source URLs can go stale if a remote server changes name | |
1517 | or becomes temporarily unavailable. This section lets you define |
|
1507 | or becomes temporarily unavailable. This section lets you define | |
1518 | rewrite rules of the form:: |
|
1508 | rewrite rules of the form:: | |
1519 |
|
1509 | |||
1520 | <pattern> = <replacement> |
|
1510 | <pattern> = <replacement> | |
1521 |
|
1511 | |||
1522 | where ``pattern`` is a regular expression matching a subrepository |
|
1512 | where ``pattern`` is a regular expression matching a subrepository | |
1523 | source URL and ``replacement`` is the replacement string used to |
|
1513 | source URL and ``replacement`` is the replacement string used to | |
1524 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1514 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1525 | ``replacements``. For instance:: |
|
1515 | ``replacements``. For instance:: | |
1526 |
|
1516 | |||
1527 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1517 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1528 |
|
1518 | |||
1529 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1519 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1530 |
|
1520 | |||
1531 | Relative subrepository paths are first made absolute, and the |
|
1521 | Relative subrepository paths are first made absolute, and the | |
1532 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1522 | rewrite rules are then applied on the full (absolute) path. The rules | |
1533 | are applied in definition order. |
|
1523 | are applied in definition order. | |
1534 |
|
1524 | |||
1535 | ``templatealias`` |
|
1525 | ``templatealias`` | |
1536 | ----------------- |
|
1526 | ----------------- | |
1537 |
|
1527 | |||
1538 | Alias definitions for templates. See :hg:`help templates` for details. |
|
1528 | Alias definitions for templates. See :hg:`help templates` for details. | |
1539 |
|
1529 | |||
1540 | ``trusted`` |
|
1530 | ``trusted`` | |
1541 | ----------- |
|
1531 | ----------- | |
1542 |
|
1532 | |||
1543 | Mercurial will not use the settings in the |
|
1533 | Mercurial will not use the settings in the | |
1544 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1534 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1545 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1535 | user or to a trusted group, as various hgrc features allow arbitrary | |
1546 | commands to be run. This issue is often encountered when configuring |
|
1536 | commands to be run. This issue is often encountered when configuring | |
1547 | hooks or extensions for shared repositories or servers. However, |
|
1537 | hooks or extensions for shared repositories or servers. However, | |
1548 | the web interface will use some safe settings from the ``[web]`` |
|
1538 | the web interface will use some safe settings from the ``[web]`` | |
1549 | section. |
|
1539 | section. | |
1550 |
|
1540 | |||
1551 | This section specifies what users and groups are trusted. The |
|
1541 | This section specifies what users and groups are trusted. The | |
1552 | current user is always trusted. To trust everybody, list a user or a |
|
1542 | current user is always trusted. To trust everybody, list a user or a | |
1553 | group with name ``*``. These settings must be placed in an |
|
1543 | group with name ``*``. These settings must be placed in an | |
1554 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1544 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1555 | user or service running Mercurial. |
|
1545 | user or service running Mercurial. | |
1556 |
|
1546 | |||
1557 | ``users`` |
|
1547 | ``users`` | |
1558 | Comma-separated list of trusted users. |
|
1548 | Comma-separated list of trusted users. | |
1559 |
|
1549 | |||
1560 | ``groups`` |
|
1550 | ``groups`` | |
1561 | Comma-separated list of trusted groups. |
|
1551 | Comma-separated list of trusted groups. | |
1562 |
|
1552 | |||
1563 |
|
1553 | |||
1564 | ``ui`` |
|
1554 | ``ui`` | |
1565 | ------ |
|
1555 | ------ | |
1566 |
|
1556 | |||
1567 | User interface controls. |
|
1557 | User interface controls. | |
1568 |
|
1558 | |||
1569 | ``archivemeta`` |
|
1559 | ``archivemeta`` | |
1570 | Whether to include the .hg_archival.txt file containing meta data |
|
1560 | Whether to include the .hg_archival.txt file containing meta data | |
1571 | (hashes for the repository base and for tip) in archives created |
|
1561 | (hashes for the repository base and for tip) in archives created | |
1572 | by the :hg:`archive` command or downloaded via hgweb. |
|
1562 | by the :hg:`archive` command or downloaded via hgweb. | |
1573 | (default: True) |
|
1563 | (default: True) | |
1574 |
|
1564 | |||
1575 | ``askusername`` |
|
1565 | ``askusername`` | |
1576 | Whether to prompt for a username when committing. If True, and |
|
1566 | Whether to prompt for a username when committing. If True, and | |
1577 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1567 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1578 | be prompted to enter a username. If no username is entered, the |
|
1568 | be prompted to enter a username. If no username is entered, the | |
1579 | default ``USER@HOST`` is used instead. |
|
1569 | default ``USER@HOST`` is used instead. | |
1580 | (default: False) |
|
1570 | (default: False) | |
1581 |
|
1571 | |||
1582 | ``clonebundles`` |
|
1572 | ``clonebundles`` | |
1583 | Whether the "clone bundles" feature is enabled. |
|
1573 | Whether the "clone bundles" feature is enabled. | |
1584 |
|
1574 | |||
1585 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
1575 | When enabled, :hg:`clone` may download and apply a server-advertised | |
1586 | bundle file from a URL instead of using the normal exchange mechanism. |
|
1576 | bundle file from a URL instead of using the normal exchange mechanism. | |
1587 |
|
1577 | |||
1588 | This can likely result in faster and more reliable clones. |
|
1578 | This can likely result in faster and more reliable clones. | |
1589 |
|
1579 | |||
1590 | (default: True) |
|
1580 | (default: True) | |
1591 |
|
1581 | |||
1592 | ``clonebundlefallback`` |
|
1582 | ``clonebundlefallback`` | |
1593 | Whether failure to apply an advertised "clone bundle" from a server |
|
1583 | Whether failure to apply an advertised "clone bundle" from a server | |
1594 | should result in fallback to a regular clone. |
|
1584 | should result in fallback to a regular clone. | |
1595 |
|
1585 | |||
1596 | This is disabled by default because servers advertising "clone |
|
1586 | This is disabled by default because servers advertising "clone | |
1597 | bundles" often do so to reduce server load. If advertised bundles |
|
1587 | bundles" often do so to reduce server load. If advertised bundles | |
1598 | start mass failing and clients automatically fall back to a regular |
|
1588 | start mass failing and clients automatically fall back to a regular | |
1599 | clone, this would add significant and unexpected load to the server |
|
1589 | clone, this would add significant and unexpected load to the server | |
1600 | since the server is expecting clone operations to be offloaded to |
|
1590 | since the server is expecting clone operations to be offloaded to | |
1601 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
1591 | pre-generated bundles. Failing fast (the default behavior) ensures | |
1602 | clients don't overwhelm the server when "clone bundle" application |
|
1592 | clients don't overwhelm the server when "clone bundle" application | |
1603 | fails. |
|
1593 | fails. | |
1604 |
|
1594 | |||
1605 | (default: False) |
|
1595 | (default: False) | |
1606 |
|
1596 | |||
1607 | ``clonebundleprefers`` |
|
1597 | ``clonebundleprefers`` | |
1608 | Defines preferences for which "clone bundles" to use. |
|
1598 | Defines preferences for which "clone bundles" to use. | |
1609 |
|
1599 | |||
1610 | Servers advertising "clone bundles" may advertise multiple available |
|
1600 | Servers advertising "clone bundles" may advertise multiple available | |
1611 | bundles. Each bundle may have different attributes, such as the bundle |
|
1601 | bundles. Each bundle may have different attributes, such as the bundle | |
1612 | type and compression format. This option is used to prefer a particular |
|
1602 | type and compression format. This option is used to prefer a particular | |
1613 | bundle over another. |
|
1603 | bundle over another. | |
1614 |
|
1604 | |||
1615 | The following keys are defined by Mercurial: |
|
1605 | The following keys are defined by Mercurial: | |
1616 |
|
1606 | |||
1617 | BUNDLESPEC |
|
1607 | BUNDLESPEC | |
1618 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
1608 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. | |
1619 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
1609 | e.g. ``gzip-v2`` or ``bzip2-v1``. | |
1620 |
|
1610 | |||
1621 | COMPRESSION |
|
1611 | COMPRESSION | |
1622 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
1612 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. | |
1623 |
|
1613 | |||
1624 | Server operators may define custom keys. |
|
1614 | Server operators may define custom keys. | |
1625 |
|
1615 | |||
1626 | Example values: ``COMPRESSION=bzip2``, |
|
1616 | Example values: ``COMPRESSION=bzip2``, | |
1627 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
1617 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. | |
1628 |
|
1618 | |||
1629 | By default, the first bundle advertised by the server is used. |
|
1619 | By default, the first bundle advertised by the server is used. | |
1630 |
|
1620 | |||
1631 | ``commitsubrepos`` |
|
1621 | ``commitsubrepos`` | |
1632 | Whether to commit modified subrepositories when committing the |
|
1622 | Whether to commit modified subrepositories when committing the | |
1633 | parent repository. If False and one subrepository has uncommitted |
|
1623 | parent repository. If False and one subrepository has uncommitted | |
1634 | changes, abort the commit. |
|
1624 | changes, abort the commit. | |
1635 | (default: False) |
|
1625 | (default: False) | |
1636 |
|
1626 | |||
1637 | ``debug`` |
|
1627 | ``debug`` | |
1638 | Print debugging information. (default: False) |
|
1628 | Print debugging information. (default: False) | |
1639 |
|
1629 | |||
1640 | ``editor`` |
|
1630 | ``editor`` | |
1641 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
1631 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) | |
1642 |
|
1632 | |||
1643 | ``fallbackencoding`` |
|
1633 | ``fallbackencoding`` | |
1644 | Encoding to try if it's not possible to decode the changelog using |
|
1634 | Encoding to try if it's not possible to decode the changelog using | |
1645 | UTF-8. (default: ISO-8859-1) |
|
1635 | UTF-8. (default: ISO-8859-1) | |
1646 |
|
1636 | |||
1647 | ``graphnodetemplate`` |
|
1637 | ``graphnodetemplate`` | |
1648 | The template used to print changeset nodes in an ASCII revision graph. |
|
1638 | The template used to print changeset nodes in an ASCII revision graph. | |
1649 | (default: ``{graphnode}``) |
|
1639 | (default: ``{graphnode}``) | |
1650 |
|
1640 | |||
1651 | ``ignore`` |
|
1641 | ``ignore`` | |
1652 | A file to read per-user ignore patterns from. This file should be |
|
1642 | A file to read per-user ignore patterns from. This file should be | |
1653 | in the same format as a repository-wide .hgignore file. Filenames |
|
1643 | in the same format as a repository-wide .hgignore file. Filenames | |
1654 | are relative to the repository root. This option supports hook syntax, |
|
1644 | are relative to the repository root. This option supports hook syntax, | |
1655 | so if you want to specify multiple ignore files, you can do so by |
|
1645 | so if you want to specify multiple ignore files, you can do so by | |
1656 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
1646 | setting something like ``ignore.other = ~/.hgignore2``. For details | |
1657 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
1647 | of the ignore file format, see the ``hgignore(5)`` man page. | |
1658 |
|
1648 | |||
1659 | ``interactive`` |
|
1649 | ``interactive`` | |
1660 | Allow to prompt the user. (default: True) |
|
1650 | Allow to prompt the user. (default: True) | |
1661 |
|
1651 | |||
1662 | ``interface`` |
|
1652 | ``interface`` | |
1663 | Select the default interface for interactive features (default: text). |
|
1653 | Select the default interface for interactive features (default: text). | |
1664 | Possible values are 'text' and 'curses'. |
|
1654 | Possible values are 'text' and 'curses'. | |
1665 |
|
1655 | |||
1666 | ``interface.chunkselector`` |
|
1656 | ``interface.chunkselector`` | |
1667 | Select the interface for change recording (e.g. :hg:`commit` -i). |
|
1657 | Select the interface for change recording (e.g. :hg:`commit` -i). | |
1668 | Possible values are 'text' and 'curses'. |
|
1658 | Possible values are 'text' and 'curses'. | |
1669 | This config overrides the interface specified by ui.interface. |
|
1659 | This config overrides the interface specified by ui.interface. | |
1670 |
|
1660 | |||
1671 | ``logtemplate`` |
|
1661 | ``logtemplate`` | |
1672 | Template string for commands that print changesets. |
|
1662 | Template string for commands that print changesets. | |
1673 |
|
1663 | |||
1674 | ``merge`` |
|
1664 | ``merge`` | |
1675 | The conflict resolution program to use during a manual merge. |
|
1665 | The conflict resolution program to use during a manual merge. | |
1676 | For more information on merge tools see :hg:`help merge-tools`. |
|
1666 | For more information on merge tools see :hg:`help merge-tools`. | |
1677 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1667 | For configuring merge tools see the ``[merge-tools]`` section. | |
1678 |
|
1668 | |||
1679 | ``mergemarkers`` |
|
1669 | ``mergemarkers`` | |
1680 | Sets the merge conflict marker label styling. The ``detailed`` |
|
1670 | Sets the merge conflict marker label styling. The ``detailed`` | |
1681 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
1671 | style uses the ``mergemarkertemplate`` setting to style the labels. | |
1682 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
1672 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
1683 | One of ``basic`` or ``detailed``. |
|
1673 | One of ``basic`` or ``detailed``. | |
1684 | (default: ``basic``) |
|
1674 | (default: ``basic``) | |
1685 |
|
1675 | |||
1686 | ``mergemarkertemplate`` |
|
1676 | ``mergemarkertemplate`` | |
1687 | The template used to print the commit description next to each conflict |
|
1677 | The template used to print the commit description next to each conflict | |
1688 | marker during merge conflicts. See :hg:`help templates` for the template |
|
1678 | marker during merge conflicts. See :hg:`help templates` for the template | |
1689 | format. |
|
1679 | format. | |
1690 |
|
1680 | |||
1691 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
1681 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
1692 | the first line of the commit description. |
|
1682 | the first line of the commit description. | |
1693 |
|
1683 | |||
1694 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
1684 | If you use non-ASCII characters in names for tags, branches, bookmarks, | |
1695 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
1685 | authors, and/or commit descriptions, you must pay attention to encodings of | |
1696 | managed files. At template expansion, non-ASCII characters use the encoding |
|
1686 | managed files. At template expansion, non-ASCII characters use the encoding | |
1697 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
1687 | specified by the ``--encoding`` global option, ``HGENCODING`` or other | |
1698 | environment variables that govern your locale. If the encoding of the merge |
|
1688 | environment variables that govern your locale. If the encoding of the merge | |
1699 | markers is different from the encoding of the merged files, |
|
1689 | markers is different from the encoding of the merged files, | |
1700 | serious problems may occur. |
|
1690 | serious problems may occur. | |
1701 |
|
1691 | |||
1702 | ``origbackuppath`` |
|
1692 | ``origbackuppath`` | |
1703 | The path to a directory used to store generated .orig files. If the path is |
|
1693 | The path to a directory used to store generated .orig files. If the path is | |
1704 | not a directory, one will be created. |
|
1694 | not a directory, one will be created. | |
1705 |
|
1695 | |||
1706 | ``patch`` |
|
1696 | ``patch`` | |
1707 | An optional external tool that ``hg import`` and some extensions |
|
1697 | An optional external tool that ``hg import`` and some extensions | |
1708 | will use for applying patches. By default Mercurial uses an |
|
1698 | will use for applying patches. By default Mercurial uses an | |
1709 | internal patch utility. The external tool must work as the common |
|
1699 | internal patch utility. The external tool must work as the common | |
1710 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
1700 | Unix ``patch`` program. In particular, it must accept a ``-p`` | |
1711 | argument to strip patch headers, a ``-d`` argument to specify the |
|
1701 | argument to strip patch headers, a ``-d`` argument to specify the | |
1712 | current directory, a file name to patch, and a patch file to take |
|
1702 | current directory, a file name to patch, and a patch file to take | |
1713 | from stdin. |
|
1703 | from stdin. | |
1714 |
|
1704 | |||
1715 | It is possible to specify a patch tool together with extra |
|
1705 | It is possible to specify a patch tool together with extra | |
1716 | arguments. For example, setting this option to ``patch --merge`` |
|
1706 | arguments. For example, setting this option to ``patch --merge`` | |
1717 | will use the ``patch`` program with its 2-way merge option. |
|
1707 | will use the ``patch`` program with its 2-way merge option. | |
1718 |
|
1708 | |||
1719 | ``portablefilenames`` |
|
1709 | ``portablefilenames`` | |
1720 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1710 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1721 | (default: ``warn``) |
|
1711 | (default: ``warn``) | |
1722 |
|
1712 | |||
1723 | ``warn`` |
|
1713 | ``warn`` | |
1724 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
1714 | Print a warning message on POSIX platforms, if a file with a non-portable | |
1725 | filename is added (e.g. a file with a name that can't be created on |
|
1715 | filename is added (e.g. a file with a name that can't be created on | |
1726 | Windows because it contains reserved parts like ``AUX``, reserved |
|
1716 | Windows because it contains reserved parts like ``AUX``, reserved | |
1727 | characters like ``:``, or would cause a case collision with an existing |
|
1717 | characters like ``:``, or would cause a case collision with an existing | |
1728 | file). |
|
1718 | file). | |
1729 |
|
1719 | |||
1730 | ``ignore`` |
|
1720 | ``ignore`` | |
1731 | Don't print a warning. |
|
1721 | Don't print a warning. | |
1732 |
|
1722 | |||
1733 | ``abort`` |
|
1723 | ``abort`` | |
1734 | The command is aborted. |
|
1724 | The command is aborted. | |
1735 |
|
1725 | |||
1736 | ``true`` |
|
1726 | ``true`` | |
1737 | Alias for ``warn``. |
|
1727 | Alias for ``warn``. | |
1738 |
|
1728 | |||
1739 | ``false`` |
|
1729 | ``false`` | |
1740 | Alias for ``ignore``. |
|
1730 | Alias for ``ignore``. | |
1741 |
|
1731 | |||
1742 | .. container:: windows |
|
1732 | .. container:: windows | |
1743 |
|
1733 | |||
1744 | On Windows, this configuration option is ignored and the command aborted. |
|
1734 | On Windows, this configuration option is ignored and the command aborted. | |
1745 |
|
1735 | |||
1746 | ``quiet`` |
|
1736 | ``quiet`` | |
1747 | Reduce the amount of output printed. |
|
1737 | Reduce the amount of output printed. | |
1748 | (default: False) |
|
1738 | (default: False) | |
1749 |
|
1739 | |||
1750 | ``remotecmd`` |
|
1740 | ``remotecmd`` | |
1751 | Remote command to use for clone/push/pull operations. |
|
1741 | Remote command to use for clone/push/pull operations. | |
1752 | (default: ``hg``) |
|
1742 | (default: ``hg``) | |
1753 |
|
1743 | |||
1754 | ``report_untrusted`` |
|
1744 | ``report_untrusted`` | |
1755 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1745 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1756 | trusted user or group. |
|
1746 | trusted user or group. | |
1757 | (default: True) |
|
1747 | (default: True) | |
1758 |
|
1748 | |||
1759 | ``slash`` |
|
1749 | ``slash`` | |
1760 | Display paths using a slash (``/``) as the path separator. This |
|
1750 | Display paths using a slash (``/``) as the path separator. This | |
1761 | only makes a difference on systems where the default path |
|
1751 | only makes a difference on systems where the default path | |
1762 | separator is not the slash character (e.g. Windows uses the |
|
1752 | separator is not the slash character (e.g. Windows uses the | |
1763 | backslash character (``\``)). |
|
1753 | backslash character (``\``)). | |
1764 | (default: False) |
|
1754 | (default: False) | |
1765 |
|
1755 | |||
1766 | ``statuscopies`` |
|
1756 | ``statuscopies`` | |
1767 | Display copies in the status command. |
|
1757 | Display copies in the status command. | |
1768 |
|
1758 | |||
1769 | ``ssh`` |
|
1759 | ``ssh`` | |
1770 | Command to use for SSH connections. (default: ``ssh``) |
|
1760 | Command to use for SSH connections. (default: ``ssh``) | |
1771 |
|
1761 | |||
1772 | ``strict`` |
|
1762 | ``strict`` | |
1773 | Require exact command names, instead of allowing unambiguous |
|
1763 | Require exact command names, instead of allowing unambiguous | |
1774 | abbreviations. (default: False) |
|
1764 | abbreviations. (default: False) | |
1775 |
|
1765 | |||
1776 | ``style`` |
|
1766 | ``style`` | |
1777 | Name of style to use for command output. |
|
1767 | Name of style to use for command output. | |
1778 |
|
1768 | |||
1779 | ``supportcontact`` |
|
1769 | ``supportcontact`` | |
1780 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
1770 | A URL where users should report a Mercurial traceback. Use this if you are a | |
1781 | large organisation with its own Mercurial deployment process and crash |
|
1771 | large organisation with its own Mercurial deployment process and crash | |
1782 | reports should be addressed to your internal support. |
|
1772 | reports should be addressed to your internal support. | |
1783 |
|
1773 | |||
1784 | ``textwidth`` |
|
1774 | ``textwidth`` | |
1785 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
1775 | Maximum width of help text. A longer line generated by ``hg help`` or | |
1786 | ``hg subcommand --help`` will be broken after white space to get this |
|
1776 | ``hg subcommand --help`` will be broken after white space to get this | |
1787 | width or the terminal width, whichever comes first. |
|
1777 | width or the terminal width, whichever comes first. | |
1788 | A non-positive value will disable this and the terminal width will be |
|
1778 | A non-positive value will disable this and the terminal width will be | |
1789 | used. (default: 78) |
|
1779 | used. (default: 78) | |
1790 |
|
1780 | |||
1791 | ``timeout`` |
|
1781 | ``timeout`` | |
1792 | The timeout used when a lock is held (in seconds), a negative value |
|
1782 | The timeout used when a lock is held (in seconds), a negative value | |
1793 | means no timeout. (default: 600) |
|
1783 | means no timeout. (default: 600) | |
1794 |
|
1784 | |||
1795 | ``traceback`` |
|
1785 | ``traceback`` | |
1796 | Mercurial always prints a traceback when an unknown exception |
|
1786 | Mercurial always prints a traceback when an unknown exception | |
1797 | occurs. Setting this to True will make Mercurial print a traceback |
|
1787 | occurs. Setting this to True will make Mercurial print a traceback | |
1798 | on all exceptions, even those recognized by Mercurial (such as |
|
1788 | on all exceptions, even those recognized by Mercurial (such as | |
1799 | IOError or MemoryError). (default: False) |
|
1789 | IOError or MemoryError). (default: False) | |
1800 |
|
1790 | |||
1801 | ``username`` |
|
1791 | ``username`` | |
1802 | The committer of a changeset created when running "commit". |
|
1792 | The committer of a changeset created when running "commit". | |
1803 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1793 | Typically a person's name and email address, e.g. ``Fred Widget | |
1804 | <fred@example.com>``. Environment variables in the |
|
1794 | <fred@example.com>``. Environment variables in the | |
1805 | username are expanded. |
|
1795 | username are expanded. | |
1806 |
|
1796 | |||
1807 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
1797 | (default: ``$EMAIL`` or ``username@hostname``. If the username in | |
1808 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
1798 | hgrc is empty, e.g. if the system admin set ``username =`` in the | |
1809 | system hgrc, it has to be specified manually or in a different |
|
1799 | system hgrc, it has to be specified manually or in a different | |
1810 | hgrc file) |
|
1800 | hgrc file) | |
1811 |
|
1801 | |||
1812 | ``verbose`` |
|
1802 | ``verbose`` | |
1813 | Increase the amount of output printed. (default: False) |
|
1803 | Increase the amount of output printed. (default: False) | |
1814 |
|
1804 | |||
1815 |
|
1805 | |||
1816 | ``web`` |
|
1806 | ``web`` | |
1817 | ------- |
|
1807 | ------- | |
1818 |
|
1808 | |||
1819 | Web interface configuration. The settings in this section apply to |
|
1809 | Web interface configuration. The settings in this section apply to | |
1820 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1810 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1821 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1811 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1822 | and WSGI). |
|
1812 | and WSGI). | |
1823 |
|
1813 | |||
1824 | The Mercurial webserver does no authentication (it does not prompt for |
|
1814 | The Mercurial webserver does no authentication (it does not prompt for | |
1825 | usernames and passwords to validate *who* users are), but it does do |
|
1815 | usernames and passwords to validate *who* users are), but it does do | |
1826 | authorization (it grants or denies access for *authenticated users* |
|
1816 | authorization (it grants or denies access for *authenticated users* | |
1827 | based on settings in this section). You must either configure your |
|
1817 | based on settings in this section). You must either configure your | |
1828 | webserver to do authentication for you, or disable the authorization |
|
1818 | webserver to do authentication for you, or disable the authorization | |
1829 | checks. |
|
1819 | checks. | |
1830 |
|
1820 | |||
1831 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1821 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1832 | you want it to accept pushes from anybody, you can use the following |
|
1822 | you want it to accept pushes from anybody, you can use the following | |
1833 | command line:: |
|
1823 | command line:: | |
1834 |
|
1824 | |||
1835 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1825 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1836 |
|
1826 | |||
1837 | Note that this will allow anybody to push anything to the server and |
|
1827 | Note that this will allow anybody to push anything to the server and | |
1838 | that this should not be used for public servers. |
|
1828 | that this should not be used for public servers. | |
1839 |
|
1829 | |||
1840 | The full set of options is: |
|
1830 | The full set of options is: | |
1841 |
|
1831 | |||
1842 | ``accesslog`` |
|
1832 | ``accesslog`` | |
1843 | Where to output the access log. (default: stdout) |
|
1833 | Where to output the access log. (default: stdout) | |
1844 |
|
1834 | |||
1845 | ``address`` |
|
1835 | ``address`` | |
1846 | Interface address to bind to. (default: all) |
|
1836 | Interface address to bind to. (default: all) | |
1847 |
|
1837 | |||
1848 | ``allow_archive`` |
|
1838 | ``allow_archive`` | |
1849 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1839 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1850 | (default: empty) |
|
1840 | (default: empty) | |
1851 |
|
1841 | |||
1852 | ``allowbz2`` |
|
1842 | ``allowbz2`` | |
1853 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1843 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1854 | revisions. |
|
1844 | revisions. | |
1855 | (default: False) |
|
1845 | (default: False) | |
1856 |
|
1846 | |||
1857 | ``allowgz`` |
|
1847 | ``allowgz`` | |
1858 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1848 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1859 | revisions. |
|
1849 | revisions. | |
1860 | (default: False) |
|
1850 | (default: False) | |
1861 |
|
1851 | |||
1862 | ``allowpull`` |
|
1852 | ``allowpull`` | |
1863 | Whether to allow pulling from the repository. (default: True) |
|
1853 | Whether to allow pulling from the repository. (default: True) | |
1864 |
|
1854 | |||
1865 | ``allow_push`` |
|
1855 | ``allow_push`` | |
1866 | Whether to allow pushing to the repository. If empty or not set, |
|
1856 | Whether to allow pushing to the repository. If empty or not set, | |
1867 | pushing is not allowed. If the special value ``*``, any remote |
|
1857 | pushing is not allowed. If the special value ``*``, any remote | |
1868 | user can push, including unauthenticated users. Otherwise, the |
|
1858 | user can push, including unauthenticated users. Otherwise, the | |
1869 | remote user must have been authenticated, and the authenticated |
|
1859 | remote user must have been authenticated, and the authenticated | |
1870 | user name must be present in this list. The contents of the |
|
1860 | user name must be present in this list. The contents of the | |
1871 | allow_push list are examined after the deny_push list. |
|
1861 | allow_push list are examined after the deny_push list. | |
1872 |
|
1862 | |||
1873 | ``allow_read`` |
|
1863 | ``allow_read`` | |
1874 | If the user has not already been denied repository access due to |
|
1864 | If the user has not already been denied repository access due to | |
1875 | the contents of deny_read, this list determines whether to grant |
|
1865 | the contents of deny_read, this list determines whether to grant | |
1876 | repository access to the user. If this list is not empty, and the |
|
1866 | repository access to the user. If this list is not empty, and the | |
1877 | user is unauthenticated or not present in the list, then access is |
|
1867 | user is unauthenticated or not present in the list, then access is | |
1878 | denied for the user. If the list is empty or not set, then access |
|
1868 | denied for the user. If the list is empty or not set, then access | |
1879 | is permitted to all users by default. Setting allow_read to the |
|
1869 | is permitted to all users by default. Setting allow_read to the | |
1880 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1870 | special value ``*`` is equivalent to it not being set (i.e. access | |
1881 | is permitted to all users). The contents of the allow_read list are |
|
1871 | is permitted to all users). The contents of the allow_read list are | |
1882 | examined after the deny_read list. |
|
1872 | examined after the deny_read list. | |
1883 |
|
1873 | |||
1884 | ``allowzip`` |
|
1874 | ``allowzip`` | |
1885 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1875 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1886 | revisions. This feature creates temporary files. |
|
1876 | revisions. This feature creates temporary files. | |
1887 | (default: False) |
|
1877 | (default: False) | |
1888 |
|
1878 | |||
1889 | ``archivesubrepos`` |
|
1879 | ``archivesubrepos`` | |
1890 | Whether to recurse into subrepositories when archiving. |
|
1880 | Whether to recurse into subrepositories when archiving. | |
1891 | (default: False) |
|
1881 | (default: False) | |
1892 |
|
1882 | |||
1893 | ``baseurl`` |
|
1883 | ``baseurl`` | |
1894 | Base URL to use when publishing URLs in other locations, so |
|
1884 | Base URL to use when publishing URLs in other locations, so | |
1895 | third-party tools like email notification hooks can construct |
|
1885 | third-party tools like email notification hooks can construct | |
1896 | URLs. Example: ``http://hgserver/repos/``. |
|
1886 | URLs. Example: ``http://hgserver/repos/``. | |
1897 |
|
1887 | |||
1898 | ``cacerts`` |
|
1888 | ``cacerts`` | |
1899 | Path to file containing a list of PEM encoded certificate |
|
1889 | Path to file containing a list of PEM encoded certificate | |
1900 | authority certificates. Environment variables and ``~user`` |
|
1890 | authority certificates. Environment variables and ``~user`` | |
1901 | constructs are expanded in the filename. If specified on the |
|
1891 | constructs are expanded in the filename. If specified on the | |
1902 | client, then it will verify the identity of remote HTTPS servers |
|
1892 | client, then it will verify the identity of remote HTTPS servers | |
1903 | with these certificates. |
|
1893 | with these certificates. | |
1904 |
|
1894 | |||
1905 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1895 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1906 | command line. |
|
1896 | command line. | |
1907 |
|
1897 | |||
1908 | You can use OpenSSL's CA certificate file if your platform has |
|
1898 | You can use OpenSSL's CA certificate file if your platform has | |
1909 | one. On most Linux systems this will be |
|
1899 | one. On most Linux systems this will be | |
1910 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1900 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1911 | generate this file manually. The form must be as follows:: |
|
1901 | generate this file manually. The form must be as follows:: | |
1912 |
|
1902 | |||
1913 | -----BEGIN CERTIFICATE----- |
|
1903 | -----BEGIN CERTIFICATE----- | |
1914 | ... (certificate in base64 PEM encoding) ... |
|
1904 | ... (certificate in base64 PEM encoding) ... | |
1915 | -----END CERTIFICATE----- |
|
1905 | -----END CERTIFICATE----- | |
1916 | -----BEGIN CERTIFICATE----- |
|
1906 | -----BEGIN CERTIFICATE----- | |
1917 | ... (certificate in base64 PEM encoding) ... |
|
1907 | ... (certificate in base64 PEM encoding) ... | |
1918 | -----END CERTIFICATE----- |
|
1908 | -----END CERTIFICATE----- | |
1919 |
|
1909 | |||
1920 | ``cache`` |
|
1910 | ``cache`` | |
1921 | Whether to support caching in hgweb. (default: True) |
|
1911 | Whether to support caching in hgweb. (default: True) | |
1922 |
|
1912 | |||
1923 | ``certificate`` |
|
1913 | ``certificate`` | |
1924 | Certificate to use when running :hg:`serve`. |
|
1914 | Certificate to use when running :hg:`serve`. | |
1925 |
|
1915 | |||
1926 | ``collapse`` |
|
1916 | ``collapse`` | |
1927 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1917 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1928 | a single level alongside repositories in the current path. With |
|
1918 | a single level alongside repositories in the current path. With | |
1929 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1919 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1930 | the current path are grouped behind navigable directory entries that |
|
1920 | the current path are grouped behind navigable directory entries that | |
1931 | lead to the locations of these repositories. In effect, this setting |
|
1921 | lead to the locations of these repositories. In effect, this setting | |
1932 | collapses each collection of repositories found within a subdirectory |
|
1922 | collapses each collection of repositories found within a subdirectory | |
1933 | into a single entry for that subdirectory. (default: False) |
|
1923 | into a single entry for that subdirectory. (default: False) | |
1934 |
|
1924 | |||
1935 | ``comparisoncontext`` |
|
1925 | ``comparisoncontext`` | |
1936 | Number of lines of context to show in side-by-side file comparison. If |
|
1926 | Number of lines of context to show in side-by-side file comparison. If | |
1937 | negative or the value ``full``, whole files are shown. (default: 5) |
|
1927 | negative or the value ``full``, whole files are shown. (default: 5) | |
1938 |
|
1928 | |||
1939 | This setting can be overridden by a ``context`` request parameter to the |
|
1929 | This setting can be overridden by a ``context`` request parameter to the | |
1940 | ``comparison`` command, taking the same values. |
|
1930 | ``comparison`` command, taking the same values. | |
1941 |
|
1931 | |||
1942 | ``contact`` |
|
1932 | ``contact`` | |
1943 | Name or email address of the person in charge of the repository. |
|
1933 | Name or email address of the person in charge of the repository. | |
1944 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
1934 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) | |
1945 |
|
1935 | |||
1946 | ``deny_push`` |
|
1936 | ``deny_push`` | |
1947 | Whether to deny pushing to the repository. If empty or not set, |
|
1937 | Whether to deny pushing to the repository. If empty or not set, | |
1948 | push is not denied. If the special value ``*``, all remote users are |
|
1938 | push is not denied. If the special value ``*``, all remote users are | |
1949 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1939 | denied push. Otherwise, unauthenticated users are all denied, and | |
1950 | any authenticated user name present in this list is also denied. The |
|
1940 | any authenticated user name present in this list is also denied. The | |
1951 | contents of the deny_push list are examined before the allow_push list. |
|
1941 | contents of the deny_push list are examined before the allow_push list. | |
1952 |
|
1942 | |||
1953 | ``deny_read`` |
|
1943 | ``deny_read`` | |
1954 | Whether to deny reading/viewing of the repository. If this list is |
|
1944 | Whether to deny reading/viewing of the repository. If this list is | |
1955 | not empty, unauthenticated users are all denied, and any |
|
1945 | not empty, unauthenticated users are all denied, and any | |
1956 | authenticated user name present in this list is also denied access to |
|
1946 | authenticated user name present in this list is also denied access to | |
1957 | the repository. If set to the special value ``*``, all remote users |
|
1947 | the repository. If set to the special value ``*``, all remote users | |
1958 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1948 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1959 | the determination of repository access depends on the presence and |
|
1949 | the determination of repository access depends on the presence and | |
1960 | content of the allow_read list (see description). If both |
|
1950 | content of the allow_read list (see description). If both | |
1961 | deny_read and allow_read are empty or not set, then access is |
|
1951 | deny_read and allow_read are empty or not set, then access is | |
1962 | permitted to all users by default. If the repository is being |
|
1952 | permitted to all users by default. If the repository is being | |
1963 | served via hgwebdir, denied users will not be able to see it in |
|
1953 | served via hgwebdir, denied users will not be able to see it in | |
1964 | the list of repositories. The contents of the deny_read list have |
|
1954 | the list of repositories. The contents of the deny_read list have | |
1965 | priority over (are examined before) the contents of the allow_read |
|
1955 | priority over (are examined before) the contents of the allow_read | |
1966 | list. |
|
1956 | list. | |
1967 |
|
1957 | |||
1968 | ``descend`` |
|
1958 | ``descend`` | |
1969 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1959 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1970 | directly in the current path will be shown (other repositories are still |
|
1960 | directly in the current path will be shown (other repositories are still | |
1971 | available from the index corresponding to their containing path). |
|
1961 | available from the index corresponding to their containing path). | |
1972 |
|
1962 | |||
1973 | ``description`` |
|
1963 | ``description`` | |
1974 | Textual description of the repository's purpose or contents. |
|
1964 | Textual description of the repository's purpose or contents. | |
1975 | (default: "unknown") |
|
1965 | (default: "unknown") | |
1976 |
|
1966 | |||
1977 | ``encoding`` |
|
1967 | ``encoding`` | |
1978 | Character encoding name. (default: the current locale charset) |
|
1968 | Character encoding name. (default: the current locale charset) | |
1979 | Example: "UTF-8". |
|
1969 | Example: "UTF-8". | |
1980 |
|
1970 | |||
1981 | ``errorlog`` |
|
1971 | ``errorlog`` | |
1982 | Where to output the error log. (default: stderr) |
|
1972 | Where to output the error log. (default: stderr) | |
1983 |
|
1973 | |||
1984 | ``guessmime`` |
|
1974 | ``guessmime`` | |
1985 | Control MIME types for raw download of file content. |
|
1975 | Control MIME types for raw download of file content. | |
1986 | Set to True to let hgweb guess the content type from the file |
|
1976 | Set to True to let hgweb guess the content type from the file | |
1987 | extension. This will serve HTML files as ``text/html`` and might |
|
1977 | extension. This will serve HTML files as ``text/html`` and might | |
1988 | allow cross-site scripting attacks when serving untrusted |
|
1978 | allow cross-site scripting attacks when serving untrusted | |
1989 | repositories. (default: False) |
|
1979 | repositories. (default: False) | |
1990 |
|
1980 | |||
1991 | ``hidden`` |
|
1981 | ``hidden`` | |
1992 | Whether to hide the repository in the hgwebdir index. |
|
1982 | Whether to hide the repository in the hgwebdir index. | |
1993 | (default: False) |
|
1983 | (default: False) | |
1994 |
|
1984 | |||
1995 | ``ipv6`` |
|
1985 | ``ipv6`` | |
1996 | Whether to use IPv6. (default: False) |
|
1986 | Whether to use IPv6. (default: False) | |
1997 |
|
1987 | |||
1998 | ``logoimg`` |
|
1988 | ``logoimg`` | |
1999 | File name of the logo image that some templates display on each page. |
|
1989 | File name of the logo image that some templates display on each page. | |
2000 | The file name is relative to ``staticurl``. That is, the full path to |
|
1990 | The file name is relative to ``staticurl``. That is, the full path to | |
2001 | the logo image is "staticurl/logoimg". |
|
1991 | the logo image is "staticurl/logoimg". | |
2002 | If unset, ``hglogo.png`` will be used. |
|
1992 | If unset, ``hglogo.png`` will be used. | |
2003 |
|
1993 | |||
2004 | ``logourl`` |
|
1994 | ``logourl`` | |
2005 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
1995 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` | |
2006 | will be used. |
|
1996 | will be used. | |
2007 |
|
1997 | |||
2008 | ``maxchanges`` |
|
1998 | ``maxchanges`` | |
2009 | Maximum number of changes to list on the changelog. (default: 10) |
|
1999 | Maximum number of changes to list on the changelog. (default: 10) | |
2010 |
|
2000 | |||
2011 | ``maxfiles`` |
|
2001 | ``maxfiles`` | |
2012 | Maximum number of files to list per changeset. (default: 10) |
|
2002 | Maximum number of files to list per changeset. (default: 10) | |
2013 |
|
2003 | |||
2014 | ``maxshortchanges`` |
|
2004 | ``maxshortchanges`` | |
2015 | Maximum number of changes to list on the shortlog, graph or filelog |
|
2005 | Maximum number of changes to list on the shortlog, graph or filelog | |
2016 | pages. (default: 60) |
|
2006 | pages. (default: 60) | |
2017 |
|
2007 | |||
2018 | ``name`` |
|
2008 | ``name`` | |
2019 | Repository name to use in the web interface. |
|
2009 | Repository name to use in the web interface. | |
2020 | (default: current working directory) |
|
2010 | (default: current working directory) | |
2021 |
|
2011 | |||
2022 | ``port`` |
|
2012 | ``port`` | |
2023 | Port to listen on. (default: 8000) |
|
2013 | Port to listen on. (default: 8000) | |
2024 |
|
2014 | |||
2025 | ``prefix`` |
|
2015 | ``prefix`` | |
2026 | Prefix path to serve from. (default: '' (server root)) |
|
2016 | Prefix path to serve from. (default: '' (server root)) | |
2027 |
|
2017 | |||
2028 | ``push_ssl`` |
|
2018 | ``push_ssl`` | |
2029 | Whether to require that inbound pushes be transported over SSL to |
|
2019 | Whether to require that inbound pushes be transported over SSL to | |
2030 | prevent password sniffing. (default: True) |
|
2020 | prevent password sniffing. (default: True) | |
2031 |
|
2021 | |||
2032 | ``refreshinterval`` |
|
2022 | ``refreshinterval`` | |
2033 | How frequently directory listings re-scan the filesystem for new |
|
2023 | How frequently directory listings re-scan the filesystem for new | |
2034 | repositories, in seconds. This is relevant when wildcards are used |
|
2024 | repositories, in seconds. This is relevant when wildcards are used | |
2035 | to define paths. Depending on how much filesystem traversal is |
|
2025 | to define paths. Depending on how much filesystem traversal is | |
2036 | required, refreshing may negatively impact performance. |
|
2026 | required, refreshing may negatively impact performance. | |
2037 |
|
2027 | |||
2038 | Values less than or equal to 0 always refresh. |
|
2028 | Values less than or equal to 0 always refresh. | |
2039 | (default: 20) |
|
2029 | (default: 20) | |
2040 |
|
2030 | |||
2041 | ``staticurl`` |
|
2031 | ``staticurl`` | |
2042 | Base URL to use for static files. If unset, static files (e.g. the |
|
2032 | Base URL to use for static files. If unset, static files (e.g. the | |
2043 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
2033 | hgicon.png favicon) will be served by the CGI script itself. Use | |
2044 | this setting to serve them directly with the HTTP server. |
|
2034 | this setting to serve them directly with the HTTP server. | |
2045 | Example: ``http://hgserver/static/``. |
|
2035 | Example: ``http://hgserver/static/``. | |
2046 |
|
2036 | |||
2047 | ``stripes`` |
|
2037 | ``stripes`` | |
2048 | How many lines a "zebra stripe" should span in multi-line output. |
|
2038 | How many lines a "zebra stripe" should span in multi-line output. | |
2049 | Set to 0 to disable. (default: 1) |
|
2039 | Set to 0 to disable. (default: 1) | |
2050 |
|
2040 | |||
2051 | ``style`` |
|
2041 | ``style`` | |
2052 | Which template map style to use. The available options are the names of |
|
2042 | Which template map style to use. The available options are the names of | |
2053 | subdirectories in the HTML templates path. (default: ``paper``) |
|
2043 | subdirectories in the HTML templates path. (default: ``paper``) | |
2054 | Example: ``monoblue``. |
|
2044 | Example: ``monoblue``. | |
2055 |
|
2045 | |||
2056 | ``templates`` |
|
2046 | ``templates`` | |
2057 | Where to find the HTML templates. The default path to the HTML templates |
|
2047 | Where to find the HTML templates. The default path to the HTML templates | |
2058 | can be obtained from ``hg debuginstall``. |
|
2048 | can be obtained from ``hg debuginstall``. | |
2059 |
|
2049 | |||
2060 | ``websub`` |
|
2050 | ``websub`` | |
2061 | ---------- |
|
2051 | ---------- | |
2062 |
|
2052 | |||
2063 | Web substitution filter definition. You can use this section to |
|
2053 | Web substitution filter definition. You can use this section to | |
2064 | define a set of regular expression substitution patterns which |
|
2054 | define a set of regular expression substitution patterns which | |
2065 | let you automatically modify the hgweb server output. |
|
2055 | let you automatically modify the hgweb server output. | |
2066 |
|
2056 | |||
2067 | The default hgweb templates only apply these substitution patterns |
|
2057 | The default hgweb templates only apply these substitution patterns | |
2068 | on the revision description fields. You can apply them anywhere |
|
2058 | on the revision description fields. You can apply them anywhere | |
2069 | you want when you create your own templates by adding calls to the |
|
2059 | you want when you create your own templates by adding calls to the | |
2070 | "websub" filter (usually after calling the "escape" filter). |
|
2060 | "websub" filter (usually after calling the "escape" filter). | |
2071 |
|
2061 | |||
2072 | This can be used, for example, to convert issue references to links |
|
2062 | This can be used, for example, to convert issue references to links | |
2073 | to your issue tracker, or to convert "markdown-like" syntax into |
|
2063 | to your issue tracker, or to convert "markdown-like" syntax into | |
2074 | HTML (see the examples below). |
|
2064 | HTML (see the examples below). | |
2075 |
|
2065 | |||
2076 | Each entry in this section names a substitution filter. |
|
2066 | Each entry in this section names a substitution filter. | |
2077 | The value of each entry defines the substitution expression itself. |
|
2067 | The value of each entry defines the substitution expression itself. | |
2078 | The websub expressions follow the old interhg extension syntax, |
|
2068 | The websub expressions follow the old interhg extension syntax, | |
2079 | which in turn imitates the Unix sed replacement syntax:: |
|
2069 | which in turn imitates the Unix sed replacement syntax:: | |
2080 |
|
2070 | |||
2081 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
2071 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
2082 |
|
2072 | |||
2083 | You can use any separator other than "/". The final "i" is optional |
|
2073 | You can use any separator other than "/". The final "i" is optional | |
2084 | and indicates that the search must be case insensitive. |
|
2074 | and indicates that the search must be case insensitive. | |
2085 |
|
2075 | |||
2086 | Examples:: |
|
2076 | Examples:: | |
2087 |
|
2077 | |||
2088 | [websub] |
|
2078 | [websub] | |
2089 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
2079 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
2090 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
2080 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
2091 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
2081 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
2092 |
|
2082 | |||
2093 | ``worker`` |
|
2083 | ``worker`` | |
2094 | ---------- |
|
2084 | ---------- | |
2095 |
|
2085 | |||
2096 | Parallel master/worker configuration. We currently perform working |
|
2086 | Parallel master/worker configuration. We currently perform working | |
2097 | directory updates in parallel on Unix-like systems, which greatly |
|
2087 | directory updates in parallel on Unix-like systems, which greatly | |
2098 | helps performance. |
|
2088 | helps performance. | |
2099 |
|
2089 | |||
2100 | ``numcpus`` |
|
2090 | ``numcpus`` | |
2101 | Number of CPUs to use for parallel operations. A zero or |
|
2091 | Number of CPUs to use for parallel operations. A zero or | |
2102 | negative value is treated as ``use the default``. |
|
2092 | negative value is treated as ``use the default``. | |
2103 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
2093 | (default: 4 or the number of CPUs on the system, whichever is larger) | |
2104 |
|
2094 | |||
2105 | ``backgroundclose`` |
|
2095 | ``backgroundclose`` | |
2106 | Whether to enable closing file handles on background threads during certain |
|
2096 | Whether to enable closing file handles on background threads during certain | |
2107 | operations. Some platforms aren't very efficient at closing file |
|
2097 | operations. Some platforms aren't very efficient at closing file | |
2108 | handles that have been written or appended to. By performing file closing |
|
2098 | handles that have been written or appended to. By performing file closing | |
2109 | on background threads, file write rate can increase substantially. |
|
2099 | on background threads, file write rate can increase substantially. | |
2110 | (default: true on Windows, false elsewhere) |
|
2100 | (default: true on Windows, false elsewhere) | |
2111 |
|
2101 | |||
2112 | ``backgroundcloseminfilecount`` |
|
2102 | ``backgroundcloseminfilecount`` | |
2113 | Minimum number of files required to trigger background file closing. |
|
2103 | Minimum number of files required to trigger background file closing. | |
2114 | Operations not writing this many files won't start background close |
|
2104 | Operations not writing this many files won't start background close | |
2115 | threads. |
|
2105 | threads. | |
2116 | (default: 2048) |
|
2106 | (default: 2048) | |
2117 |
|
2107 | |||
2118 | ``backgroundclosemaxqueue`` |
|
2108 | ``backgroundclosemaxqueue`` | |
2119 | The maximum number of opened file handles waiting to be closed in the |
|
2109 | The maximum number of opened file handles waiting to be closed in the | |
2120 | background. This option only has an effect if ``backgroundclose`` is |
|
2110 | background. This option only has an effect if ``backgroundclose`` is | |
2121 | enabled. |
|
2111 | enabled. | |
2122 | (default: 384) |
|
2112 | (default: 384) | |
2123 |
|
2113 | |||
2124 | ``backgroundclosethreadcount`` |
|
2114 | ``backgroundclosethreadcount`` | |
2125 | Number of threads to process background file closes. Only relevant if |
|
2115 | Number of threads to process background file closes. Only relevant if | |
2126 | ``backgroundclose`` is enabled. |
|
2116 | ``backgroundclose`` is enabled. | |
2127 | (default: 4) |
|
2117 | (default: 4) |
@@ -1,353 +1,346 b'' | |||||
1 | # mail.py - mail sending bits for mercurial |
|
1 | # mail.py - mail sending bits for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import, print_function |
|
8 | from __future__ import absolute_import, print_function | |
9 |
|
9 | |||
10 | import email |
|
10 | import email | |
11 | import os |
|
11 | import os | |
12 | import quopri |
|
12 | import quopri | |
13 | import smtplib |
|
13 | import smtplib | |
14 | import socket |
|
14 | import socket | |
15 | import sys |
|
15 | import sys | |
16 | import time |
|
16 | import time | |
17 |
|
17 | |||
18 | from .i18n import _ |
|
18 | from .i18n import _ | |
19 | from . import ( |
|
19 | from . import ( | |
20 | encoding, |
|
20 | encoding, | |
21 | error, |
|
21 | error, | |
22 | sslutil, |
|
22 | sslutil, | |
23 | util, |
|
23 | util, | |
24 | ) |
|
24 | ) | |
25 |
|
25 | |||
26 | _oldheaderinit = email.Header.Header.__init__ |
|
26 | _oldheaderinit = email.Header.Header.__init__ | |
27 | def _unifiedheaderinit(self, *args, **kw): |
|
27 | def _unifiedheaderinit(self, *args, **kw): | |
28 | """ |
|
28 | """ | |
29 | Python 2.7 introduces a backwards incompatible change |
|
29 | Python 2.7 introduces a backwards incompatible change | |
30 | (Python issue1974, r70772) in email.Generator.Generator code: |
|
30 | (Python issue1974, r70772) in email.Generator.Generator code: | |
31 | pre-2.7 code passed "continuation_ws='\t'" to the Header |
|
31 | pre-2.7 code passed "continuation_ws='\t'" to the Header | |
32 | constructor, and 2.7 removed this parameter. |
|
32 | constructor, and 2.7 removed this parameter. | |
33 |
|
33 | |||
34 | Default argument is continuation_ws=' ', which means that the |
|
34 | Default argument is continuation_ws=' ', which means that the | |
35 | behavior is different in <2.7 and 2.7 |
|
35 | behavior is different in <2.7 and 2.7 | |
36 |
|
36 | |||
37 | We consider the 2.7 behavior to be preferable, but need |
|
37 | We consider the 2.7 behavior to be preferable, but need | |
38 | to have an unified behavior for versions 2.4 to 2.7 |
|
38 | to have an unified behavior for versions 2.4 to 2.7 | |
39 | """ |
|
39 | """ | |
40 | # override continuation_ws |
|
40 | # override continuation_ws | |
41 | kw['continuation_ws'] = ' ' |
|
41 | kw['continuation_ws'] = ' ' | |
42 | _oldheaderinit(self, *args, **kw) |
|
42 | _oldheaderinit(self, *args, **kw) | |
43 |
|
43 | |||
44 | setattr(email.header.Header, '__init__', _unifiedheaderinit) |
|
44 | setattr(email.header.Header, '__init__', _unifiedheaderinit) | |
45 |
|
45 | |||
46 | class STARTTLS(smtplib.SMTP): |
|
46 | class STARTTLS(smtplib.SMTP): | |
47 | '''Derived class to verify the peer certificate for STARTTLS. |
|
47 | '''Derived class to verify the peer certificate for STARTTLS. | |
48 |
|
48 | |||
49 | This class allows to pass any keyword arguments to SSL socket creation. |
|
49 | This class allows to pass any keyword arguments to SSL socket creation. | |
50 | ''' |
|
50 | ''' | |
51 | def __init__(self, ui, host=None, **kwargs): |
|
51 | def __init__(self, ui, host=None, **kwargs): | |
52 | smtplib.SMTP.__init__(self, **kwargs) |
|
52 | smtplib.SMTP.__init__(self, **kwargs) | |
53 | self._ui = ui |
|
53 | self._ui = ui | |
54 | self._host = host |
|
54 | self._host = host | |
55 |
|
55 | |||
56 | def starttls(self, keyfile=None, certfile=None): |
|
56 | def starttls(self, keyfile=None, certfile=None): | |
57 | if not self.has_extn("starttls"): |
|
57 | if not self.has_extn("starttls"): | |
58 | msg = "STARTTLS extension not supported by server" |
|
58 | msg = "STARTTLS extension not supported by server" | |
59 | raise smtplib.SMTPException(msg) |
|
59 | raise smtplib.SMTPException(msg) | |
60 | (resp, reply) = self.docmd("STARTTLS") |
|
60 | (resp, reply) = self.docmd("STARTTLS") | |
61 | if resp == 220: |
|
61 | if resp == 220: | |
62 | self.sock = sslutil.wrapsocket(self.sock, keyfile, certfile, |
|
62 | self.sock = sslutil.wrapsocket(self.sock, keyfile, certfile, | |
63 | ui=self._ui, |
|
63 | ui=self._ui, | |
64 | serverhostname=self._host) |
|
64 | serverhostname=self._host) | |
65 | self.file = smtplib.SSLFakeFile(self.sock) |
|
65 | self.file = smtplib.SSLFakeFile(self.sock) | |
66 | self.helo_resp = None |
|
66 | self.helo_resp = None | |
67 | self.ehlo_resp = None |
|
67 | self.ehlo_resp = None | |
68 | self.esmtp_features = {} |
|
68 | self.esmtp_features = {} | |
69 | self.does_esmtp = 0 |
|
69 | self.does_esmtp = 0 | |
70 | return (resp, reply) |
|
70 | return (resp, reply) | |
71 |
|
71 | |||
72 | class SMTPS(smtplib.SMTP): |
|
72 | class SMTPS(smtplib.SMTP): | |
73 | '''Derived class to verify the peer certificate for SMTPS. |
|
73 | '''Derived class to verify the peer certificate for SMTPS. | |
74 |
|
74 | |||
75 | This class allows to pass any keyword arguments to SSL socket creation. |
|
75 | This class allows to pass any keyword arguments to SSL socket creation. | |
76 | ''' |
|
76 | ''' | |
77 | def __init__(self, ui, keyfile=None, certfile=None, host=None, |
|
77 | def __init__(self, ui, keyfile=None, certfile=None, host=None, | |
78 | **kwargs): |
|
78 | **kwargs): | |
79 | self.keyfile = keyfile |
|
79 | self.keyfile = keyfile | |
80 | self.certfile = certfile |
|
80 | self.certfile = certfile | |
81 | smtplib.SMTP.__init__(self, **kwargs) |
|
81 | smtplib.SMTP.__init__(self, **kwargs) | |
82 | self._host = host |
|
82 | self._host = host | |
83 | self.default_port = smtplib.SMTP_SSL_PORT |
|
83 | self.default_port = smtplib.SMTP_SSL_PORT | |
84 | self._ui = ui |
|
84 | self._ui = ui | |
85 |
|
85 | |||
86 | def _get_socket(self, host, port, timeout): |
|
86 | def _get_socket(self, host, port, timeout): | |
87 | if self.debuglevel > 0: |
|
87 | if self.debuglevel > 0: | |
88 | print('connect:', (host, port), file=sys.stderr) |
|
88 | print('connect:', (host, port), file=sys.stderr) | |
89 | new_socket = socket.create_connection((host, port), timeout) |
|
89 | new_socket = socket.create_connection((host, port), timeout) | |
90 | new_socket = sslutil.wrapsocket(new_socket, |
|
90 | new_socket = sslutil.wrapsocket(new_socket, | |
91 | self.keyfile, self.certfile, |
|
91 | self.keyfile, self.certfile, | |
92 | ui=self._ui, |
|
92 | ui=self._ui, | |
93 | serverhostname=self._host) |
|
93 | serverhostname=self._host) | |
94 | self.file = smtplib.SSLFakeFile(new_socket) |
|
94 | self.file = smtplib.SSLFakeFile(new_socket) | |
95 | return new_socket |
|
95 | return new_socket | |
96 |
|
96 | |||
97 | def _smtp(ui): |
|
97 | def _smtp(ui): | |
98 | '''build an smtp connection and return a function to send mail''' |
|
98 | '''build an smtp connection and return a function to send mail''' | |
99 | local_hostname = ui.config('smtp', 'local_hostname') |
|
99 | local_hostname = ui.config('smtp', 'local_hostname') | |
100 | tls = ui.config('smtp', 'tls', 'none') |
|
100 | tls = ui.config('smtp', 'tls', 'none') | |
101 | # backward compatible: when tls = true, we use starttls. |
|
101 | # backward compatible: when tls = true, we use starttls. | |
102 | starttls = tls == 'starttls' or util.parsebool(tls) |
|
102 | starttls = tls == 'starttls' or util.parsebool(tls) | |
103 | smtps = tls == 'smtps' |
|
103 | smtps = tls == 'smtps' | |
104 | if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): |
|
104 | if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): | |
105 | raise error.Abort(_("can't use TLS: Python SSL support not installed")) |
|
105 | raise error.Abort(_("can't use TLS: Python SSL support not installed")) | |
106 | mailhost = ui.config('smtp', 'host') |
|
106 | mailhost = ui.config('smtp', 'host') | |
107 | if not mailhost: |
|
107 | if not mailhost: | |
108 | raise error.Abort(_('smtp.host not configured - cannot send mail')) |
|
108 | raise error.Abort(_('smtp.host not configured - cannot send mail')) | |
109 | verifycert = ui.config('smtp', 'verifycert', 'strict') |
|
|||
110 | if verifycert not in ['strict', 'loose']: |
|
|||
111 | if util.parsebool(verifycert) is not False: |
|
|||
112 | raise error.Abort(_('invalid smtp.verifycert configuration: %s') |
|
|||
113 | % (verifycert)) |
|
|||
114 | verifycert = False |
|
|||
115 |
|
||||
116 | if smtps: |
|
109 | if smtps: | |
117 | ui.note(_('(using smtps)\n')) |
|
110 | ui.note(_('(using smtps)\n')) | |
118 | s = SMTPS(ui, local_hostname=local_hostname, host=mailhost) |
|
111 | s = SMTPS(ui, local_hostname=local_hostname, host=mailhost) | |
119 | elif starttls: |
|
112 | elif starttls: | |
120 | s = STARTTLS(ui, local_hostname=local_hostname, host=mailhost) |
|
113 | s = STARTTLS(ui, local_hostname=local_hostname, host=mailhost) | |
121 | else: |
|
114 | else: | |
122 | s = smtplib.SMTP(local_hostname=local_hostname) |
|
115 | s = smtplib.SMTP(local_hostname=local_hostname) | |
123 | if smtps: |
|
116 | if smtps: | |
124 | defaultport = 465 |
|
117 | defaultport = 465 | |
125 | else: |
|
118 | else: | |
126 | defaultport = 25 |
|
119 | defaultport = 25 | |
127 | mailport = util.getport(ui.config('smtp', 'port', defaultport)) |
|
120 | mailport = util.getport(ui.config('smtp', 'port', defaultport)) | |
128 | ui.note(_('sending mail: smtp host %s, port %d\n') % |
|
121 | ui.note(_('sending mail: smtp host %s, port %d\n') % | |
129 | (mailhost, mailport)) |
|
122 | (mailhost, mailport)) | |
130 | s.connect(host=mailhost, port=mailport) |
|
123 | s.connect(host=mailhost, port=mailport) | |
131 | if starttls: |
|
124 | if starttls: | |
132 | ui.note(_('(using starttls)\n')) |
|
125 | ui.note(_('(using starttls)\n')) | |
133 | s.ehlo() |
|
126 | s.ehlo() | |
134 | s.starttls() |
|
127 | s.starttls() | |
135 | s.ehlo() |
|
128 | s.ehlo() | |
136 |
if |
|
129 | if starttls or smtps: | |
137 | ui.note(_('(verifying remote certificate)\n')) |
|
130 | ui.note(_('(verifying remote certificate)\n')) | |
138 |
sslutil.validatesocket(s.sock |
|
131 | sslutil.validatesocket(s.sock) | |
139 | username = ui.config('smtp', 'username') |
|
132 | username = ui.config('smtp', 'username') | |
140 | password = ui.config('smtp', 'password') |
|
133 | password = ui.config('smtp', 'password') | |
141 | if username and not password: |
|
134 | if username and not password: | |
142 | password = ui.getpass() |
|
135 | password = ui.getpass() | |
143 | if username and password: |
|
136 | if username and password: | |
144 | ui.note(_('(authenticating to mail server as %s)\n') % |
|
137 | ui.note(_('(authenticating to mail server as %s)\n') % | |
145 | (username)) |
|
138 | (username)) | |
146 | try: |
|
139 | try: | |
147 | s.login(username, password) |
|
140 | s.login(username, password) | |
148 | except smtplib.SMTPException as inst: |
|
141 | except smtplib.SMTPException as inst: | |
149 | raise error.Abort(inst) |
|
142 | raise error.Abort(inst) | |
150 |
|
143 | |||
151 | def send(sender, recipients, msg): |
|
144 | def send(sender, recipients, msg): | |
152 | try: |
|
145 | try: | |
153 | return s.sendmail(sender, recipients, msg) |
|
146 | return s.sendmail(sender, recipients, msg) | |
154 | except smtplib.SMTPRecipientsRefused as inst: |
|
147 | except smtplib.SMTPRecipientsRefused as inst: | |
155 | recipients = [r[1] for r in inst.recipients.values()] |
|
148 | recipients = [r[1] for r in inst.recipients.values()] | |
156 | raise error.Abort('\n' + '\n'.join(recipients)) |
|
149 | raise error.Abort('\n' + '\n'.join(recipients)) | |
157 | except smtplib.SMTPException as inst: |
|
150 | except smtplib.SMTPException as inst: | |
158 | raise error.Abort(inst) |
|
151 | raise error.Abort(inst) | |
159 |
|
152 | |||
160 | return send |
|
153 | return send | |
161 |
|
154 | |||
162 | def _sendmail(ui, sender, recipients, msg): |
|
155 | def _sendmail(ui, sender, recipients, msg): | |
163 | '''send mail using sendmail.''' |
|
156 | '''send mail using sendmail.''' | |
164 | program = ui.config('email', 'method', 'smtp') |
|
157 | program = ui.config('email', 'method', 'smtp') | |
165 | cmdline = '%s -f %s %s' % (program, util.email(sender), |
|
158 | cmdline = '%s -f %s %s' % (program, util.email(sender), | |
166 | ' '.join(map(util.email, recipients))) |
|
159 | ' '.join(map(util.email, recipients))) | |
167 | ui.note(_('sending mail: %s\n') % cmdline) |
|
160 | ui.note(_('sending mail: %s\n') % cmdline) | |
168 | fp = util.popen(cmdline, 'w') |
|
161 | fp = util.popen(cmdline, 'w') | |
169 | fp.write(msg) |
|
162 | fp.write(msg) | |
170 | ret = fp.close() |
|
163 | ret = fp.close() | |
171 | if ret: |
|
164 | if ret: | |
172 | raise error.Abort('%s %s' % ( |
|
165 | raise error.Abort('%s %s' % ( | |
173 | os.path.basename(program.split(None, 1)[0]), |
|
166 | os.path.basename(program.split(None, 1)[0]), | |
174 | util.explainexit(ret)[0])) |
|
167 | util.explainexit(ret)[0])) | |
175 |
|
168 | |||
176 | def _mbox(mbox, sender, recipients, msg): |
|
169 | def _mbox(mbox, sender, recipients, msg): | |
177 | '''write mails to mbox''' |
|
170 | '''write mails to mbox''' | |
178 | fp = open(mbox, 'ab+') |
|
171 | fp = open(mbox, 'ab+') | |
179 | # Should be time.asctime(), but Windows prints 2-characters day |
|
172 | # Should be time.asctime(), but Windows prints 2-characters day | |
180 | # of month instead of one. Make them print the same thing. |
|
173 | # of month instead of one. Make them print the same thing. | |
181 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) |
|
174 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) | |
182 | fp.write('From %s %s\n' % (sender, date)) |
|
175 | fp.write('From %s %s\n' % (sender, date)) | |
183 | fp.write(msg) |
|
176 | fp.write(msg) | |
184 | fp.write('\n\n') |
|
177 | fp.write('\n\n') | |
185 | fp.close() |
|
178 | fp.close() | |
186 |
|
179 | |||
187 | def connect(ui, mbox=None): |
|
180 | def connect(ui, mbox=None): | |
188 | '''make a mail connection. return a function to send mail. |
|
181 | '''make a mail connection. return a function to send mail. | |
189 | call as sendmail(sender, list-of-recipients, msg).''' |
|
182 | call as sendmail(sender, list-of-recipients, msg).''' | |
190 | if mbox: |
|
183 | if mbox: | |
191 | open(mbox, 'wb').close() |
|
184 | open(mbox, 'wb').close() | |
192 | return lambda s, r, m: _mbox(mbox, s, r, m) |
|
185 | return lambda s, r, m: _mbox(mbox, s, r, m) | |
193 | if ui.config('email', 'method', 'smtp') == 'smtp': |
|
186 | if ui.config('email', 'method', 'smtp') == 'smtp': | |
194 | return _smtp(ui) |
|
187 | return _smtp(ui) | |
195 | return lambda s, r, m: _sendmail(ui, s, r, m) |
|
188 | return lambda s, r, m: _sendmail(ui, s, r, m) | |
196 |
|
189 | |||
197 | def sendmail(ui, sender, recipients, msg, mbox=None): |
|
190 | def sendmail(ui, sender, recipients, msg, mbox=None): | |
198 | send = connect(ui, mbox=mbox) |
|
191 | send = connect(ui, mbox=mbox) | |
199 | return send(sender, recipients, msg) |
|
192 | return send(sender, recipients, msg) | |
200 |
|
193 | |||
201 | def validateconfig(ui): |
|
194 | def validateconfig(ui): | |
202 | '''determine if we have enough config data to try sending email.''' |
|
195 | '''determine if we have enough config data to try sending email.''' | |
203 | method = ui.config('email', 'method', 'smtp') |
|
196 | method = ui.config('email', 'method', 'smtp') | |
204 | if method == 'smtp': |
|
197 | if method == 'smtp': | |
205 | if not ui.config('smtp', 'host'): |
|
198 | if not ui.config('smtp', 'host'): | |
206 | raise error.Abort(_('smtp specified as email transport, ' |
|
199 | raise error.Abort(_('smtp specified as email transport, ' | |
207 | 'but no smtp host configured')) |
|
200 | 'but no smtp host configured')) | |
208 | else: |
|
201 | else: | |
209 | if not util.findexe(method): |
|
202 | if not util.findexe(method): | |
210 | raise error.Abort(_('%r specified as email transport, ' |
|
203 | raise error.Abort(_('%r specified as email transport, ' | |
211 | 'but not in PATH') % method) |
|
204 | 'but not in PATH') % method) | |
212 |
|
205 | |||
213 | def mimetextpatch(s, subtype='plain', display=False): |
|
206 | def mimetextpatch(s, subtype='plain', display=False): | |
214 | '''Return MIME message suitable for a patch. |
|
207 | '''Return MIME message suitable for a patch. | |
215 | Charset will be detected as utf-8 or (possibly fake) us-ascii. |
|
208 | Charset will be detected as utf-8 or (possibly fake) us-ascii. | |
216 | Transfer encodings will be used if necessary.''' |
|
209 | Transfer encodings will be used if necessary.''' | |
217 |
|
210 | |||
218 | cs = 'us-ascii' |
|
211 | cs = 'us-ascii' | |
219 | if not display: |
|
212 | if not display: | |
220 | try: |
|
213 | try: | |
221 | s.decode('us-ascii') |
|
214 | s.decode('us-ascii') | |
222 | except UnicodeDecodeError: |
|
215 | except UnicodeDecodeError: | |
223 | try: |
|
216 | try: | |
224 | s.decode('utf-8') |
|
217 | s.decode('utf-8') | |
225 | cs = 'utf-8' |
|
218 | cs = 'utf-8' | |
226 | except UnicodeDecodeError: |
|
219 | except UnicodeDecodeError: | |
227 | # We'll go with us-ascii as a fallback. |
|
220 | # We'll go with us-ascii as a fallback. | |
228 | pass |
|
221 | pass | |
229 |
|
222 | |||
230 | return mimetextqp(s, subtype, cs) |
|
223 | return mimetextqp(s, subtype, cs) | |
231 |
|
224 | |||
232 | def mimetextqp(body, subtype, charset): |
|
225 | def mimetextqp(body, subtype, charset): | |
233 | '''Return MIME message. |
|
226 | '''Return MIME message. | |
234 | Quoted-printable transfer encoding will be used if necessary. |
|
227 | Quoted-printable transfer encoding will be used if necessary. | |
235 | ''' |
|
228 | ''' | |
236 | enc = None |
|
229 | enc = None | |
237 | for line in body.splitlines(): |
|
230 | for line in body.splitlines(): | |
238 | if len(line) > 950: |
|
231 | if len(line) > 950: | |
239 | body = quopri.encodestring(body) |
|
232 | body = quopri.encodestring(body) | |
240 | enc = "quoted-printable" |
|
233 | enc = "quoted-printable" | |
241 | break |
|
234 | break | |
242 |
|
235 | |||
243 | msg = email.MIMEText.MIMEText(body, subtype, charset) |
|
236 | msg = email.MIMEText.MIMEText(body, subtype, charset) | |
244 | if enc: |
|
237 | if enc: | |
245 | del msg['Content-Transfer-Encoding'] |
|
238 | del msg['Content-Transfer-Encoding'] | |
246 | msg['Content-Transfer-Encoding'] = enc |
|
239 | msg['Content-Transfer-Encoding'] = enc | |
247 | return msg |
|
240 | return msg | |
248 |
|
241 | |||
249 | def _charsets(ui): |
|
242 | def _charsets(ui): | |
250 | '''Obtains charsets to send mail parts not containing patches.''' |
|
243 | '''Obtains charsets to send mail parts not containing patches.''' | |
251 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] |
|
244 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] | |
252 | fallbacks = [encoding.fallbackencoding.lower(), |
|
245 | fallbacks = [encoding.fallbackencoding.lower(), | |
253 | encoding.encoding.lower(), 'utf-8'] |
|
246 | encoding.encoding.lower(), 'utf-8'] | |
254 | for cs in fallbacks: # find unique charsets while keeping order |
|
247 | for cs in fallbacks: # find unique charsets while keeping order | |
255 | if cs not in charsets: |
|
248 | if cs not in charsets: | |
256 | charsets.append(cs) |
|
249 | charsets.append(cs) | |
257 | return [cs for cs in charsets if not cs.endswith('ascii')] |
|
250 | return [cs for cs in charsets if not cs.endswith('ascii')] | |
258 |
|
251 | |||
259 | def _encode(ui, s, charsets): |
|
252 | def _encode(ui, s, charsets): | |
260 | '''Returns (converted) string, charset tuple. |
|
253 | '''Returns (converted) string, charset tuple. | |
261 | Finds out best charset by cycling through sendcharsets in descending |
|
254 | Finds out best charset by cycling through sendcharsets in descending | |
262 | order. Tries both encoding and fallbackencoding for input. Only as |
|
255 | order. Tries both encoding and fallbackencoding for input. Only as | |
263 | last resort send as is in fake ascii. |
|
256 | last resort send as is in fake ascii. | |
264 | Caveat: Do not use for mail parts containing patches!''' |
|
257 | Caveat: Do not use for mail parts containing patches!''' | |
265 | try: |
|
258 | try: | |
266 | s.decode('ascii') |
|
259 | s.decode('ascii') | |
267 | except UnicodeDecodeError: |
|
260 | except UnicodeDecodeError: | |
268 | sendcharsets = charsets or _charsets(ui) |
|
261 | sendcharsets = charsets or _charsets(ui) | |
269 | for ics in (encoding.encoding, encoding.fallbackencoding): |
|
262 | for ics in (encoding.encoding, encoding.fallbackencoding): | |
270 | try: |
|
263 | try: | |
271 | u = s.decode(ics) |
|
264 | u = s.decode(ics) | |
272 | except UnicodeDecodeError: |
|
265 | except UnicodeDecodeError: | |
273 | continue |
|
266 | continue | |
274 | for ocs in sendcharsets: |
|
267 | for ocs in sendcharsets: | |
275 | try: |
|
268 | try: | |
276 | return u.encode(ocs), ocs |
|
269 | return u.encode(ocs), ocs | |
277 | except UnicodeEncodeError: |
|
270 | except UnicodeEncodeError: | |
278 | pass |
|
271 | pass | |
279 | except LookupError: |
|
272 | except LookupError: | |
280 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) |
|
273 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) | |
281 | # if ascii, or all conversion attempts fail, send (broken) ascii |
|
274 | # if ascii, or all conversion attempts fail, send (broken) ascii | |
282 | return s, 'us-ascii' |
|
275 | return s, 'us-ascii' | |
283 |
|
276 | |||
284 | def headencode(ui, s, charsets=None, display=False): |
|
277 | def headencode(ui, s, charsets=None, display=False): | |
285 | '''Returns RFC-2047 compliant header from given string.''' |
|
278 | '''Returns RFC-2047 compliant header from given string.''' | |
286 | if not display: |
|
279 | if not display: | |
287 | # split into words? |
|
280 | # split into words? | |
288 | s, cs = _encode(ui, s, charsets) |
|
281 | s, cs = _encode(ui, s, charsets) | |
289 | return str(email.Header.Header(s, cs)) |
|
282 | return str(email.Header.Header(s, cs)) | |
290 | return s |
|
283 | return s | |
291 |
|
284 | |||
292 | def _addressencode(ui, name, addr, charsets=None): |
|
285 | def _addressencode(ui, name, addr, charsets=None): | |
293 | name = headencode(ui, name, charsets) |
|
286 | name = headencode(ui, name, charsets) | |
294 | try: |
|
287 | try: | |
295 | acc, dom = addr.split('@') |
|
288 | acc, dom = addr.split('@') | |
296 | acc = acc.encode('ascii') |
|
289 | acc = acc.encode('ascii') | |
297 | dom = dom.decode(encoding.encoding).encode('idna') |
|
290 | dom = dom.decode(encoding.encoding).encode('idna') | |
298 | addr = '%s@%s' % (acc, dom) |
|
291 | addr = '%s@%s' % (acc, dom) | |
299 | except UnicodeDecodeError: |
|
292 | except UnicodeDecodeError: | |
300 | raise error.Abort(_('invalid email address: %s') % addr) |
|
293 | raise error.Abort(_('invalid email address: %s') % addr) | |
301 | except ValueError: |
|
294 | except ValueError: | |
302 | try: |
|
295 | try: | |
303 | # too strict? |
|
296 | # too strict? | |
304 | addr = addr.encode('ascii') |
|
297 | addr = addr.encode('ascii') | |
305 | except UnicodeDecodeError: |
|
298 | except UnicodeDecodeError: | |
306 | raise error.Abort(_('invalid local address: %s') % addr) |
|
299 | raise error.Abort(_('invalid local address: %s') % addr) | |
307 | return email.Utils.formataddr((name, addr)) |
|
300 | return email.Utils.formataddr((name, addr)) | |
308 |
|
301 | |||
309 | def addressencode(ui, address, charsets=None, display=False): |
|
302 | def addressencode(ui, address, charsets=None, display=False): | |
310 | '''Turns address into RFC-2047 compliant header.''' |
|
303 | '''Turns address into RFC-2047 compliant header.''' | |
311 | if display or not address: |
|
304 | if display or not address: | |
312 | return address or '' |
|
305 | return address or '' | |
313 | name, addr = email.Utils.parseaddr(address) |
|
306 | name, addr = email.Utils.parseaddr(address) | |
314 | return _addressencode(ui, name, addr, charsets) |
|
307 | return _addressencode(ui, name, addr, charsets) | |
315 |
|
308 | |||
316 | def addrlistencode(ui, addrs, charsets=None, display=False): |
|
309 | def addrlistencode(ui, addrs, charsets=None, display=False): | |
317 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. |
|
310 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. | |
318 | A single element of input list may contain multiple addresses, but output |
|
311 | A single element of input list may contain multiple addresses, but output | |
319 | always has one address per item''' |
|
312 | always has one address per item''' | |
320 | if display: |
|
313 | if display: | |
321 | return [a.strip() for a in addrs if a.strip()] |
|
314 | return [a.strip() for a in addrs if a.strip()] | |
322 |
|
315 | |||
323 | result = [] |
|
316 | result = [] | |
324 | for name, addr in email.Utils.getaddresses(addrs): |
|
317 | for name, addr in email.Utils.getaddresses(addrs): | |
325 | if name or addr: |
|
318 | if name or addr: | |
326 | result.append(_addressencode(ui, name, addr, charsets)) |
|
319 | result.append(_addressencode(ui, name, addr, charsets)) | |
327 | return result |
|
320 | return result | |
328 |
|
321 | |||
329 | def mimeencode(ui, s, charsets=None, display=False): |
|
322 | def mimeencode(ui, s, charsets=None, display=False): | |
330 | '''creates mime text object, encodes it if needed, and sets |
|
323 | '''creates mime text object, encodes it if needed, and sets | |
331 | charset and transfer-encoding accordingly.''' |
|
324 | charset and transfer-encoding accordingly.''' | |
332 | cs = 'us-ascii' |
|
325 | cs = 'us-ascii' | |
333 | if not display: |
|
326 | if not display: | |
334 | s, cs = _encode(ui, s, charsets) |
|
327 | s, cs = _encode(ui, s, charsets) | |
335 | return mimetextqp(s, 'plain', cs) |
|
328 | return mimetextqp(s, 'plain', cs) | |
336 |
|
329 | |||
337 | def headdecode(s): |
|
330 | def headdecode(s): | |
338 | '''Decodes RFC-2047 header''' |
|
331 | '''Decodes RFC-2047 header''' | |
339 | uparts = [] |
|
332 | uparts = [] | |
340 | for part, charset in email.Header.decode_header(s): |
|
333 | for part, charset in email.Header.decode_header(s): | |
341 | if charset is not None: |
|
334 | if charset is not None: | |
342 | try: |
|
335 | try: | |
343 | uparts.append(part.decode(charset)) |
|
336 | uparts.append(part.decode(charset)) | |
344 | continue |
|
337 | continue | |
345 | except UnicodeDecodeError: |
|
338 | except UnicodeDecodeError: | |
346 | pass |
|
339 | pass | |
347 | try: |
|
340 | try: | |
348 | uparts.append(part.decode('UTF-8')) |
|
341 | uparts.append(part.decode('UTF-8')) | |
349 | continue |
|
342 | continue | |
350 | except UnicodeDecodeError: |
|
343 | except UnicodeDecodeError: | |
351 | pass |
|
344 | pass | |
352 | uparts.append(part.decode('ISO-8859-1')) |
|
345 | uparts.append(part.decode('ISO-8859-1')) | |
353 | return encoding.tolocal(u' '.join(uparts).encode('UTF-8')) |
|
346 | return encoding.tolocal(u' '.join(uparts).encode('UTF-8')) |
General Comments 0
You need to be logged in to leave comments.
Login now