hg merge preview

Mads Kiilerich mads at kiilerich.com
Thu Sep 1 09:28:13 UTC 2011


On 09/01/2011 09:21 AM, Peter Toft wrote:
> Odd - with a freshly baked Mercurial 1.9.2 on a Linux Mint box I simply
> get empty returns when running
>
>     hg diff -r 'p1()'
>     hg diff -r 'p2()'
>
> in a scenario where I have merge problems (the rotten bastard behind the
> keyboard here even created them *G*)

Strange. It works here. But note that these commands will show you the 
uncommitted changes in your working directory. Are you sure they haven't 
been committed or 'up -C'ed? Try to check with 'hg summary' (which also 
will give a brief summary of what will be committed by a commit of a merge.

/Mads


   $ hg init
   $ touch {A,B,C}.txt
   $ hg ci -Aqm0

User A:

   $ echo " " >> A.txt
   $ echo " " >> B.txt
   $ hg commit -m "bla from A" # 1

User B:

   $ hg up -qr0
   $ echo "x" >> A.txt
   $ echo " " >> C.txt
   $ hg commit -qm "bla bla from b" # 2

Merge using ugly conflict markers:

   $ hg merge --tool internal:merge
   merging A.txt
   warning: conflicts during merge.
   merging A.txt failed!
   1 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' 
to abandon
   [1]

   $ hg summary
   parent: 2:cfcd243db2ab tip
    bla bla from b
   parent: 1:d13ac2cbfee5
    bla from A
   branch: default
   commit: 2 modified, 1 unknown, 1 unresolved (merge)
   update: (current)

   $ hg diff -r 'p1()'
   diff -r cfcd243db2ab A.txt
   --- a/A.txt   Thu Jan 01 00:00:00 1970 +0000
   +++ b/A.txt   Thu Sep 01 09:23:56 2011 +0000
   @@ -1,1 +1,5 @@
   +<<<<<<< local
    x
   +=======
   +
   +>>>>>>> other
   diff -r cfcd243db2ab B.txt
   --- a/B.txt   Thu Jan 01 00:00:00 1970 +0000
   +++ b/B.txt   Thu Sep 01 09:23:56 2011 +0000
   @@ -0,0 +1,1 @@
   +

   $ hg diff -r 'p2()'
   diff -r d13ac2cbfee5 A.txt
   --- a/A.txt   Thu Jan 01 00:00:00 1970 +0000
   +++ b/A.txt   Thu Sep 01 09:23:56 2011 +0000
   @@ -1,1 +1,5 @@
   +<<<<<<< local
   +x
   +=======

   +>>>>>>> other
   diff -r d13ac2cbfee5 C.txt
   --- a/C.txt   Thu Jan 01 00:00:00 1970 +0000
   +++ b/C.txt   Thu Sep 01 09:23:56 2011 +0000
   @@ -0,0 +1,1 @@
   +




More information about the Mercurial mailing list