Mercurial:移动到新的存储库结构 - subrepos 更新

Mercurial: moving to a new repository structure - subrepos update

那么,问题来了:

假设我们有一个非常旧的 Kallithea 安装和一大堆存储库,经过 5 年的密集开发,它变得臃肿,充满了遗留和实验性的东西、结构不一致等。我们决定更新所有东西到现代版本,删除所有遗留和未使用的东西,并在服务器上构建新的存储库目录结构。

基本上,问题是:

正在重做为

因此,要更新支持新目录结构的项目 PROJ1 和 PROJ2,我们需要更新这些项目[及其所有分支].hgsub。这将使它们的所有先前修订处于 'hanging' 状态 - 无法直接克隆它们,更新它们肯定会有一些问题,等等

有没有一种通用的方法来处理这种情况,同时修复所有以前的修订?

.hgrc 文件有一个适合您的 subpaths 选项:

subpaths

Subrepository source URLs can go stale if a remote server changes name or becomes temporarily unavailable. This section lets you define rewrite rules of the form:

= where pattern is a regular expression matching a subrepository source URL and replacement is the replacement string used to rewrite it. Groups can be matched in pattern and referenced in replacements. For instance:

http://server/(.*)-hg/ = http://hg.server//

rewrites http://server/foo-hg/ into http://hg.server/foo/.

Relative subrepository paths are first made absolute, and the rewrite rules are then applied on the full (absolute) path. If pattern doesn't match the full path, an attempt is made to apply it on the relative path alone. The rules are applied in definition order.