The codebase was breaking in ways no one could trace. Changes seemed to bleed into places they had no right to be. The cause was clear: mutability without discipline.
Mercurial is fast, distributed, and trusted by teams shipping critical software. But without immutability, its history can still be altered, rewritten, or polluted. Immutability in Mercurial means designing your workflow, hooks, and repository policies so commits and tags cannot be changed once written. This eliminates hidden merges, prevents history rewrites, and guarantees that every hash points to the same exact data forever.
Implementing immutability in Mercurial starts with server-side enforcement. Disable --force pushes. Require signed commits. Use hooks like pretxnchangegroup to reject incoming changesets that rewrite public history. Store repositories on filesystems with write protections for .hg/store. Audit pushes with scripts that compare incoming changes against known public states.