dummy merge (two branches) for dummies

Uwe Brauer oub at mat.ucm.es
Thu Aug 18 12:23:20 UTC 2016


   > On Wed, 2016-08-17 at 21:28 +0000, Uwe Brauer wrote:

   > It's not the magic.

   > The magic is to do the merge followed by a full revert.

Thanks very much however I am not entirely sure about the revert
command.


Here is what I did

 hg init                
 hg  branch uwe     
 echo line-which-is-in-both-files > test.txt
 hg add test.txt
 hg commit -m "Uwe one"       
 hg branch foo
 echo line-which-is-in-both-files > test.txt
 hg commit -m "Foo two"
 echo foo-three >> test.txt
 hg commit -m "Foo three"       
 hg update uwe
 echo uwe-four >> test.txt
 hg commit -m "Uwe four"       
 hg log -G              

Which results in

@  changeset:   3:548f8c4f0e50
|  branch:      uwe
|  tag:         tip
|  parent:      0:dd35e276060e
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Thu Aug 18 12:19:26 2016 +0000
|  summary:     Uwe four
|
| o  changeset:   2:531f39a666ad
| |  branch:      foo
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Aug 18 12:19:26 2016 +0000
| |  summary:     Foo three
| |
| o  changeset:   1:1941b7cc3e7b
|/   branch:      foo
|    user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Thu Aug 18 12:19:25 2016 +0000
|    summary:     Foo two
|
o  changeset:   0:dd35e276060e
   branch:      uwe
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Thu Aug 18 12:19:25 2016 +0000
   summary:     Uwe one


Now I want to stay in the branch uwe and take the last commit from the
foo branch which is rev 2 into the branch uwe.

Then I just run:



hg merge --tool internal:other foo
hg commit -m "Merge I want"


 hg log -G

Gives me 

@    changeset:   4:bf50e87bd1b5
|\   branch:      uwe
| |  tag:         tip
| |  parent:      3:548f8c4f0e50
| |  parent:      2:531f39a666ad
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Aug 18 12:21:10 2016 +0000
| |  summary:     Merge I want
| |
| o  changeset:   3:548f8c4f0e50
| |  branch:      uwe
| |  parent:      0:dd35e276060e
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Aug 18 12:19:26 2016 +0000
| |  summary:     Uwe four
| |
o |  changeset:   2:531f39a666ad
| |  branch:      foo
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Thu Aug 18 12:19:26 2016 +0000
| |  summary:     Foo three
| |
o |  changeset:   1:1941b7cc3e7b
|/   branch:      foo
|    user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Thu Aug 18 12:19:25 2016 +0000
|    summary:     Foo two
|
o  changeset:   0:dd35e276060e
   branch:      uwe
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Thu Aug 18 12:19:25 2016 +0000
   summary:     Uwe one

Which looks what I want. So is my approach correct or is there something
I oversee?

Thanks

Uwe Brauer 



More information about the Mercurial mailing list