Splitting a repository in two (by directory)
Philip Pemberton
lists at philpem.me.uk
Tue Jul 28 16:03:44 UTC 2009
Hi,
I've been working on a project for a while (about 3 months), which
consists of two parts: the application itself (the "core"), and a small
web-admin interface. At the moment, both of these are stuffed into the
same repository, but are fully capable of working independently.
At the moment, the repository looks like this:
/hg/myapp
/admin
/adm_libs
config.inc.php
index.php
/lib
/smarty
... loads of files in here ...
security.inc.php
tests.inc.php
/templates
mainpage.tpl
index.php
install.php
What I want are two repositories, "myapp-admin" and "myapp-core", with
/hg/myapp/admin/* in "myapp-admin", and the rest in "myapp-core". So far
I've come up with a few ways of doing this:
(1): Move admin into another directory, "hg init" that directory, "hg
addrem", "hg commit", then push that to my server. Then remove admin
from core, "hg commit". This of course means my version history for part
of the admin side's development is in the "core" repo (mixed up with the
changes for "core"), while the rest of it is in the "admin" repo.
(2): Create two new repos called 'admin' and 'core'. Check out every
single change from the source repo (/hg/myapp) one-by-one, copy the
files into the two new repos as appropriate (admin files go into admin,
everything else goes into core), and check the changes in. This would
preserve the change history and comments as I'd like, and obviously if
there are no changes that affect e.g. "core", then "hg commit" will just
exit -- the comments will only apply to the part that actually changed.
Ideally I'd like to do something along the lines of (2). This way the
changes that apply to 'core' stay with 'core', and the changes that
apply to 'admin' stay with 'admin'. The problem is, I don't feel like
typing "hg checkout -r{N}; cp -R {files} {elsewhere}; (cd elsewhere; hg
commit)" and retyping (or at least copy-pasting) the changelog entries
for nearly 100 changesets.
So finally, on to the million-dollar question: is there a better way to
do this?
(a Google search for "mercurial split repository" seems to think not)
Thanks,
--
Phil.
lists at philpem.me.uk
http://www.philpem.me.uk/
More information about the Mercurial
mailing list