I have a branch that was developed for a long period of time. During the development default branch was merged into that branch several times. I would like now to review all the changes done on that branch ignoring merges, to decide whether it is safe to merge it to default.
I tried
hg diff -r "branch('myBranch') - merge()"
but it still shows changes introduced by merges. Also tried following this How to show the diff specific to a named branch in mercurial but
hg diff -r "branch('myBranch') - branch('default')"
still bring changes introduced by merges.
You have to read about revsets syntax
Your case
hg log -r "branch('myBranch') and ! merge()"
Try:
If you haven't done any merges to the branch, then "ancestor" will pick up the original branch point. If you've done merges, then "ancestor" will pick up the latest merge point.
For example, on the graph below you'll get the diff between 520 and 519:
On the simpler graph below you'll get a diff between 516 and 513:
Per Matt Mackall what you probably want is:
hg diff -r mainbranchrev -r mywork
He writes:
The following uses the
log
command but with the--patch
parameter it can show the modified lines as well:Short form:
The problem with your commands is that when you perform a
hg diff
and pass it several changesets, you actually perform a diff between those changesets, hence you will see the merge result.If you want to see just the changes made by the changesets then you could use
export
:For easier reviewing, you can output these to files with names based on the revision/changeset id:
... creates a file for each non-merge changeset in
mybranch
, and outputs it to a file with the name "40-digit changeset id.patch". If you'd prefer the revision number (only useful for your local repository as revision id's are local), use"%R.patch"
.That is a very good question, which I am trying to find good answer for a long time, and yet not found a good one. OK, one thing which 100% works is this:
I use this workflow all the time, but it does not satisfy me fully because it requires to switch branches (when I actually might not want to do actual merge right at this exact moment, I am just checking whats there)
I've been searching for ages for a good solution here, but so far there are none found. Tried those:
This problem also discussed in: