From 9695738d936b54a9ef225e2d3c634f95f822c53d Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Tue, 20 Feb 2024 20:27:12 +0200 Subject: [PATCH] Add another way to resolve merge conflicts with Meld --- CHANGELOG.md | 3 +++ cli/src/config/merge_tools.toml | 9 +++++++++ docs/config.md | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac78133347f..b4689e6ea48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added completions for [Nushell](https://nushell.sh) to `jj util completion` +* Another way to resolve conflicts with Meld, in 3 tabs, adding to the + experimental `meld-3` tool. + ### Fixed bugs * On Windows, symlinks in the repo are now materialized as regular files in the diff --git a/cli/src/config/merge_tools.toml b/cli/src/config/merge_tools.toml index af0bbc8d1df..d936b4e9004 100644 --- a/cli/src/config/merge_tools.toml +++ b/cli/src/config/merge_tools.toml @@ -11,6 +11,15 @@ merge-args = ["$left", "$base", "$right", "-o", "$output", "--auto-merge"] program="meld" # If using this as a template, note that `$output` is repeated twice below edit-args = ["$left", "$output", "$right", "-o", "$output"] +# With Meld's 3-way merge resolution mode, once the output pane has been +# edited, it loses the original contents of `$base`. Here we offer an +# alternative that opens the original two sides compared to the base in two +# more tabs. +merge-args = ["--diff", "$left", "$output", "$right", "--diff", "$base", "$left", "--diff", "$base", "$right"] +# To make it useful, the output pane must be prepopulated with _something_. The +# conflict markers here are not a great distraction, and might even be helpful +# in their own right. +merge-tool-edits-conflict-markers = true [merge-tools.vimdiff] program = "vim" diff --git a/docs/config.md b/docs/config.md index 04eeda5904b..864c2b36034 100644 --- a/docs/config.md +++ b/docs/config.md @@ -521,6 +521,15 @@ the conflict is done, `jj` assumes that the conflict was only partially resolved and parses the conflict markers to get the new state of the conflict. The conflict is considered fully resolved when there are no conflict markers left. +### Experimental 3-tab conflict resolution + +The `"meld-3"` merge editor does not use the `--auto-merge` feature. Instead, +it sets up Meld to show 3 tabs. The first tab opens a 3-pane view of the left +and right sides with an editing pane in the middle. The middle pane contains +the output with conflict markers to resolve. The next two tabs open 2-pane +views for reference while editing, each showing a diff from the base to one of +the sides. + ## Commit Signing `jj` can be configured to sign and verify the commits it creates using either