How to get rid of big binary files buried in my repository's history

Matt Mackall mpm at selenic.com
Wed Feb 25 12:00:25 CST 2009


On Wed, 2009-02-25 at 09:18 -0500, Douglas Philips wrote:
> On or about 2009 Feb 25, at 6:37 AM, Matt Mackall indited:
> > On Wed, 2009-02-25 at 09:44 +0100, Martin Geisler wrote:
> >>> * convert the repository hg -> hg and use a filemap.
> >>
> >>  I don't know why, but this will change revision hashes on all
> >>  changesets, including those from before the file was added.
> >
> > Given you're part of crew now, you ought to know why:
> >
> > The changeset id is a hash of every byte in the given changeset AND  
> > its
> > parents. You can't change any byte anywhere in history without  
> > breaking
> > it.
> 
> Isn't the full answer that convert is creating a brand new repo?

Nope.

> And that means recreating all the changesets from scratch, and that  
> means even if the bits are the same, the changesets won't be (though  
> the time stamps seem to be correct, hmmm, that is what I thought would  
> make the diff).

There are a couple details in changesets we might not properly preserve,
but you're not likely to see them in modern hg.

> At the end of my hg->hg conversion all the tags are borked too,  
> because of course all the changesets are different... (I'm using hg  
> 1.1.2 on Mac OS X 10.5 FWIW). hg help convert says that  
> convert.hg.saverev defaults to True

convert -h says:

    --config convert.hg.saverev=True          (boolean)
        allow target to preserve source revision ID

And on closer inspection "preserve" means "save original revision ids in
the new changeset" and not "don't destroy my current changeset hashes". 
This seems like a very unfortunate and self-defeating default AND option
description. Guess I'll change it.

Btw, here's how you see what convert's doing:

hg log --debug:

changeset:   0:bf48baa0a47adaad41e508f34684eddb9a41a91a
tag:         tip
parent:      -1:0000000000000000000000000000000000000000
parent:      -1:0000000000000000000000000000000000000000
manifest:    0:8515d4bfda768e04af4c13a69a72e28c7effbea7
user:        Matt Mackall <mpm at selenic.com>
date:        Wed Feb 25 11:35:18 2009 -0600
files+:      a
extra:       branch=default
extra:       convert_revision=e8c9b0cb44a70e87b27634d80729d88535d0c6db
description:
0

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list