Mercurial repository recovery

Mercurial revlog corruption can damage repository history while leaving the current working files intact.

Mercurial separates working-directory state from repository history under .hg. Damage to dirstate can confuse local status, while missing or corrupt revlogs in .hg/store can remove changesets, manifests, or file revisions.

Understand the symptom

hg verify distinguishes working-state problems from damaged repository history.

WHY

What is happening

Mercurial documents dirstate reconstruction separately from revlog recovery. Known-good clones can supply missing history, while lossy conversion may change revision hashes and require every user to re-clone.

What you may see

Symptoms that change the recovery path.

01

hg verify reports missing revlog

A changeset, manifest, or file revision cannot be located.

02

Unknown revision after dirstate damage

Working-directory parent pointers are invalid.

03

Clone or pull stops at one changeset

Repository history is unreadable at a specific point.

04

Working files exist but status is wrong

Current content survived while dirstate or metadata did not.

Protect the source

Actions that can make the situation worse.

01

Rebuildstate can forget additions

It may restore parent state without reconstructing every local intent.

02

Lossy conversion changes hashes

Branches, tags, integrations, and clones may need reconciliation.

03

Hardlinked clones can share damage

A supposedly separate copy may reference the same underlying storage.

Do this now

Safe steps before evaluation.

01

Copy the repository and working tree

Keep .hg and uncommitted files together with permissions and timestamps.

02

Run hg verify only on a copy

Record the first error, affected revlog, repository requirements, and version.

03

Collect independent clones

Preserve remotes, bundles, CI checkouts, developer clones, and release artifacts.

04

List uncommitted priorities

Identify modified, added, removed, ignored, and untracked files before rebuilding state.

NEPFOSYS process

How a data-first evaluation proceeds.

01

Repository assessment

NEPFOSYS maps requirements, changesets, manifests, revlogs, dirstate, bookmarks, phases, and readable ranges.

02

History comparison

Clones, bundles, working files, and intact revlogs are correlated on protected copies.

03

Recovered-repository validation

hg verify, revision graphs, tags, branches, file histories, hashes, and working changes are reviewed.

A clear next step

Preserve the original device before another repair or recovery attempt.

Start a case with the exact symptoms, incident timeline, prior attempts, encryption details, and the files that matter most. NEPFOSYS will route the case to the appropriate DFW intake or nationwide mail-in path.

Start with a case review

Questions, answered

What customers ask before starting.

Is dirstate corruption the same as history loss?

No. Dirstate tracks the working copy; revlogs store repository history.

Can another clone repair the repository?

Often it can supply missing history if it contains the same revisions and repository format.

Will hg convert preserve every hash?

Not necessarily; lossy recovery can create a new history that requires re-cloning.

DFW local · Nationwide mail-in

Protect the device. Start with the facts.

Start my recovery case