From 17e37012852dddd760cf434af04f0a9f07eac3c2 Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Tue, 20 Feb 2024 20:27:12 +0200 Subject: [PATCH] Expand the `meld-3` tool experiment to editing file conflicts --- CHANGELOG.md | 3 +++ cli/src/config/merge_tools.toml | 8 ++++++++ docs/config.md | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac78133347..b4689e6ea4 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 af0bbc8d1d..c8e5ae3bb0 100644 --- a/cli/src/config/merge_tools.toml +++ b/cli/src/config/merge_tools.toml @@ -11,6 +11,14 @@ 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 the normal Meld merge conflict resolution setup, changes from `$base` to +# either side are not highlighted. 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"] +# The output pane in the first tab must be prepopulated with _something_. The +# conflict markers were chosen here, rather than simply the base, because they +# contain enough information to let you skip the other tabs for simple cases. +merge-tool-edits-conflict-markers = true [merge-tools.vimdiff] program = "vim" diff --git a/docs/config.md b/docs/config.md index 04eeda5904..64756c8329 100644 --- a/docs/config.md +++ b/docs/config.md @@ -521,6 +521,16 @@ 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 opens 3 tabs in Meld. The first tab is 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. This first tab +contains enough information on its own to resolve the conflicts. The next two +tabs are 2-pane views for reference, each showing a diff from the base to one +of the sides. The last tab (the right side compared to base) is generally the +more useful of the two reference tabs. + ## Commit Signing `jj` can be configured to sign and verify the commits it creates using either