diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-07 15:59:09 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-07 15:59:09 -0400 |
commit | d85fa243e03624cd4c49484a47b20053b2a313a8 (patch) | |
tree | 9cab3406eb43d79d0e4101b5e9038fa317933858 /b4/__init__.py | |
parent | 9ead0d56c5f282d700181873b185c4e868f09350 (diff) | |
download | b4-d85fa243e03624cd4c49484a47b20053b2a313a8.tar.gz |
Add -P,--cherry-pick option to "b4 am"
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 <heiko@sntech.de>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/__init__.py')
-rw-r--r-- | b4/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
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(): |