在OSX上设置水银/窑子仓库 [英] setting up mercurial/kiln subrepos on osx
问题描述
我一直在尝试使用窑炉按照此问题的答案中的说明进行操作.
I have been trying to follow the instructions in the answer to this question, using kiln.
我希望能够按以下方式安排事情:
i'd like to be able to arrange things as follows:
-
/somepath/thirdparty
映射到窑库第三方",并包含各种代码 -
/somepath/common
映射到窑库"common",并包含我编写的共享代码
/somepath/thirdparty
maps to a kiln repository "thirdparty" and contains assorted code/somepath/common
maps to a kiln repository "common" and contains shared code i have written
和
-
/somepath/project1
映射到窑库"project1" -
/somepath/project1/thirdparty
映射到上方的第三方分支 -
/somepath/project1/common
映射到上方的公共分支
/somepath/project1
maps to kiln repository "project1"/somepath/project1/thirdparty
maps to branch of thirdparty above/somepath/project1/common
maps to branch of common above
和
-
/somepath/project2
映射到窑库"project1" -
/somepath/project2/thirdparty
映射到上方的第三方的另一个分支 -
/somepath/project2/common
映射到上方另一个常见分支
/somepath/project2
maps to kiln repository "project1"/somepath/project2/thirdparty
maps to another branch of thirdparty above/somepath/project2/common
maps to another branch of common above
我发现,当按照说明创建.hgsub
文件并将其添加到Kiln或将其推送到Kiln时,我再也无法在Kiln Web文件查看器中查看Kiln文件了–它显示了有关Kiln过热"的模糊消息. :-)此外,尽管它确实在正确的位置自动创建了子文件夹,但并未在其中填充文件(可能是因为拉取失败).
I found that when I created the .hgsub
file as instructed and added/pushed it to Kiln, I could no longer view the Kiln files in the Kiln web file viewer — it displayed an obscure message about the Kiln "overheating" :-) Additionally, whilst it did automatically create the subfolders in the correct place, they were not populated with files, (possibly because the pull failed).
有人用窑炉尝试过类似的东西吗?
Anybody tried anything like this before, using Kiln?
由于我打算使用通用代码开发许多应用程序(并可能最终以开放源代码的形式发布该库),所以我希望在离散的存储库中对其进行管理.但是,由于某些项目是针对最终客户的,因此我需要为他们提供一个包含上述内容的单一存储库.
As I intend to develop a number of apps using the common code (and potentially eventually release the library as open source), I would like to have it managed in discrete repositories. As some of the projects are for end clients however, I need to be able to give them a single repository that includes things as described above.
推荐答案
基恩(Kiln)当前不支持在服务器上使用嵌套URL的子存储库.这意味着您不能同时使用以下两个URL:
Kiln does currently not support subrepos that use nested URLs on the server. This means that you cannot have both the following URLs working:
http://server/kiln/somepath/project1
http://server/kiln/somepath/project1/thirdparty
因此,您应该设置Kiln,以便在服务器上拥有四个存储库:
So you should setup Kiln so that you have four repositories on the server:
http://server/kiln/somepath/project1
http://server/kiln/somepath/project2
http://server/kiln/somepath/thirdparty
http://server/kiln/somepath/common
这很容易-仅有四个普通存储库.然后克隆项目"并使用以下命令创建.hgsub
文件:
That's easy — just four normal repositories. Then clone "project" and create the .hgsub
file with:
thirdparty = http://server/kiln/somepath/thirdparty
common = http://server/kiln/somepath/common
将其推回窑炉时,它将注意到并显示子存储库的链接.但是,子存储库不会最终嵌套在服务器上.因此服务器上将没有任何project1/thirdparty
路径.
When you push that back to Kiln, it will notice and display links for the subrepositories. However, the subrepositories wont end up being nested on the server. So there wont be any project1/thirdparty
path on the server.
您是否想要那样也很不清楚.当您有多个项目进行协作并使用某些通用代码库时,则希望"project1"和"project2"相互获取对此通用代码库的更改.因此,两个项目中的common
子仓库都可以从http://server/kiln/somepath/common
推入和拉出非常有用.
It's also far from clear that you would want that. When you have several projects that collaborate and use some common code base, then you want "project1" and "project2" to get each other's changes to this common code base. So it very useful that the common
subrepo in both projects push and pull from http://server/kiln/somepath/common
.
在Mercurial中,我们通常建议您使用common = common
形式的路径在.hgsub
文件中.这意味着服务器必须支持嵌套存储库.如果Kiln不支持嵌套存储库,则可以改用完整路径.
In Mercurial, we normally recommend that you use paths of the form common = common
in the .hgsub
file. This means that the server must support nested repositories. When Kiln doesn't support nested repos, you can use full paths instead.
最初设置子存储库时,请记住需要手动更新它们.因此,使用上述URL,您可以通过运行以下命令来设置"project1":
When you initially setup the subrepositories, then remember that you need to update them manually. So with the above URLs, you would setup "project1" by running:
$ hg clone http://server/kiln/somepath/project1
$ echo "common = http://server/kiln/somepath/common" > .hgsub
$ echo "thirdparty = http://server/kiln/somepath/thirdparty" > .hgsub
$ hg commit -m "Created subrepos"
这将创建初始的空子存储库.它们是空的,因为您没有告诉Mercurial您需要它们中的哪个变更集.这在.hgsubstate
中进行了跟踪,您会在其中找到
This creates initial empty subrepositories. They are empty because you haven't told Mercurial which changeset you need in them. This is tracked in .hgsubstate
where you'll find:
0000000000000000000000000000000000000000 common
0000000000000000000000000000000000000000 thirdparty
要填充子存储库
$ cd common
$ hg pull --update
$ cd ../thirdparty
$ hg pull --update
$ cd ..
$ hg commit -m "Updated subrepos"
这将使用两个子存储库的当前提示更改集ID更新.hgsubstate
中的000...
行.将来的"project1"克隆将注意到.hgsubstate
文件,并确保将子存储库更新为此处提到的修订版本.
This updates the 000...
lines in .hgsubstate
with the current tip changeset IDs for the two subrepos. Future clones of "project1" will notice the .hgsubstate
file and make sure to update the subrepos to the revision mentioned there.
这篇关于在OSX上设置水银/窑子仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!