How does mercurial compress files in repository?

拥有回忆 提交于 2019-12-12 10:56:31

问题


I'm seeing that mercurial efficiently compresses the files in repository

(repo/.hg/store/data)

Does anybody know what kind of compression is used for repository files?

Thanks.


回答1:


There are two levels of compression in Mercurial repositories: delta storage, and zlib compression.

In addition, various other parts employ also compression. For example, bundles can be compressed with both gzip and bzip2, as can archive tarballs - but I don't think you were asking for these.




回答2:


You might find Mercurial author Matt Mackall's paper on the revlog format interesting.




回答3:


Initial versions of files are compressed using deflate (same algorithm as zip), but for updated files, Mercurial stores only a (binary) diff against a previous version.

It also tries to do the right thing: When a deflated JPEG turns out bigger than the original, it will not store it "compressed", for example.



来源:https://stackoverflow.com/questions/1270470/how-does-mercurial-compress-files-in-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!