在克隆中进行更改时保持 Mercurial 子存储库最新的工作流程? [英] Workflow to keep Mercurial subrepositories up to date when changes are made in clones?
问题描述
我已经阅读了有关 Mercurial 子存储库的所有问题,但我仍然不确定它是如何工作的.我们在 IIS 上使用 hgweb.cgi,所以我们有 http://到我们所有存储库的路径.
I have read every question on Mercurial subrepositories that I could and still not sure how it works. We are using hgweb.cgi on IIS so we have http:// paths to all of our repos.
这是基本布局:
/Libraries - http://server/Libraries
/Project1 - http://server/Project1
/Project1/LibrariesSubrepo - http://server/Project1/LibrariesSubrepo (clone of libraries)
/Project2 - http://server/Project1
/Project2/LibrariesSubrepo - http://server/Project2/LibrariesSubrepo (clone of libraries)
在 .hgsub 文件中,我将路径设置为:
In the .hgsub files, I have the path setup as:
LibrariesSubrepo = LibrariesSubrepo
如果我想处理这些项目,我会将它们从服务器克隆到我的工作站,这样我就有了 Project1 和 Project2 的克隆,它也会自动拉取子存储库.
If I want to work on the projects, I clone them from the server to my workstation so I have a clone of Project1 and Project2 and it automatically pulls the subrepos as well.
在我本地工作站的 project1 中,我对/Project1/LibrariesSubrepo 中的文件进行了一些更改.如何确保这些更改返回到服务器上库的源存储库?我是否必须手动将子存储库中的更改推送到子存储库的源存储库?
In project1 on my local workstation, I make some changes to files in the /Project1/LibrariesSubrepo. How do I ensure that those changes make it back to the source repo for Libraries on the server? Do I have to manually push the changes from the subrepo to the source repo of the subrepo ?
我希望能够在本地对 Project1 存储库进行更改,然后提交/推送这些更改,然后在 Project2 中,我应该能够从应该将 Project2/LibrariesSubrepo 更新到最新的服务器中提取更改版本.
I would like to be able to make changes in the Project1 repo locally, then commit/push those changes, then in Project2, I should be able to pull the changes from the server which should update the Project2/LibrariesSubrepo to the latest version.
推荐答案
你绝对可以手动从 Project1
中的 LibrariesSubrepo
推送到 Libraries
> 服务器上的存储库,然后手动从 Libraries
拉入 Project2 克隆中的 LibrariesSubrepo
.
You can definitely push manually from your LibrariesSubrepo
in Project1
to the Libraries
repository on the server and then manually pull from Libraries
into LibrariesSubrepo
in a Project2 clone.
但是,您也可以链接服务器上的子仓库:
However, you can also link the subrepos on the server:
共享扩展让您可以创建两个或多个共享一个
.hg
文件夹.在服务器上执行此操作,以便服务器上子存储库的三个实例共享.hg
文件夹.
The share extension lets you create two or more repositories that share a
.hg
folder. Do this on the server so that the three instances of the subrepo on the server share the.hg
folders.
符号链接 .hg
文件夹——更老套,只有在你可以创建符号链接的服务器上才有效(Unix 服务器或 Windows Vista 及更高版本,具有正确的权限).
Symlink the .hg
folders -- more oldschol and it only works if you're on a server where you can create symlink (Unix servers or Windows Vista and later with the right priviledge).
在服务器上只保留一个子存储库,但在 hgweb
配置中将其公开 3 次.像这样:
Keep just one subrepo on the server but expose it three times in the hgweb
configuration. Like this:
[paths]
Project1 = /repos/Project1
Project1/LibrariesSubrepo = /repos/Libraries
Project2 = /repos/Project2
Project2/LibrariesSubrepo = /repos/Libraries
在所有情况下,服务器上实际上只有三个存储库:Project1
、Project2
和 Libraries
.
In all cases, there are actually only three repositories on the server: Project1
, Project2
, and Libraries
.
这篇关于在克隆中进行更改时保持 Mercurial 子存储库最新的工作流程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!