Adding a Git subrepository to Mercurial

偶尔善良 提交于 2019-12-03 01:46:44

For future reference, the development branch of mercurial (and thus the upcoming 1.8 release) now supports native git subrepos. This particular case is implemented very nicely and a push from the root repository will only tell the git subrepo to push if its remote repository is not known to have the current commit.

This isn't possible due to Mercurial's method of pushing. This is a by design error.

The best solution is to update to a previous revision where the subrepositories don't exist, and then push. This will bypass Mercurial's restriction and upload the necessary .hgsub and .hgsubstate files. This is a little inconvenient, but is the best way I've found so far to get Mercurial and Git to work with each other.

Perhaps in the future Hg-Git will be updated to handle this use case automatically.

I think you should use multiple repositories; DVCS works better like that.

For example, make one repository that contains the dependencies from github. You only pull in that repo to get the changes, you never push. Then you have another repository for your project, for development. Here you are free to do whatever you want. And then you link to your own hg repo for the dependencies.

That's if I correctly understood your problem and what you're trying to do :)

If you have no outgoing changesets in the subrepository, the 'push' should actually do nothing other than retrieve the latest changeset list from the remote repository. Therefore, the actual 'push' part of the push won't happen. I've successfully used read-only BitBucket repositories as submodules.

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