Mercurial Merge

There are times when you will see some more difficult to resolve Mercurial conflicts, perhaps with extra branches in Tortoise.  This usually comes about because a developer forgot to pull the most recent code before pushing a recent check in.  For instance, the .hgtags file which tracks build numbers will be out of sync because the developer did not pull it down before checking in.

Transparent Merge

In Mercurial, when you pull and update from the repository, merges are usually done transparently if there are no conflicts:
:”’hg pull -u”’

Deliberate Merge

There are times when trying to do an update in Mercurial from the central repository, the tool will report that there are merge conflicts.  The first thing to try is a merge, commit, then push like so:

:”’hg pull -u”’
–>cannot update, merge conflicts
:”’hg merge”’
:”’hg commit -m “merge””’
:”’hg push”’

Resolve Merge

But if something more complicated happens, like the hg tags scenario where your local file is completely out of sync you need to resolve the conflicts.
:”’hg resolve”’
–> this will open the default file comparison tool, or KDiff if you have tortoise installed, so that you can manually merge the files:
[[File:Merge sample.jpg]]
:”’hg commit -m “merge””’
:”’hg push”’

Comments are closed.