### Install b4 from a git checkout Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install the latest development version of b4 from a local git clone using pipx. This requires cloning the repository and then installing it. ```none git clone https://git.kernel.org/pub/scm/utils/b4/b4.git cd b4 git submodule update --init pipx install . ``` -------------------------------- ### Initialize Submodules and Install Requirements Source: https://github.com/mricon/b4/blob/master/README.rst Commands to run after cloning the b4 repository to initialize submodules and install necessary dependencies. ```bash git submodule update --init ``` ```bash python3 -m pip install -r requirements.txt ``` -------------------------------- ### Install b4 with pipx Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 using pipx, which installs CLI tools into isolated environments. This is the recommended method for installing from PyPI. ```none pipx install b4 ``` -------------------------------- ### B4 CI Configuration Examples Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Configuration examples for b4's CI integration, showing how to set built-in or custom per-patch and per-series check commands. ```ini [b4] # Built-in checkpatch (auto-detected, but can be set explicitly) review-perpatch-check-cmd = _builtin_checkpatch # Custom per-patch check review-perpatch-check-cmd = /path/to/my-perpatch-check.py # Per-series check (cover letter piped to stdin) review-series-check-cmd = /path/to/my-series-check.py ``` -------------------------------- ### Install b4 using apt Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 using the apt package manager. This is suitable for Debian-based distributions. ```none # apt install b4 ``` -------------------------------- ### Install Latest Master with Pip Source: https://github.com/mricon/b4/blob/master/README.rst Install the latest development version from the master branch. Use with caution as it may be unstable. ```bash python3 -m pip install git+https://git.kernel.org/pub/scm/utils/b4/b4.git@master ``` -------------------------------- ### Example Output of mbox Command Source: https://github.com/mricon/b4/blob/master/docs/maintainer/mbox.md This example demonstrates the typical output when using the 'b4 mbox' command, showing the download process and the final saved filename in mailbox format. ```shell $ b4 mbox 20200313231252.64999-1-keescook@chromium.org Grabbing thread from lore.kernel.org/all/20200313231252.64999-1-keescook%40chromium.org/t.mbox.gz 5 messages in the thread Saved ./20200313231252.64999-1-keescook@chromium.org.mbx ``` -------------------------------- ### Git Diff Example Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-custody-ref-unordered.txt This snippet displays a git diff output, indicating a change from 'junk1' to 'junk2' in the file 'b4/junk.py'. This is part of the test setup. ```git diff diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): -junk1 +junk2 ``` -------------------------------- ### Install b4 using dnf Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 using the dnf package manager. This is suitable for distributions that use dnf. ```none # dnf install b4 ``` -------------------------------- ### Install Latest Release with Pip Source: https://github.com/mricon/b4/blob/master/README.rst Install the latest stable release of b4 using pip. ```bash python3 -m pip install b4 ``` -------------------------------- ### Install b4 from git checkout with TUI support Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 from a local git clone with TUI support using pipx. This includes the necessary dependencies for TUI features. ```none pipx install .[tui] ``` -------------------------------- ### b4 shazam merge template example Source: https://github.com/mricon/b4/blob/master/docs/config.md An example of content for a merge commit template file used by `b4 shazam`. Lines starting with '#' are ignored. Placeholders like `${seriestitle}` are substituted during commit creation. ```none # Lines starting with '#' will be removed before invoking git-merge # This is the first line (title) of the merge # ${seriestitle}: will be a cleaned up subject of the cover # letter or the first patch in the series. # ${patch_or_series}: will say "patch" if a single patch or # "patch series" if more than one Merge ${patch_or_series} "${seriestitle}" ${authorname} <${authoremail}> says: # This will be the entirety of the cover letter minus anything # below the "-- \n" signature line. You will almost certainly # want to edit it down to only include the relevant info. ${covermessage} # This will contain a lore link to the patches in question Link: ${midurl} # git-merge will append any additional information here, depending # on the flags you used to invoke it (e.g. --log, --signoff, etc) ``` -------------------------------- ### Vim Syntax Highlighting Setup Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Instructions for setting up b4 review syntax highlighting in Vim by copying or symlinking files into the Vim configuration directory. ```shell mkdir -p ~/.vim/syntax ~/.vim/ftdetect ~/.vim/ftplugin ln -s /path/to/b4/misc/vim/syntax/b4review.vim ~/.vim/syntax/ ln -s /path/to/b4/misc/vim/ftdetect/b4review.vim ~/.vim/ftdetect/ ln -s /path/to/b4/misc/vim/ftplugin/b4review.vim ~/.vim/ftplugin/ ``` -------------------------------- ### Install b4 using uv Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 using uv, a fast alternative to pipx. This command installs the tool into an isolated environment. ```none uv tool install b4 ``` -------------------------------- ### Install b4 with TUI dependencies using uv Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 with TUI dependencies using uv. This command ensures all necessary components for TUI features are installed. ```none uv tool install b4[tui] ``` -------------------------------- ### Basic Follow-up Trailer Example Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-custody-ref-with-ignored.txt Illustrates a simple follow-up trailer in a Git commit message. This is useful for indicating related commits or discussions. ```git Follow-up trailer collating test. Link: https://msgid.link/some@msgid.here Reviewed-by: Original Reviewer Signed-off-by: Original Submitter Suggested-by: Friendly Suggester Fixes: abcdef01234567890 Link: https://lore.kernel.org/other@msgid.here # bug discussion Tested-by: Followup Reviewer2 Cc: Dev Eloper1 Cc: Dev Eloper2 Cc: Some List Signed-off-by: Test Override ``` -------------------------------- ### Install b4 with TUI dependencies using pipx Source: https://github.com/mricon/b4/blob/master/docs/installing.md Install b4 along with TUI dependencies required for the 'b4 review tui' command using pipx. ```none pipx install b4[tui] ``` -------------------------------- ### Thank-You Message Template Example Source: https://github.com/mricon/b4/blob/master/docs/config.md Define templates for generating thank-you messages. Supports variables like ${sentdate}, ${fromname}, ${quote}, ${branch}, and ${treename}. Lines starting with '#' are removed. This example shows templates for pull requests and patch series. ```none # Lines starting with '#' will be removed # You can have two different templates for responding to # pull requests and for responding to patch series, though # in reality the difference will probably be one word: # "merged/pulled" vs. "applied". # Keeping it short and sweet is preferred. # On ${sentdate}, ${fromname} wrote: # quote will be limited to 5-6 lines, respecting paragraphs ${quote} # You can also use ${branch} and ${treename} if you set # b4.thanks-treename in your config, e.g.: #Applied to ${treename} (${branch}), thanks! # # If you track multiple remotes in the same repo, then you can add # the following values to [remote], to be loaded when you run # b4 ty -b foo/branchname: # [remote "foo"] # url = https://... # fetch = ... # b4-treename = uname/sound.git # b4-commit-url-mask = https://git.kernel.org/uname/sound/c/%.8s Applied to ${branch}, thanks! # for patch series, the summary is a list of each patch with a link # to the commit id in your tree, so you probably want to set # b4.thanks-commit-url-mask in gitconfig to a value like: # [b4] # thanks-commit-url-mask = https://git.kernel.org/username/c/%.12s # # Check this page for info on convenient URL shorteners: # https://korg.wiki.kernel.org/userdoc/git-url-shorterners ${summary} Best regards, -- # if ~/.signature exists, it will be put here, otherwise # the contents will be "user.name " from gitconfig ${signature} ``` -------------------------------- ### Configure Patchwork Server URL Source: https://github.com/mricon/b4/blob/master/docs/config.md Set the `pw-url` to the top-level URL of your patchwork installation, not the patch listing. For example, 'https://patchwork.kernel.org/'. ```none pw-url = https://patchwork.kernel.org/ ``` -------------------------------- ### Example Per-Patch Review File Content Source: https://github.com/mricon/b4/blob/master/misc/agent-reviewer.md Illustrates the structure of a per-patch review file (NNNN.txt), including free-form text and annotated diffs with comments. ```text One NULL-pointer dereference issue in the error path The kzalloc() call is not checked before the pointer is dereferenced, which could cause a crash under memory pressure. > diff --git a/lib/helpers.c b/lib/helpers.c > index abc1234..def5678 100644 > --- a/lib/helpers.c > +++ b/lib/helpers.c > @@ -30,6 +30,8 @@ void setup_helper(struct ctx *ctx) > int ret; > > + ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); kzalloc() can return NULL here. The caller dereferences the pointer unconditionally on line 36, which would be a NULL-pointer dereference under memory pressure. > + ptr->field = value; > return 0; ``` -------------------------------- ### Example Commit with Follow-up Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-custody-ref-unordered.txt This snippet shows a sample commit message with various follow-up trailers. It includes standard trailers and demonstrates how multiple instances of the same trailer type (e.g., Link, Reviewed-by, Cc) are handled. ```git commit message Follow-up trailer collating test. Link: https://msgid.link/some@msgid.here Reviewed-by: Original Reviewer Signed-off-by: Original Submitter Suggested-by: Friendly Suggester Fixes: abcdef01234567890 Link: https://lore.kernel.org/other@msgid.here # bug discussion Reviewed-by: Followup Reviewer1 Tested-by: Followup Reviewer2 Cc: Dev Eloper1 Cc: Dev Eloper2 Cc: Some List Signed-off-by: Test Override ``` -------------------------------- ### Example of reviewing trailers in editor Source: https://github.com/mricon/b4/blob/master/docs/contributor/trailers.md This is an example of how trailers are displayed in your editor when using `b4 trailers -u -i`. You can reject a trailer by changing its leading '+' to an 'x'. ```none - [PATCH 1/2] Add frobnicator support + Reviewed-by: Foo Bar # via: https://lore.kernel.org/r/msgid@example.com ``` -------------------------------- ### Install B4 with Shell Completion Source: https://github.com/mricon/b4/blob/master/README.rst Install b4 along with shell completion support using pip. This enables features like command-line argument autocompletion. ```bash python3 -m pip install b4[completion] ``` -------------------------------- ### Git Patch File Example Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-non-git-patch-with-comments-ref-defaults.txt A sample Git patch file demonstrating follow-up trailers, comments, and a code diff. This format is used for submitting code changes. ```git-patch From git@z Thu Jan 1 00:00:00 1970 Subject: [PATCH] Simple test From: Test Test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Follow-up trailer collating test. Fixes: abcdef01234567890 Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter Reviewed-by: Followup Reviewer1 --- This contains comments that are included below the message, but there is no diffstat. --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@@ def junk(): -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Prepare and Send Patches with b4 Source: https://github.com/mricon/b4/blob/master/CONTRIBUTING.rst Commands to use b4 for preparing and sending patches. Ensure b4 is installed and configured before use. ```bash b4 prep ``` ```bash b4 send ``` -------------------------------- ### Prepare New Feature Branch Source: https://github.com/mricon/b4/blob/master/src/b4/man/b4.1.rst Starts a new branch for a feature, forking from a specific tag, and prepares it for patch additions. ```bash b4 prep -n my-new-feature -f v6.4-rc4 ``` -------------------------------- ### Customizing checkpatch command Source: https://github.com/mricon/b4/blob/master/docs/maintainer/am-shazam.md Example of how to configure a custom checkpatch command using the b4.am-perpatch-check-cmd setting. ```ini [b4] am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --strict ``` -------------------------------- ### Launch b4 Review TUI Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Starts the text-based user interface for reviewing patch series. This command should be run after enrolling the repository. ```bash b4 review tui ``` -------------------------------- ### Upgrade B4 from PyPI Source: https://github.com/mricon/b4/blob/master/README.rst Upgrade an existing b4 installation to the latest version available on PyPI. ```bash python3 -m pip install --upgrade b4 ``` -------------------------------- ### Mutt Configuration for Stdin Pipe Separator Source: https://github.com/mricon/b4/blob/master/docs/maintainer/mbox.md Example configuration for mutt to set a pipe separator for use with b4. ```muttrc set pipe_sep = "\n---randomstr---\n" ``` -------------------------------- ### Example B4 Thanks PR Template Content Source: https://github.com/mricon/b4/blob/master/docs/config.md This snippet shows the expected content format for the `b4.thanks-pr-template` configuration file. It includes placeholders for dates, names, quotes, branches, and summaries, along with comments explaining their usage. ```none # Lines starting with '#' will be removed # You can have two different templates for responding to # pull requests and for responding to patch series, though # in reality the difference will probably be one word: # "merged/pulled" vs. "applied". # Keeping it short and sweet is preferred. # On ${sentdate}, ${fromname} wrote: # quote will be limited to 5-6 lines, respecting paragraphs ${quote}
# You can also use ${branch} and ${treename} if you set # b4.thanks-treename in your config, e.g.: #Merged into ${treename} (${branch}), thanks! # # If you track multiple remotes in the same repo, then you can add # the following values to [remote], to be loaded when you run # b4 ty -b foo/branchname: # [remote "foo"] # url = https://... # fetch = ... # b4-treename = uname/sound.git # b4-commit-url-mask = https://git.kernel.org/uname/sound/c/%.8s Merged into ${branch}, thanks!
# for pull requests, the summary is a one-liner with the merge commit, # so you probably want to set b4.thanks-commit-url-mask in gitconfig # to a value like: # [b4] # thanks-commit-url-mask = https://git.kernel.org/username/c/%.12s # # Check this page for info on convenient URL shorteners: # https://korg.wiki.kernel.org/userdoc/git-url-shorterners ${summary}
Best regards, -- # if ~/.signature exists, it will be put here, otherwise # the contents will be "user.name " from gitconfig ${signature} ``` -------------------------------- ### Configure Patchwork Project Name Source: https://github.com/mricon/b4/blob/master/docs/config.md Use `pw-project` to specify the name of the patchwork project, matching the URL sub-path. For example, 'linux-usb'. ```none pw-project = linux-usb ``` -------------------------------- ### Reviewing a Series Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Select a series and press 'r' to start reviewing. B4 fetches the thread, checks attestation, and creates a review branch. The interface shows patches on the left and diffs on the right. ```bash r ``` -------------------------------- ### Upgrade b4 with pipx Source: https://github.com/mricon/b4/blob/master/docs/installing.md Upgrade an existing b4 installation to the latest version using pipx. ```none pipx upgrade b4 ``` -------------------------------- ### Basic b4 PR Usage Source: https://github.com/mricon/b4/blob/master/docs/maintainer/pr.md Use this command to fetch a pull request. By default, it fetches into FETCH_HEAD. Ensure b4 is installed and configured. ```none b4 pr ``` -------------------------------- ### Symlink b4.sh to user bin Source: https://github.com/mricon/b4/blob/master/docs/installing.md Run b4 directly from a git checkout without installing by creating a symbolic link from b4.sh to your user's bin directory. ```none ln -sf $HOME/path/to/b4/b4.sh ~/bin/b4 ``` -------------------------------- ### Email with Standard Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-test-extinfo.txt An example email showcasing standard trailer fields like Reported-by, Reviewed-by, Fixes, Tested-by, and Link. ```email From test@example.com Tue Aug 30 11:19:07 2022 From: Test Test Subject: [PATCH] Simple test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-ID: This is a simple trailer parsing test. Reported-by: Some, One Reviewed-by: Bogus Bupkes [for the parts that are bogus] Fixes: abcdef01234567890 Tested-by: Some Person Link: https://msgid.link/some@msgid.here # initial submission Signed-off-by: Wrapped Persontrailer --- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@@ def junk(): -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Git Commit Patch with Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-with-diffstat-ref-defaults.txt Example of a git patch file demonstrating follow-up trailers like Fixes, Reviewed-by, Link, and Signed-off-by. ```git From git@z Thu Jan 1 00:00:00 1970 Subject: [PATCH] Simple test From: Test Test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Follow-up trailer collating test. Fixes: abcdef01234567890 Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter Reviewed-by: Followup Reviewer1 --- b4/junk.py | 1 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@@ -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Configure AI Review Agent Command Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Set the git configuration keys for the review agent command and prompt path. This example shows how to configure Claude as the review agent. ```none [b4] review-agent-command = claude --add-dir .git --allowedTools 'Bash(git:*) Read Glob Grep Write(.git/b4-review/**) Edit(.git/b4-review/**)' -- review-agent-prompt-path = .git/agent-reviewer.md ``` -------------------------------- ### Configure Mutt to Track Series Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Example of how to configure the mutt email client to pipe a message to 'b4 review track' when a specific key (e.g., '8') is pressed. ```vim macro index 8 "b4 review track" ``` -------------------------------- ### Python Example for Accessing Tracking File Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md This Python snippet demonstrates how to access and parse the B4_TRACKING_FILE environment variable to retrieve series tracking data, such as branch tips for KernelCI queries. ```python import json, os tracking = json.load(open(os.environ['B4_TRACKING_FILE'])) tips = tracking.get('series', {}).get('branch-tips', []) for tip in tips: # tip has 'date', 'branch', 'sha' query_kernelci(tip['sha'], tip['branch']) ``` -------------------------------- ### Configure GitHub Copilot CLI for AI Review Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Configure the review agent command and prompt path to use GitHub Copilot CLI for AI-assisted review. This setup uses autopilot and yolo modes. ```git config [b4] review-agent-command = copilot --autopilot --yolo review-agent-prompt-path = .git/agent-reviewer.md ``` -------------------------------- ### Example of a non-matching trailer Source: https://github.com/mricon/b4/blob/master/docs/maintainer/am-shazam.md Illustrates a scenario where the 'From' header email address does not match the trailer's email address, causing b4 to ignore the trailer by default. ```none From: Alice Maintainer Subject: Re: [PATCH v3 3/3] Some patch title > [...] Reviewed-by: Alice Maintainer ``` -------------------------------- ### Apply Specific Textual TUI Themes Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Examples of applying specific Textual TUI themes using the TEXTUAL_THEME environment variable. These demonstrate different aesthetic options for the TUI. ```shell TEXTUAL_THEME=textual-dark b4 review tui ``` ```shell TEXTUAL_THEME=dracula b4 review tui ``` ```shell TEXTUAL_THEME=textual-ansi b4 review tui ``` -------------------------------- ### Reinstall b4 from git after updates Source: https://github.com/mricon/b4/blob/master/docs/installing.md Reinstall b4 from a local git checkout using pipx after pulling new changes. The --force flag ensures the installation is updated. ```none git pull origin master git submodule update pipx install --force . ``` -------------------------------- ### Configure Gemini CLI for AI Review Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Configure the review agent command and prompt path to use Gemini CLI for AI-assisted review. This setup includes sandbox mode and specified allowed tools. ```git config [b4] review-agent-command = gemini --sandbox --allowed-tools 'Bash(git:*) Read Glob Grep Write(.git/b4-review/**) Edit(.git/b4-review/**)' review-agent-prompt-path = .git/agent-reviewer.md ``` -------------------------------- ### Example of Interactive Review Content Source: https://github.com/mricon/b4/blob/master/docs/maintainer/ty.md When using 'b4 ty -i', your editor will display a list of detected series and pull requests, pre-marked to send. Review the 'Sent' and 'Applied' timestamps, and the commit IDs to confirm matches. Change the leading '+' to 'x' to skip sending a thank-you. ```text + [PATCH v4 0/5] Enhance RPMsg buffer management # From: Tanmay Shah # Sent: Mon, 15 Jun 2026 13:20:02 -0700 # Link: https://patch.msgid.link/20260615202007.3484668-1-tanmay.shah@amd.com # --- # [1/5] commit-id: 1a2b3c4d5e6f # [2/5] commit-id: 2b3c4d5e6f70 # ... # --- # Applied: Wed, 17 Jun 2026 12:00:00 -0400 ``` -------------------------------- ### Example Git Commit Message with Follow-up Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-single-ref-addlink.txt This snippet shows a sample Git commit message structure that includes various trailers, such as 'Fixes', 'Reviewed-by', 'Link', and 'Signed-off-by'. It illustrates how follow-up trailers are appended after the main commit message body. ```git From git@z Thu Jan 1 00:00:00 1970 Subject: [PATCH] Simple test From: Test Test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Follow-up trailer collating test. Fixes: abcdef01234567890 Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter Reviewed-by: Followup Reviewer1 Tested-by: Followup Reviewer2 Link: https://patch.msgid.link/orig-message@example.com Signed-off-by: Test Override diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@@ def junk(): -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Example Git Commit with Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-test-simple.txt This snippet shows a sample Git commit message that includes various trailer fields. These fields are often used for metadata like bug tracking or review information. ```git From test@example.com Tue Aug 30 11:19:07 2022 From: Test Test Subject: [PATCH] Simple test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-ID: This is a simple trailer parsing test. Reported-by: "Doe, Jane" Reviewed-by: Bogus Bupkes Fixes: abcdef01234567890 Link: https://msgid.link/some@msgid.here --- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@@ def junk(): -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Prepare and Compare Mbox Files Source: https://github.com/mricon/b4/blob/master/docs/maintainer/diff.md Prepare two mbox files using 'b4 am' and then compare them using 'b4 diff'. This is the recommended way to use the diff command. ```bash $ b4 am --no-cover -n ver1 msgid-of-ver-1 $ b4 am --no-cover -n ver2 msgid-of-ver-2 $ b4 diff -m ver1.mbx ver2.mbx ``` -------------------------------- ### Launch TUI Source: https://github.com/mricon/b4/blob/master/docs/maintainer/bugs.md Launch the Text User Interface for bug tracking. ```none b4 bugs tui ``` -------------------------------- ### Enroll Repository for Review Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Use this command to create necessary metadata and a SQLite database for the review workflow. The `-i` flag allows for multiple checkouts of the same git repository. ```bash b4 review enroll [path] [-i identifier] ``` -------------------------------- ### Enroll Repository for b4 Review Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Run this command once per checkout to create the necessary tracking database and metadata for b4 review. Use the -i flag to specify a unique identifier if managing multiple subsystems. ```bash b4 review enroll ``` ```bash b4 review enroll -i my-subsystem ``` -------------------------------- ### Show All Info for Current Branch Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this to display all information for the current branch. This is the default behavior when no parameters are provided. ```bash b4 prep --show-info ``` -------------------------------- ### Managing Series Lifecycle Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Use 'a' to open the action menu for options like 'Mark as waiting on new revision' or 'Snooze'. Press 'u' to update to newer revisions. ```bash a u ``` -------------------------------- ### Load Emacs b4-review-mode Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Add this to your Emacs init file to load the b4-review-mode.el file, which provides review helpers. ```emacs-lisp (load "/path/to/b4/misc/emacs/b4-review-mode.el") ``` -------------------------------- ### Sample Non-Git Patch with Follow-up Trailers Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-non-git-patch-ref-defaults.txt This snippet shows a sample patch file content, including standard email headers and specific follow-up trailers like 'Fixes', 'Reviewed-by', and 'Link'. It also includes a diff section for a Python file. ```text From git@z Thu Jan 1 00:00:00 1970 Subject: [PATCH] Simple test From: Test Test Date: Tue, 30 Aug 2022 11:19:07 -0400 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Follow-up trailer collating test. Fixes: abcdef01234567890 Reviewed-by: Original Reviewer Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter Reviewed-by: Followup Reviewer1 --- a/b4/junk.py +++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): -junk1 +junk2 -- 2.wong.fu ``` -------------------------------- ### Clone b4 Source Code Source: https://github.com/mricon/b4/blob/master/CONTRIBUTING.rst Use this command to get the latest b4 source code from the kernel Git repository. ```bash git clone https://git.kernel.org/pub/scm/utils/b4/b4.git/ ``` -------------------------------- ### Create Review Directory and Identity File Source: https://github.com/mricon/b4/blob/master/misc/agent-reviewer.md This command sequence creates the necessary review directory based on the HEAD commit SHA and prepares for writing the identity.txt file. ```shell head_sha=$(git rev-parse HEAD) mkdir -p .git/b4-review/$head_sha ``` -------------------------------- ### Prepare for Quilt Source: https://github.com/mricon/b4/blob/master/docs/maintainer/am-shazam.md The -Q or --quilt-ready flag saves patches in a format directly usable by the quilt tool. ```bash b4 am -Q ... ``` -------------------------------- ### Switch to a stable branch Source: https://github.com/mricon/b4/blob/master/docs/installing.md Switch to a stable branch of the b4 git repository, for example, 'stable-0.9.y', if you prefer not to use the master branch. ```none git switch stable-0.9.y ``` -------------------------------- ### Send .thanks File using Mutt Source: https://github.com/mricon/b4/blob/master/docs/maintainer/ty.md This command demonstrates how to send a generated .thanks file using the mutt email client. Ensure the .thanks file is in the current directory. ```none $ mutt -f foo.thanks ``` -------------------------------- ### Opening the Queued Thank-You Message Viewer Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Press 'Q' in the thank-you preview screen to open the queue viewer, which lists pending messages. Press 'Q' again to attempt delivery. ```bash Q ``` -------------------------------- ### Get HEAD Commit SHA Source: https://github.com/mricon/b4/blob/master/misc/agent-reviewer.md Use this command to retrieve the SHA of the current HEAD commit, which is used for naming the review directory. ```shell git rev-parse HEAD ``` -------------------------------- ### Custom checkpatch command for Linux kernel Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Example of setting a custom command for --check flag to use a stricter checkpatch.pl configuration. ```ini [b4] prep-perpatch-check-cmd = ./scripts/checkpatch.pl --terse --no-summary --mailback --strict --showfile ``` -------------------------------- ### Prepare Patch Series for Git AM Source: https://github.com/mricon/b4/blob/master/src/b4/man/b4.1.rst Downloads a thread, applies follow-up trailers, adds a Signed-Off-By trailer and a Link trailer, then saves the result as an mbox file ready for 'git am'. ```bash b4 am -sl [msgid] ``` -------------------------------- ### Navigating Patches and Comments Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Use bracket keys to navigate between patches, j/k to scroll, and Space/Backspace to page. Use '.' and ',' to jump between comments within a patch. ```bash [ ] j k Space Backspace . , ``` -------------------------------- ### Invoke b4 with Stdin Pipe Separator Source: https://github.com/mricon/b4/blob/master/docs/maintainer/mbox.md Example command to invoke b4 using stdin with a custom pipe separator, as configured in mutt. ```bash -m - --stdin-pipe-sep='\n---randomstr---\n' ``` -------------------------------- ### Basic dig usage Source: https://github.com/mricon/b4/blob/master/docs/maintainer/dig.md Pass a commit-ish object to `b4 dig` to find its origin. Examples include using HEAD, a SHA, or a tag. ```bash $ b4 dig -c HEAD $ b4 dig -c abc123 $ b4 dig -c v6.14-rc2~10 ``` -------------------------------- ### Configure User Agent Plus Identifier Source: https://github.com/mricon/b4/blob/master/docs/config.md Append a unique identifier to the User-Agent header for server operators to identify specific installations. This is typically a UUID. ```gitconfig [lore] useragentplus = 550e8400-e29b-41d4-a716-446655440000 ``` -------------------------------- ### Cherry-picking specific patches Source: https://github.com/mricon/b4/blob/master/docs/maintainer/am-shazam.md Demonstrates how to use the -P option to select a subset of patches from a series based on their numbers, message-ids, or subject patterns. ```none b4 am -P 1,3,5-7,9- ``` ```none b4 am -P _ ``` ```none b4 am -P -1 ``` ```none b4 am -P *iscsi* ``` -------------------------------- ### Get Full Commit Message Source: https://github.com/mricon/b4/blob/master/misc/agent-reviewer.md Retrieves the complete commit message for the latest commit on a specified branch. This is useful for initial inspection of commit details. ```shell # Get the full commit message of the tip commit git log -1 --format=%B ``` -------------------------------- ### Show All Info for a Specific Branch Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this to display all information for a given branch. The branch name must be valid. ```bash b4 prep --show-info b4/foodrv-bar ``` -------------------------------- ### Set Patch Review State Source: https://github.com/mricon/b4/blob/master/docs/config.md Use `pw-review-state` to automatically set the review status of retrieved patches when running `b4 am` or `b4 shazam`. For example, 'under-review'. ```none pw-review-state = under-review ``` -------------------------------- ### Prepare Subset of Patch Series for Git AM Source: https://github.com/mricon/b4/blob/master/src/b4/man/b4.1.rst Downloads a specific range of patches (e.g., 1-3) from a thread, applies trailers, and prepares an mbox file for 'git am'. ```bash b4 am -sl -P 1-3 [msgid] ``` -------------------------------- ### Set Patch Accepted State Source: https://github.com/mricon/b4/blob/master/docs/config.md Use `pw-accept-state` to set the status of applied patches to a specified state when running `b4 ty`. For example, setting it to 'accepted'. ```none pw-accept-state = accepted ``` -------------------------------- ### Create New Patch Series Branch Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this to create a new branch for starting work on a new patch series. A name for the new series is required. ```bash b4 prep -n NEW_SERIES_NAME ``` -------------------------------- ### Configure Default Take Method Source: https://github.com/mricon/b4/blob/master/docs/config.md Set the default take method to pre-select in the Take dialog. Valid values are 'merge', 'linear', and 'cherry-pick'. If not set, no method is pre-selected. ```shell git config b4.review-default-take-method merge ``` -------------------------------- ### Output review information in JSON format Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Outputs review information in JSON format. Can be combined with --list for a JSON array of all branches or used alone for a single branch. ```none b4 review show-info --json ``` ```none b4 review show-info --list --json ``` -------------------------------- ### Inline Comment Formatting Example Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Illustrates the standard mailing-list reply format for inline comments, where original content is quoted and new comments are added on unquoted lines. ```none > @@ -10,3 +10,4 @@ > context line > +new_function(); Needs a NULL check here. > +return result; ``` -------------------------------- ### Set Patch Discarded State Source: https://github.com/mricon/b4/blob/master/docs/config.md Use `pw-discard-state` to set the status of matching patches to a specified state when running `b4 ty -d`. For example, setting it to 'rejected'. ```none pw-discard-state = rejected ``` -------------------------------- ### Review and selectively reject trailers before applying Source: https://github.com/mricon/b4/blob/master/docs/contributor/trailers.md Use this command to review incoming trailers in your editor before they are applied. This is useful for preventing unexpected trailers, such as those from older, unapplied series, from being added to your commits. Rejected trailers are saved to `.git/b4-trailers-ignore.json` and will not be offered again from the same message provenance. ```none b4 trailers -u -i ``` -------------------------------- ### Create New Branch with Specific Fork-Point Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this to create a new branch starting from a specific commit (fork-point) instead of the current HEAD. The fork-point identifier is required. ```bash b4 prep -f FORK_POINT ``` -------------------------------- ### Get Patch Commit Message Source: https://github.com/mricon/b4/blob/master/misc/agent-reviewer.md Retrieves the full commit message for a given patch SHA, excluding the diff. This is useful for inspecting the message content of individual patches. ```shell git show --format=%B --no-patch ``` -------------------------------- ### Configure pre/post history-rewrite hooks for b4 prep Source: https://github.com/mricon/b4/blob/master/docs/releases.md Configure `b4.prep-pre-rewrite-hook` and `b4.prep-post-rewrite-hook` in your b4 configuration to run commands before and after b4 rewrites history on a prep branch. ```ini [b4] prep-pre-rewrite-hook = stg commit --all prep-post-rewrite-hook = stg repair ``` -------------------------------- ### Start a New Topical Branch Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this command to create a new branch for your patch series. It's recommended to use a descriptive name for the branch as it forms part of the `change-id`. ```bash b4 prep -n descriptive-name [-f tagname] ``` -------------------------------- ### Configure Git Remote Push and Fetch Refspecs Source: https://github.com/mricon/b4/blob/master/docs/maintainer/review.md Set up push and fetch refspecs for the review-sync remote to ensure only b4/review/* branches are transferred. The '+' prefix enables force-pushing. ```none git config --add remote.review-sync.push '+refs/heads/b4/review/*:refs/heads/b4/review/*' ``` ```none git config --add remote.review-sync.fetch 'refs/heads/b4/review/*:refs/heads/b4/review/*' ``` -------------------------------- ### Configure Keyring Source in .gitconfig Source: https://github.com/mricon/b4/blob/master/docs/config.md Set the keyring source path in your .gitconfig file after cloning the PGP keys repository. This allows B4 to use the specified keys for attestation. ```ini [b4] keyringsrc = ~/path/to/pgpkeys/.keyring ``` -------------------------------- ### Git Patch Diff Example 2 Source: https://github.com/mricon/b4/blob/master/src/tests/samples/trailers-followup-with-cover-ref-addlink.txt This snippet demonstrates another file modification in a Git patch, changing 'bupkes1' to 'bupkes2' in the b4/bupkes.py file. This is part of a follow-up patch series. ```diff diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py +++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): -bupkes1 +bupkes2 -- 2.wong.fu ``` -------------------------------- ### Prepare Tree for 3-Way Merge Source: https://github.com/mricon/b4/blob/master/src/b4/man/b4.1.rst Downloads a patch series and ensures the local git tree is prepared for a 3-way merge by verifying the existence of all index blobs. ```bash b4 am -3 [msgid] ``` -------------------------------- ### Enroll Existing Branch with b4 prep Source: https://github.com/mricon/b4/blob/master/docs/contributor/prep.md Use this command to make an existing Git branch trackable by b4 if you didn't run `b4 prep -n` initially. This allows you to use b4's contributor-oriented commands. ```none b4 prep -e master ``` -------------------------------- ### Configure DNS Resolvers for Attestation Source: https://github.com/mricon/b4/blob/master/docs/config.md Specify custom DNS servers for domain key lookups if OS-provided resolvers are insufficient. This is useful in corporate networks. ```none attestation-dns-resolvers = 8.8.8.8, 8.8.4.4 ``` -------------------------------- ### Configure Post-Rewrite Hook Source: https://github.com/mricon/b4/blob/master/docs/config.md Specify a command to run after a successful history rewrite on a prep branch. A non-zero exit status is logged as a warning but does not undo the rewrite. ```none [b4] prep-post-rewrite-hook = stg repair ``` -------------------------------- ### Configure AI-Assisted Review Command Source: https://github.com/mricon/b4/blob/master/docs/config.md Set the command to invoke for AI-assisted review, triggered by the 'a' keybinding. This option must be set along with b4.review-agent-prompt-path for the agent feature to be available. ```shell git config b4.review-agent-command "" ``` -------------------------------- ### View Contributor Keys for Patches Source: https://github.com/mricon/b4/blob/master/docs/maintainer/kr.md Use this command to display the keys used to sign a set of patches in a given thread. It fetches the thread and lists associated public keys and their storage paths. ```none $ b4 kr --show-keys Grabbing thread from lore.kernel.org/all//t.mbox.gz --- alice.developer@example.org: (unknown) keytype: ed25519 pubkey: AbCdzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= krpath: ed25519/example.org/alice.developer/20211009 fullpath: /home/user/.local/share/b4/keyring/ed25519/example.org/alice.developer/20211009 --- ``` -------------------------------- ### Fetching Follow-up Comments Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md Press 'f' to fetch follow-up messages from lore, which appear as colored panels in the diff view. ```bash f ``` -------------------------------- ### Apply Patches with Merge Strategy Source: https://github.com/mricon/b4/blob/master/docs/reviewer/getting-started.md When taking a series, choose between merge, linear (git am), or cherry-pick strategies for applying patches. The series status updates to 'accepted' after applying. ```bash a ```