将 Mercurial 与 Cygwin 一起使用?
我们一直在尝试将 Mercurial 与 Cygwin(在 Windows 上)一起使用,但遇到错误,因为 Cygwin 使用正斜杠,而 Mercurial 似乎需要反斜杠。有解决方法吗?
问题示例:
hg status
M src\myfile.java
hg ci src\myfile.java <-- Error: abort: srcmyfile.java: The system cannot find the file specified
??
We've been trying to use Mercurial with Cygwin (on Windows) but run into an error as Cygwin uses forward slashes and Mercurial seems to require backslashes. Is there a workaround?
Example of issue:
hg status
M src\myfile.java
hg ci src\myfile.java <-- Error: abort: srcmyfile.java: The system cannot find the file specified
??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Ian Lewis 建议:
这相当于“如果您还打算使用 Tortoise HG,则不要使用 cygwin 的 hg”,这对我来说似乎是最好的解决方案。
Ian Lewis suggests:
Which amounts to "don't use cygwin's hg if your going to also use Tortoise HG", which seems like the best solution to me.
将其添加到您的 .hgrc 中:
现在 TortoiseHg 也将使用正确的斜杠:
Add this to your .hgrc:
Now TortoiseHg will use proper slashes too:
我没有这样的问题,因为我使用两个 Mercurial:
您可以安全地使用它们,因为两个版本都将版本历史记录存储在同一
.hg
文件夹中。 Mercurial 以某种独立于操作系统的方式将有关路径的信息存储在.hg
文件夹中。为了安全起见,请对两个 Mercurial 使用相同的版本。
I don't have such a problem because I use two Mercurials:
You can safely use both of them because both versions store version history in the same
.hg
folder. Mercurial stores info about paths in.hg
folder is some OS-independent way.To be safe use the same version for both Mercurials.
我通过使用 shell 脚本解决了 bzr 的类似问题,该脚本使用 cygpath 命令转换斜杠。它可能需要根据您的需要进行一些调整,但这是我的脚本:
它循环遍历所有命令行参数。如果它以减号(bzr 选项)开头,则它只是按原样附加参数。否则,它会通过 cygpath 运行它并转义所有空格。我不记得
"$i" =~ //
的用途。和我想象的不符。希望有帮助。I solved a similar problem for bzr by using a shell script that converts the slashes using the cygpath command. It may require some tweaking for your needs, but here's my script:
It cycles through all the command line arguments. If it starts with a minus sign (bzr option), it just appends the argument as is. Otherwise, it runs it through cygpath and escapes all the spaces. I don't remember what the
"$i" =~ //
is for. It doesn't match up what I thought it was. Hope that helps.