How to use SVK
Contents
SVK Setup and Usage Instructions
Setup
These are steps which need to be followed to set up SVK initally, whether there is an existing SVN repository to migrate or not. Assumes a default install of Subversion and SVK. More information can be found in the book Version Control with SVK.
svk depotmap --init
- Initializes SVK.
svk mirror svn://user@svn.parentrepository.com/project //project_parent
Mirror initialized. Run svk sync //project_parent to start mirroring.
- Mirrors the parent repository to a local depot.
svk sync //project_parent
Syncing svn://user@svn.parentrepository.com/project
Retrieving log information from 1 to 134
Committed revision 2 from revision 1.
...
Committed revision 135 from revision 134.- Retrieves all the revisions of the parent repository into the local mirror. Alternatively the following can be used to ignore older revisions:
svk sync --skipto HEAD //project_parent
- Retrieves all the revisions of the parent repository into the local mirror. Alternatively the following can be used to ignore older revisions:
svk cp //project_parent //project_new
Committed revision 136.
- Creates a child depot based on the mirror of the parent repository. SVK will know henceforth that the child is related to the parent.
svnserve -d -r /path/to/.svk/local
- Begin serving the SVK depots via the SVN protocol. Not necessary if serving the depot via HTTP over Apache or only accessing the depot locally via the
file://
protocol.
- Begin serving the SVK depots via the SVN protocol. Not necessary if serving the depot via HTTP over Apache or only accessing the depot locally via the
svn co svn://childhost/project_new /path/to/working/copy/of/project
- Use Subversion tools to check out a working copy of the child depot. This working copy can be operated upon normally with SVN tools - commit, update, etc.
Migrating an Existing Repository
These are steps which need to be followed when a previously existing SVN repository needs to be migrated to SVK. Assumes the setup steps above have been completed.
svk mirror svn://user@childrepositoryhost/project_old //project_old
Mirror initialized. Run svk sync //project_old to start mirroring.
- Mirror the old repository (which must have been based on the parent repository at some point) to an SVK depot.
svk sync //project_old
Syncing svn://user@childrepositoryhost/project_old
Retrieving log information from 1 to 6
Committed revision 138 from revision 1.
...
Committed revision 143 from revision 6.- Retrieve all the revisions of the old SVN repository into the SVK depot mirror of the old repository.
kill 1234
- Kill the svnserve process which is serving the old SVN repository. Substitute the correct process ID.
svk merge -r 138:143 -l //project_old //project_new
Committed revision 144.
- Merge the revisions from the SVK depot which mirrors the old repository into the child depot (which is a copy of the mirror depot of the parent repository). All revisions will be imported in one commit - incremental revision merges don't seem to be supported by SVK at the time of writing (using the
-I
switch results in an error). Note that the revision numbers above apply to the SVK revisions, not the SVN revisions from the old SVN repository.
- Merge the revisions from the SVK depot which mirrors the old repository into the child depot (which is a copy of the mirror depot of the parent repository). All revisions will be imported in one commit - incremental revision merges don't seem to be supported by SVK at the time of writing (using the
svk mirror -d //project_old
Mirror path '//project_old' detached.
- Remove the now-unneeded mirror of the old SVN repository (optional).
svn up /path/to/working/copy/of/project
- Update the working copy of the child depot with the change containing all the revisions from the old SVN repository.
Migrating Changes Between the Parent Mirror and the Child Depot
- To pull all changes from the parent repository into the mirror, and push all changes from the mirror into the parent repository:
svk sync //project_parent
- As above, but only up to a specific revision:
svk sync -t 133 //project_parent
- To merge a specific revision range from the parent depot (mirror) to the child depot (copy of mirror):
svk merge -r 1000:1050 //project_parent //project_child
(Note that the revision numbers refer to the SVK depot revision numbers, not the revision numbers of the parent repository.)
- To auto-merge all changes from the parent depot to the child depot:
svk smerge //project_parent //project_child
or
svk pull //project_child
- As above, synchronizing the parent mirror first:
svk smerge -s //project_parent //project_child