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

Matt Mackall mpm at selenic.com
Wed Feb 25 05:37:38 CST 2009


On Wed, 2009-02-25 at 09:44 +0100, Martin Geisler wrote:
> Tim Molendijk <tim at timmolendijk.nl> writes:
> 
> > I very much don't like this situation, but how can I truly get rid of
> > the file? If I simply remove it, it remains part of a past changeset,
> > so every time I make a new clone of the repository it will need to be
> > downloaded again (twice in my case).
> 
> The problem that moved/renamed files take up extra space is known:
> 
>   http://www.selenic.com/mercurial/bts/issue883
> 
> You can add yourself to the nosy list if you want to follow the issue.
> 
> > If I update back to a revision before I added the file I lose all my
> > changes that followed, and I cannot see how I could merge these
> > changes back in without merging back in the video file as well.
> 
> As suggested you can either:
> 
> * clone the repository at a revision before you added the file. Then
>   redo the following changesets. You can redo the changesets in many
>   ways:
> 
>   - use hg export and hg import
>   - use MQ
>   - use the transplant extension
> 
>   This approach has the advantage that previous changesets are left
>   untouched and so other clones will still be related to your clone.
> 
> * 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.

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




More information about the Mercurial mailing list