[debugsetparents is the solution?] (was: linear history two bookmarks only fast forward, but not in git)

Uwe Brauer oub at mat.ucm.es
Thu Nov 14 12:04:14 UTC 2019


>>> "UB" == Uwe Brauer <oub at mat.ucm.es> writes:

   > Hi 

   > This is a bit absurd.
   > Consider the following script 

   > hg init
   > echo "First" > test.org
   > hg add test.org
   > hg commit -u "Bernhard Riemann <bernhard.riemann at gmail.com>" -m "First"
   > hg book master
   > 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"
   > hg book feature
   > echo "Forth" >> test.org
   > hg commit  -m "Fourth"
   > echo "Fifth" >> test.org
   > hg commit  -m "Fifth"
   > echo "Six" >> test.org
   > hg commit  -m "Six"
   > hg log -G

   > The graph looks like 

   > @  changeset:   5:0a994b5c1f24
   > |  bookmark:    feature
   > |  tag:         tip
   > |  user:        Uwe Brauer <oub at mat.ucm.es>
   > |  date:        Thu Nov 14 11:51:45 2019 +0100
   > |  summary:     Six
   > |
   > o  changeset:   4:71ec83059439
   > |  user:        Uwe Brauer <oub at mat.ucm.es>
   > |  date:        Thu Nov 14 11:51:44 2019 +0100
   > |  summary:     Fifth
   > |
   > o  changeset:   3:32393bfa7ac2
   > |  user:        Uwe Brauer <oub at mat.ucm.es>
   > |  date:        Thu Nov 14 11:51:44 2019 +0100
   > |  summary:     Fourth
   > |
   > o  changeset:   2:c3b403573e29
   > |  bookmark:    master
   > |  user:        Bernhard Riemann <bernhard.riemann at gmail.com>
   > |  date:        Thu Nov 14 11:51:44 2019 +0100
   > |  summary:     Third

   > I cannot merge the feature branch into a master, I can only do a fast
   > forward.

   >   hg up master
   >   hg merge feature 

   > returns:

   > abort: nothing to merge


   > Well there is only ONE head, nor surprise.


   > Now I push this repository (using hg-git) to an empty git repository

   > And run in that pushed git repository

   >   git merge --no-ff feature

   > Then I change back into the mercurial repository and run

   >   hg pull -u

   > And voila the branches are merged.

   > @    changeset:   6:3f6e10ac3dd1
   > |\   bookmark:    feature
   > | |  bookmark:    master
   > | |  tag:         default/master
   > | |  tag:         tip
   > | |  parent:      2:bafb2e37c7f8
   > | |  parent:      5:e3c7d0ba27c0
   > | |  user:        Uwe Brauer <oub at mat.ucm.es>
   > | |  date:        Thu Nov 14 11:58:42 2019 +0100
   > | |  summary:     Merge branch 'feature'
   > | |
   > | o  changeset:   5:e3c7d0ba27c0
   > | |  tag:         default/feature
   > | |  user:        Uwe Brauer <oub at mat.ucm.es>
   > | |  date:        Thu Nov 14 11:57:35 2019 +0100
   > | |  summary:     Six
   > | |
   > | o  changeset:   4:606afa729cef
   > | |  user:        Uwe Brauer <oub at mat.ucm.es>
   > | |  date:        Thu Nov 14 11:57:34 2019 +0100
   > | |  summary:     Fifth
   > | |
   > | o  changeset:   3:6f2b2870446d
   > |/   user:        Uwe Brauer <oub at mat.ucm.es>
   > |    date:        Thu Nov 14 11:57:34 2019 +0100
   > |    summary:     Fourth


   > The question is, could such a behavior me somehow implemented, maybe as
   > an extension?

   > Regards


   > Uwe Brauer 

The following seems to work!

hg up master
hg debugsetparents . feature
hg ci -m "Merged linear history"

I obtain 


    changeset:   6:2eb54e12c0ac
|\   bookmark:    master
| |  tag:         tip
| |  parent:      2:5156697bc0df
| |  parent:      5:703b001898e5
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Nov 14 12:57:09 2019 +0100
| |  summary:     Merged feature branch into master
| |
| o  changeset:   5:703b001898e5
| |  bookmark:    feature
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Nov 14 12:56:35 2019 +0100
| |  summary:     Six
| |
| o  changeset:   4:0fcb0f1f4d26
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Nov 14 12:56:35 2019 +0100
| |  summary:     Fifth
| |
| o  changeset:   3:66a736372ab2
|/   user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Thu Nov 14 12:56:35 2019 +0100
|    summary:     Fourth
|

   > _______________________________________________
   > Mercurial mailing list
   > Mercurial at mercurial-scm.org
   > https://www.mercurial-scm.org/mailman/listinfo/mercurial
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5025 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20191114/e9464257/attachment.p7s>


More information about the Mercurial mailing list