Paolo
Paolo

Reputation: 21056

Multiple repositories as one in mercurial

I'm in trouble figuring out how to organize a mercurial repository for a Django project I'm starting. This is the current configuration:

.
├── .hg
├── docs
├── manage.py
├── project
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── requirements.txt

For how my workflow is, I'd prefer to keep the activities related to project and docs separated. Having two dedicated repositories could be a way to solve the issue, but then I should clone two repos if I want both the docs and the project, while I'd be optimal to clone only one all-inclusive repo, as the one of the picture above.

Is it possible to obtain what I want, and how to reorganize project, docs and repositories?

Upvotes: 1

Views: 106

Answers (2)

kravasb
kravasb

Reputation: 696

You can have repositories nested inside parent repo. It is considered to be a bad practice. I think you should split your docs and code into separate repositories.

You can add hooks on desired operations so actions taken in one repository could automatically be executed in the other. In addition to that you can also use aliases for operations on both repos, so you'll have special commands for operations in both repos.

To solve cloning issues you can create script which will clone both repos in desired folder.

Upvotes: 2

Eldad Assis
Eldad Assis

Reputation: 11045

It's possible to nest repositories under a parent one. See Mercurial Subrepository.

BUT - this is not a good practice. See FeaturesOfLastResort explanation here.

In our R&D, we have many repositories, and when needed, the developers are already used to cloning the needed ones (2 or more) for the relevant activity.

I hope this helps.

Upvotes: 2

Related Questions