Mercurial: Renaming a file results in duplicate co

2020-04-02 17:13发布

I just start using Mercurial yesterday (I don't have much programming experiences). I noticed, if I rename a 200MB file, ideally the repository size should not change, but I found it increased 200MB.

Is this a bug/weakness of Mercurial? Any chance it could be fixed/improved in future?


Update:

I have just tried TortoiseGit 64bit version on Windows 7 64bit. It didn't create duplicate contents when renaming files. But it seems once I renamed a file, its history was lost.


Update 2:

See tonfa's comment below. From Mercurial wiki - GSoC Ideas 2010:

Project Ideas

Lightweight copies/renames

(very difficult - a successful student will become an expert in Mercurial's storage format and transmission protocol)

Copies and renames currently are not too efficient. Mercurial copies the copied/renamed source file to the new initial revision of the target file in its internal history store. For renames, this is especially counter-intuitive, as renaming a large file grows the store by the file's size. It would be better if Mercurial had some way of referring to the existing revision from the new file, while preserving backwards compatbility and bounded I/O guarantees for retrieving revisions. See issue883 for discussion. There's an mq from an old attempt at this located here.

Contact: mpm, tonfa, cyanite

标签: mercurial
1条回答
▲ chillily
2楼-- · 2020-04-02 17:34

No, it is not a bug. Renaming in mercurial causes removing file in old place and creating it in new one (with keeping the reference though, for merge and logging purposes).

So at least for now you can do nothing.

查看更多
登录 后发表回答