Mercurial workflow with subrepositories and offline clones?

只谈情不闲聊 提交于 2019-12-05 12:52:10

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.

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.

The canonical way to use subrepositories is to have X = X paths in the .hgsub file:

sub/shared = sub/shared

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!