дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
fix(vcs): offer New Changelist and Move under Group By Staging State (#6596)
With the staging area off and the Commit tool window grouped by Staging State, the Staged / Unstaged nodes carry no changelist, so Move to Another Changelist… was hidden and New Changelist… (only on changelist headers) was unreachable. Their nodes and files now offer Move to Another Changelist… in the first group and New Changelist… next to Create Patch and Shelve. Nothing changes with the staging area on. Fixes #6422 Co-authored-by: audichuang <[email protected]>
Цей коміт міститься в:
1 джерело
9592b9ee1b
коміт
604e9348f2
2 files changed
+21
-1
No files matched your search
@@ -507,6 +507,8 @@ export function nodeMenu(
|
||||
]
|
||||
: []),
|
||||
];
|
||||
// Group By Staging State hides the lists, but its files still belong to one (#6422).
|
||||
const inChangelist = !staging && nodes.some((n) => n.changelist || n.group === "staged" || n.group === "unstaged");
|
||||
// The staging menu operates on the index. A change list can commit or move individual files.
|
||||
const primary: MenuItem[] = staging
|
||||
? [...stageActions, stash, ...rollback, ...fileActions]
|
||||
@@ -518,7 +520,8 @@ export function nodeMenu(
|
||||
run: () => commitFiles(paths),
|
||||
},
|
||||
...rollback,
|
||||
...(nodes.some((n) => n.changelist)
|
||||
// Group By Staging State hides the lists, but its files still belong to one, as in IDEA (#6422).
|
||||
...(inChangelist
|
||||
? [
|
||||
{
|
||||
kind: "action" as const,
|
||||
@@ -588,6 +591,7 @@ export function nodeMenu(
|
||||
{ label: "Copy File Name", icon: "copy", run: () => copyChangePaths(nodes, "name") },
|
||||
...(staging ? [] : [{ kind: "separator" as const }, ...fileActions, ...stageActions]),
|
||||
{ kind: "separator" },
|
||||
...(inChangelist ? [{ kind: "action" as const, action: "vcs.changelist.new" }] : []),
|
||||
...(canExportPatch ? [{ kind: "action" as const, action: "vcs.createPatch", arg: patchSelection }] : []),
|
||||
...(canExportPatch ? [{ kind: "action" as const, action: "vcs.copyPatch", arg: patchSelection }] : []),
|
||||
{ kind: "action", action: "vcs.shelve", arg: paths },
|
||||
|
||||
@@ -245,6 +245,21 @@ describe("staging operations of the tree's nodes", () => {
|
||||
expect(labels(nodeMenu([group("unstaged").children![0]!], []))).toContain("Commit File…");
|
||||
});
|
||||
|
||||
it("offers New Changelist and Move under Group By Staging State only while change lists are on (#6422)", () => {
|
||||
const actions = (node: (typeof roots)[number]) =>
|
||||
nodeMenu([node], []).flatMap((item) => (item.kind === "action" ? [item.action] : []));
|
||||
useSettings(false);
|
||||
for (const node of [group("staged"), group("unstaged"), group("unstaged").children![0]!]) {
|
||||
expect(actions(node)).toContain("vcs.changelist.new");
|
||||
expect(actions(node)).toContain("vcs.changelist.move");
|
||||
}
|
||||
useSettings(true);
|
||||
for (const node of [group("staged"), group("unstaged").children![0]!]) {
|
||||
expect(actions(node)).not.toContain("vcs.changelist.new");
|
||||
expect(actions(node)).not.toContain("vcs.changelist.move");
|
||||
}
|
||||
});
|
||||
|
||||
it.each([false, true])("groups the change menu for staging area = %s", (staging) => {
|
||||
useSettings(staging);
|
||||
const underUnstaged = group("unstaged").children!.find((n) => n.label === "Unstaged.kt")!;
|
||||
@@ -268,6 +283,7 @@ describe("staging operations of the tree's nodes", () => {
|
||||
"Copy File Name",
|
||||
]);
|
||||
expect(groups).toContainEqual([
|
||||
...(staging ? [] : ["vcs.changelist.new"]),
|
||||
"vcs.createPatch",
|
||||
"vcs.copyPatch",
|
||||
"vcs.shelve",
|
||||
|
||||
Reference in new issue
Заблокувати користувача