Show More
@@ -117,13 +117,17 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
117 | 117 | def prompt(prompt, default = None, rest = ': ', empty_ok = False): |
|
118 | 118 | if not ui.interactive: |
|
119 | 119 | return default |
|
120 | if default: prompt += ' [%s]' % default | |
|
120 | if default: | |
|
121 | prompt += ' [%s]' % default | |
|
121 | 122 | prompt += rest |
|
122 | 123 | while True: |
|
123 | 124 | r = ui.prompt(prompt, default=default) |
|
124 |
if r: |
|
|
125 |
|
|
|
126 | if empty_ok: return r | |
|
125 | if r: | |
|
126 | return r | |
|
127 | if default is not None: | |
|
128 | return default | |
|
129 | if empty_ok: | |
|
130 | return r | |
|
127 | 131 | ui.warn(_('Please enter a valid value.\n')) |
|
128 | 132 | |
|
129 | 133 | def confirm(s, denial): |
@@ -149,27 +153,33 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
149 | 153 | body = '' |
|
150 | 154 | for line in patch: |
|
151 | 155 | if line.startswith('#'): |
|
152 |
if line.startswith('# Node ID'): |
|
|
156 | if line.startswith('# Node ID'): | |
|
157 | node = line.split()[-1] | |
|
153 | 158 | continue |
|
154 | 159 | if (line.startswith('diff -r') |
|
155 | 160 | or line.startswith('diff --git')): |
|
156 | 161 | break |
|
157 | 162 | desc.append(line) |
|
158 |
if not node: |
|
|
163 | if not node: | |
|
164 | raise ValueError | |
|
159 | 165 | |
|
160 | 166 | #body = ('\n'.join(desc[1:]).strip() or |
|
161 | 167 | # 'Patch subject is complete summary.') |
|
162 | 168 | #body += '\n\n\n' |
|
163 | 169 | |
|
164 | 170 | if opts['plain']: |
|
165 |
while patch and patch[0].startswith('# '): |
|
|
166 |
|
|
|
167 | while patch and not patch[0].strip(): patch.pop(0) | |
|
171 | while patch and patch[0].startswith('# '): | |
|
172 | patch.pop(0) | |
|
173 | if patch: | |
|
174 | patch.pop(0) | |
|
175 | while patch and not patch[0].strip(): | |
|
176 | patch.pop(0) | |
|
168 | 177 | if opts['diffstat']: |
|
169 | 178 | body += cdiffstat('\n'.join(desc), patch) + '\n\n' |
|
170 | 179 | if opts['attach']: |
|
171 | 180 | msg = email.MIMEMultipart.MIMEMultipart() |
|
172 | if body: msg.attach(email.MIMEText.MIMEText(body, 'plain')) | |
|
181 | if body: | |
|
182 | msg.attach(email.MIMEText.MIMEText(body, 'plain')) | |
|
173 | 183 | p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch') |
|
174 | 184 | binnode = bin(node) |
|
175 | 185 | # if node is mq patch, it will have patch file name as tag |
@@ -315,7 +325,8 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
315 | 325 | body = '' |
|
316 | 326 | if opts['diffstat']: |
|
317 | 327 | d = cdiffstat(_('Final summary:\n'), jumbo) |
|
318 |
if d: |
|
|
328 | if d: | |
|
329 | body = '\n' + d | |
|
319 | 330 | |
|
320 | 331 | body = getdescription(body, sender) |
|
321 | 332 | msg = email.MIMEText.MIMEText(body) |
@@ -383,8 +394,10 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
383 | 394 | start_time = (start_time[0] + 1, start_time[1]) |
|
384 | 395 | m['From'] = sender |
|
385 | 396 | m['To'] = ', '.join(to) |
|
386 | if cc: m['Cc'] = ', '.join(cc) | |
|
387 |
|
|
|
397 | if cc: | |
|
398 | m['Cc'] = ', '.join(cc) | |
|
399 | if bcc: | |
|
400 | m['Bcc'] = ', '.join(bcc) | |
|
388 | 401 | if opts['test']: |
|
389 | 402 | ui.status('Displaying ', m['Subject'], ' ...\n') |
|
390 | 403 | ui.flush() |
General Comments 0
You need to be logged in to leave comments.
Login now