From: Dan Williams <dan.j.williams@intel.com>
To: konstantin@linuxfoundation.org
Cc: ksummit@lists.linux.dev, workflows@vger.kernel.org
Subject: [PATCH 2/3] b4, ty: Move git_get_rev_diff to __init__ for reuse in post processing shazam
Date: Tue, 14 Oct 2025 00:15:29 -0700 [thread overview]
Message-ID: <20251014071530.3665691-3-dan.j.williams@intel.com> (raw)
In-Reply-To: <20251014071530.3665691-1-dan.j.williams@intel.com>
In support of adding link trailers as git notes, factor out
git_get_rev_diff() for reuse.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
src/b4/__init__.py | 5 +++++
src/b4/ty.py | 7 +------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index c608a4d7956a..c2cdb028fa54 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -2932,6 +2932,11 @@ def in_directory(dirname: str) -> Generator[bool, None, None]:
os.chdir(cdir)
+def git_get_rev_diff(gitdir: Optional[str], rev: str) -> Tuple[int, str]:
+ args = ['diff', '%s~..%s' % (rev, rev)]
+ return git_run_command(gitdir, args)
+
+
def setup_config(cmdargs: argparse.Namespace) -> None:
"""Setup configuration options. Needs to be called before accessing any of
the config options."""
diff --git a/src/b4/ty.py b/src/b4/ty.py
index 9f01bd534c74..8d41a22e536b 100644
--- a/src/b4/ty.py
+++ b/src/b4/ty.py
@@ -70,11 +70,6 @@ def git_get_merge_id(gitdir: Optional[str], commit_id: str, branch: Optional[str
return lines[-1]
-def git_get_rev_diff(gitdir: Optional[str], rev: str) -> Tuple[int, str]:
- args = ['diff', '%s~..%s' % (rev, rev)]
- return b4.git_run_command(gitdir, args)
-
-
def git_get_commit_message(gitdir: Optional[str], rev: str) -> Tuple[int, str]:
args = ['log', '--format=%B', '-1', rev]
return b4.git_run_command(gitdir, args)
@@ -191,7 +186,7 @@ def get_all_commits(gitdir: Optional[str], branch: str, since: str = '1.week',
# Get patch hash of each commit
for line in lines:
commit_id, subject = line.split(maxsplit=1)
- ecode, out = git_get_rev_diff(gitdir, commit_id)
+ ecode, out = b4.git_get_rev_diff(gitdir, commit_id)
pwhash = b4.LoreMessage.get_patchwork_hash(out)
logger.debug('phash=%s', pwhash)
# get all message-id or link trailers
--
2.51.0
next prev parent reply other threads:[~2025-10-14 7:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 7:15 [PATCH 0/3] b4: Add git notes for submission link trailers Dan Williams
2025-10-14 7:15 ` [PATCH 1/3] b4: Move linktrailer to a LoreMessage property Dan Williams
2025-10-14 7:15 ` Dan Williams [this message]
2025-10-14 7:15 ` [PATCH 3/3] mbox: Add a --add-link-note option to shazam Dan Williams
2025-10-14 18:28 ` dan.j.williams
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=20251014071530.3665691-3-dan.j.williams@intel.com \
--to=dan.j.williams@intel.com \
--cc=konstantin@linuxfoundation.org \
--cc=ksummit@lists.linux.dev \
--cc=workflows@vger.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