File sharing in a guided approach between hg repositories

Problem: one hg repository has a file that I want to update and save in another hg repository, and I don't want to copy and paste. I want the file to be available in both repositories.

Scenario:

Work with product 0001

Project A has an hg repository.

Down, Project B is evolving. There is basically no connection between projects A and B, but there are some files that can be shared.

File versioning in a managed approach is critical: copy & paste is not a viable solution.

There are some solutions that may work -

  • Combining both repositories in a repo. But this means that version numbers for a set of files will change due to outflows elsewhere. In addition, different projects are not very connected.
  • Convert both into sub-class. I'm not sure if this is the right approach, subrepos seems to have some kind of ridiculous behavior related to parent repo. (Or are they used to?)

Extending this problem is the concept of sharing certain files between products. One way or another, the file must be exchanged and properly tracked as a separate file, but in two different products.

A common problem can be indicated like this -

Given a set of products, each of which has its own repository under development, which is divided and developed on files living in each other's repositories (think of utility routines and frameworks), what is an hg solution for constant support of the file version between products.

What is a good solution here?

+4
source share
1 answer

The second call is correct. You have to extract the files that would be in both repositories and make this the third repo, which you, in turn, will make a sub repo for each of projects A and project B.

I do not know when you first looked at subrepos, but they have been around for about a year and are well supported.

Read some subrepo related answers here in the stack overflow, make sure your subrepo paths are relative (not absolute w / http: // etc.) in them, and they will treat you very well.

Update:

Today's release of mercury 1.7 includes these improvements for subrepos:

  • support for reassigning the source paths of a subrepository (see [subpath] in hgrc (5))
  • create add, difference, incoming, outgoing and status commands in subrepos using --subrepos/-S
  • subrepo: add support for 'hg archive'
  • subrepo: checking check status in subrepos SVN (issue2445)
+3
source

All Articles