具有子存储库和离线克隆的 Mercurial 工作流程?
我经常离线。
因此,通常情况下,我使用一个本地克隆作为功能、错误等的“中心”
hg clone local-hub bug-123
。离线工作。凉爽的。
如果该项目包含远程子存储库,我可以使用类似的工作流程吗?
因为,如果 .hgsub 说
sub/shared = http://server/hg/shared
hg clone 说
abort: error: getaddrinfo failed
请注意,一旦创建了克隆(在连接时),push
和 pull
将使用子存储库的 hgrc< 中的路径/code> (而不是
.hgsub
中的位置)。所以我可以将其指向本地克隆,一切都很酷。
但是 clone
会查看 .hgsub
(正如它应该的那样)。因此,如果“blessed”子存储库位于服务器上,我无法离线创建新的克隆,即使我需要的文件就在那里。
这是一个问题,对吧?
I'm offline a lot.
So normally, I use one local clone as a "hub" for features, bugs, etc.
hg clone local-hub bug-123
Works offline. Cool.
Can I use a similar workflow if that project contains remote subrepositories?
Because, if .hgsub says
sub/shared = http://server/hg/shared
hg clone says
abort: error: getaddrinfo failed
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.
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.
This is a problem, right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
理想情况下,无论谁设置该项目,都在其 .hgsub 文件中使用相对 URL,如下所示:
然后,当然,实际上使共享成为主存储库的同级。然后,只要您克隆了主存储库和子存储库(作为兄弟姐妹),那么一切都会成功。
如果他们在 .hgsub 文件中使用了绝对 URL,您可以使用 .hgrc 中的子路径部分来解决这个问题,如下所示:
它在您的客户端中提供了一个转换层。
Ideally whomever set up the project uses relative URLs in their .hgsub file like this:
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.
If they've used absolute URLs in their .hgsub file you can work around it using the subpaths section in your .hgrc like this:
which provides a translation layer in your client.
使用子存储库的规范方法是在
.hgsub
文件中包含X = X
路径:这样克隆在结构上看起来就像原始的一样 - 所以你可以使用克隆来制作更多(本地!)克隆。
但是,这并不总是可能的,例如,Bitbucket 不会让您在其服务器上创建嵌套存储库。在这种情况下,
.hgsub
文件中的../X
样式路径更好,您可以使用 子路径配置部分 将这些路径转换为您可以在本地使用的路径。The canonical way to use subrepositories is to have
X = X
paths in the.hgsub
file:That way a clone will structurally look just like the original -- and so you can use the clone to make further (local!) clones.
However, this is not always possible, for example, Bitbucket wont let you create the nested repositories on their server. In that case, the
../X
style paths in the.hgsub
file is better, and you can use the subpaths configuration section to translate these paths into paths you can use locally.