How to fix/investigate a corrupted repo?

Matt Mackall mpm at selenic.com
Fri Dec 6 21:47:52 UTC 2013


On Fri, 2013-12-06 at 16:24 -0500, Long Vu wrote:
> Hi,
> 
> My co-worker did a Ctrl-C during another mercurial operation, then did
> a rollback and now his repo appears to be corrupted.
> 
> hg verify
> 
> checking changesets
> checking manifests
> crosschecking files in changesets and manifests
> checking files
>  Web/Portal/source/com/intelerad/web/portal/gwt/server/PortalPatientService.java at 134048:
> broken revlog! (index
> data/Web/Portal/source/com/intelerad/web/portal/gwt/server/PortalPatientService.java.i
> is corrupted)
> warning: orphan revlog
> 'data/Web/Portal/source/com/intelerad/web/portal/gwt/server/PortalPatientService.java.i'
> warning: orphan revlog
> 'data/Web/Portal/source/com/intelerad/web/portal/gwt/server/PortalPatientService.java.d'
> 56960 files, 147298 changesets, 380139 total revisions
> 2 warnings encountered!
> 1 integrity errors encountered!
> (first damaged changeset appears to be 134048)
> 
> 
> So I thought maybe I could just strip that damaged changeset and pull
> again from upstream but strip doesn't work.
> 
> hg strip 134048
> 
> abort: index data/Web/Portal/source/com/intelerad/web/portal/gwt/server/PortalPatientService.java.i
> is corrupted!
> 
> 
> I ended up re-cloning everything which of course fixed the problem.
> 
> However, is there other ways to fix this kind of corruption error than
> re-cloning from scratch?

It usually involves some manual wizardry with a hex editor.

For non-interleaved revlogs (ones with a .d file), the .i file is a
sequence of 64-byte records. If these get scribbled in or only partially
written, hg will complain. You can usually manually truncate the file
until it starts working.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list