@npetchimuthu You don't have to merge all the heads into default. Presumably some of these topological heads are closed branches that were already merged into other branches. If so, then you can create a new branch called dangling_heads and merge all the closed heads to that branch.
I've done this for one of our repositories, so I can advise on the specifics. To get a list of closed topological heads, you can use the following:
for b in `hg heads -tc | grep '^branch:' | sed -e 's@^branch: *@@'`
do
hg log -r "branch($b) and closed()"
done
We had a lot of these.
UPDATE: this script is extremely slow.
We use Magnus Akselvoll's script from https://github.com/magnusakselvoll/hg-http-400 to fix this problem.
Any feedback from Atlassian on their ability to add an option to change the close branch order of events?