I'm using a mercurial GUI TortoiseHg. I was asked to go from default working branch to production branch, write a piece of code, commit and push it there, then update back to default branch and continue my next assignments there, as we keep default and production branches separate. However, there was also a request to "merge the latest change also to default branch".
How do I merge the latest revision also to default, without merging the two branches as one, which is of course not what I want to do?
You can't.
When merging you always merge the complete branch up to that point, not just a single changeset.
You got two options.
You can "graft" or "transplant" (depending on the version of Mercurial you're using) the single changeset from one branch to another. This will effectively (try to) apply the same changes to the target branch, and make a small note of where the changes came from as well. This is not a merge.
To use these functions update first to the tip of the branch you want the changeset "merged" into, and then use the graft/transplant command to apply the other changeset on top of it. If you're doing this using TortoiseHg, you can right-click the changeset you want to "merge" and there should be a menu item there. If not you may need to enable an extension or possibly even update to a newer version of Mercurial/TortoiseHg.
What you should've done instead was to update back to the point where you created one of the branches from the other in the first place, commit the fix on top of that, and then merge it into both branches. Assuming you really want to merge that is.
In other words you would've had this:
A---B---C---D---E---F <-- branch 1
\
+-1---2---3---4 <-- branch 2
You would've updated back to B, committed your fix on top of B, and then merged that changeset into both branches, like this:
+-C---D---E---F <-- branch 1
/
A---B---X <-- fix changeset
\
+-1---2---3---4 <-- branch 2
and then after merge:
+-C---D---E---F---G
/ /
A---B---X-------------+
\ \
+-1---2---3---4---5
G
and 5
are the two merges in this case.