From patchwork Fri Mar 1 10:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13578290 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2B536A325 for ; Fri, 1 Mar 2024 10:24:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288666; cv=none; b=JPB7cUINPj17XmL/zuMyKsvhLU+BYseBJRRtt5dXMK1zBVEb2oxBh86qMHCczowuT+jR79eatPqgyzUaO9yXBR0QTHoVQUxtnBR5cf7fyvGNNK18GWWghMBMohJlH6jsfpuKBcc5ARPEh/r0Mk2i0aMRb4EYgg2UaeU9ugACIWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288666; c=relaxed/simple; bh=MUl67GiziNLxF2rhL2JeYCgwLuz/pDHPf4f9XrlPizc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ct5h02AeP2BGRHmNZ11gUw7AmH4KJcmYe64gkp5jQFmhE6B3oUqNOTTx3FqhONlQjOGm/CBUVY/YH8nFbiPea9iMyBtcE2mjoe6DI0PONehI+7n5LzOx2yYq+plK2sM2Fh5qw/ZVLPi70+LxhnQW+htvrTcF74pYGIV9GgVQ7YQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZqQgb6q1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZqQgb6q1" Received: by smtp.kernel.org (Postfix) id 97B26C43394; Fri, 1 Mar 2024 10:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A37DC433F1; Fri, 1 Mar 2024 10:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709288665; bh=MUl67GiziNLxF2rhL2JeYCgwLuz/pDHPf4f9XrlPizc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqQgb6q1snSukSV7bkx0Bio+rRv0bioXHSEzBuPXg6iWTWMxTTMxSQo2uwGJ9QFFG jtGrew7oRWSwfKHMWSGwZ8uSnWOk5JCbQCdMkkrhxo54JB00EKqK73nEy0/cdf7Qai rMebjDKuNnRaJ7bJKui9WtJPJLiqhJg/xiDXrhgjoMjGpMNb1NmhZzf7wQQrBs0d9N vTxUALIVI2TKt3h28U0b1KsiCfrOGp5sN7TgmM+shDzB7e1guXkP/K9D5BuwCBhAQO 6sSe7ffgIl3f4Kza1nnBNVvLh++pv/fKSdHq3o8Ecju1LoF1JGY4FuwCWbCPaHzUHv a6YWUKy9RIEKg== From: Will Deacon To: tools@kernel.org Cc: Will Deacon , Konstantin Ryabitsev , Jason Gunthorpe , Nicolin Chen , Will Deacon Subject: [PATCH 1/2] ty: Try subject matching for every commit before using trackers Date: Fri, 1 Mar 2024 10:24:17 +0000 Message-Id: <20240301102418.17705-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240301102418.17705-1-will@kernel.org> References: <20240301102418.17705-1-will@kernel.org> Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Will Deacon Nicolin reports that 'b4 ty' produced a "thank you" letter with incorrect commit IDs: https://lore.kernel.org/r/ZeDtfKMUXnOnJOic@Asurada-Nvidia This appears to be because of the creative use of Message-Ids in the series at: https://lore.kernel.org/r/0-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com For example, comparing the Message-Id of patches 1 and 11 of that series, we can see that one is a substring of the other: Message-Id: <1-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com> Message-Id: <11-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com> This confuses auto_locate_series(), as it will end up matching the Message-Id of patch 1 with the Link: tag in patch 11 and therefore get the wrong patch/commit association. Fix this problem by trying to match each commit based on the Subject before falling back to the fuzzier tracker-based matching. Reported-by: Nicolin Chen Signed-off-by: Will Deacon --- src/b4/ty.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/b4/ty.py b/src/b4/ty.py index a8bdabf5bcbc..950c357a89c5 100644 --- a/src/b4/ty.py +++ b/src/b4/ty.py @@ -217,7 +217,13 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str, success = True matches += 1 break - elif len(patch) > 2 and len(patch[2]) and len(commit[2]): + + if success: + continue + + # try to locate by tracker + for pwhash, commit in commits.items(): + if len(patch) > 2 and len(patch[2]) and len(commit[2]): for tracker in commit[2]: if tracker.find(patch[2]) >= 0: logger.debug('Matched using recorded message-id') From patchwork Fri Mar 1 10:24:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13578291 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EA386A325 for ; Fri, 1 Mar 2024 10:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288667; cv=none; b=c3TbSHT5YlEyjBxTgPJtNi3GVK4a9U1VwfV2Ct0DsY6EjcgHkbWY/pXzIakhdeemZp+HfowrT7Ow7ugtF0sZ2MckEWyJLNtt+06SCkb/NXKc6hvRJxjZCmpnvp/Eol975jQisbBGyWMGi4i4+H9QYYdjfQXROZ7wuugdy+QWOsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288667; c=relaxed/simple; bh=uUuE5LcFt9QFo89f9ap4FIgpU9upi6KldC3VWA9NnWE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zp49Wn403rZf/kjfFZafl3EYMzHHhsV20//SELp1bPaQqSsAu0thsjGzO59zE0TgI1jHH7w+pzcZ//77nuvDSrAqAsLef7is56l3RO7eF+gKHeTfGgtuzIy9iOn+1Lj2gem8PdkNedmEsmMDQ7EewVkr2NYm8YV5fQtoVQVYFpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XGhjBolk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XGhjBolk" Received: by smtp.kernel.org (Postfix) id 59347C43390; Fri, 1 Mar 2024 10:24:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEFA2C433F1; Fri, 1 Mar 2024 10:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709288667; bh=uUuE5LcFt9QFo89f9ap4FIgpU9upi6KldC3VWA9NnWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGhjBolkwAd+UOtG7zzgduER8yqN0U1RXKnHPQz8xeZI53jn1QJ+nFtxEnH3J3W1u +mFe42Dh+Q6INNsx6kwM9hoaTA9RCjeeJdpb0mP8Yq4ypd+8urFI8ro2IH6MTDQYNd TmM6uYOjc1L0luWoxVYih4nTz4Qal5nHEpwYi8eDbCAeS5u2EdUg9O7vp+m6GaOIuG Y3vD/NvMbIJyt6aEdS1xG2UgTv2rx3hY0xfvP3rnV9ZfdYhUPpe+NGNh/pwahc7yTp otNQIR9D9tVTQie1RB+QgonRargmgOZc9fNW9W1IfYzGrafjdjsha++6/IQEsDwtVW zPajnPgv3+JZg== From: Will Deacon To: tools@kernel.org Cc: Will Deacon , Konstantin Ryabitsev , Jason Gunthorpe , Nicolin Chen , Will Deacon Subject: [PATCH 2/2] ty: Remove unused 'matches' variable Date: Fri, 1 Mar 2024 10:24:18 +0000 Message-Id: <20240301102418.17705-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240301102418.17705-1-will@kernel.org> References: <20240301102418.17705-1-will@kernel.org> Precedence: bulk X-Mailing-List: tools@linux.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Will Deacon The 'matches' variable in auto_locate_series() is updated but not used for anything, so remove it. Signed-off-by: Will Deacon --- src/b4/ty.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/b4/ty.py b/src/b4/ty.py index 950c357a89c5..97f4c44a0832 100644 --- a/src/b4/ty.py +++ b/src/b4/ty.py @@ -198,7 +198,6 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str, patchids = set(commits.keys()) # We need to find all of them in the commits found = list() - matches = 0 at = 0 for patch in jsondata['patches']: at += 1 @@ -206,7 +205,6 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str, if patch[1] in patchids: logger.debug('Found: %s', patch[0]) found.append((at, commits[patch[1]][0])) - matches += 1 else: # try to locate by subject success = False @@ -215,7 +213,6 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str, logger.debug('Matched using subject') found.append((at, commit[0])) success = True - matches += 1 break if success: @@ -229,7 +226,6 @@ def auto_locate_series(gitdir: Optional[str], jsondata: dict, branch: str, logger.debug('Matched using recorded message-id') found.append((at, commit[0])) success = True - matches += 1 break if success: break