testViewNamesWhatTheOtherSideUses
The other side's definition of a conflicted name that can't follow this side's change (it doesn't typecheck against
it) keeps using what this branch replaced; tcm view shows that by name, saying which version it is.
import { okIn, tcmIn, tempDir } from "#codebase/tcmts/cli/test/e2e/harness"; import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; export const testViewNamesWhatTheOtherSideUses = () => { const dir = tempDir("merge view names"); const tcm = (...args: string[]) => okIn(dir, ...args); const update = (code: string) => { fs.writeFileSync(path.join(dir, "scratch.ts"), `// tcm: namespace lib\n${code}\n`); tcm("update"); }; tcm("init"); update(`export const f = (a: number): number => a;\nexport const g = (): number => f(1);`); tcm("branch", "s"); tcm("switch", "s"); update( `export const f = (a: string): number => a.length;\nexport const g = (): number => f("1");`, ); tcm("switch", "main"); update(`import { f } from "#codebase/lib";\nexport const g = (): number => f(1) + 0;`); tcm("switch", "s"); assert.equal(tcmIn(dir, "merge", "main").status, 1); const theirs = /conflict lib\.g: \S+ \(ours: s\) vs (\S+) \(theirs: main\)/.exec( tcm("todo"), )![1]!; const shown = tcm("view", theirs); assert.match(shown, /import \{ f \} from "#codebase\/lib";/); assert.doesNotMatch(shown, /\.tcm\/cache/); assert.match(shown, /not named on this branch: \S+ is an older lib\.f/); }