tl;dr: In app-portage/gentoolkit-0.5.1 there's a new tool I wrote,
called merge-driver-ekeyword that can automatically resolve git merge
conflicts involving the KEYWORDS=... line in ebuilds.

Since the KEYWORDS=... assignment is a single line, git struggles to
handle conflicts. When rebasing a series of commits that modify the
KEYWORDS=... it's usually easier to throw them away and reapply on the
new tree than it is to manually handle conflicts during the rebase.

git allows a 'merge driver' program to handle conflicts; this program
handles conflicts in the KEYWORDS=... assignment. E.g., given an ebuild
with these keywords:

KEYWORDS="~alpha amd64 arm arm64 ~hppa ppc ppc64 x86"

One developer drops the ~alpha keyword and pushes to gentoo.git, and
another developer stabilizes hppa. Without this merge driver, git
requires the second developer to manually resolve the conflict which is
tedious and prone to mistakes when rebasing a long series of patches.
With the custom merge driver, it automatically resolves the conflict.

To use the merge driver, configure your gentoo.git as such:

gentoo.git/.git/config:

    [merge "keywords"]
            name = KEYWORDS merge driver
            driver = merge-driver-ekeyword %O %A %B %P

gentoo.git/.git/info/attributes:

    *.ebuild merge=keywords

With that configured, git merge conflicts on the KEYWORDS=... line will
be resolved automatically (e.g. during git pull --rebase).

Enjoy!

Attachment: signature.asc
Description: PGP signature

Reply via email to