Syncing SVN to Mercurial using svnsync & hg convert — misses svn:externals?

泄露秘密 提交于 2019-12-23 19:28:05

问题


I've created a Mercurial mirror of an SVN repository (using this tutorial: http://oreilly.com/opensource/excerpts/opensource-mercurial/migrating-to-mercurial.html). The sync works great, except I've noticed it's not picking up an external repository that is referenced in the main SVN repo...

I'd ideally like to be able to pull everything as a single repo into Mercurial (along with changesets if possible).

What I'm not sure of is: is the missing external a limitation of svnsync, or a limitation of hg convert?

Is there any way I can force the external to be synced as well, into the same Mercurial repo?


I'm thinking a good solution would be to set up the sync process all over again, for the external. Create a fork of the current hg mirror, and sync the external into the hg mirror fork.

The catch with that is, the external's trunk is intended to go into a subfolder of the first mirror, so how can I replicate that with convert? I doubt I could tell convert to import into a subfolder...


回答1:


is the missing external a limitation of svnsync or a limitation of hg convert?

svnsync is used to create a mirror of a SVN repository. This includes any svn:externals properties. Therefore it must be a limitation of hg convert.

Note that you don't really need to create a mirror with svnsync. The article recommends this only because having a local copy might speed up the conversion process.

Is there any way I can force the external to be synced as well, into the same Mercurial repo?

It is common for a SVN repository to contain multiple loosely related projects, each with their own branches and tags. But Mercurial doesn't work that way: when you branch, you branch everything that is in the repository. You should create a separate mercurial repository for each project in SVN that has its own trunk/branches/tags. This different approach is most likely why hg convert ignores externals, even if they are in the same SVN repository.

There is an equivalent of svn:externals in mercurial; it's called "subrepositories". Instead of having one or more svn:externals properties, you have a single .hgsub file with similar content in the root of your project. You should first convert each SVN project to a seperate mercurial repository, and then connect them with subrepositories. See the mercurial wiki page for subrepositories for more details.



来源:https://stackoverflow.com/questions/4258518/syncing-svn-to-mercurial-using-svnsync-hg-convert-misses-svnexternals

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