Using Mercurial to support two versions of a program - clones or named branches?

We use Mercurial to manage the project, but now we want to create a Lite version of the same project (that is, a version with some remote or simplified features).

Since the Lite version will share most of its code with the full version, we are considering whether this is better:

  • Create a clone of the source project and save each project separately.
  • Use named branches to support both versions of the project in the same repository.

We are pretty new to version control software, and this will be the first time we have used named branches. Can someone please help identify the pros and cons of each approach. Which approach would make it easier to fix errors between the two projects?

Thanks,

Andrew

+4
source share
2 answers

You can use any of 4 methods - they have more or less the same amount of functionality and differ only in the commands used to synchronize the code base

To solve the "Individual Clones" "... each separate project" is Bad Thing (tm) and a violation of the DRY principle: reusable code (Lite version) must be supported in one place, and core changes extracted from Lite repo for complete repo

Note

When I wrote about 4 solutions, I had in mind, in addition to clones and named branches,

  • MQ (Lite version is a set of changes in the repository, the full version is MQ-patch (s) on top of Lie in the same repo
  • Subrepositories | Guestrepo (Lite version - super repo, full version - one or more subrepositories in the super repository)
0
source

Having the same problem, I came across this question. Now I have found a solution that I would like to share with you.

Suppose we have two devices: A and B, both have essentially the same firmware, but with certain differences that need to be saved. Thus, two versions are saved in two branches - A and B

If I make changes to one of the versions, I can combine them with others in certain conditions.

The condition is that the common predecessor (common base) must have a "giving" branch.

To ensure this, you can do

 hg debugsetparents . <other branch before the modifications> 

After that, the current working set is similar to merging two branches, except that the data remains stable, i.e. e. "We" retain "our" material.

After that, you can perform a "real" merge with another branch after the changes.

The result of this is that you get exactly the difference between the manually created common base in the cottage branch and the final state of the feed branch, which leads to the exact change that you want to receive.

0
source

Source: https://habr.com/ru/post/1486588/


All Articles