Mercurial file connection failure after unsuccessful file sharing

Background:

First there was a base.c file, and this file was in a repository that had only one Base branch.

Base was forked to make an Extended throw. Then this new branch had several changes made to base.c

If the errors were fixed in the base.c file in Base , they would be combined with Extended .

It turns out that adding too much material to base.c in the Extended branch was not a good idea, so the file is copied to ext.c Then most of the Extended add-ons are removed from base.c and Base from ext.c Thus, at this point, base.c in Extended very similar, as in Base .

Problem:

When the file was split, Mercurial was informed that ext.c is a copy of base.c because they have a common history. Unfortunately, this was not a good idea.

Now, if errors are fixed on the Base branch and merged with Extended , Mercurial believes that these changes should be applied to both base.c and ext.c , although the latter no longer resembles the previous one. This makes the merge very annoying.

Is there a way to tell Mercurial that ext.c no longer be considered base.c ? One solution would be to replace ext.c with a new file, but then history would not follow.

+6
source share
1 answer

You can break the connection with hg forget ext.c and then hg add ext.c as a new file. But if you do this with a revision of the ext.c hint, you will lose the whole story until this point.

Instead, you can add an earlier version of ext.c , perhaps even before renaming, and repeat it (history) ever since. You can add ext.c history as a branch to the previous revision and merge it into a tooltip:

 ---o---o---o---(tip)--(merge) \ / e---e---e ... e 

Or maybe that doesn't matter, and you can simply add ext.c history to the current tip :

 ---o---o---o---(tip)--e--e--e--e 

None of these approaches involves rewriting the story (the β€œforgotten” version of ext.c simply left as a dead end), so there should be no problem propagating the changes.

+2
source

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


All Articles