gpt4 book ai didi

shell - 了解 mercurial repo 状态的最快方法

转载 作者:行者123 更新时间:2023-12-01 07:02:14 26 4
gpt4 key购买 nike

在大型存储库上,hg status 可能非常慢,如果我们想在 shell 提示符中显示存储库的状态,这可能是个问题。

这是 hg --profile status 的结果:

   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
7682 0 0.3287 0.3287 <mercurial.osutil.listdir>
63067 0 0.2052 0.2052 <method 'match' of '_sre.SRE_Pattern' objects>
1 0 0.7164 0.0735 mercurial.dirstate:999(traverse)
2 0 0.8105 0.0496 mercurial.dirstate:1102(status)
139 0 0.0420 0.0420 <zlib.decompress>
62501 0 0.1137 0.0339 mercurial.dirstate:617(_normalizefile)
12 0 0.0307 0.0307 <method 'read' of 'file' objects>
63760 0 0.0283 0.0283 <method 'get' of 'dict' objects>
1 0 0.0217 0.0217 <mercurial.parsers.make_file_foldmap>
376 0 0.0508 0.0202 mercurial.manifest:468(walk)
70079 0 0.0327 0.0170 mercurial.posix:241(normcase)
1 0 0.0167 0.0167 mercurial.dirstate:200(_dirs)
70079 0 0.0156 0.0156 <mercurial.parsers.asciilower>
2 0 0.0137 0.0137 <mercurial.parsers.parse_dirstate>
62875 0 0.2166 0.0116 mercurial.match:177(__call__)
4 0 0.0113 0.0113 <method 'update' of '_hashlib.HASH' objects>
1 0 0.0107 0.0106 mercurial.manifest:451(_dirs)
105 75 0.0132 0.0081 <__import__>
2 0 0.7559 0.0069 mercurial.dirstate:940(walk)
2 0 0.0062 0.0062 <mercurial.mpatch.patches>
724 678 0.0188 0.0061 sre_parse:395(_parse)
1198 1152 0.0094 0.0056 sre_compile:64(_compile)
3866 0 0.0043 0.0040 re:208(escape)
6227 0 0.0044 0.0036 sre_parse:193(__next)
1 0 0.0767 0.0028 mercurial.manifest:1307(read)
1431 1152 0.0032 0.0026 sre_parse:151(getwidth)
1 0 0.0219 0.0026 mercurial.dirstate:167(_dirfoldmap)
30130 0 0.0024 0.0024 <method 'append' of 'list' objects>
1 0 0.0022 0.0022 mercurial.manifest:407(__init__)
7573 0 0.0036 0.0022 sre_parse:141(__getitem__)

我已经找到了针对 hg branch ( see here for more details ) 的优化,但是我找不到针对 hg status 的优化。

你知道一些魔术来改善它吗?我不需要知道哪些文件脏或不脏的详细信息,我只需要知道存储库是否干净,这样我就可以显示干净或红色提示。

谢谢!

最佳答案

您尝试过 FsMonitor 吗?扩展?

维基页面的描述:

Integrates the file-monitoring program Watchman with Mercurial to produce faster status results.

On a particular Linux system, for a real-world repository with over 400,000 files hosted on ext4, vanilla hg status takes 1.3 seconds. On the same system, with fsmonitor it takes about 0.3 seconds.

关于shell - 了解 mercurial repo 状态的最快方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40452486/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com