public inbox for gentoo-dev-announce@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev-announce] New tool: merge-driver-ekeyword automatically resolves git merge conflicts involving KEYWORDS=...
@ 2021-03-02  3:54 Matt Turner
  0 siblings, 0 replies; only message in thread
From: Matt Turner @ 2021-03-02  3:54 UTC (permalink / raw
  To: gentoo-dev-announce; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 636 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-02  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02  3:54 [gentoo-dev-announce] New tool: merge-driver-ekeyword automatically resolves git merge conflicts involving KEYWORDS= Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox