public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Matt Turner" <mattst88@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: bin/
Date: Sat, 25 May 2024 03:45:25 +0000 (UTC)	[thread overview]
Message-ID: <1716608654.a667d934de4e5980111fb0b4e3ecae19b477131f.mattst88@gentoo> (raw)

commit:     a667d934de4e5980111fb0b4e3ecae19b477131f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu May 23 23:23:23 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> 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 <mattst88 <AT> 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)


             reply	other threads:[~2024-05-25  3:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-25  3:45 Matt Turner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-24 18:05 [gentoo-commits] proj/gentoolkit:master commit in: bin/ Matt Turner
2024-06-24 18:05 Matt Turner
2024-06-24 18:05 Matt Turner
2024-05-25  3:45 Matt Turner
2024-05-25  3:45 Matt Turner
2023-08-29 15:48 Mike Gilbert
2023-08-29  1:38 Sam James
2023-08-29  0:51 Sam James
2022-12-03 13:54 Michał Górny
2022-12-03 13:54 Michał Górny
2022-07-28 15:29 Brian Dolbec
2022-07-09 19:50 Brian Dolbec
2022-05-19  4:30 Sam James
2021-03-12  2:31 Matt Turner
2021-02-25  0:06 Matt Turner
2020-12-31 22:11 Matt Turner
2020-03-16 14:24 Ben Kohler
2016-10-17 17:39 Paul Varner
2016-06-06 21:15 Paul Varner

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=1716608654.a667d934de4e5980111fb0b4e3ecae19b477131f.mattst88@gentoo \
    --to=mattst88@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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