equal
deleted
inserted
replaced
102 ui.write(s, '\n') |
102 ui.write(s, '\n') |
103 ans = prompt(ui, _('does the diffstat above look okay?'), 'y') |
103 ans = prompt(ui, _('does the diffstat above look okay?'), 'y') |
104 if not ans.lower().startswith('y'): |
104 if not ans.lower().startswith('y'): |
105 raise util.Abort(_('diffstat rejected')) |
105 raise util.Abort(_('diffstat rejected')) |
106 return s |
106 return s |
|
107 |
|
108 def introneeded(opts, number): |
|
109 '''is an introductory message required?''' |
|
110 return number > 1 or opts.get('intro') or opts.get('desc') |
107 |
111 |
108 def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None): |
112 def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None): |
109 |
113 |
110 desc = [] |
114 desc = [] |
111 node = None |
115 node = None |
168 flag = ' '.join(opts.get('flag')) |
172 flag = ' '.join(opts.get('flag')) |
169 if flag: |
173 if flag: |
170 flag = ' ' + flag |
174 flag = ' ' + flag |
171 |
175 |
172 subj = desc[0].strip().rstrip('. ') |
176 subj = desc[0].strip().rstrip('. ') |
173 if total == 1 and not opts.get('intro'): |
177 if not introneeded(opts, total): |
174 subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) |
178 subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) |
175 else: |
179 else: |
176 tlen = len(str(total)) |
180 tlen = len(str(total)) |
177 subj = '[PATCH %0*d of %d%s] %s' % (tlen, idx, total, flag, subj) |
181 subj = '[PATCH %0*d of %d%s] %s' % (tlen, idx, total, flag, subj) |
178 msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) |
182 msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) |
327 name = patchnames[i] |
331 name = patchnames[i] |
328 msg = makepatch(ui, repo, p, opts, _charsets, i + 1, |
332 msg = makepatch(ui, repo, p, opts, _charsets, i + 1, |
329 len(patches), name) |
333 len(patches), name) |
330 msgs.append(msg) |
334 msgs.append(msg) |
331 |
335 |
332 if len(patches) > 1 or opts.get('intro'): |
336 if introneeded(opts, len(patches)): |
333 tlen = len(str(len(patches))) |
337 tlen = len(str(len(patches))) |
334 |
338 |
335 flag = ' '.join(opts.get('flag')) |
339 flag = ' '.join(opts.get('flag')) |
336 if flag: |
340 if flag: |
337 subj = '[PATCH %0*d of %d %s]' % (tlen, 0, len(patches), flag) |
341 subj = '[PATCH %0*d of %d %s]' % (tlen, 0, len(patches), flag) |