Argh!!!

Matt Mackall mpm at selenic.com
Wed Mar 14 16:22:29 CDT 2007


On Wed, Mar 14, 2007 at 03:18:49PM -0600, Phillip Neiswanger wrote:
> All commands that try to make use of the repository no longer work, ie

> prompt> hg verify
...
>     self.manifest = manifest.manifest(self.sopener, v)
...
>     e = struct.unpack(self.indexformat, cur)

Somehow you've corrupted your manifest index. Not sure how you managed
that precisely, running commands as root shouldn't cause that.

But because Mercurial is append-only, the corruption is very likely at
the very end of the index. To fix it, all you need to do is truncate
it back to a working revision.

So start with:

$ ls -l .hg/store/
total 2280
-rw-r--r-- 1 username username  779981 Mar 14 15:48 00changelog.d
-rw-r--r-- 1 username username  254976 Mar 14 15:48 00changelog.i
-rw-r--r-- 1 username username 1012185 Mar 14 15:48 00manifest.d
-rw-r--r-- 1 username username  254976 Mar 14 15:48 00manifest.i
drwxr-xr-x 8 username username    4096 Feb  6 16:09 data/

The size of each index entry is 64 bytes:

$ python
Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 254976/64.0
3984.0

To truncate it back to manifest revision 3980, do something like:
>>> 3980 * 64
254720

$ cp manifest.i manifest.i.orig
$ dd if=manifest.i.orig of=manifest.i bs=1 count=254720

Then it should be readable.

If you've got changelog entries that point to truncated manifest
entries, you'll obviously have trouble pulling or checking out those
versions, but you should be able to clone -r <last full version>.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list