##// END OF EJS Templates
fix patchbomb prompt when sending series of patches
Alexander Solovyov -
r9612:d051db8e default
parent child Browse files
Show More
@@ -76,9 +76,11 b' from mercurial import cmdutil, commands,'
76 from mercurial.i18n import _
76 from mercurial.i18n import _
77 from mercurial.node import bin
77 from mercurial.node import bin
78
78
79 def prompt(ui, prompt, default=None, rest=': ', empty_ok=False):
79 def prompt(ui, prompt, default='', rest=': ', empty_ok=False):
80 if not ui.interactive():
80 if not ui.interactive():
81 if default or empty_ok:
81 return default
82 return default
83 raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest)))
82 if default:
84 if default:
83 prompt += ' [%s]' % default
85 prompt += ' [%s]' % default
84 prompt += rest
86 prompt += rest
@@ -331,8 +333,7 b' def patchbomb(ui, repo, *revs, **opts):'
331 subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag)
333 subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag)
332 else:
334 else:
333 subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches))
335 subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches))
334 subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj,
336 subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj)
335 default='None')
336
337
337 body = ''
338 body = ''
338 if opts.get('diffstat'):
339 if opts.get('diffstat'):
@@ -152,6 +152,9 b" hg email --date '1970-1-1 0:1' -n -f quu"
152 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz \
152 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz \
153 -r 0:1 | fixheaders
153 -r 0:1 | fixheaders
154
154
155 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar --in-reply-to baz \
156 -s test -r 0:1 | fixheaders
157
155 echo "% test single flag for single patch"
158 echo "% test single flag for single patch"
156 hg email --date '1970-1-1 0:1' -n --flag fooFlag -f quux -t foo -c bar -s test \
159 hg email --date '1970-1-1 0:1' -n --flag fooFlag -f quux -t foo -c bar -s test \
157 -r 2 | fixheaders
160 -r 2 | fixheaders
@@ -1177,17 +1177,20 b' diff -r eae5fcf795ee -r e317db6a6f28 .hg'
1177 +ff2c9fa2018b15fa74b33363bda9527323e2a99f two
1177 +ff2c9fa2018b15fa74b33363bda9527323e2a99f two
1178 +ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff
1178 +ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff
1179
1179
1180 abort: Subject:[PATCH 0 of 2] Please enter a valid value
1181 This patch series consists of 2 patches.
1182
1180 This patch series consists of 2 patches.
1183 This patch series consists of 2 patches.
1181
1184
1182
1185
1183 Write the introductory message for the patch series.
1186 Write the introductory message for the patch series.
1184
1187
1185
1188
1186 Displaying [PATCH 0 of 2] None ...
1189 Displaying [PATCH 0 of 2] test ...
1187 Content-Type: text/plain; charset="us-ascii"
1190 Content-Type: text/plain; charset="us-ascii"
1188 MIME-Version: 1.0
1191 MIME-Version: 1.0
1189 Content-Transfer-Encoding: 7bit
1192 Content-Transfer-Encoding: 7bit
1190 Subject: [PATCH 0 of 2] None
1193 Subject: [PATCH 0 of 2] test
1191 Message-Id: <patchbomb.60@
1194 Message-Id: <patchbomb.60@
1192 In-Reply-To: <baz>
1195 In-Reply-To: <baz>
1193 References: <baz>
1196 References: <baz>
General Comments 0
You need to be logged in to leave comments. Login now