updated 6/24/13: updated with revised conventions for naming branches and their tags
updated 12/10/07: updated with revised conventions for naming branches and their tags
updated 2/08/07: updated 'working with externals' section with proper naming conventions
updated 7/31/06: added summary of example for branch naming conventions; replaced env var $SVNREPO with $SVN to shorten line lengths
updated 7/24/06: split document into 2 parts, added section on naming conventions for branches and their tags
updated 6/9/06: corrected name of external directories file and instructions for using it
updated 3/21/06: added info on resolving conflicts
updated 2/2/06: corrected some typos in instructions for working with externals
updated 1/24/06: added warning about expanded keywords when porting a branch
The following is meant to be a simple illustration of useful subcommands of the Subversion Command Line Client, svn. This is *not* meant as a substitute for reading the recommended text, which is available on-line here: http://svnbook.red-bean.com. Chapter 3: Guided Tour is particularly useful.
* the following assumes the environment variable $SVN has been set to the repository URL: https://svn-ccsm-models.cgd.ucar.edu
Examples for cam development, but applicable to any component
------------------------------------------------------------------------------------------------------
Typical work cycle:
view contents of repository for cam (may also enter URL/path into web browser)
> svn list $SVN/cam1
view list of cam trunk tags
> svn list $SVN/cam1/trunk_tags
checkout the HEAD of cam's trunk into working copy directory
> svn co $SVN/cam1/trunk cam_trunk_head_wc
much faster cam checkout if no further communication with repository is needed
> svn export $SVN/cam1/trunk cam_trunk_head_export
schedule new file in working copy directory for repository addition
> svn add
schedule working copy file for repository deletion
> svn delete
move working copy file or directory to new location
> svn move
view actual changes to working copy files relative to what was checked out
> svn diff
same as previous, only with user-supplied diff command
> svn diff --diff-cmd /usr/bin/diff -x "-b"
view changes relative to an older tag (don't forget the dot after --new)
svn diff --old $SVN/cam1/trunk_tags/ --new .
view state of working copy files relative to latest in repository
> svn status -u
view revision, URL and other useful information about your working copy files
> svn info
update working copy files to HEAD revision in repository
> svn update
if conflicts arise, you may undo unwanted modifications to working copy files
> svn revert
cleanup of conflicts may also require letting svn know things are resolved
> svn resolved
if project uses ChangeLog file for documentation, update it
> emacs cam_trunk_head_wc/models/atm/cam/doc/ChangeLog
commit changes from working copy directory to HEAD revision with log message
> svn commit -m "appropriate message"
tag new version of cam trunk
> svn copy $SVN/cam1/trunk $SVN/cam1/trunk_tags/
view history of log messages for cam's trunk
> svn log $SVN/cam1/trunk
include the paths changed with each revision
> svn log --verbose $SVN/cam1/trunk
-----------------------------------------------------------------------------------------------------
Working with branches:
determine the naming conventions adopted for the project(s) you'll be working with
** see the section on "Naming conventions for branches and their tags" **
make new cam branch from existing tag
> svn copy $SVN/cam1/trunk_tags/ $SVN/cam1/branches/ -m "appropriate message"
checkout the HEAD of a cam branch into working copy directory
> svn co $SVN/cam1/branches/ some_cam_branch_wc
--make changes as described above for trunk work--
view diffs between two cam trunk tags
> svn diff --old $SVN/cam1/trunk_tags/ --new $SVN/cam1/trunk_tags/
merge changes between trunk tags into working copy of a branch
> cd some_cam_branch_wc
> svn merge $SVN/cam1/trunk_tags/ $SVN/cam1/trunk_tags/
--resolve any conflicts, examine working copy status as described above--
commit changes from working copy directory to HEAD revision with log message
> svn commit -m "appropriate message"
tag new version of cam branch
> svn copy $SVN/cam1/branches/ $SVN/cam1/branch_tags/ -m "appropriate message"
----------------------------------------------------------------------------------------------------
Naming conventions for branches and their tags (adopted by cam and clm):
branches should be named starting with a unique string, descriptive of the branch
> svn copy $SVN/clm2/trunk_tags/clm3_expa_60 $SVN/clm2/branches/hydro -m "creating branch for development of hydro code"
branch tags should go in a subdirectory under under the project's branch_tags directory using the name of the branch and ending in '_tags'
> svn mkdir $SVN/clm2/branch_tags/hydro_tags -m "creating subdirectory for branch tags"
an initial branch tag should be created marking the start point of the branch and a numeric increment should be used in the tag name along with the trunk tag it is up to date with
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n00_clm3_expa_60 -m "making initial branch tag"
subsequent tags reflecting branch work should be incremented accordingly
> svn co $SVN/clm2/branches/hydro hydro_wcopy
> cd hydro_wcopy
** make changes **
> svn commit -m "committing hydro branch work"
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_60 -m "making new branch tag"
updating a branch to newer versions of the trunk should be reflected in the tag names, but the branch name itself remains unchanged
> cd hydro_wcopy
> svn update
> svn commit -m "updating branch to latest version of trunk"
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_65 -m "making branch tag"
branching from branches should be done in a similar manner
example summary...
trunk:
$SVN/clm2/trunk
some trunk tags:
clm3_expa_60
clm3_expa_61
clm3_expa_62
branch:
$SVN/clm2/branches/hydro
some branch tags:
$SVN/clm2/branch_tags/hydro_tags/hydro_n00_clm3_expa_60
$SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_60
$SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydro_tags/hydro_n02_clm3_expa_62
branch-of-branch:
$SVN/clm2/branches/hydbob
some branch-of-branch tags:
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n00_hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n01_hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n01_hydro_n02_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n02_hydro_n02_clm3_expa_62
continued on part 2...
updated 12/10/07: updated with revised conventions for naming branches and their tags
updated 2/08/07: updated 'working with externals' section with proper naming conventions
updated 7/31/06: added summary of example for branch naming conventions; replaced env var $SVNREPO with $SVN to shorten line lengths
updated 7/24/06: split document into 2 parts, added section on naming conventions for branches and their tags
updated 6/9/06: corrected name of external directories file and instructions for using it
updated 3/21/06: added info on resolving conflicts
updated 2/2/06: corrected some typos in instructions for working with externals
updated 1/24/06: added warning about expanded keywords when porting a branch
The following is meant to be a simple illustration of useful subcommands of the Subversion Command Line Client, svn. This is *not* meant as a substitute for reading the recommended text, which is available on-line here: http://svnbook.red-bean.com. Chapter 3: Guided Tour is particularly useful.
* the following assumes the environment variable $SVN has been set to the repository URL: https://svn-ccsm-models.cgd.ucar.edu
Examples for cam development, but applicable to any component
------------------------------------------------------------------------------------------------------
Typical work cycle:
view contents of repository for cam (may also enter URL/path into web browser)
> svn list $SVN/cam1
view list of cam trunk tags
> svn list $SVN/cam1/trunk_tags
checkout the HEAD of cam's trunk into working copy directory
> svn co $SVN/cam1/trunk cam_trunk_head_wc
much faster cam checkout if no further communication with repository is needed
> svn export $SVN/cam1/trunk cam_trunk_head_export
schedule new file in working copy directory for repository addition
> svn add
schedule working copy file for repository deletion
> svn delete
move working copy file or directory to new location
> svn move
view actual changes to working copy files relative to what was checked out
> svn diff
same as previous, only with user-supplied diff command
> svn diff --diff-cmd /usr/bin/diff -x "-b"
view changes relative to an older tag (don't forget the dot after --new)
svn diff --old $SVN/cam1/trunk_tags/ --new .
view state of working copy files relative to latest in repository
> svn status -u
view revision, URL and other useful information about your working copy files
> svn info
update working copy files to HEAD revision in repository
> svn update
if conflicts arise, you may undo unwanted modifications to working copy files
> svn revert
cleanup of conflicts may also require letting svn know things are resolved
> svn resolved
if project uses ChangeLog file for documentation, update it
> emacs cam_trunk_head_wc/models/atm/cam/doc/ChangeLog
commit changes from working copy directory to HEAD revision with log message
> svn commit -m "appropriate message"
tag new version of cam trunk
> svn copy $SVN/cam1/trunk $SVN/cam1/trunk_tags/
view history of log messages for cam's trunk
> svn log $SVN/cam1/trunk
include the paths changed with each revision
> svn log --verbose $SVN/cam1/trunk
-----------------------------------------------------------------------------------------------------
Working with branches:
determine the naming conventions adopted for the project(s) you'll be working with
** see the section on "Naming conventions for branches and their tags" **
make new cam branch from existing tag
> svn copy $SVN/cam1/trunk_tags/ $SVN/cam1/branches/ -m "appropriate message"
checkout the HEAD of a cam branch into working copy directory
> svn co $SVN/cam1/branches/ some_cam_branch_wc
--make changes as described above for trunk work--
view diffs between two cam trunk tags
> svn diff --old $SVN/cam1/trunk_tags/ --new $SVN/cam1/trunk_tags/
merge changes between trunk tags into working copy of a branch
> cd some_cam_branch_wc
> svn merge $SVN/cam1/trunk_tags/ $SVN/cam1/trunk_tags/
--resolve any conflicts, examine working copy status as described above--
commit changes from working copy directory to HEAD revision with log message
> svn commit -m "appropriate message"
tag new version of cam branch
> svn copy $SVN/cam1/branches/ $SVN/cam1/branch_tags/ -m "appropriate message"
----------------------------------------------------------------------------------------------------
Naming conventions for branches and their tags (adopted by cam and clm):
branches should be named starting with a unique string, descriptive of the branch
> svn copy $SVN/clm2/trunk_tags/clm3_expa_60 $SVN/clm2/branches/hydro -m "creating branch for development of hydro code"
branch tags should go in a subdirectory under under the project's branch_tags directory using the name of the branch and ending in '_tags'
> svn mkdir $SVN/clm2/branch_tags/hydro_tags -m "creating subdirectory for branch tags"
an initial branch tag should be created marking the start point of the branch and a numeric increment should be used in the tag name along with the trunk tag it is up to date with
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n00_clm3_expa_60 -m "making initial branch tag"
subsequent tags reflecting branch work should be incremented accordingly
> svn co $SVN/clm2/branches/hydro hydro_wcopy
> cd hydro_wcopy
** make changes **
> svn commit -m "committing hydro branch work"
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_60 -m "making new branch tag"
updating a branch to newer versions of the trunk should be reflected in the tag names, but the branch name itself remains unchanged
> cd hydro_wcopy
> svn update
> svn commit -m "updating branch to latest version of trunk"
> svn copy $SVN/clm2/branches/hydro $SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_65 -m "making branch tag"
branching from branches should be done in a similar manner
example summary...
trunk:
$SVN/clm2/trunk
some trunk tags:
clm3_expa_60
clm3_expa_61
clm3_expa_62
branch:
$SVN/clm2/branches/hydro
some branch tags:
$SVN/clm2/branch_tags/hydro_tags/hydro_n00_clm3_expa_60
$SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_60
$SVN/clm2/branch_tags/hydro_tags/hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydro_tags/hydro_n02_clm3_expa_62
branch-of-branch:
$SVN/clm2/branches/hydbob
some branch-of-branch tags:
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n00_hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n01_hydro_n01_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n01_hydro_n02_clm3_expa_62
$SVN/clm2/branch_tags/hydbob_tags/hydbob_n02_hydro_n02_clm3_expa_62
continued on part 2...