Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: "Kernel.org Tools" <tools@kernel.org>, kernel-team@meta.com
Subject: Re: [PATCH b4] prep: add --cleanup-older-than option to clean up stale branches
Date: Tue, 4 Aug 2026 02:26:56 -0700	[thread overview]
Message-ID: <anGvfnqMfavE6HKk@gmail.com> (raw)
In-Reply-To: <178578404438.357789.17589596756429737801.b4-review@b4>

On Mon, Aug 03, 2026 at 07:07:24PM +0000, Konstantin Ryabitsev wrote:
> > B4 is so useful that I have too many branches now, create a way to
> > easily remove old branches.
> > 
> > Add a new --cleanup-older-than DAYS option that archives and removes
> > prep-tracked branches whose latest commit is older than the specified
> > number of days. Each matching branch goes through the normal per-branch
> > confirmation prompt.
> 
> Sorry this sat so long -- I missed it initially and just caught up to it
> now going over old series submissions. It needs rebasing, but I don't
> see why not to take it.

No problem, thanks for getting to it. I am using this on my b4, and this
has proved valuable to cleanup old branches. 

I will rebase and resend.

> > diff --git a/src/b4/command.py b/src/b4/command.py
> > index ca7f238..2d263de 100644
> > --- a/src/b4/command.py
> > +++ b/src/b4/command.py
> > @@ -401,6 +401,8 @@ def setup_parser() -> argparse.ArgumentParser:
> >                         help='Show series info in a format that can be passed to other commands.')
> >      spp_g.add_argument('--cleanup', metavar='BRANCHNAME', nargs='*',
> >                         help='Archive and remove prep-tracked branches and all associated sent/ tags')
> > +    sp_prep.add_argument('--cleanup-older-than', metavar='DAYS', type=int, default=None,
> > +                         help='Archive prep-tracked branches older than DAYS days')
> >  
> >      ag_prepn = sp_prep.add_argument_group('Create new branch', 'Create a new branch for working on patch series')
> >      ag_prepn.add_argument('-n', '--new', dest='new_series_name',
> 
> Suggestion: add it to `spp_g` instead of straight to sp_prep
> (`spp_g.add_argument('--cleanup-older-than', ...)`), right next to
> `--cleanup`.


Will do. It turns out not to be purely cosmetic: because the option sits
outside the mutually exclusive group and cmd_prep dispatches it before
--cleanup, argparse accepts

    b4 prep --cleanup b4/foo --cleanup-older-than 30
    b4 prep -n newtopic --cleanup-older-than 30

and silently ignores --cleanup / -n in both cases. Moving it into spp_g
makes argparse reject them outright.

> Minor nit: the help text says "Archive prep-tracked branches older than
> DAYS days", but the operation also removes the branch (like
> `--cleanup`'s help text, which says "Archive and remove..."). Worth
> aligning the wording so it's not surprising that the branch is deleted,
> not just archived.

Agreed, I'll align the wording with --cleanup's "Archive and remove...".


      reply	other threads:[~2026-08-04  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 11:58 [PATCH b4] prep: add --cleanup-older-than option to clean up stale branches Breno Leitao
2026-08-03 19:07 ` Konstantin Ryabitsev
2026-08-04  9:26   ` Breno Leitao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anGvfnqMfavE6HKk@gmail.com \
    --to=leitao@debian.org \
    --cc=kernel-team@meta.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox