From d85fa243e03624cd4c49484a47b20053b2a313a8 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 7 May 2020 15:59:09 -0400 Subject: Add -P,--cherry-pick option to "b4 am" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets someone select a subset of patches in a series, e.g.: b4 am -P 1-3,5,7- [msgid] Suggested-by: Heiko Stübner Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'b4/__init__.py') diff --git a/b4/__init__.py b/b4/__init__.py index a7fb436..bf4898b 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -465,8 +465,8 @@ class LoreSeries: return slug - def save_am_mbox(self, mbx, noaddtrailers, covertrailers, - trailer_order=None, addmysob=False, addlink=False, linkmask=None): + def save_am_mbox(self, mbx, noaddtrailers, covertrailers, trailer_order=None, addmysob=False, + addlink=False, linkmask=None, cherrypick=None): usercfg = get_user_config() config = get_main_config() @@ -496,6 +496,10 @@ class LoreSeries: at = 1 atterrors = list() for lmsg in self.patches[1:]: + if cherrypick is not None and at not in cherrypick: + at += 1 + logger.debug(' skipped: [%s/%s] (not in cherrypick)', at, self.expected) + continue if lmsg is not None: if self.has_cover and covertrailers and self.patches[0].followup_trailers: lmsg.followup_trailers.update(self.patches[0].followup_trailers) @@ -1913,7 +1917,7 @@ def parse_int_range(intrange, upper=None): if n.isdigit(): yield int(n) elif n.find('<') == 0 and len(n) > 1 and n[1:].isdigit(): - yield from range(0, int(n[1:])) + yield from range(1, int(n[1:])) elif n.find('-') > 0: nr = n.split('-') if nr[0].isdigit() and nr[1].isdigit(): -- cgit v1.2.3