Why are renames so expensive?

Jeff Schiller codedread at gmail.com
Fri Feb 19 22:17:54 UTC 2010


	$ hg init
	$ du -k . | sort -nr | head -1
	8	./.hg
	$ cp ~/some-pic.jpg .
	$ du -k . | sort -nr | head -1
	3248	.
	$ hg add some-pic.jpg
	$ hg ci -m "Add photo"
	$ du -k . | sort -nr | head -1
	6516	.

At this point, the repo now takes about double hte size of the photo.
So far this is what git and bzr do as well.

	$ hg rename some-pic.jpg photo.jpg
	$ hg ci -m "Rename photo"
	$ du -k . | sort -nr | head -1
	9756	.

Now the repo takes about triple the size of the photo.  git and bzr do
not do this, they seem to do a logical move.

Why does hg take this approach?  I see no logical reason why a move or
copy should not be only a fixed delta cost to the repo.

Thanks,
Jeff



More information about the Mercurial mailing list