From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0B0791581D3 for ; Sat, 25 May 2024 03:45:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 01443E29B9; Sat, 25 May 2024 03:45:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5058CE29B9 for ; Sat, 25 May 2024 03:45:28 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 82A18335D0F for ; Sat, 25 May 2024 03:45:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B7BDA1B45 for ; Sat, 25 May 2024 03:45:25 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1716608654.a667d934de4e5980111fb0b4e3ecae19b477131f.mattst88@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: bin/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: bin/merge-driver-ekeyword X-VCS-Directories: bin/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: a667d934de4e5980111fb0b4e3ecae19b477131f X-VCS-Branch: master Date: Sat, 25 May 2024 03:45:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fa2ef521-ba8a-4b9c-96b3-4be637a35c36 X-Archives-Hash: ca202c67de545c31269a6edb159a88aa commit: a667d934de4e5980111fb0b4e3ecae19b477131f Author: Matt Turner gentoo org> AuthorDate: Thu May 23 23:23:23 2024 +0000 Commit: Matt Turner gentoo org> CommitDate: Sat May 25 03:44:14 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a667d934 bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit Previously we only looked for changes to the KEYWORDS= line in our local commit being rebased. If it contained no changes to KEYWORDS= then the merge-driver gave up. However our local patch may conflict with an upstream patch that changed KEYWORDS. In that case, we can look for changes to the KEYWORDS= line in the other patch and try to apply its change to ours. This happened in gentoo.git commits 2c5cd6c4e004 ("sys-fs/squashfs-tools-ng: Stabilize 1.3.0 amd64, #930693") 7129c2e4e5f3 ("sys-fs/squashfs-tools-ng: run elibtoolize in non-live ebuild") leading to a rebase mistake in the latter (later fixed by commit 7579afbd4aa1 ("sys-fs/squashfs-tools-ng: stabilize 1.3.0 for amd64")). With this patch applied, the merge conflicts are automatically resolved between the two commits regardless of which is "ours" vs "theirs". Signed-off-by: Matt Turner gentoo.org> bin/merge-driver-ekeyword | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword index efdfbde..6d5f869 100755 --- a/bin/merge-driver-ekeyword +++ b/bin/merge-driver-ekeyword @@ -1,6 +1,6 @@ #!/usr/bin/python3 # -# Copyright 2020-2023 Gentoo Authors +# Copyright 2020-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 or later """ @@ -119,12 +119,16 @@ def main(argv: Sequence[str]) -> int: B = argv[3] # %B - filename of the other branch's version P = argv[4] # %P - original path of the file - # Get changes from %O to %B - changes = keyword_changes(O, B) - if changes: - # Apply O -> B changes to A + # Get changes to KEYWORDS= from %O to %B + if changes := keyword_changes(O, B): + # Apply %O -> %B changes to %A result = apply_keyword_changes(A, P, changes) sys.exit(result) + # Get changes to KEYWORDS= from %O to %A + elif changes := keyword_changes(O, A): + # Apply %O -> %A changes to %B + result = apply_keyword_changes(B, P, changes) + sys.exit(result) else: try: os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", "-L", "ours", A, O, B)