Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting rid of non-topological heads in Mercurial

Tags:

mercurial

I have the following situation in my repository:

A----B----F----G----(long time)----H       <- default branch, H is what I'm working on
      \
       C----D                              <- default branch, long time ago
             \
              E                            <- non-default named branch

I'm working in the default branch, the current revision is H, the tip. Sadly in historic times, someone worked on D and then branched this into a named branch, in revision E. (This was actually an SVN import, but that doesn't matter).

Until now, that was not a problem, because D is not a topological head. But nowadays I use buildbot to perform some testing and buildbot complains about multiple heads in the default branch. This is correct, because it uses hg heads to determine the default heads.

How can I get rid of D being a head of the default branch? I thought about closing D via hg commit --close-branch. But doesn't that create an actual topological head?

like image 747
Michael Avatar asked Nov 03 '25 10:11

Michael


1 Answers

Short answer: No

Illustrated answer

>hg glog --template "{rev}-{branch}\n"

o  9-German
|
| @  8-default
| |
o |  7-default
| |
o |  6-default
| |
o |  5-default
| |
| o  4-default
| |
| o  3-default
| |
| o  2-default
| |
| o  1-default
|/
o  0-default

>hg heads

changeset:   9:62eaf0f52632
branch:      German

changeset:   8:39b0fec94839

changeset:   7:d98a89a763cf

>hg up 7

>hg commit --close-branch -m "Close variation"

>hg heads

changeset:   9:62eaf0f52632
branch:      German

changeset:   8:39b0fec94839

New topological head will appear only in case of creating (non-closed) childs of 10

Repo-Tree

like image 176
Lazy Badger Avatar answered Nov 06 '25 03:11

Lazy Badger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!