How to combine two projects in Mercurial?

I have two separate mercurial repositories. At this point it makes sense that they "become one" because I want to work on the two projects simultaneously.

I'd really like the two projects to each be a subdirectory in the new repository.

  • How do I merge the two projects?
  • Is this a good idea, or should I keep them separate?
  • It seems I ought to be able to push from one repository to the other... Maybe this is really straight forward?


    I was able to combine my two repositories in this way:

  • Use hg clone first_repository to clone one of the repositories.
  • Use hg pull -f other_repository to pull the code in from the other repository.
  • The -f (force) flag on the pull is the key -- it says to ignore the fact that the two repositories are not from the same source.

    Here are the docs for this feature.


    hg started to have subrepo since 1.3 (2009-07-01). The early versions were incomplete and shaky but now it's pretty usable.


    If you aren't using the same code across the projects, keep them separate. You can set your personal repository of each of those projects to be just a directory apart. Why mix all the branches, merges, and commit comments when you don't have to.

    About your edit: Pushing from One repository to Another. You can always use the transplant command. Although, all this is really side stepping your desire to combine the two, so you might feel uncomfortable using my suggestions. Then you can use the forest extension, or something.

    hg transplant -s REPOSITORY lower_rev:high_rev
    
    链接地址: http://www.djcxy.com/p/37626.html

    上一篇: 从另一个mercurial存储库中提取单个文件

    下一篇: 如何在Mercurial中结合两个项目?