dummy merge (two branches) for dummies

Uwe Brauer oub at mat.ucm.es
Thu Aug 18 18:14:48 UTC 2016


>>> "Matt" == Matt Mackall <mpm at selenic.com> writes:

   > On Thu, 2016-08-18 at 12:23 +0000, Uwe Brauer wrote:
   >>  
   >> hg merge --tool internal:other foo

   > Again, this is not the important bit.

   > Really, it's this simple:

   > - check out the branch you want
   > - merge with the branch you don't want
   > - discard all the changes from that merge with revert <- the important bit
   > - check in the result

   > The debugsetparents trick works, but is much more mysterious.

Hm, sorry to nag but the debugsetparents trick and your advice do not
produce the same result.

Here are the tree solutions:
1: mine

 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 merge --tool internal:other foo
 hg commit  -m "Merge I want"

File test.txt contains

line-which-is-in-both-files
foo-three

2: debugsetparents

 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 update foo
 hg debugsetparents uwe foo
 hg branch uwe
 hg commit -m "Merge"

File test.txt contains

line-which-is-in-both-files
foo-three

3: your solution

 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 merge --tool internal:local  foo
 hg revert --all -r uwe 
 hg commit  -m "Merge I want"


File test.txt contains
line-which-is-in-both-files
uwe-four

As you can see your solutions differs, and to me it seems that solution
1+2 give the same result, at least for that example, what do I miss?




More information about the Mercurial mailing list