简体   繁体   English

具有mercurial子存储库的工作流程

[英]Workflow with mercurial subrepositories

My project uses a mercurial repository and is developed under Linux. 我的项目使用mercurial存储库,是在Linux下开发的。 It also depends on a "common" library, which we wish to share with other projects. 它还取决于我们希望与其他项目共享的“通用”库。 The solution I'm currently considering is to put the library in a mercurial subrepository, and create a "thin shell" repository as suggested here . 我目前正在考虑的解决方案是将库放在一个mercurial子库中,并按照此处的建议创建一个“瘦shell”存储库。

Assume my repository looks like this: 假设我的存储库看起来像这样:

project/
  core/
  common/

I'm not sure what the workflow should look like. 我不确定工作流程应该是什么样子。 When should I commit to project ? 什么时候我应该投入project Do I create feature branches on it, or only in the subrepositories? 我是在其上创建功能分支还是仅在子存储库中创建功能分支? What happens when a new feature requires backwards-incompatible changes in both core and common ? 当新功能需要corecommon向后不兼容的更改时会发生什么?

Any additional tips would be appreciated. 任何额外的提示将不胜感激。

When should I commit to project? 什么时候我应该投入项目?

As the project repository should only contain the subrepositories (and track their revisions), you should (and only have to) commit to project when you have checked out a different version of either the core or the common repository and you permanently want to use it for your project. 由于项目存储库应该只包含子存储库(并跟踪它们的修订版),因此当您检出核心或公共存储库的不同版本并且您永远想要使用它时,您应该(并且只需要)提交项目为您的项目。

Do I create feature branches on it, or only in the subrepositories? 我是在其上创建功能分支还是仅在子存储库中创建功能分支?

You have to create a "feature" repo for both the project repo and the repo where you want to implement the feature in. 您必须为要在其中实现该功能的项目仓库和仓库创建“功能”仓库。

If you only fork the project repo, it will still track the original core/common. 如果您只分叉项目仓库,它仍将跟踪原始核心/公共仓库。 On the other hand you also need to fork the project repo to have a complete working environment containing all needed subrepos. 另一方面,您还需要将项目仓库分叉以具有包含所有所需子实例的完整工作环境。

Another approach is that every developer has his own permanent fork of the project repo and tracks the feature repos in it that he is currently working on. 另一种方法是每个开发人员都拥有自己的项目仓库永久分支,并跟踪他当前正在处理的功能库。

A pull request would then just be created for the changed subrepository. 然后,仅为更改的子库创建拉取请求。

What happens when a new feature requires backwards-incompatible changes in both core and common 当新功能需要核心和通用的向后不兼容的更改时会发生什么

This would imply that you would do/commit/push these changes in both repositories and update the tracked version in the project shell repo (commit the new shell repo state and push it). 这意味着您将在两个存储库中执行/ commit / push这些更改并更新项目shell repo中的跟踪版本(提交新的shell repo状态并推送它)。

This results in a working version of your project. 这会生成项目的工作版本。

What will not work, of course, is using to incompatible versions of the core or common repository. 当然,不起作用的是使用不兼容的核心版本或公共存储库。

Sounds like one should strive for backwards compability for the common repo anyway as it might be used in other projects, too. 听起来像一个人应该为共同的回购努力争取向后兼容性,因为它也可能在其他项目中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM