Show More
@@ -60,6 +60,14 b' overwritten by command line flags like -' | |||||
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 specify a template for flags to be added in subject prefixes. Flags | |||
|
64 | specified by --flag option are exported as ``{flags}`` keyword:: | |||
|
65 | ||||
|
66 | [patchbomb] | |||
|
67 | flagtemplate = "{separate(' ', | |||
|
68 | ifeq(branch, 'default', '', branch|upper), | |||
|
69 | flags)}" | |||
|
70 | ||||
63 | You can set patchbomb to always ask for confirmation by setting |
|
71 | You can set patchbomb to always ask for confirmation by setting | |
64 | ``patchbomb.confirm`` to true. |
|
72 | ``patchbomb.confirm`` to true. | |
65 | ''' |
|
73 | ''' | |
@@ -77,11 +85,13 b' from mercurial import (' | |||||
77 | commands, |
|
85 | commands, | |
78 | encoding, |
|
86 | encoding, | |
79 | error, |
|
87 | error, | |
|
88 | formatter, | |||
80 | hg, |
|
89 | hg, | |
81 | mail, |
|
90 | mail, | |
82 | node as nodemod, |
|
91 | node as nodemod, | |
83 | patch, |
|
92 | patch, | |
84 | scmutil, |
|
93 | scmutil, | |
|
94 | templater, | |||
85 | util, |
|
95 | util, | |
86 | ) |
|
96 | ) | |
87 | stringio = util.stringio |
|
97 | stringio = util.stringio | |
@@ -135,9 +145,22 b' def introwanted(ui, opts, number):' | |||||
135 | intro = 1 < number |
|
145 | intro = 1 < number | |
136 | return intro |
|
146 | return intro | |
137 |
|
147 | |||
|
148 | def _formatflags(ui, repo, rev, flags): | |||
|
149 | """build flag string optionally by template""" | |||
|
150 | tmpl = ui.config('patchbomb', 'flagtemplate') | |||
|
151 | if not tmpl: | |||
|
152 | return ' '.join(flags) | |||
|
153 | out = util.stringio() | |||
|
154 | opts = {'template': templater.unquotestring(tmpl)} | |||
|
155 | with formatter.templateformatter(ui, out, 'patchbombflag', opts) as fm: | |||
|
156 | fm.startitem() | |||
|
157 | fm.context(ctx=repo[rev]) | |||
|
158 | fm.write('flags', '%s', fm.formatlist(flags, name='flag')) | |||
|
159 | return out.getvalue() | |||
|
160 | ||||
138 | def _formatprefix(ui, repo, rev, flags, idx, total, numbered): |
|
161 | def _formatprefix(ui, repo, rev, flags, idx, total, numbered): | |
139 | """build prefix to patch subject""" |
|
162 | """build prefix to patch subject""" | |
140 | flag = ' '.join(flags) |
|
163 | flag = _formatflags(ui, repo, rev, flags) | |
141 | if flag: |
|
164 | if flag: | |
142 | flag = ' ' + flag |
|
165 | flag = ' ' + flag | |
143 |
|
166 |
@@ -1113,6 +1113,14 b' Disabled extensions:' | |||||
1113 | intro=never # never include an introduction message |
|
1113 | intro=never # never include an introduction message | |
1114 | intro=always # always include an introduction message |
|
1114 | intro=always # always include an introduction message | |
1115 |
|
1115 | |||
|
1116 | You can specify a template for flags to be added in subject prefixes. Flags | |||
|
1117 | specified by --flag option are exported as "{flags}" keyword: | |||
|
1118 | ||||
|
1119 | [patchbomb] | |||
|
1120 | flagtemplate = "{separate(' ', | |||
|
1121 | ifeq(branch, 'default', '', branch|upper), | |||
|
1122 | flags)}" | |||
|
1123 | ||||
1116 | You can set patchbomb to always ask for confirmation by setting |
|
1124 | You can set patchbomb to always ask for confirmation by setting | |
1117 | "patchbomb.confirm" to true. |
|
1125 | "patchbomb.confirm" to true. | |
1118 |
|
1126 |
@@ -2371,6 +2371,128 b' test multi-address parsing:' | |||||
2371 |
|
2371 | |||
2372 |
|
2372 | |||
2373 |
|
2373 | |||
|
2374 | test flag template: | |||
|
2375 | $ echo foo > intro.text | |||
|
2376 | $ hg email --date '1970-1-1 0:1' -n -f quux -t foo -r 0:1 \ | |||
|
2377 | > --desc intro.text --subject test \ | |||
|
2378 | > --config patchbomb.flagtemplate='R{rev}' | |||
|
2379 | this patch series consists of 2 patches. | |||
|
2380 | ||||
|
2381 | Cc: | |||
|
2382 | ||||
|
2383 | displaying [PATCH 0 of 2 R1] test ... | |||
|
2384 | Content-Type: text/plain; charset="us-ascii" | |||
|
2385 | MIME-Version: 1.0 | |||
|
2386 | Content-Transfer-Encoding: 7bit | |||
|
2387 | Subject: [PATCH 0 of 2 R1] test | |||
|
2388 | Message-Id: <patchbomb.60@*> (glob) | |||
|
2389 | User-Agent: Mercurial-patchbomb/* (glob) | |||
|
2390 | Date: Thu, 01 Jan 1970 00:01:00 +0000 | |||
|
2391 | From: quux | |||
|
2392 | To: foo | |||
|
2393 | ||||
|
2394 | foo | |||
|
2395 | ||||
|
2396 | displaying [PATCH 1 of 2 R0] a ... | |||
|
2397 | Content-Type: text/plain; charset="us-ascii" | |||
|
2398 | MIME-Version: 1.0 | |||
|
2399 | Content-Transfer-Encoding: 7bit | |||
|
2400 | Subject: [PATCH 1 of 2 R0] a | |||
|
2401 | X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab | |||
|
2402 | X-Mercurial-Series-Index: 1 | |||
|
2403 | X-Mercurial-Series-Total: 2 | |||
|
2404 | Message-Id: <8580ff50825a50c8f716.61@*> (glob) | |||
|
2405 | X-Mercurial-Series-Id: <8580ff50825a50c8f716.61@*> (glob) | |||
|
2406 | In-Reply-To: <patchbomb.60@*> (glob) | |||
|
2407 | References: <patchbomb.60@*> (glob) | |||
|
2408 | User-Agent: Mercurial-patchbomb/* (glob) | |||
|
2409 | Date: Thu, 01 Jan 1970 00:01:01 +0000 | |||
|
2410 | From: quux | |||
|
2411 | To: foo | |||
|
2412 | ||||
|
2413 | # HG changeset patch | |||
|
2414 | # User test | |||
|
2415 | # Date 1 0 | |||
|
2416 | # Thu Jan 01 00:00:01 1970 +0000 | |||
|
2417 | # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab | |||
|
2418 | # Parent 0000000000000000000000000000000000000000 | |||
|
2419 | a | |||
|
2420 | ||||
|
2421 | diff -r 000000000000 -r 8580ff50825a a | |||
|
2422 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
2423 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |||
|
2424 | @@ -0,0 +1,1 @@ | |||
|
2425 | +a | |||
|
2426 | ||||
|
2427 | displaying [PATCH 2 of 2 R1] b ... | |||
|
2428 | Content-Type: text/plain; charset="us-ascii" | |||
|
2429 | MIME-Version: 1.0 | |||
|
2430 | Content-Transfer-Encoding: 7bit | |||
|
2431 | Subject: [PATCH 2 of 2 R1] b | |||
|
2432 | X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9 | |||
|
2433 | X-Mercurial-Series-Index: 2 | |||
|
2434 | X-Mercurial-Series-Total: 2 | |||
|
2435 | Message-Id: <97d72e5f12c7e84f8506.62@*> (glob) | |||
|
2436 | X-Mercurial-Series-Id: <8580ff50825a50c8f716.61@*> (glob) | |||
|
2437 | In-Reply-To: <patchbomb.60@*> (glob) | |||
|
2438 | References: <patchbomb.60@*> (glob) | |||
|
2439 | User-Agent: Mercurial-patchbomb/* (glob) | |||
|
2440 | Date: Thu, 01 Jan 1970 00:01:02 +0000 | |||
|
2441 | From: quux | |||
|
2442 | To: foo | |||
|
2443 | ||||
|
2444 | # HG changeset patch | |||
|
2445 | # User test | |||
|
2446 | # Date 2 0 | |||
|
2447 | # Thu Jan 01 00:00:02 1970 +0000 | |||
|
2448 | # Node ID 97d72e5f12c7e84f85064aa72e5a297142c36ed9 | |||
|
2449 | # Parent 8580ff50825a50c8f716709acdf8de0deddcd6ab | |||
|
2450 | b | |||
|
2451 | ||||
|
2452 | diff -r 8580ff50825a -r 97d72e5f12c7 b | |||
|
2453 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
2454 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 | |||
|
2455 | @@ -0,0 +1,1 @@ | |||
|
2456 | +b | |||
|
2457 | ||||
|
2458 | ||||
|
2459 | test flag template plus --flag: | |||
|
2460 | $ hg email --date '1970-1-1 0:1' -n -f quux -t foo -r 0 --flag 'V2' \ | |||
|
2461 | > --config patchbomb.flagtemplate='{branch} {flags}' | |||
|
2462 | this patch series consists of 1 patches. | |||
|
2463 | ||||
|
2464 | Cc: | |||
|
2465 | ||||
|
2466 | displaying [PATCH default V2] a ... | |||
|
2467 | Content-Type: text/plain; charset="us-ascii" | |||
|
2468 | MIME-Version: 1.0 | |||
|
2469 | Content-Transfer-Encoding: 7bit | |||
|
2470 | Subject: [PATCH default V2] a | |||
|
2471 | X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab | |||
|
2472 | X-Mercurial-Series-Index: 1 | |||
|
2473 | X-Mercurial-Series-Total: 1 | |||
|
2474 | Message-Id: <8580ff50825a50c8f716.60@*> (glob) | |||
|
2475 | X-Mercurial-Series-Id: <8580ff50825a50c8f716.60@*> (glob) | |||
|
2476 | User-Agent: Mercurial-patchbomb/* (glob) | |||
|
2477 | Date: Thu, 01 Jan 1970 00:01:00 +0000 | |||
|
2478 | From: quux | |||
|
2479 | To: foo | |||
|
2480 | ||||
|
2481 | # HG changeset patch | |||
|
2482 | # User test | |||
|
2483 | # Date 1 0 | |||
|
2484 | # Thu Jan 01 00:00:01 1970 +0000 | |||
|
2485 | # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab | |||
|
2486 | # Parent 0000000000000000000000000000000000000000 | |||
|
2487 | a | |||
|
2488 | ||||
|
2489 | diff -r 000000000000 -r 8580ff50825a a | |||
|
2490 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
2491 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |||
|
2492 | @@ -0,0 +1,1 @@ | |||
|
2493 | +a | |||
|
2494 | ||||
|
2495 | ||||
2374 | test multi-byte domain parsing: |
|
2496 | test multi-byte domain parsing: | |
2375 | $ UUML=`$PYTHON -c 'import sys; sys.stdout.write("\374")'` |
|
2497 | $ UUML=`$PYTHON -c 'import sys; sys.stdout.write("\374")'` | |
2376 | $ HGENCODING=iso-8859-1 |
|
2498 | $ HGENCODING=iso-8859-1 |
General Comments 0
You need to be logged in to leave comments.
Login now