##// END OF EJS Templates
patchbomb: pass around ui and revs that are needed for flag template...
Yuya Nishihara -
r31186:83fa357e default
parent child Browse files
Show More
@@ -135,7 +135,7 b' def introwanted(ui, opts, number):'
135 135 intro = 1 < number
136 136 return intro
137 137
138 def _formatprefix(flags, idx, total, numbered):
138 def _formatprefix(ui, repo, rev, flags, idx, total, numbered):
139 139 """build prefix to patch subject"""
140 140 flag = ' '.join(flags)
141 141 if flag:
@@ -147,7 +147,7 b' def _formatprefix(flags, idx, total, num'
147 147 tlen = len(str(total))
148 148 return '[PATCH %0*d of %d%s]' % (tlen, idx, total, flag)
149 149
150 def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, numbered,
150 def makepatch(ui, repo, rev, patchlines, opts, _charsets, idx, total, numbered,
151 151 patchname=None):
152 152
153 153 desc = []
@@ -214,7 +214,8 b' def makepatch(ui, repo, patchlines, opts'
214 214 else:
215 215 msg = mail.mimetextpatch(body, display=opts.get('test'))
216 216
217 prefix = _formatprefix(opts.get('flag'), idx, total, numbered)
217 prefix = _formatprefix(ui, repo, rev, opts.get('flag'), idx, total,
218 numbered)
218 219 subj = desc[0].strip().rstrip('. ')
219 220 if not numbered:
220 221 subj = ' '.join([prefix, opts.get('subject') or subj])
@@ -311,14 +312,16 b' def _getbundlemsgs(repo, sender, bundle,'
311 312 msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
312 313 return [(msg, subj, None)]
313 314
314 def _makeintro(repo, sender, patches, **opts):
315 def _makeintro(repo, sender, revs, patches, **opts):
315 316 """make an introduction email, asking the user for content if needed
316 317
317 318 email is returned as (subject, body, cumulative-diffstat)"""
318 319 ui = repo.ui
319 320 _charsets = mail._charsets(ui)
320 321
321 prefix = _formatprefix(opts.get('flag'), 0, len(patches), numbered=True)
322 # use the last revision which is likely to be a bookmarked head
323 prefix = _formatprefix(ui, repo, revs.last(), opts.get('flag'),
324 0, len(patches), numbered=True)
322 325 subj = (opts.get('subject') or
323 326 prompt(ui, '(optional) Subject: ', rest=prefix, default=''))
324 327 if not subj:
@@ -357,7 +360,7 b' def _getpatchmsgs(repo, sender, revs, pa'
357 360
358 361 # build the intro message, or skip it if the user declines
359 362 if introwanted(ui, opts, len(patches)):
360 msg = _makeintro(repo, sender, patches, **opts)
363 msg = _makeintro(repo, sender, revs, patches, **opts)
361 364 if msg:
362 365 msgs.append(msg)
363 366
@@ -366,10 +369,11 b' def _getpatchmsgs(repo, sender, revs, pa'
366 369
367 370 # now generate the actual patch messages
368 371 name = None
369 for i, p in enumerate(patches):
372 assert len(revs) == len(patches)
373 for i, (r, p) in enumerate(zip(revs, patches)):
370 374 if patchnames:
371 375 name = patchnames[i]
372 msg = makepatch(ui, repo, p, opts, _charsets, i + 1,
376 msg = makepatch(ui, repo, r, p, opts, _charsets, i + 1,
373 377 len(patches), numbered, name)
374 378 msgs.append(msg)
375 379
General Comments 0
You need to be logged in to leave comments. Login now