[PATCH 0 of 1] merge: add --no-fast-forward to suppress fast-forward merge

Didly didlybom at gmail.com
Sun Mar 6 15:04:17 CST 2011


On Sun, Mar 6, 2011 at 12:37 PM, Adrian Buehlmann <adrian at cadifra.com>wrote:

> On 2011-03-06 12:02, Didly (aka Angel Ezquerra :-) wrote:
> > Actually this is the first I've heard of it and I don't really know what
> > it means. Is it related to merging with a descendant?
> > Anyway, I guess it does confuse at least some existing users :-)
>
> Consider the following DAG (DAG=directed acyclic graph; time increases
> from left to right):
>
>                   d1
>  default   --o-----o
>                     \                      Figure 1
>  stable    -----o----o---o---o---o
>                      s1          s2
>
> If you update to d1, merge with s2, and commit, mercurial will notice
> that there were no changes on the default branch and will just create a
> new commit with the branch name "default".
>
> The result will be a new changeset d2 on default, even though you said
> "hg merge s2":
>
>                   d1               d2
>  default   --o-----o               o
>                     \             /        Figure 2a
>  stable    -----o----o---o---o---o
>                      s1          s2
>
> Note that the new changeset d2 has a single parent s2. No merge changeset!
>
> You could do the same with 'hg branch --force default', followed by commit.
>
> So, mercurial is just doing a "fast-forward" on the stable branch,
> instead of really doing:
>
>                   d1               d2'
>  default   --o-----o---------------o
>                     \             /        Figure 2b
>  stable    -----o----o---o---o---o
>                      s1          s2
>
> If mercurial would really do a d2' merge changeset, that changeset would
> contain no file changes at all.
>
> Similarly, d2 in figure 2a does not contain any file changes at all.
>

Yuya, Adrian,

thanks a lot for the very clear and detailed explanations. I really
appreciate them!

The old behaviour definitely makes more sense to me. I guess most users
would expect to get see two branches merge after executing a merge command,
even if empty.

Angel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110306/fecc9112/attachment.htm>


More information about the Mercurial-devel mailing list