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
|
|
@ -627,6 +627,29 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
- **Look:** both sides use the Lutra editor theme and the file's language; changed lines are tinted with `color-mix` of `--lt-vcs-deleted` (left) and `--lt-vcs-added` (right) into `--lt-editor-bg`, changed words more strongly, a change bar in each gutter, unchanged stretches over 8 lines collapse to a row (3 lines of context). No colour outside the tokens.
|
||||
- **Tests:** `ui/tests/vcs/DiffView.test.ts` (21 Vitest tests against a fake engine: params and `git.show` parsing, EOL normalisation, index and HEAD sides, one tab per side, the palette without a path, bad params and no file as toasts, disabled without a project, edits on the right reaching `buffer.edit`, engine changes reaching the right side, the left side refresh on `gitChanged`, closing with the buffer, binary / too large / git error / deleted / new file, switching between diff and file tabs, next/previous change with wrap-around, the tree context menu by right click and by Shift+F10 with Escape).
|
||||
|
||||
### History (M4.6)
|
||||
|
||||
- **Backend (`crates/vcs/src/log.rs`, appended to `Repo`):**
|
||||
- `log(LogQuery {skip, limit ≤ 500, path?, query?, author?})`: `git log --topo-order` (children before parents, so the UI can draw lanes) over `--branches --remotes --tags HEAD`; with a path, HEAD's history of that path, with `--follow` when it is a file. Text and author filters are literal and case-insensitive (`--fixed-strings --regexp-ignore-case`). In a repository whose root lies above the project, only commits touching the project. A repository without commits has an empty log.
|
||||
- Format: `%x1e` before each record, NUL between hash, parents, author, email, strict ISO date, subject and decorations (`%D`); malformed records are skipped.
|
||||
- `show_commit(hash)`: 4–64 hex digits only. Reads the full message (`show -s`) and the files against the first parent (`diff-tree --no-commit-id -r -z -M --name-status`, `--root` for a root commit), at most 10,000 inside the project, with `truncated`.
|
||||
- `show_at(path, rev)`: `rev:path` through `cat-file --batch-check`, then the blob, with the same binary, size and BOM rules as `show`. A revision starting with `-`, holding `:` or control characters is refused; a missing path or revision is empty contents.
|
||||
- The parsers are property-tested with random bytes.
|
||||
- **Shared hook for new git commands (wave 2/3):** `Repo::run`, `check_name` and `SMALL_CAP` are `pub(crate)`. In `cmd/git.rs`, `Op::Custom {mutates, run}` and `start_with(state, id, mutates, run)` run a closure from another module exactly like the built-in commands: a pending outcome, git and the repository cached, and `gitChanged` after a change. `rel_path` resolves path params. M4.6's commands live in `crates/engine/src/cmd/git_log.rs`.
|
||||
- **Commands** (read-only, pending, no `gitChanged`):
|
||||
- `git.log {skip?, limit? (1–500, 100), path?, query?, author?}` → `{commits: [{hash, parents, author, email, date, subject, refs}]}`.
|
||||
- `git.showCommit {hash}` → `{hash, parents, author, email, date, message, files: [{path, status, origPath?}], truncated}`. `email` and `truncated` are additions to the C6 contract.
|
||||
- `git.showAt {path, rev}` → `{text|null, binary, tooLarge}` (the shape of `git.show`).
|
||||
- A bad limit, hash, revision or path is `invalid_params`; an unknown commit is `failed` with git's message.
|
||||
- **Log tab** (`ui/src/components/vcs/log/`): `log.ts` is the store, `graph.ts` the lane layout, `LogToolWindow.vue` the window. It is a tab of the bottom panel, opened by the UI commands `vcs.showLog` (menu Git › Log) and `vcs.showHistory {path?}` (menu Git › Show History, the project tree's context menu; without a path, the active editor tab's file). Neither has a default shortcut.
|
||||
- **List:** pages of 100 through `runWaiting`. The next page loads when the list scrolls within 30 rows of its end, or when the keyboard selection gets there. One load at a time, a generation counter drops stale answers, at most 50,000 commits. Rows show the graph, ref badges (HEAD, branch, remote, tag; `<remote>/HEAD` left out), the subject, the author and the local date. Up/Down/Page/Home/End move the selection.
|
||||
- **Graph:** one column per waiting lane. A commit takes the leftmost lane waiting for it, and the other lanes waiting for it join it. Its first parent continues in its column, and further parents join an existing lane or take the first free one. Lanes left after a page carry into the next, so rows already drawn never change. At most 24 columns, coloured from theme tokens only. With a text or author filter there is no graph (the parents are not listed), only dots.
|
||||
- **Filters:** message and author fields apply 300 ms after typing or on Enter. A "History of <path>" chip clears the path filter. `gitChanged` reloads only when HEAD or the branch moved (a commit or a checkout), not on staging. A project open or close clears the tab.
|
||||
- **Details:** the selected commit's short hash, author, email, date, full message and changed files (state colours, "from <old path>" for renames). Enter or a double-click on a file opens its diff at that commit.
|
||||
- **Diff at a commit (in M4.3's viewer):** `useDiffStore().openAtCommit(path, {hash, parent, origPath, deleted})` opens a "Diff: <name> (<short hash>)" tab. The left side is `git.showAt` of the old path at the first parent (empty for a root commit or an added file), the right side `git.showAt` at the commit (empty for a deleted file). Both sides are read-only texts with normalised line breaks; nothing is re-read on `gitChanged`, and no buffer is opened.
|
||||
- **Checked in the app** (debug build with the bundled UI, Windows 11, git 2.47.1, control port 7946, a demo repository with a feature branch merged with `--no-ff`, a rename, a tag and an unmerged branch; screenshots only, no input): `git.log` 75–79 ms over the control channel; `vcs.showLog` showed the lanes branching at the merge and joining at the fork point, the badges (HEAD, main, feature, hotfix, v1.0) and the first commit's details; `vcs.showHistory {path: "Renamed.php"}` showed its three commits back to the import as `Old.php`, without the other branch. The diff at a commit needs a double-click, so it is covered by Vitest only.
|
||||
- **Tests:** `crates/vcs/tests/log.rs` (5 tests against real temp repositories: empty repository, paging, merge parents and refs, tags, literal text filter, author filter, history across a rename, a folder's history, commit details and a root commit, contents at a commit and its parent, bad input, a project inside a repository); unit and property tests in `log.rs`; `crates/engine/tests/git_log.rs` (the command shapes, paging, filters, an absolute path, bad params, no `gitChanged`); Vitest `ui/tests/vcs/Log.test.ts` (21 tests: lanes for linear and merged histories, across pages and capped, parsers, badges, paging, filters with stale answers, reloads on `gitChanged`, errors, details, the window's rows, keyboard, filters and chip, the diff at a commit with both sides read-only, commands and the tree menu).
|
||||
|
||||
### Branches (M4.5)
|
||||
|
||||
- **Where:** `ui/src/components/vcs/branches/`: `branches.ts` is the Pinia store, `BranchStatusItem.vue` the status-bar item (one line in `StatusBar.vue`, after H3's progress item), `BranchPopup.vue` the popup. The item supplies the UI commands, so they exist wherever the status bar is.
|
||||
|
|
@ -654,6 +677,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-28 | minor | M4.6: history backend (`git.log`, `git.showCommit`, `git.showAt`), the shared hook for new git commands, the Log tab, diffs at a commit |
|
||||
| 2026-10-27 | minor | F3: `lutra_proc::spawn_suspended` (Phpactor) and `adopt` (ConPTY shell in a job), cancel superseded completions, syntax proptests compare leaf kinds |
|
||||
| 2026-10-27 | minor | C6 F1: remote branch checkout without a configured remote (`--no-track`), `git.lastMessage` and the Amend prefill, one shared git status store |
|
||||
| 2026-10-27 | minor | F2: `ui.screenshot` through WebView2 `CapturePreview` without focus; region fallback elsewhere; `--control` windows open unfocused |
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Every known shortfall, ranked. This is the work list: unless the owner gives a t
|
|||
| G5 | Search and navigation: find in files, go to file/class/symbol, first index | M2 | ~35 h |
|
||||
| G6 | Language server: completion, definition, hover, rename via Phpactor (~~PHP detection and Phpactor download~~, M3.1; ~~engine wiring and diagnostics~~, M3.3; ~~completion, hover, signature help~~, M3.4; ~~definition, references, rename~~, M3.5) | M3 | ~15 h |
|
||||
| G7 | ~~Terminal~~ (M3.6: PTY sessions, xterm.js sub-tabs in the bottom panel; settings, persistence, links and search still open), ~~`lutra` CLI and single instance~~ (M3.7: open folders and files at a line, `--wait`, forwarding a second start, token-protected rendezvous), ~~MCP server~~ (M3.8: `lutra mcp` with list/execute every command, screenshot, read buffer, recent events, open buffers as resources; still missing: resource and tool change notifications, progress for long commands), files outside the open project (the CLI refuses them; needs out-of-project buffers or a second window), `lutra diff` | M3 | ~16 h |
|
||||
| G8 | Git integration: ~~backend through the installed git~~ (M4.1: status, stage/unstage, commit and amend, file contents at HEAD/index, branches, checkout, branch creation, `gitChanged`), ~~Changes window~~ (M4.2: staged/changes/untracked groups, stage and unstage per file and group, commit and amend after saving, amend prefilled with the last message (C6 F1), no chunk staging), ~~gutter markers and status colours~~ (M4.4: added/modified/deleted against the index, tree and tab colours; no chunk actions), ~~diff viewer~~ (M4.3: side by side against the index or HEAD, editable working copy, next/previous change; no unified view, chunk actions or other revisions), ~~branch popup~~ (M4.5: status-bar branch, popup with local and remote branches and a filter, checkout after saving, new branch from HEAD; no merge, rebase, rename or delete), log, blame, conflicts, stash, remotes | M4 | ~122 h |
|
||||
| G8 | Git integration: ~~backend through the installed git~~ (M4.1: status, stage/unstage, commit and amend, file contents at HEAD/index, branches, checkout, branch creation, `gitChanged`), ~~Changes window~~ (M4.2: staged/changes/untracked groups, stage and unstage per file and group, commit and amend after saving, amend prefilled with the last message (C6 F1), no chunk staging), ~~gutter markers and status colours~~ (M4.4: added/modified/deleted against the index, tree and tab colours; no chunk actions), ~~diff viewer~~ (M4.3: side by side against the index or HEAD, editable working copy, next/previous change; no unified view, chunk actions or other revisions), ~~branch popup~~ (M4.5: status-bar branch, popup with local and remote branches and a filter, checkout after saving, new branch from HEAD; no merge, rebase, rename or delete), ~~log~~ (M4.6: Log tab with graph lanes, filters, paging, commit details, diffs at a commit, file history; no date or branch filters, no actions on commits), blame, conflicts, stash, remotes | M4 | ~122 h |
|
||||
| G9 | Debugger, test runner, Composer, run configurations | M5 | ~300 h |
|
||||
| G10 | Own indexer, type inference, inspections, refactorings | M6 | ~800 h |
|
||||
| G11 | Stability: crash-free operation on real projects and machines (~~recovery journal~~, M1.7) | ongoing | ~95 h |
|
||||
|
|
@ -54,6 +54,7 @@ G6 progress: M3.2 landed the LSP client library in `crates/lsp`: JSON-RPC framin
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-28 | patch | G8: log and file history (M4.6) |
|
||||
| 2026-10-27 | minor | G11 note: suspended Phpactor start, terminal shell in a job, completion cancel, syntax proptest (F3) |
|
||||
| 2026-10-27 | patch | G8: amend prefill, remote checkout fix, shared status store (C6 F1) |
|
||||
| 2026-10-27 | minor | Screenshot item shrunk: webview capture without focus on Windows (F2) |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Milestones
|
||||
|
||||
> **Status:** M0–M3 done, M4 in progress (C5: Git backend, Changes window, gutter markers and status colours, diff viewer, branches) · **Last updated:** 2026-10-26
|
||||
> **Status:** M0–M3 done, M4 in progress (C5: Git backend, Changes window, gutter markers and status colours, diff viewer, branches; C6: log) · **Last updated:** 2026-10-28
|
||||
|
||||
Hours are agent wall-clock hours for one agent; M0 and M1 so far are measured, the rest estimated. Since cycle C1 (factor 0.07) M1–M3 were scaled ×0.1 to ×0.15 (measured factors: C1 0.07, C2 0.10, C3 0.14, C4 0.17; next cycle ×0.18); M4–M6 keep their first raw estimates (multiply by ~0.1 for the calibrated value).
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ Hours are agent wall-clock hours for one agent; M0 and M1 so far are measured, t
|
|||
| M1 | Editor and project: open folder, tree, tabs, editor, save, recovery, palette, settings, themes | done 2026-10-16 (M1.1 text, M1.2 VFS, M1.5 tree UI, M1.3 engine workspace, M1.4 desktop bridge, M1.6 tabs and editor, M1.11 message catalog, M1.9a settings backend, M1.10 themes, M1.7 recovery journal, M1.12 notifications, M1.13 C1 follow-ups, M1.8 command palette and keymap, M1.14 app icon, M1.9b settings dialog; C2 live checks pending, gaming mode) | ~5.6 (measured: C1 2.5, C2 3.1) |
|
||||
| M2 | Syntax and search: highlighting, structure, find in files, go to file/class/symbol | done 2026-10-17 (C3: M2.1 tree-sitter syntax, M2.2 highlighting + `editor.reveal`, M2.3 search backend, M2.4 Find tool window, M2.5 symbol index + go-to commands, M2.6 go-to popup, M2.7 Structure tool window) | ~6.1 (measured) |
|
||||
| M3 | LSP, terminal, CLI: completion, diagnostics, go to definition, hover, rename; terminal; `lutra` CLI and MCP — **MVP** | done 2026-10-22 (C4: M3.1 PHP detection and Phpactor download, M3.2 LSP client, M3.3 engine wiring and diagnostics, M3.4 completion, hover and signature help, M3.5 definition, references and rename, M3.6 integrated terminal, M3.7 CLI and single instance, M3.8 MCP server, M3.9 app menu, M3.10 autosave; live check with real key presses pending) | ~14 (measured) |
|
||||
| M4 | Git: status, diff, commit, branches, log, blame, conflicts | in progress (C5: M4.1 backend, M4.2 Changes window, M4.4 gutter markers and status colours, M4.3 diff viewer, M4.5 branches done) | ~122 |
|
||||
| M4 | Git: status, diff, commit, branches, log, blame, conflicts | in progress (C5: M4.1 backend, M4.2 Changes window, M4.4 gutter markers and status colours, M4.3 diff viewer, M4.5 branches done; C6: M4.6 log done) | ~122 |
|
||||
| M5 | Debugger (Xdebug via DAP), PHPUnit/Pest runner, Composer, run configurations | not started | ~300 |
|
||||
| M6 | Own indexer and inspections; Symfony, Laravel, Shopware, WordPress support | not started | ~1,100 |
|
||||
| M7 | Workbench and tools: Deployment (FTP/SFTP/local mappings, upload/download, compare with server, save before deploy, optional upload on save per server), Local History, diff tool (files/folders), scratch files, macros, keymap editor, user themes, plug-in system, Database tools and SQL, HTTP Client, SSH/Docker/Vagrant/WSL, File Watchers, external tools, TODO view, tasks and contexts | not started | ~900 |
|
||||
|
|
@ -34,6 +34,7 @@ By the raw estimates the alpha gate needs M1–M4 plus cross-platform verificati
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-28 | minor | M4.6 log and file history |
|
||||
| 2026-10-26 | minor | M4.5 branch widget and popup |
|
||||
| 2026-10-26 | minor | M4.3 diff viewer |
|
||||
| 2026-10-25 | minor | M4.4 gutter markers and status colours |
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
# Tooling checklist
|
||||
|
||||
> **Status:** integrated terminal partial (M3.6), Git backend, Changes window, diff viewer and branches partial (M4.1, M4.2, M4.3, M4.5) · **Last updated:** 2026-10-26
|
||||
> **Status:** integrated terminal partial (M3.6), Git backend, Changes window, diff viewer and branches, log partial (M4.1, M4.2, M4.3, M4.5, M4.6) · **Last updated:** 2026-10-28
|
||||
|
||||
- [ ] Integrated terminal with tabs
|
||||
- M3.6 (2026-10-18): PTY sessions (pwsh → powershell → cmd on Windows, `$SHELL` or `/bin/sh` on Unix; cwd = project root) in the bottom panel's Terminal tab, several terminals as sub-tabs, xterm.js rendering with Lutra's colours, copy/paste, resize, exit codes; closed with the project. Missing: settings, persistence across restarts, split tabs, search, links, the PHP interpreter in `PATH`.
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
- M4.2 (2026-10-25): status, stage/unstage and commit (with amend) from the Changes tab, saving open files first. Missing: diff, gutter markers, branches UI, push/pull, log, blame, conflicts, stash.
|
||||
- M4.3 (2026-10-26): a side-by-side diff of the working copy against the staged version or the last commit, editable on the right, with next/previous change. Missing: comparing with other revisions or branches, a unified view, three-way merge for conflicts.
|
||||
- M4.5 (2026-10-26): current branch in the status bar, switch to a local or remote branch (saving open files first, git's refusal shown) and create a branch from HEAD in the branches popup. Missing: merge, rebase, rename, delete, push/pull, log, blame, conflicts, stash.
|
||||
- M4.6 (2026-10-28): Log tab with graph lanes, message and author filters and lazy paging; commit details with each file's diff at that commit; history of a file from the tree, the editor or the menu. Missing: date and branch filters, actions on commits (cherry-pick, revert, reset, checkout), comparing two commits, blame, conflicts, stash, push/pull.
|
||||
- [ ] Composer: install, update, require, scripts
|
||||
- [ ] PHP interpreters: local, Docker
|
||||
- [ ] Xdebug via DAP: breakpoints, stepping, variables, watches
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-28 | minor | Git: log and file history (M4.6) |
|
||||
| 2026-10-26 | minor | Git: branch widget, checkout and new branch (M4.5) |
|
||||
| 2026-10-26 | minor | Git: diff viewer (M4.3) |
|
||||
| 2026-10-25 | minor | Git: status, staging and commit from the Changes tab (M4.2) |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue