Lightweight copy

Brendan Cully brendan at kublai.com
Mon May 7 16:59:56 CDT 2007


On Sunday, 06 May 2007 at 15:58, TK Soh wrote:
> On 5/6/07, Matt Mackall <mpm at selenic.com> wrote:
> > On Sun, May 06, 2007 at 02:29:03PM +0200, Guido Ostkamp wrote:
> > > > The most recent revision of the file or all the files in the directory
> > > > is copied, and it remembers where each file was copied from so that it
> > > > can merge changes across file renames.
> > >
> > > thanks, but this is not what I meant.
> > >
> > > I just did some experiments. My repository (after removal of working copy)
> > > has a size of 442 MB. When I "hg copy dir1 dir2; hg commit" where dir1 has
> > > everything in it, then (again after removal of the working copy) the size
> > > of the repository has increased to 825 MB.
> > >
> > > This certainly means that Mercurial does not use lightweight copies.
> >
> > When you copy a file, a new revlog is created with the new filename
> > containing a single compressed revision of the file. If the old file
> > only had one revision, then yes, the size will double. If the old file
> > had a thousand revisions, it will not.
> 
> I am guessing a significant portion of renames, especially on the
> directories, happen as second thought, so there's a good chance that a
> lot of files will only contain one revision. It'd be nice if Hg can
> somehow create a link info in the new revlog that reference back to
> old revlog instead.

Overlay does some pretty similar work. I think it shouldn't be too
hard to adapt it for in-repo backpointers, say by setting another
revlog flag in entry 0 and making the inline data be the source name.


More information about the Mercurial mailing list