Mercurial subrepository from a non-nested / sibling directory?

前端 未结 1 490
逝去的感伤
逝去的感伤 2021-01-15 22:50

Is it possible to create a subrepository using a sibling path?

Subversion is our \"chosen\" VCS here, but I\'ve already had quite a few issues with out of date comm

相关标签:
1条回答
  • 2021-01-15 23:18

    Subrepositories are always inside another repository. In other words, subrepositories lets you version a collection of repositories where some repositories are nested inside other repositories. Subrepositories can thus not be siblings without creating an outer repository.

    The relative paths you're talking about are used when Mercurial needs to figure out where to get a new subrepository from. That is, when you run hg update (or when it's run for you as part of hg clone) and Mercurial notices a .hgsub file, then it needs to create the subrepositories mentioned there. To create the subrepo, Mercurial uses the path on right-hand side:

    sub-A = relative/path
    sub-B = C:/absolute/path
    

    Here sub-A will be checked out in the root of your working copy using the command

    hg clone <default path for main repo>/relative/path sub-A
    

    and sub-B is checked out using the command

    hg clone C:/absolute/path sub-B
    

    That's all — it's a very simple mechanism. I've tried to describe this in my subrepository guide and it's also explained in the wiki.

    For your case, you can make a thin shell repository for the parts that belong together. This repo will be like Project1 above and have Program1, Program2, Service1, etc as subrepos. The .hgsub will look like this:

    Program1 = Program1
    Program2 = Program2
    Service1 = Service1
    Service2 = Service2
    

    By using "trivial subrepo paths" you make things easy: a clone looks just like the clone source and everything is kept together.

    A final note: unless you use Program1 or Service1 in other projects, then you should just put everything into a single repository.

    0 讨论(0)
提交回复
热议问题