开发者

How to work with overlapping repositories in Mercurial

开发者 https://www.devze.com 2022-12-31 06:16 出处:网络
Often I want to have a main repository of source, shared by several \"similar\" projects. Each sub-project contains most of the same files, but is a specific configurable instance. That means there ar

Often I want to have a main repository of source, shared by several "similar" projects. Each sub-project contains most of the same files, but is a specific configurable instance. That means there are usually a bunch of files and directories that nee开发者_如何学编程d to be different for each instance.

In CVS I used to create the main repository and the secondary ones, then use the modules file to bind the two together for a specific name. In SVN I used svn:externals to tie back the secondary directories into the main one.

What works in Mercurial?


It depends on the nature of the specific files that need to be different.
If you can transform them as template files, then you can:

  • have a main repo shared as a SubRepo (as said in the documentation: SubRepos are the "closest to what you can achieve with Subversion directories marked with the svn:externals property")
  • have "similar" projects which will:
    • include that main repo as a subrepo (referencing a specific revision)
    • run a versioned script which will take those template files and build the actual files with the right values per environment.

That way you keep separate the templates (in the main repo) and the values (which each similar projects know about depending on their specific environment).
That being said, not every variation of files can be processed as "templates to be instantiated".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号