summaryrefslogtreecommitdiff
path: root/bin/merge-driver-ekeyword
AgeCommit message (Collapse)Author
2024-06-07bin/merge-driver-ekeyword: Move logic to a separate moduleMatt Turner
To facilitate unit testing. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Don't pass program name to main()Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Don't sys.exit() from main()Matt Turner
Makes unit testing easier. Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-06-07bin/merge-driver-ekeyword: Store merged output in correct locationMatt Turner
Fixes: a667d93 ("bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit") Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commitMatt Turner
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@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Two blank lines after function defMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2024-05-24bin/merge-driver-ekeyword: Remove unused importsMatt Turner
Fixes: 1a2c70d ("Run `pyupgrade --py39-plus`") Signed-off-by: Matt Turner <mattst88@gentoo.org>
2023-08-29bin/merge-driver-ekeyword: replace os.system with os.execlpMike Gilbert
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
2023-08-29bin/merge-driver-ekeyword: mangle exit code correctlySam James
Fixes: 263e3d64adac1ee2968233e151d1ee590532f42d Signed-off-by: Sam James <sam@gentoo.org>
2023-08-29bin/merge-driver-ekeyword: fix compatibility with >=git-2.42.0Sam James
Commit 2b7b788fb31a74bcbff4e4c6efc6f3db6c3a49b7 upstream makes more use of the result from a merge driver. Correctly surface the result from `git merge-file` so that we don't wrongly throw away information but also don't make git think the driver crashed (-1 is for exceptional cases, not "failed to merge"). Signed-off-by: Sam James <sam@gentoo.org>
2023-08-07Run `pyupgrade --py39-plus`Sam James
Signed-off-by: Sam James <sam@gentoo.org>
2021-09-20Change tabs to spaces (using autopep8). Also, format repo using black.Wolfgang E. Sanyer
The following command was used to change the tabs to spaces: autopep8 --in-place --select=E101,E11,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E133,E20,E211,E22,E224,E224,E226,E227,E228,E231,E241,E242,E251,E252,E26,E265,E266,E27,E301,E302,E303,E304,E305,E306,W291,W293,W391 -r . And then black was run as `black .` on the entire tree Signed-off-by: Wolfgang E. Sanyer <WolfgangESanyer@gmail.com> Signed-off-by: Matt Turner <mattst88@gentoo.org>
2021-03-11bin: Fix type annotationsMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2021-02-24bin: Handle case of no KEYWORD removalsMatt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
2020-12-31bin: Add merge-driver-ekeywordMatt Turner
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 Signed-off-by: Matt Turner <mattst88@gentoo.org>