M4.6: Git log and file history
- crates/vcs log.rs: Repo::log (topological, all refs, paging, literal message/author filters, a path's history with --follow), show_commit (message and files against the first parent, renames) and show_at (a file at any commit); parsers property-tested. - Engine git.log, git.showCommit, git.showAt in cmd/git_log.rs through the step-1 hook. - Log tab in the bottom panel: graph lanes carried across pages, ref badges, filters, lazy paging, keyboard; commit details whose files open a read-only diff at that commit in M4.3's viewer. - vcs.showLog and vcs.showHistory (menu, tree context menu, active editor tab), no default shortcuts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b814c49733
commit
a8531825a3
27 changed files with 3349 additions and 16 deletions
|
|
@ -30,7 +30,9 @@
|
|||
* (`Mod+Alt+Shift+G`) and `vcs.commit` (`Mod+Alt+Shift+M`, which also
|
||||
* focuses the commit message box); `vcs.refresh` re-reads the Git status.
|
||||
* Its store reads the status from the start, so it is current when the
|
||||
* tab opens.
|
||||
* tab opens. The Log tab (M4.6) appears with `vcs.showLog` and with
|
||||
* `vcs.showHistory {path?}` (the history of a file or folder; without a
|
||||
* path, of the active editor tab's file); neither has a default shortcut.
|
||||
*
|
||||
* A slim header bar along the top (M3.9) holds the app menu
|
||||
* ({@link AppMenu}); its `header` slot can replace it.
|
||||
|
|
@ -49,6 +51,10 @@ import ReferencesToolWindow from "../editor/nav/ReferencesToolWindow.vue";
|
|||
import { useNavStore } from "../editor/nav/nav";
|
||||
import ChangesToolWindow from "../vcs/changes/ChangesToolWindow.vue";
|
||||
import { useChangesStore } from "../vcs/changes/changes";
|
||||
import LogToolWindow from "../vcs/log/LogToolWindow.vue";
|
||||
import { SHOW_HISTORY_COMMAND, SHOW_LOG_COMMAND, useLogStore } from "../vcs/log/log";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
import { useProjectStore } from "../../stores/project";
|
||||
import ProjectToolWindow from "../project/ProjectToolWindow.vue";
|
||||
import StatusBar from "../StatusBar.vue";
|
||||
import StructureToolWindow from "../structure/StructureToolWindow.vue";
|
||||
|
|
@ -96,9 +102,12 @@ const terminal = useTerminalStore();
|
|||
const problems = useProblemsStore();
|
||||
const nav = useNavStore();
|
||||
const changes = useChangesStore();
|
||||
const vcsLog = useLogStore();
|
||||
const editor = useEditorStore();
|
||||
const project = useProjectStore();
|
||||
|
||||
/** Tool windows of the bottom panel. */
|
||||
type BottomTool = "find" | "terminal" | "problems" | "references" | "changes";
|
||||
type BottomTool = "find" | "terminal" | "problems" | "references" | "changes" | "log";
|
||||
/** The bottom tool window last chosen. */
|
||||
const bottomTool = ref<BottomTool>("find");
|
||||
/** Bottom tool windows that are shown, in tab order. */
|
||||
|
|
@ -109,6 +118,7 @@ const bottomTools = computed(() => {
|
|||
if (problems.visible) tools.push({ id: "problems", title: t("problems.toolWindow.title") });
|
||||
if (nav.visible) tools.push({ id: "references", title: t("nav.references.title") });
|
||||
if (changes.visible) tools.push({ id: "changes", title: t("vcs.changes.toolWindow.title") });
|
||||
if (vcsLog.visible) tools.push({ id: "log", title: t("vcs.log.toolWindow.title") });
|
||||
return tools;
|
||||
});
|
||||
/** The active bottom tool window: the chosen one if shown, else the first. */
|
||||
|
|
@ -126,7 +136,9 @@ const bottomStore = computed(() =>
|
|||
? nav
|
||||
: bottomActive.value === "changes"
|
||||
? changes
|
||||
: find,
|
||||
: bottomActive.value === "log"
|
||||
? vcsLog
|
||||
: find,
|
||||
);
|
||||
/** Expansion of the panel, kept per tool window by its store. */
|
||||
const bottomOpen = computed({
|
||||
|
|
@ -142,7 +154,7 @@ const bottomOpen = computed({
|
|||
* @param id - the tool window id from the panel.
|
||||
*/
|
||||
function chooseBottom(id: string): void {
|
||||
if (id === "find" || id === "terminal" || id === "problems" || id === "references" || id === "changes") {
|
||||
if (id === "find" || id === "terminal" || id === "problems" || id === "references" || id === "changes" || id === "log") {
|
||||
bottomTool.value = id;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,6 +172,7 @@ onMounted(() => {
|
|||
terminal.start();
|
||||
problems.start();
|
||||
changes.start();
|
||||
vcsLog.start();
|
||||
withdraw = [
|
||||
commands.provide("view.toggleProjectTree", {
|
||||
run: () => {
|
||||
|
|
@ -201,6 +214,20 @@ onMounted(() => {
|
|||
run: () => changes.refresh(),
|
||||
enabled: () => commands.isEnabled("git.status"),
|
||||
}),
|
||||
commands.provide(SHOW_LOG_COMMAND, {
|
||||
run: () => {
|
||||
bottomTool.value = "log";
|
||||
return vcsLog.open();
|
||||
},
|
||||
enabled: () => project.root !== null,
|
||||
}),
|
||||
commands.provide(SHOW_HISTORY_COMMAND, {
|
||||
run: (params) => {
|
||||
bottomTool.value = "log";
|
||||
return vcsLog.runShowHistory(params, editor.activeTab?.path ?? null);
|
||||
},
|
||||
enabled: () => project.root !== null,
|
||||
}),
|
||||
commands.provide("view.toggleStructure", {
|
||||
run: () => {
|
||||
toggleLeft("structure");
|
||||
|
|
@ -218,6 +245,7 @@ onBeforeUnmount(() => {
|
|||
terminal.stop();
|
||||
problems.stop();
|
||||
changes.stop();
|
||||
vcsLog.stop();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -292,6 +320,10 @@ onBeforeUnmount(() => {
|
|||
<ProblemsToolWindow v-show="bottomActive === 'problems'" />
|
||||
<ReferencesToolWindow v-show="bottomActive === 'references'" />
|
||||
<ChangesToolWindow v-show="bottomActive === 'changes'" />
|
||||
<LogToolWindow
|
||||
v-if="vcsLog.visible"
|
||||
v-show="bottomActive === 'log'"
|
||||
/>
|
||||
</BottomPanel>
|
||||
<StatusBar />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue