带有子存储库和脱机克隆的Mercurial工作流程? [英] Mercurial workflow with subrepositories and offline clones?
问题描述
我经常离线.
通常,我将一个本地克隆用作功能,错误等的集线器".
So normally, I use one local clone as a "hub" for features, bugs, etc.
hg clone local-hub bug-123
离线工作.很好.
如果该项目包含远程子存储库,我可以使用类似的工作流程吗?
Can I use a similar workflow if that project contains remote subrepositories?
因为.hgsub说
sub/shared = http://server/hg/shared
汞克隆说
abort: error: getaddrinfo failed
请注意,一旦创建克隆(连接时),push
和pull
将使用子存储库hgrc
中的路径(而不是.hgsub
中的位置).因此,我可以将其指向本地克隆,一切都很棒.
Note that once the clone is created (while connected), push
and pull
will use the path in the subrepo's hgrc
(instead of the location in .hgsub
). So I can point this to a local clone and everything is cool.
但是clone
会查看.hgsub
(应该如此).因此,如果祝福"子仓库在服务器上,即使我需要的文件就在其中,我也无法脱机创建新的克隆.
But clone
looks at .hgsub
(as it's supposed to). So if the "blessed" subrepo is on a server, I can't create new clones offline, even though the files I need are right there.
这是个问题,对吧?
推荐答案
理想情况下,任何设置项目的人都会在其.hgsub文件中使用相对URL,如下所示:
Ideally whomever set up the project uses relative URLs in their .hgsub file like this:
sub/shared = ../shared
,然后,当然,实际上使共享成为主仓库的同级.然后,只要您克隆了主存储库和子存储库(作为同级项),一切都会正常进行.
and then, of course, actually makes shared a sibling of the main repo. Then as long as you have cloned down the main repo and the subs (as siblings) then everything will work out.
如果他们在.hgsub文件中使用了绝对URL,则可以使用.hgrc中的subpaths部分来解决该问题,如下所示:
If they've used absolute URLs in their .hgsub file you can work around it using the subpaths section in your .hgrc like this:
[subpaths]
http://server/hg/shared = ../shared
在您的客户端中提供翻译层.
which provides a translation layer in your client.
这篇关于带有子存储库和脱机克隆的Mercurial工作流程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!