merge topics (two heads)
Steve Fink
sphink at gmail.com
Tue Oct 29 18:27:08 UTC 2019
On 10/26/19 1:38 AM, Uwe Brauer wrote:
> > Uwe Brauer <oub at mat.ucm.es> writes:
>
>
> > What are you trying to do here? What do you expect to happen?
>
>
> I wanted to see whether topics behave like named branches and I thought
> so, because creating a topic creates a new head, however I cannot merge
> them.
>
> The following script where I replaced topics by branch, displays the
> same graph (almost) and also indicates two heads, these two heads
> however I can merge.
>
> hg init
> echo "First" > test.org
> hg add test.org
> hg commit -u "Bernhard Riemann <bernhard.riemann at gmail.com>" -m "First"
> echo "Second" >> test.org
> hg commit -u "Bernhard Riemann <bernhard.riemann at gmail.com>" -m "Second"
> echo "Third" >> test.org
> hg commit -u "Bernhard Riemann <bernhard.riemann at gmail.com>" -m "Third"
> echo "Forth" >> test.org
> hg commit -m "Fourth"
> hg branch NewTopic
> echo "Fifth" >> test.org
> hg commit -m "Fifth"
> echo "Six" >> test.org
> hg commit -m "Six"
> hg log -G
> hg heads
What version of hg? With hg-5.1, I do not get the same behavior. `hg
heads` lists only the NewTopic tip (rev 5).
I wouldn't expect setting a topic to create a new head. It changes the
hash, but it's just setting some extra metadata.
But I just tried with hg-3.7.1 and hg-4.7.1, and I get your behavior
with both. So I guess this has changed recently.
If you make sure you have a topological branch to force a new head, then
I guess this depends on what `hg merge` does with topics. Normally, hg
commands restrict their view to the current topic. So in that way, I
could argue that there shouldn't be a merge in your case, because the
topic has only one head. But I think merge may be one of the exceptions,
because of the common scenario of merging a topic back into the
un-topic'ed mainline?
More information about the Mercurial
mailing list