在Mercurial存储库中查找大文件 [英] Finding Large Files in Mercurial Repository
问题描述
类似于此链接,但为水银.我想找到对我的Merurial存储库最大的贡献的文件.
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.
我打算使用hg convert来创建一个新的较小的存储库.我只是不确定哪些文件正在影响存储库的大小.它们可能是已经删除的文件.
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.
在存储库历史记录中的任何位置查找这些内容的好方法是什么?超过20,000次提交.我正在考虑使用Powershell脚本,但是我不确定执行此操作的最佳方法是什么.
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.
推荐答案
检查hg help fileset
.像
hg files "set:size('>1M')"
应该为您解决问题.您可能需要对所有修订进行操作,尽管它仅对一个修订进行操作.在bash中,我会尝试类似的
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
可能会成功.也许可以对其进行优化,因为它目前有些重复,并且可能会运行很多时间.在具有22000次提交的OpenTTD存储库上,我的笔记本电脑只用了不到10分钟的时间.
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.
(还请检查templates
,files
和grep
上的汞帮助)
(Also check hg help on templates
, files
and grep
)
这篇关于在Mercurial存储库中查找大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!