Hg回购的git子模块? [英] git submodule from Hg repo?

查看:83
本文介绍了Hg回购的git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常旧的项目,它直接包含另一个项目的源代码,而不是将其作为库链接。回到糟糕的时代,当我将所有内容都保存在CVS中时,我在供应商分支上拥有外部代码并定期进口。现在我的项目在git中,将外部项目作为子模块包含在内是更有意义的。但是,有一个问题:外部项目已经迁移到Mercurial。我找到了git-hg和hg-git项目,但我不确定是否有人正确处理子模块。



有没有办法创建一个git子模块指向一个Hg repo而不是一个git repo?

由于 hg-git 确实提到了子模块还不被支持,只剩下一个手动选项:




  • 在您有权访问的地方设置Git存储库,

  • 将其添加为Git远程文件,然后

  • 从项目中运行 hg gpush


    例如: $ cd hg-git#(一个储存库)
    $ hg gremote add origin git@github.com/schacon/hg-git.git
    $ hg gpush

    Git repo将代表您的子模块,但是如果您修改并推送该子模块,则仍然必须从该Git repo中将实际的Hg repo。



    其他很棒的git-hg命令列在这个 rosetta stone


    I have a very old project that includes the source from another project directly, instead of linking it as a library. Back in the bad days, when I was keeping everything in CVS, I had the external code on a vendor branch and did periodic imports. Now that my project is in git it would make more sense to include the external project as a submodule. But, there's a problem: the external project has migrated to Mercurial. I've found the git-hg and hg-git projects, but I'm not sure if either one handles submodules properly.

    Is there a way to create a git submodule that points to an Hg repo instead of a git repo?

    解决方案

    Since the hg-git does mention that submodules are not supported yet, that leaves only a manual option:

    • setup a Git repository somewhere that you have push access to,
    • add it as a Git remote and then
    • run hg gpush from within your project.

    For example:

    $ cd hg-git # (an Hg repository)
    $ hg gremote add origin git@github.com/schacon/hg-git.git
    $ hg gpush
    

    That Git repo will represent your submodule, but if you modify and push that submodule, you will still have to pull from that Git repo to the actual Hg repo.

    Other great git-hg commands are listed in this "rosetta stone".

    这篇关于Hg回购的git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆