Mercurial Rebase Script

I read the RebaseProject page and tried a non-trivial example (without reinstalling the full branch). It is similar to rebase D in scenario I B.

Here is the situation before rebase:

default : 0 ----- 2 \ feature : 1 ----- 3 

Now I would like to reinstall 3 to 2 , specifying:

 default : 0 ----- 2 ----- 3 \ feature : 1 

Unfortunately, the exact commands are not listed in the RebaseProject page, but from my understanding of the usage synopsis, this should be:

 hg rebase --source 3 --dest 2 

But for some reason, my understanding should be wrong, because I get rebase combined with merging:

 default : 0 ----- 2 ----- 3 \ / feature : 1 ------- 

Why is this?

Commands for playing the script:

 hg init touch a hg add a hg commit -m "added a" hg branch feature touch b hg add b hg commit -m "added b on feature" hg up -C default touch c hg add c hg commit -m "added c on default" hg up -C feature echo "feature" >> a hg commit -m "changed a on feature" hg rebase --source 3 --dest 2 
+4
source share
1 answer

Your script is very similar to the rebase G onto I part rebase G onto I of scenario B Rebase Project Scenarios:

Scenario b
...

scenario B originally
...

rebase G on I

rebase G onto I

In your scenario, D == 1 , I == 2 and G == 3 . After rebooting, 3 communicates with 1 in the same way that G' communicates with D This is due to the fact that D not an ancestor of I and:

Note. Rebase discards the parent relationship only if the parent is the ancestor of the target.

You really want to remove this association, and then, according to the docs, you need a development version to get the --detach :

Using the development version, a new option is available --detach, which cancels this relationship.

new --detach option

+3
source

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


All Articles