M4.8: merge conflicts with a three-pane resolve view

Backend (crates/vcs/src/merge.rs, cmd/git_merge.rs via start_with):
git.merge {branch} -> {result: merged|upToDate|conflicts, conflicts},
git.mergeAbort, git.conflictVersions {path} -> {base?, ours, theirs,
binary, tooLarge} from the index stages :1:/:2:/:3:, git.markResolved
{paths}. Repo::lock becomes pub(crate) so merge and abort hold the
mutation lock.

UI (ui/src/components/vcs/merge/): merge dialog with branch picker,
conflicts list from the shared status store, a three-pane resolve view
(ours / editable result / theirs) with accept left/right per chunk,
accept all, previous/next conflict, Apply through the file's buffer then
mark resolved, keep-a-side for modify/delete, abort after confirmation.
Own three-way line merge on @codemirror/merge's diff. UI commands
vcs.merge, vcs.resolveConflicts, vcs.abortMerge (no default shortcuts);
the Changes window opens conflicted rows in the resolve view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-29 17:48:24 +01:00
parent 74c674ed12
commit d82e57b3ac
26 changed files with 3872 additions and 16 deletions

View file

@ -14,9 +14,11 @@
* (`--lt-vcs-*`), its directory and its state. Up/Down, Page Up/Down,
* Home and End move the selection, Space stages or unstages it, Enter or
* a double-click opens it.
* - **Opening:** through the UI command `vcs.showDiff {path, staged}` when
* something provides it (the diff viewer, M4.3); until then the file
* opens in the editor (`file.open`), unless it was deleted.
* - **Opening:** a conflicted file through `vcs.resolveConflicts {path}`
* (the merge dialog, M4.8); others through the UI command
* `vcs.showDiff {path, staged}` when something provides it (the diff
* viewer, M4.3); until then the file opens in the editor (`file.open`),
* unless it was deleted.
* - **Commit box:** the message, an Amend checkbox and Commit. Commit
* saves dirty buffers first (`flushDirty`); `Mod+Enter` in the box
* commits too.
@ -204,12 +206,18 @@ function groupToggleLabel(group: GroupId): string {
}
/**
* Opens a row: the diff when `vcs.showDiff` is provided, else the file.
* Opens a row: a conflicted file's resolve view when `vcs.resolveConflicts`
* is provided (M4.8), else the diff when `vcs.showDiff` is provided, else
* the file.
*
* @param row - the row.
*/
async function openRow(row: ChangeRow): Promise<void> {
changes.select(row.key);
if (row.state === "conflicted" && commands.isEnabled("vcs.resolveConflicts")) {
await commands.execute("vcs.resolveConflicts", { path: row.file.path });
return;
}
const staged = row.group === "staged";
if (commands.isEnabled("vcs.showDiff")) {
await commands.execute("vcs.showDiff", { path: row.file.path, staged });