[PATCH 4 of 6] patchbomb: build patch texts by _getpatchmsgs()

Yuya Nishihara yuya at tcha.org
Tue Mar 7 09:35:36 EST 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1488014884 -32400
#      Sat Feb 25 18:28:04 2017 +0900
# Node ID 619df871ab3248552a7ac982c3916a7632639acd
# Parent  3ce342fc93179cfec1b85722f79d9861cabb52de
patchbomb: build patch texts by _getpatchmsgs()

Now _getpatchmsgs() knows revision numbers, which allows us to generate flags
by applying a template to changectx objects.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -340,7 +340,7 @@ def _makeintro(repo, sender, patches, **
                                      opts.get('test'))
     return (msg, subj, diffstat)
 
-def _getpatchmsgs(repo, sender, patches, patchnames=None, **opts):
+def _getpatchmsgs(repo, sender, revs, patchnames=None, **opts):
     """return a list of emails from a list of patches
 
     This involves introduction message creation if necessary.
@@ -349,6 +349,7 @@ def _getpatchmsgs(repo, sender, patches,
     """
     ui = repo.ui
     _charsets = mail._charsets(ui)
+    patches = list(_getpatches(repo, revs, **opts))
     msgs = []
 
     ui.write(_('this patch series consists of %d patches.\n\n')
@@ -597,8 +598,7 @@ def email(ui, repo, *revs, **opts):
         bundleopts.pop('bundle', None)  # already processed
         msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts)
     else:
-        _patches = list(_getpatches(repo, revs, **opts))
-        msgs = _getpatchmsgs(repo, sender, _patches, **opts)
+        msgs = _getpatchmsgs(repo, sender, revs, **opts)
 
     showaddrs = []
 


More information about the Mercurial-devel mailing list