“hg.exe 的命令行太长” Mercurial 中的错误

发布于 2024-10-08 17:25:56 字数 297 浏览 0 评论 0原文

因此,基本上每次我尝试更新更改的文件时,我都会遇到这个可怕的错误。然后,我必须手动仅选择一些文件,定义提交消息,然后返回并选择更多文件,放置其他提交文本等,直到覆盖所有更改的文件。

还有更简单的事吗,妈的?

我在 Visual Studio 2010 中使用 Tortoise HG ( http://www.newsupaplex.pp.ru/index_eng .html ),如果有什么区别的话。

So, basically about every time I try to do an update to my changed files, I get this awful error. I then have to manually select only some of the files, define a commit message, then come back and select some more files, put other commit text, etc, etc until I have covered all the changed files.

Is there anything simpler, dammit?

I am using Tortoise HG in Visual Studio 2010 ( http://www.newsupaplex.pp.ru/index_eng.html ), if it makes any difference.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

国粹 2024-10-15 17:25:56

HgSccPackage 使用 Mercurial 命令行客户端 hg.exe。
用于运行外部进程 (hg.exe) 的 .Net Framework API 中的最大命令行长度有 ~2000 个字符的限制。

由于提交必须是原子的,因此 HgSccPackage 无法完成该错误的操作。

您有三个选项:

  1. 您可以选择在提交窗口中检查所有更改的文件。然后 HgSccPackage 将调用 Mercurial 客户端提交所有文件(无需在命令行参数中传递每个文件)。
  2. 如果可能的话,您可以将提交拆分为具有更少文件的更小的逻辑部分。
  3. 如果可能的话,恢复一些文件并立即提交所有其他文件

如果 Mercurial 客户端可以选择在文件中传递文件列表(例如每行包含文件名的 list.txt),则会容易得多。但没有这样的选择。

顺便说一下,HgSccPackage 不传递文件的完整路径。相反,它传递相对于存储库根目录的文件路径。所以,你达到了命令行限制,这很奇怪。

您要提交多少文件?
为什么不能提交所有文件?

HgSccPackage uses mercurial command line client hg.exe.
There is a limitation on maximum command line length ~2000 characters in the .Net framework API used to run an external process (hg.exe).

And since the commit must be atomic the HgSccPackage fail to complete operation with that error.

You have three options:

  1. You have an option to check all changed files in commit window. Then HgSccPackage will call mercurial client to commit all files (without passing each and every one in command line arguments).
  2. If it is possible, you can split commit to smaller logical parts with fewer files.
  3. If it is possible, revert some files and commit all other at once

It would be much easier if the mercurial client had an option to pass a file list in a file (for example list.txt with file names in each line). But there is no such option.

By the way, the HgSccPackage does not pass a full path for files. Instead it pass the file path relative to the repository root. So, it rather strange, that you hit the command line limit.

How much files you are commiting ?
Why can't you commit all files ?

Mercurial SCC 包 检查生成的命令行是否不超过 1,700 个字符。

我对包的源代码进行了一些挖掘,显然,当调用 Mercurial 的命令时,它最终会使用 hg.exe 上的 Process.Start() 方法和 UseShellExecute =指定 false 选项。

Process.Start 方法的文档提到参数的长度和进程的完整路径的长度之和不应超过 2080,但深入研究 .NET Framework 本身,我无法找到该限制的任何强制执行。 WinAPI CreateProcess 函数(使用其中 Process.Start 实际上最终调用了 32,768 个字符的更宽松的限制。

所以这可能是 VS 插件的错误。

至于我,当我遇到类似的问题时,因为我的项目太深 C:\Documents and Settings\Regent\My Documents\Visual Studio 2010\Projects\ 我刚刚创建了一个 NTFS 符号链接 并随后使用 C:\Projects\

Mercurial SCC Package checks whether the resulting command line is not greater than 1,700 characters.

I've digged package's source code a bit and apparently when invoking Mercurial's commands it ends up with using Process.Start() method on hg.exe with UseShellExecute = false option specified.

Process.Start method's documentation mentions that the sum of the length of the arguments and the length of the full path to the process shouldn't exceed 2080 but digging the .NET Framework itself I was unable to find any enforcement of that limitation. WinAPI CreateProcess function (with which Process.Start effectively ends up calling to) have more generous limitation of 32,768 characters.

So it might be bug with VS addin.

As for me when I had a similar problem because my projects was too deep inside C:\Documents and Settings\Regent\My Documents\Visual Studio 2010\Projects\ I just created a NTFS symbolic link and used C:\Projects\ afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文