How to convert an existing Mercurial repository to use subrepositories and keep the history intact?

别来无恙 提交于 2019-12-04 02:18:28

Nope, I'm afraid there are no tools that will allow you to split a repository in the way you ask for.

Just to clarify your question, then let us imagine you have a repository where the content of root.txt and sub/file.txt evolve like this

   root.txt  sub/file.txt`
0: root 0    file 0
1: root 1    file 1
2: root 2    file 2

for the first three changesets. What you ask for is an option for hg convert that would turn this into two repositories (easy, we can do that today) and where the convert extension injects .hgsub and .hgsubstate files so that the three changesets contain

   root.txt  .hgsub     .hgsubstate  |       file.txt
0: root 0    sub = sub  <X> sub      |  <X>: file 0
1: root 1    sub = sub  <Y> sub      |  <Y>: file 1
2: root 2    sub = sub  <Z> sub      |  <Z>: file 2

where the <X>, <Y>, and <Z> hashes are the one corresponding to the first three commits in the subrepository.

There is no such option for hg convert today, but based on the above it sounds feasible to write one. That would give you a great way to convert back and forth between a combined and a split repository.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!