Versions 63 to 318
Lines 1–7 at 318 (were 1–7 at 63)
11// Discard unpublished changes to some files, like git restore. Writes go through RestoreHost; 22// today the host is Project. 4−import type { AtomId, Graph, Hunk, View } from "../../src/engine/index.ts";
4+import type { AtomId, Graph, Hunk, ReadView } from "../../src/engine/index.ts"; 55import { checkReadPath } from "./path-rules.ts"; 66import { ProjectError } from "./project-error.ts"; 77import type { AgentState, Blobs, Entry, Files, Meta, Mode, Modes, RestoreAnswer } from "./project-types.ts"; Lines 11–25 at 318 (were 11–24 at 63)
1111 readonly graph: Graph; 1212 agent(name: string, entries: Entry[]): AgentState; 1313 draft(agent: AgentState): AtomId[]; 14− touchedFiles(ids: Iterable<AtomId>, views: readonly View[]): Set<string>;
14+ touchedFiles(ids: Iterable<AtomId>, views: readonly ReadView[]): Set<string>; 1515 apply(entry: Entry): void; 16− view(set: ReadonlySet<AtomId>): View;
16+ view(set: ReadonlySet<AtomId>): ReadView; 1717 agentSet(agent: AgentState): Set<AtomId>; 18− agentView(agent: AgentState): View;
18+ agentView(agent: AgentState): ReadView; 19+ agentViewWithout?(agent: AgentState, excluded: ReadonlySet<AtomId>): ReadView; 21− view: View,
2324 text: string | null | undefined, Lines 65–79 at 318 (were 64–72 at 63)
6465 // Whatever is still changed in a target goes back with a new change. 6566 const now = host.draft(agent); 6667 const without = new Set(now); 67− const original = host.view(new Set([...host.agentSet(agent)].filter((id) => !without.has(id))));
68+ const originalAgent = { ...agent, mine: [...agent.mine] }; 69+ const originalView = () => 70+ host.agentViewWithout 71+ ? host.agentViewWithout(originalAgent, without) 72+ : host.view(new Set([...host.agentSet(originalAgent)].filter((id) => !without.has(id)))); 6873 for (const path of [...targets].toSorted()) { 6974 if (!touched.has(path)) continue; 75+ // A previous file may have mutated the graph. Reopen the same base view. 76+ const original = originalView(); 7077 const was = original.attrs(path);