Using svn and svnmerge
From openmichigan
Notes on using svnmerge tool for the production branch
Information and tutorials about using svnmerge.py can be found at http://www.orcaware.com/svn/wiki/Svnmerge.py
The latest version (as of this writing) of svnmerge.py is installed in /usr/local/bin/svnmerge.py
Specific notes on updating oerBETA and OERca
Initializing the repository for use with svnmerge
svnmerge on oerbeta fails with:
user@hostname:/var/www/oerbeta$ svnmerge.py -n init svnmerge: no copyfrom info available. Explicit source argument (-S/--source) required.
A few failed attempts at specifying the --source value resulted in the svnmerge-integrated property being totally wrong:
root@hostname:/var/www/oerbeta# svn proplist -v . Properties on '.': svnmerge-integrated : /ocw2/branches/production:1-50519 /ocw2/trunk:1-50518 /ocw2/trunk/tool:1-50518
Fixed this up by manually setting the property:
root@hostname:/var/www/oerbeta# svn propset svnmerge-integrated /ocw2/trunk:1-50518 . property 'svnmerge-integrated' set on '.'
Now it is correct (well... not actually -- see below!):
root@hostname:/var/www/oerbeta# svn proplist -v . Properties on '.': svnmerge-integrated : /ocw2/trunk:1-50518 root@hostname:/var/www/oerbeta# svnmerge.py avail 50589,50601,50621,50625,50627,50631,50633-50635,50691,50704,50773,50895 root@hostname:/var/www/oerbeta#
Attempting to check in just the property change also got the local change to the .htaccess file as well. Will need to be careful when upgrading the production machine!
user@hostname:/var/www/oerbeta$ sudo svn commit --username user@umich.edu -F svnmerge-commit-message.txt . Authentication realm: <https://source.sakaiproject.org:443> Subversion Repository Password for 'user@umich.edu': Sending . Sending .htaccess Transmitting file data . Committed revision 50926. user@hostname:/var/www/oerbeta$
Get the list of available revisions, with the log entries to tie them to Jira entries:
user@hostname:/var/www/oerbeta$ svnmerge.py avail --log ------------------------------------------------------------------------ r50589 | zzuser@umich.edu | 2008-06-25 13:28:19 -0400 (Wed, 25 Jun 2008) | 1 line Changed paths: M /ocw2/trunk/tool/system/application/models/material.php fix to OERDEV-124: materials status (# of COs to clear) should be reflected in the color ------------------------------------------------------------------------ r50601 | zzuser@umich.edu | 2008-06-25 16:28:59 -0400 (Wed, 25 Jun 2008) | 1 line Changed paths: M /ocw2/trunk/tool/system/application/models/coobject.php M /ocw2/trunk/tool/system/application/views/default/content/materials/edit_material.php fix to OERDEV-122:search for COs under re-create, replacement (currently can search under ask-provenance, ask-replacement, cleared, fair use, commission, permission, search, retain, remove) ------------------------------------------------------------------------ [...]
After choosing the desired revisions, attempt to merge them:
user@hostname:/var/www/oerbeta$ sudo svnmerge.py merge -r 50589,50601,50621,50625,50631,50691,50704,50773,50895 property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. Skipped missing target: 'tool/system/application/models/material.php' Skipped missing target: 'tool/system/application/models/coobject.php' Skipped missing target: 'tool/system/application/models' Skipped missing target: 'tool/system/application/controllers/materials.php' Skipped missing target: 'tool/system/application/controllers' Skipped missing target: 'tool/system/application/views/default/content/materials/co/_edit_repl_upload.php' Skipped missing target: 'tool/system/application/views/default/content/materials/co' Skipped missing target: 'tool/system/application/views/default/content/materials/askforms/instructor/inst_ne_prov.php' Skipped missing target: 'tool/system/application/views/default/content/materials/askforms/instructor' Skipped missing target: 'tool/system/application/views/default/content/materials/askforms' Skipped missing target: 'tool/system/application/views/default/content/materials/edit_material.php' Skipped missing target: 'tool/system/application/views/default/content/materials' Skipped missing target: 'tool/system/application/views/default/content' Skipped missing target: 'tool/system/application/views/default' Skipped missing target: 'tool/system/application/views' Skipped missing target: 'tool/system/application' Skipped missing target: 'tool/system' Skipped missing target: 'tool' property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. Skipped missing target: 'tool/system/application/models/coobject.php' Skipped missing target: 'tool/system/application/models' Skipped missing target: 'tool/system/application/views/default/content/materials/edit_material.php' Skipped missing target: 'tool/system/application/views/default/content/materials' Skipped missing target: 'tool/system/application/views/default/content' Skipped missing target: 'tool/system/application/views/default' Skipped missing target: 'tool/system/application/views' Skipped missing target: 'tool/system/application' Skipped missing target: 'tool/system' Skipped missing target: 'tool' property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. Skipped missing target: 'tool/system/application/models/coobject.php' Skipped missing target: 'tool/system/application/models' Skipped missing target: 'tool/system/application/controllers/materials.php' Skipped missing target: 'tool/system/application/controllers' Skipped missing target: 'tool/system/application' Skipped missing target: 'tool/system' Skipped missing target: 'tool/snapper/Ssnapper.jar' Skipped missing target: 'tool/snapper' Skipped missing target: 'tool' property 'svnmerge-integrated' set on '.' property 'svnmerge-blocked' deleted from '.'. user@hostname:/var/www/oerbeta$
Something is obviously wrong! Although the final version of the path for the svnmerge-integrated property looked right, it is not. After some more research, edited the property manually to really get it right:
user@hostname:/var/www/oerbeta$ svn propedit svnmerge-integrated . [ manual editing using vi editor ] user@hostname:/var/www/oerbeta$ svn pl -v . Properties on '.': svnmerge-integrated : /ocw2/trunk/tool:1-50518 user@hostname:/var/www/oerbeta$
Merging changes
With that properly fixed, we are ready to attempt the merge again:
user@hostname:/var/www/oerbeta$ sudo svnmerge.py merge -r 50589,50601,50621,50625,50631,50691,50704,50773,50895 property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. U system/application/models/material.php U system/application/models/coobject.php U system/application/controllers/materials.php U system/application/views/default/content/materials/co/_edit_repl_upload.php U system/application/views/default/content/materials/askforms/instructor/inst_ne_prov.php U system/application/views/default/content/materials/edit_material.php property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. G system/application/models/coobject.php G system/application/views/default/content/materials/edit_material.php property 'svnmerge-integrated' deleted from '.'. property 'svnmerge-blocked' deleted from '.'. G system/application/models/coobject.php G system/application/controllers/materials.php U snapper/Ssnapper.jar property 'svnmerge-integrated' set on '.' property 'svnmerge-blocked' deleted from '.'. user@hostname:/var/www/oerbeta$
OK! That looks better. Now test, test, test...
After testing to verify these changes function as expected, we are ready to commit the changes to the production branch:
user@hostname:/var/www/oerbeta$ sudo svn commit -F svnmerge-commit-message.txt Sending . Sending snapper/Ssnapper.jar Sending system/application/controllers/materials.php Sending system/application/models/coobject.php Sending system/application/models/material.php Sending system/application/views/default/content/materials/askforms/instructor/inst_ne_prov.php Sending system/application/views/default/content/materials/co/_edit_repl_upload.php Sending system/application/views/default/content/materials/edit_material.php Transmitting file data ....... Committed revision 50948. user@hostname:/var/www/oerbeta$
The svnmerge-integrated property now includes the revisions we have merged. The list of available revisions has been reduced.
user@hostname:/var/www/oerbeta$ svn proplist -v . Properties on '.': svnmerge-integrated : /ocw2/trunk/tool:1-50518,50589-50626,50628-50632,50636-50895 user@hostname:/var/www/oerbeta$ user@hostname:/var/www/oerbeta$ svnmerge.py avail 50627,50633-50635 user@hostname:/var/www/oerbeta$