How to use SVK

From Opentaps Wiki

Jump to: navigation, search

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.

  1. svk depotmap --init
    • Initializes SVK.
  2. 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.
  3. 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
  4. 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.
  5. 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.
  6. svn co svn://localhost/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.

  1. 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.
  2. 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.
  3. kill <font color="red">1234</font>
    • Kill the svnserve process which is serving the old SVN repository. Substitute the correct process ID.
  4. svk merge -r <font color="red">138:143</font> -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.
  5. svk mirror -d //project_old
    Mirror path '//project_old' detached.
    • Remove the now-unneeded mirror of the old SVN repository (optional).
  6. 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 <font color="red">133</font> //project_parent

  • To merge a specific revision range from the parent depot (mirror) to the child depot (copy of mirror):

svk merge -r <font color="red">1000:1050</font> //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



© Open Source Strategies, Inc. Development of this documentation site is sponsored by Open Source Strategies, Inc.
Help support opentaps with a subscription to this documentation site.