I have a graphlog that looks something like this:
(snip)
| |
| o 1) Other Dev: Commit
| | \
o | | 2) Me: Commit
/ | | |
| | o | 3) Other Dev: Commits with an error
| |/| |
| o |/ 4) Me: Merge and commit
| /|
|/ |
o | 5) Me: Realize there were bugs in the commit and take earlier version to merge with
| o 6) Other Dev: Fixes error
o / 7) Me: committing some changes
|/
o 8) Me: Merge fixed tip
At (8), everything is as it should be with the exception of the dangling extra head at (4). To get rid of it I have to merge (4) -.-> (8) but, since there is nothing in (4) that I need, I can safely discard all of it’s changes. I could do this merge manually file-by-file (and usually this isn’t that big a deal) but for my own edification – is there a simple one-line way to say “merge (4) with (8) and always take (8)”?
Yes. The
internal:localbuiltin merge tool.Similarly there’s
internal:otherthat picks the other version of files as the merged version.Here’s an example to clarify what’s going on, start off with a repo with a single file:
Branch it and put a conflict in
a:Also add another file just in the merged in branch:
Go back and merge the anonymous head:
Naturally at this point without the merge tool we’d get a conflict on
a. But using the merge tool, we’re telling Mercurial to take the version of the first parent on every file that the merged with cset has also touched.