Is there a way to Flatten/Replace mercurial subrepos with their contents (including history)

Viewed 52

I'm trying to see if I can remove subrepos from our source tree.

With our source tree. We have two subrepos, the original use for these has long since passed. And I wanted to experiment with replacing them with a single repo containing the whole tree instead. This will improve workflow around committing, searching history, performance as only 1 tree needs to be pushed/pulled, preventing issues caused by branches being out of sync, and making tools like heptapod more viable.

I want to maintain the history of all the repos. The solution I would try is:

  • Export every changeset for each repo.
  • Update each changeset in the root repo with the matching changesets in the subrepos added.
  • Create empty changesets for the root repo where there's not matching changeset in the subrepos.
  • Replace .hgsub{repo,state} with some sort of ".flattened_hgsub{repo,state}"
  • Create a new hg tree.
  • Import each changeset into the new tree.

I'm just wondering there's a tool for doing something like this already. Otherwise I'll see if I can make one myself. (Dusting off the old python skills)

0 Answers
Related