So, here is the problem:
Let's say we have a very old installation of Kallithea with whole bunch of repositories, and, after 5 years of intensive development, it became bloated with legacy and experimental stuff, structural inconsistencies, etc. We have decided to update everything to modern versions, remove all legacy and unused stuff, and build a new directory structure of repositories on the server.
Basically, problem is:
DIRECTORY1 [ PROJ1 SUBPROJ1 ] //SUBPROJ1 is a subrepo for PROJ1, .hgsub approves.
DIRECTORY2 [ PROJ2 ] // SUBPROJ1 is a subrepo for PROJ2 as well!
is being reworked as
COMMON [ SUBPROJ1 ]
DIRECTORY1 [ PROJ1 ]
DIRECTORY2 [ PROJ2 ]
So, to make an update for projects PROJ1 and PROJ2 that supports new directory structure, we need to update .hgsub
for these projects [and all their branches as well ]. This would leave all previous revisions of them in a 'hanging' state - no way to clone them directly, there surely would be some issues on updating to them, etc.
Is there a general way to deal with such situations that fixes ALL previous revisions as well?
The .hgrc
file has a subpaths option that could work for you:
subpaths
Subrepository source URLs can go stale if a remote server changes name or becomes temporarily unavailable. This section lets you define rewrite rules of the form:
= where pattern is a regular expression matching a subrepository source URL and replacement is the replacement string used to rewrite it. Groups can be matched in pattern and referenced in replacements. For instance:
http://server/(.*)-hg/ = http://hg.server/\1/
rewrites
http://server/foo-hg/
intohttp://hg.server/foo/
.Relative subrepository paths are first made absolute, and the rewrite rules are then applied on the full (absolute) path. If pattern doesn't match the full path, an attempt is made to apply it on the relative path alone. The rules are applied in definition order.