While trying to work out an integration between Kiln and Bamboo I ran into an issue that Fog Creek support indicated might be a problem of having too many topological heads in my repository. We typically have a pattern of closing a branch prior to merging back into a main branch but that clearly gets forgotten from time to time.
$ hg head -t | grep ^changeset: | wc -l
1361
My understanding is that those heads need to be communicated one way or the other when pulling from the hosting Mercurial server to know which heads need to by sync'd. That's a lot of wasted effort given that over 1100 of those heads are completely dead to us -- so I'd like to get rid of those heads!
It's fairly straightforward to identify the heads I want to eliminate:
$ hg log -r "heads(all()) - ( head() and not closed() )" --template "{node}\n" | wc -l
1199
I initially thought it would be fairly straightforward to clean this up:
- Create a new dummy branch
- Iteratively merge all of the closed topological heads into the dummy branch (keep local)
Unfortunately, I ran into a couple of issues:
- If I started the dummy branch from my current default head, merges took a really long time ( I estimate it will take weeks to do all 1100+ merges )
- If I start from changeset 0, I get quickly run into an ambiguous merge issue that I don't know how to resolve ("ambiguous merge - picked m action"?)
Any ideas or suggestions on how I should proceed? Is my iterative merge idea sane? Are one of the two ideas for where to start from more reasonable than the other?
Any help is greatly appreciated!