Idea: hg merge --close

Pierre-Yves David pierre-yves.david at
Sun Apr 7 08:02:07 EDT 2019

On 4/7/19 12:52 PM, Joerg Sonnenberger wrote:
> Hello all,
> one thing we discussed during the mini sprint is the issue of dealing
> with merged vs active vs inactive branches. At the moment, closing a
> branch to get it off the branch list is a separate operation, which can
> be annoying. One idea for this is to add a --close flag to merge, which
> effectively results in the following topology:
>       b1a  b2a
>       |    |
>       |    b2b (close=1)
>       |   /
>       b1b (merge)
> as opposed to the current:
>       b1a  b2a
>       |   /
>       |  /
>       b1b
> The advantage to having a separate closing commit is that it doesn't
> keep a topological head open. The commit message to be used could be
> specified as templated option in hgrc, defaulting to something like
> 'Closing branch %s after merge' to so. The one downside is that the
> parent of b1b now points to an artifical commit, which makes the history
> a bit more messy.

I like the idea[1], people having been asking for a simple UI for `hg 
merge --close` for a long time. The approach of creating an extra 
changeset lift the "clarity" concerns raised in previous discussions 
around `hg merge --close`.

As a small optional optimization, if the merged changeset is "draft", we 
could "amend" it into a branch closing one.

Pierre-Yves David

[1] unsurprisingly, being part of the discussion that produced this 
email o:-)

More information about the Mercurial-devel mailing list