开发者

Using subrepositories in mercurial to "share code"

开发者 https://www.devze.com 2023-03-23 11:00 出处:网络
I have a repository in which I have three subfolders. A, B and a core folder. I need the files of the core folder in A and in B. So every file of the core folder should be inside another folder in A

I have a repository in which I have three subfolders.

A, B and a core folder.

I need the files of the core folder in A and in B. So every file of the core folder should be inside another folder in A and B and every update to the files should be commited to "core" and vice versa.

So I tried to make the core folder to a subrepository and add this to A and B.

So in folder B for example there is following line in the .hgsub www = ../core

In the main repository is in the .hgsub core = core

I assume there is something I do wrong, but maybe you have a hint how to achieve what I want :)

(Update)

To clarify:

The reposi开发者_运维知识库tory contains different "projects" for an app.

A is Android and B is iOS. The "core" contains HTML+JS files which are later used in the Android and iOS projects to build apps with phonegap.


If I understand you right, you have this:

repo
  |
  +-- core         <--+
  +-- A               |
      +-- core     ---+ \A\core and \B\core should be equal to \core
  +-- B               |
      +-- core     ---+

There is nothing in Mercurial that will help you with this.

What you can do is this:

core-repo
  +-- (content)

repo
  +-- A
      +-- core        --- sub-repo pointing to core-repo
  +-- B
      +-- core        --- sub-repo pointing to core-repo

This will allow you to commit changes to the sub-repo inside A, push, and then pull and update into the sub-repo inside B, keeping them in sync.

0

精彩评论

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

关注公众号