Файли
openidea/src/features/vcs/comparePaths.ts
T
Mosab Anini 5c3feea2a8
CI / Changes (push) Successful in 2s
Language smoke / Language smoke (typescript) (push) Failing after 5s
CI / Cargo deny (push) Successful in 10m50s
CI / Rust (windows-latest) (push) Failing after 18s
CI / Frontend (push) Failing after 30m6s
Language smoke / Language smoke (kotlin) (push) Failing after 5s
CI / E2E (push) Failing after 30m45s
CI / Rust (ubuntu-22.04) (push) Failing after 2m14s
CI / Rust (macos-latest) (push) Failing after 1h0m27s
CI / Remote server (linux musl) (push) Successful in 8m3s
Language smoke / Language smoke (go) (push) Failing after 7s
Language smoke / Language smoke (python) (push) Failing after 4s
Language smoke / Language smoke (rust) (push) Failing after 4s
CI / Plugins (SDK, official, fixtures) (push) Successful in 11m37s
Language smoke / Language smoke (java) (push) Failing after 5s
fix(vcs): honour the modal commit interface for Commit File… and diffs (#2158)
With Use non-modal commit interface unticked, parts of the IDE still assumed the Commit tool window: Commit File only set the inclusion and focused a message field that mode does not have, and diffs opened as editor tabs. Commit File and Commit Changelist now open the Commit dialog with those changes included, and user-opened VCS diffs (Local Changes, log, Shelf, compare actions) open in a front window whose close shortcut stays inside it. With the setting ticked, the default, behaviour is unchanged.

Co-authored-by: manini-1 <[email protected]>
2026-11-09 01:01:50 +08:00

54 рядки
2.0 KiB
TypeScript

import { call, commands } from "@/platform/ipc";
import { notifications } from "@/workbench/contributions";
import { tx } from "@/platform/i18n";
import { chooseRepositoryRevision } from "./RevisionChooser";
import { openVcsDiff } from "./diffInput";
import { showPathComparison } from "./operations";
import { displayPath } from "./compare";
export async function comparePathsWithRevision(paths: string[], revision?: string) {
const scope = await call(commands.vcsCompareScope(paths));
if (!scope.repositories.length) {
notifications().notify({
group: "vcs",
level: "info",
title: "Selection is outside Git repositories",
body: scope.skippedPaths.map((path) => displayPath(path)).join("\n"),
});
return;
}
const choice = revision
? { rev: revision, repositories: null }
: await chooseRepositoryRevision(tx("Compare with Branch or Revision"), {
repositories: scope.repositories,
tags: true,
});
if (!choice) return;
if (scope.singleFile && !revision) {
await openVcsDiff({
path: paths[0]!,
left: { type: "rev", rev: choice.rev, label: choice.rev },
right: { type: "worktree" },
});
} else {
// A shared branch reviews the selection, including explicit errors for roots lacking it.
const repositories = choice.repositories && choice.repositories.length === 1 ? choice.repositories : null;
showPathComparison(paths, choice.rev, repositories);
}
}
/** Returns false for a single file, whose existing Show Diff behavior is retained. */
export async function showDirectoryWorkingDiff(paths: string[]): Promise<boolean> {
const scope = await call(commands.vcsCompareScope(paths));
if (scope.singleFile) return false;
if (!scope.repositories.length) {
notifications().notify({
group: "vcs",
level: "info",
title: "Selection is outside Git repositories",
body: scope.skippedPaths.map((path) => displayPath(path)).join("\n"),
});
} else showPathComparison(paths, "HEAD", null);
return true;
}