Version 52 (modified by nicolasmartin, 23 months ago) (diff)

SubVersioN basics

Last edition on 05/18/20 09:05:57 by smasson

## Definitions

${REV} # SVN revision number

${URL} # web address of a path in the SVN repository (URL scheme + relative path in the repository)
## URL scheme depends on your role
##- user:
##- developer svn+ssh://${ID}

${WCPATH} # Working Copy PATH


Create a branch

$ svn copy {${URL},${WCPATH}}[@${REV}] {${URL},${WCPATH}}

Update to a different URL

Mirror a different branch $i.e$ traversing branch in the same repository (hazardous!! )

$ svn switch ${URL}[@${REV}] [${WCPATH}]

Relocate to a different URL $i.e$ keep the same branch but move to a new server or URL scheme

$ svn switch --relocate ${URL1}[@${REV1}] ${URL2}[@${REV2}]

Merging sources

Apply the differences between two sources to a working copy path

$ svn merge {${URL1},${WCPATH1}}[@${REV1}] {${URL1},${WCPATH2}}[@${REV2}] [${WCPATH}]

Manage versioned items

Add/Remove a item
(file or folder)

$ svn {add,del} ${WCPATH}

Info / Status / Log

Display information about a local or remote item

$ svn info [{${WCPATH},${URL}}][@${REV}]

Display the current state of the working path wrt the one mirrored in the repository

$ svn status [-[qu]] [${WCPATH}]

Display all commits performed to your working path since its creation

$ svn log --verbose --stop-on-copy ${WCPATH}

Revert local changes

$ svn revert  ${WCPATH}

Manage versioned SVN properties on items

Set properties

svn:keywords: log record of last commit in routine

$ svn propset svn:keywords Id on ${WCPATH}

svn:mime-type: syntax highlighting and merging process

svn:executable: executable permissions of shell scripts

$ svn propset svn:executable on ${WCPATH}

svn:externals: defining external sources

Single external example

$ svn propset svn:externals ${URL}[@${REV}] ${WCPATH}

Multi externals example using an editor

$ svn propedit svn:externals ${WCPATH}

Delete a property

$ svn propdel ${SVN_PROPERTY} ${WCPATH}

Push changes to the repository

$ svn ci [-m 'log message in one line'] items

Then in the appropriate directory

# Commit and write the log message (ticket link #.... and so on) in your editor
$ svn ci files_list
# `svn ci` without files list will commit all modified files recursively from the current directory
# or directly from the command line of the shell session
$ svn ci -m 'log_message' files_list
# Tip: set your editor for SVN for multi-lines commit message
# for sh  and other related shells, interesting to include it in ~/.profile or ~/.bash_profile)
$ export SVN_EDITOR='your_favourite_editor' 
# for csh  "    "      "      ""  ,      "      ""    "    "" "" ~/.login                     )
$ setenv SVN_EDITOR='your_favourite_editor'

Push modified external items from a working copy

Use explicit option with SVN commit command, think that no revision has to be set on related ext def (equivalent to @HEAD)

$ svn ci --include-externals ... 

With the new layout of the repository, some may encounter downloading or updating issues with

$ svn co -r ${REV} ${URL}

Use instead the more robust syntax

$ svn co ${URL}@${REV}

See ​ for more.