简体   繁体   English

我可以拆分Mercurial存储库吗?

[英]Can I split a Mercurial repository?

I have a largish Mercurial repository that I've decided would be better as several smaller repositories. 我有一个较大的Mercurial存储库,我已经决定将它作为几个较小的存储库更好。 Is there a way that I can split the repository and have each piece retain its revision history? 有没有办法可以拆分存储库并让每个部分保留其修订历史记录?

The best way to do this is using the 'convert' extension . 最好的方法是使用'convert'扩展名 You'll use mercurial and both source and destination type and then use a --filemap with entries like: 您将使用mercurial以及源和目标类型,然后使用带有以下条目的--filemap

exclude path/you/do/not/want
rename path/you/do/want .

The rename is only necessary if you want to take the parts you're keeping and move them "higher" in the directory hierarchy. 只有当您想要获取正在保留的部分并在目录层次结构中将它们“移动”更高时,才需要重命名。

I found a detailed guide here : 我在这里找到了详细的指南:

Create a file map new-repo.filemap such as 创建一个文件映射new-repo.filemap ,如

include vendor/FooBackend
rename vendor/FooBackend .

Create another file map rewrite-old-repo.filemap : 创建另一个文件映射rewrite-old-repo.filemap

exclude vendor/FooBackend

Create the new repository: 创建新存储库:

hg convert /path/to/current/repo /path/to/new/repo --filemap new-repo.filemap

The new repository is now finished. 新存储库现已完成。 The directory is empty, but a hg update will bring its contents up to speed. 该目录为空,但hg update将使其内容加快速度。

Create the modified repository: 创建修改后的存储库:

hg convert /path/to/current/repo /path/to/rewritten/repo --filemap rewrite-old-repo.filemap

只需克隆它并从每个副本中删除不需要的东西。

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

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