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

Adrian Buehlmann adrian at cadifra.com
Sun Mar 6 05:37:47 CST 2011

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):

  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.

More information about the Mercurial-devel mailing list