mercurial - 如何将 Mercurial 子存​​储库推送到它们自己的源

标签 mercurial repository tortoisehg mercurial-subrepos subrepos

我正在使用子存储库在多个项目之间共享代码。 我将这些共享存储库的“主”版本保存在一个中央位置。 这样我就可以轻松地将我对它们所做的更改推送到一个项目中,并将它们拉到另一个项目中。 这行得通,但理想情况下,我只想推送项目存储库,所有子存储库都应推送到它们的来源。但是 Mercurial 总是将所有子存储库推送到主存储库的源。

这是我的设置:

Project1 (default path = Project-Central-Location/Project1)
 - lib-A (default path = Library-Central-Location/lib-A)
 - lib-B (default path = Library-Central-Location/lib-B)

Project2 (default path = Project-Central-Location/Project2)
 - lib-A (default path = Library-Central-Location/lib-A)

Library-Central-Location
 - lib-A   <= push of Project1 should push lib-A to this location
 - lib-B

Project-Central-Location
 - Project1
   - lib-A <= push of Project1 pushes lib-A to this location instead
   - lib-B
 - Project 2
   - lib-A

最佳答案

我最终使用了钩子(Hook)。首先,中央位置的项目里面的库需要指向对应的中央库仓库:

Project-Central-Location
 - Project1
   - lib-A <= (default path = Library-Central-Location/lib-A)
   - lib-B <= (default path = Library-Central-Location/lib-B)
 - Project 2
   - lib-A <= (default path = Library-Central-Location/lib-A)

然后你需要将它添加到他们的.hg/hgrc 文件中:

[hooks]
changegroup.hg-push = hg push

这样一来,我将在推送项目时触发对中央库的推送。

关于mercurial - 如何将 Mercurial 子存​​储库推送到它们自己的源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67822715/

相关文章:

Mercurial:在 bundle 中包含 secret 变更集?

python - 忽略 mercurial hook 中的某些 mercurial 命令

svn - 从 Mercurial 转换为 Subversion

mercurial - Mercurial 中克隆和复制的区别

mercurial - 推送 SSH 时抑制 TortoiseHg 中的 "Push to remote repository?"提示

git - 为什么有时需要 "git commit -a"而不是 "git commit"?

Spring Mongo Populator 一一

java - Spring Security - 存储库 SocialUser

maven-2 - IntelliJ IDEA : “Indexed Maven Repositories” list - how to REMOVE a remote maven repository in this list?

visual-studio-2010 - 设置 BitBucket 和 Mercurial 以在组环境中使用