Finding Large Files in Mercurial Repository

大憨熊 提交于 2019-12-06 23:55:37

问题


Similar to this link but for mercurial. I'd like to find the files that are most contributing to the size of my mercurial repository.

I intend to use hg convert to create a new, smaller repository. I'm just not sure yet which files are contributing to the repository size. They could be files that have already been deleted.

What is a good way to find these anywhere in the repository history? There are over 20,000 commits. I'm thinking a powershell script, but I'm not sure what the best way to go about this is.


回答1:


Check hg help fileset. Something like

hg files "set:size('>1M')"

should do the trick for you. You might need to operate over all revisions, though as it only operates on one revision. In bash I'd try something like

for i in `hg log -r"all()" "set:size('>400k')" --template="{rev}\n"`; do hg files -r$i "set:size('>400k')"; done | sort | uniq

might do the trick. Maybe it can be optimized as it's currently a bit duplication and might run for quite a bit; on the OpenTTD repository with 22000 commits it took on my laptop just short of 10 minutes.

(Also check hg help on templates, files and grep)



来源:https://stackoverflow.com/questions/34278136/finding-large-files-in-mercurial-repository

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