Search code examples
mercurial

hg diff by specifying one revision and automatically using the parents of that particular revision


This this possible? Currently, I first do an hg parents to find the parents, then an hg diff using two revisions. But it would be easier if hg diff had the option to take a single revision and find the parents automatically.


Solution

  • You're looking for the 'change' switch on diff:

     -c --change REV          change made by revision
    

    you use it like this (for revision 298):

    hg diff --change 298
    

    If you use it on a merge changeset (which has two parents), only the first parent is compared. In that case you can use the p2 revset to get the second parent:

    hg diff -r 298:p2(298)