3

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)

phd
  • 82,685
  • 13
  • 120
  • 165
Triss Healy
  • 478
  • 5
  • 8
  • Have you tried https://stackoverflow.com/a/10450591/3195477 treating the subrepos as just independent sources? It also mentions using `hg convert` which may work if that does not for some reason. – StayOnTarget Aug 18 '20 at 11:31
  • I suppose with that solution we would just hg move the sub repo contents into their correct positions in the main repo. Remove the subrepos from the main one then merge all three. I'll try that, then I won't have to do any history editing. – Triss Healy Aug 19 '20 at 08:03

0 Answers0