resolvedEntry

tcmts.cli.merge.resolvedEntry · #5drd5aex · term · runs anywhere

The history entry's name for saving definitions over conflicted names: resolve lib.k (merged), each with how it was settled (ours or theirs where it's that side's definition, kept whole), as tcm history and tcm diff show it.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { conflictAt } from "#codebase/tcmts/cli/merge";
import type { DefKind } from "#codebase/tcmts/core/types";

export function resolvedEntry(
  cb: Codebase,
  resolved: { path: string; kind: DefKind; hash: string }[],
): string {
  const how = resolved.map((r) => {
    const side = conflictAt(cb, r.path, r.kind)?.sides.find((s) => s.hash === r.hash)?.side;
    return `${r.path} (${side ?? "merged"})`;
  });
  return `resolve ${how.slice(0, 2).join(", ")}${how.length > 2 ? ` (+${how.length - 2})` : ""}`;
}

uses

used by