I\'m trying to get in the habit of doing code reviews, but merges have been making the process difficult because I don\'t know how to ask Mercurial to \"show only changes introd
The short answer: you can't do this with any stock Mercurial command.
Running hg diff -c 3
will show you the changes between 3
and its first parent -- i.e. the changeset you were at when you ran hg merge
.
This makes sense when you think of branches as more than just simple changesets. When you run hg up 1 && hg merge 2
you're telling Mercurial: "Merge changeset 2
into changeset 1
".
It's more obvious if you're using named branches. Say changeset 2
in your example was on a named branch called rewrite-ui
. When you run hg update 1 && hg merge rewrite-ui
you're effectively saying: "Merge all the changes in the rewrite-ui
branch into the current branch." When you later run hg diff -c
on this changeset it's showing you everything that was introduced to the default
branch (or whatever branch 1
happens to be on) by the merge, which makes sense.
From your question, though, it looks like you're looking for a way to say:
Show me every hunk in this changeset that wasn't present in either of its parents, and show me every hunk present in either of its parents that isn't also present in
3
.
This isn't a simple thing to calculate (I'm not even sure I got the description right just now). I can definitely see how it would be useful, though, so if you can define it unambiguously you might convince one of us Mercurial contributors that read SO to implement it.
In order to do code reviews you really want to see just the changes in the project that you are reviewing. To that end we use a new branch for each story and use pull requests to spotlight the changes, having merged all changes into the story branch before creating the pull request. We host our code on bitbucket and the review / pull request tools are really very good, offering a side by side diff.
Pull requests with side-by-side diffs