Partial (for each file / folder) branching / tagging in Mercurial?

In the classic SUV (CVS / SVN), you can add new files / folders in one branch, and then “label” them with some branch tag so that they appear on another branch as well (from where they can diverge again). This works by updating the working copy in a specific state, and then setting the branch tag.

How can I achieve something like this in Mercurial? I searched broadly and broadly, but there seems to be no way to move only a few files / folders to another branch.

In my case, some historical branch received some updates, which should now be transferred to the current active branch (which was before converting the repo from Subversion to Mercurial). Is there any method that saves the history of these files / this folder? Or will I need to re-enter the current state of these files into another branch (i.e., start from scratch)?

Side note: between the ends of both branches there are several hundred conflicting changes. That's why I'm looking for an alternative to full merging between branches (which will also be a problem because one of the branches will cease to exist after the merge).

+4
source share
1 answer

Extensio mercury transplantation should do the trick. Transplant reapplies the change set to the branch of your choice. It is usually used as a way to move bug fixes from one branch to another (i.e., from some long branch corresponding to the released version of the code, to the actively developed default branch).

The transplant is distributed with Mercurial, but you may have to enable it by adding the following lines to your Mercurial.ini (or .hgrc):

[extensions] transplant= 

From TortoiseHg, you can upgrade to a set of changes to the destination (that is: where you place the corrections), and then right-click on the set of changes that you want to move and select “Transplant to Local”. Help on the command line can be found at the link above.

One caveat is that transplantation applies to change sets, and she wants to apply the whole set of changes. So, if the change set contains some changes that you want to apply and some not, you need to work a little. One way around this is to use the histedit extension and split this set of changes into two. This can be complicated and not recommended if your repo does not contain locally (i.e.: if it is on the server somewhere). An option of brute force would be to transplant the set of changes, and then simply undo unwanted changes and fix these modes as the second set of changes.

+2
source

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


All Articles