Documentation for Moving Content Between Repositories
This document walks through the necessary steps to move items from one repository to another.
First you must get the content ready for exporting by checking it out and moving it to a convenient location.
Then generate a list of the modules:
Copy those modules from the entire checkout:
Now you are ready to zip up the modules:
Create a new empty workgroup on cnx.org, i.e. http://cnx.org/GroupWorkspaces/wg1138
Now you must publish the entire workgroup to get new module IDs
Once published, you must check out the entire workgroup:
You now must start making the dictionary of old module ID to new module ID. This script creates dict.txt in the current directory:
To finish the dictionary, run make_dict_final.py which creates dict_final.txt:
You must now apply the mapping to the modules:
Run renameZips.py to match the modules to their new IDs
After editing importZips.zctl to reflect your credentials, run on server that will house the new modules:
Grab keywords from old modules:
Edit setKeywords.zctl to reflect workgroup number and then run setKeywords on new modules:
Change roles in the new modules/collection:
Publish the now complete modules in your workgroup:
user@sandbox:~/projects/devsets/Repository2RepositoryMove$ cd /tmp
user@sandbox:/tmp$ cvs -R -d /var/lib/cvs co xmlpages-sandbox
Then generate a list of the modules:
user@sandbox:/tmp/xmlpages-sandbox$ cd /opt/instances/sandbox/
user@sandbox:/opt/instances/sandbox$ ./bin/zopectl debug
>>> l = app.plone.content.col10427.latest.containedModuleIds()
>>> x = set(l)
>>> len(x)
301
>>> l = app.plone.content.col10428.latest.containedModuleIds()
>>> y = set(l)
>>> len(y)
255
>>> a = x | y
>>> len(a)
301
>>> " ".join(a)
Copy those modules from the entire checkout:
user@sandbox:/opt/instances/sandbox$ cd -
user@sandbox:/tmp/xmlpages-sandbox$ mkdir ../mods
user@sandbox:/tmp/xmlpages-sandbox$ mv (module list) ../mods
user@sandbox:/tmp/xmlpages-sandbox$ cd ../mods/
user@sandbox:/tmp$ cp -r mods/ ~/projects/devsets/Repository2RepositoryMove/
Now you are ready to zip up the modules:
user@sandbox:/tmp$ cd mods
user@sandbox:/tmp/mods$ for m in m*; do (cd $m; rm -r CVS; zip ../$m.zip * ) ; done
user@sandbox:/tmp/mods$ mkdir ../zips
user@sandbox:/tmp/mods$ mv *.zip ../zips/
user@sandbox:/tmp/mods$ cd ..
user@sandbox:/tmp$ cp -r zips/ ~/projects/devsets/Repository2RepositoryMove/
Create a new empty workgroup on cnx.org, i.e. http://cnx.org/GroupWorkspaces/wg1138
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./create_from_zip.py -u user -p "" -n http://cnx.org -w wg1138 -z /home/user/projects/devsets/Repository2RepositoryMove/zips
Now you must publish the entire workgroup to get new module IDs
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./workGroupActions.py -u user -p "" -n http://cnx.org -w wg1138 -m "publishing for first time" -g
Once published, you must check out the entire workgroup:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./workGroupActions.py -u user -p "" -n http://cnx.org -w wg1138 -m "checking out for first time" -c
You now must start making the dictionary of old module ID to new module ID. This script creates dict.txt in the current directory:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./make_dict.py -z /home/user/projects/devsets/Repository2RepositoryMove/zips/
To finish the dictionary, run make_dict_final.py which creates dict_final.txt:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./make_dict_final.py -u user -p "" -n http://cnx.org -w wg1138
You must now apply the mapping to the modules:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./applyMapping.py -m dict_final.txt -d /home/user/projects/devsets/Repository2RepositoryMove/mods
Run renameZips.py to match the modules to their new IDs
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./renameZips.py -m dict_final.txt -d /home/user/projects/devsets/Repository2RepositoryMove/mappedzips/
After editing importZips.zctl to reflect your credentials, run on server that will house the new modules:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ssh production
user@production:~$ cd /opt/instances/cnx
user@production:/opt/instances/cnx$ ./bin/zopectl run ~/projects/devsets/Repository2RepositoryMove/importZips.zctl
user@production:/opt/instances/cnx$ logout
Connection to production closed.
Grab keywords from old modules:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ssh sandbox
user@sandbox:~$ cd /opt/instances/sandbox
user@sandbox:/opt/instances/sandbox$ ./bin/zopectl run ~/projects/devsets/Repository2RepositoryMove/getKeywords.zctl
user@sandbox:/opt/instances/sandbox$ cp /tmp/kwmapdict.eval ~/projects/devsets/Repository2RepositoryMove/
user@sandbox:/opt/instances/sandbox$ logout
Connection to sandbox closed.
Edit setKeywords.zctl to reflect workgroup number and then run setKeywords on new modules:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ssh production
user@production:~$ cd projects/devsets/Repository2RepositoryMove/
user@production:~/projects/devsets/Repository2RepositoryMove$ /opt/instances/cnx/bin/zopectl run setKeywords.zctl
user@production:~/projects/devsets/Repository2RepositoryMove$ logout
Connection to production closed.
Change roles in the new modules/collection:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ svn export https://software.cnx.rice.edu/svn/scripts/trunk/zopectl/change-roles.zctl
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ssh production
user@production:~$ cd projects/devsets/Repository2RepositoryMove/
user@production:~/projects/devsets/Repository2RepositoryMove$ /opt/instances/cnx/bin/zopectl run change-roles.zctl
user@production:~/projects/devsets/Repository2RepositoryMove$ logout
Connection to production closed.
Publish the now complete modules in your workgroup:
user@workstation:~/projects/devsets/Repository2RepositoryMove$ ./workGroupActions.py -u user -p "" -n http://cnx.org -w wg1138 -m "content complete, final publish" -g
