Can I subrepos nest in Mercurial?

I am having problems setting up a project in Mercurial with subrepos.

Purpose:

I want to configure the structure as follows:

-- Build_Repo (this repo will be used to track dependencies) -- Subrepo_A (this is the main source) -- Modules (Part of Subrepo_A) -- Subrepo_B 

So, there are three repositories: Build, A and B. B is nested inside A, A is nested in the root assembly repository. The build repository will be used to track dependencies, subrepo A will be used to track the main source files, and subrepo B (and others) will be used to track the development of the module / plugin.

Problem / Question

I have no problem setting up the original repo and the nested Subrepo_A by simply adding the path and source of Subrepo_A to the .hgsub file and passing it to the build repository. However, when after I add the path / source subrepo_B to the repo.hgsub assembly and then try to execute, I get an error message:

abort: path 'Subrepo_A / Modules / Sebrepo_B' is inside the nested repo 'Subrepo_A'

Mercurial is not like a nested repo inside an already nested repo. Is this true, or am I missing something? Any best ideas on how to manage assemblies / dependencies?

+8
version-control mercurial dependencies mercurial-subrepos
source share
2 answers

The problem here is one of the inevitable limitations of Mercurial: the repository corresponds to the folder tree on your computer. The repository is responsible for everything under this folder tree.

When your top-level repository includes a repository, it transfers full control over this part of the folder structure. Thus, the upper level cannot indicate another subrepository somewhere in the first subfolders folders.

Solution 1

Subrepo_B is actually a Subrepo_A dependency. In this case, make your repositories a reflection of the true dependency by editing the Subrepo_A.hgsub file to add Subrepo_B in the / Sebrepo _B module. This works because Subrepo_A retains control of its folders.

Decision 2

Subrepo_A is independent of Subrepo_B, you put it there for convenience. In this case, you must make Subrepo_A and Subrepo_B subordinate (in different places) to Build_Repo.

+1
source share

In your situation, you will need to add subrepoB to subrepoA.

I would suggest trying to move the dependencies so that your tree has only 2 levels, but this may not be possible. Otherwise, it will not be very smooth.

0
source share

All Articles