= SubVersioN basics Last edition on '''[[Wikinfo(changed_ts)]]''' by '''[[Wikinfo(changed_by)]]''' [[PageOutline(2-3)]] {{{#!sh ## 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: http://forge.ipsl.jussieu.fr/nemo/svn ##- developer svn+ssh://${ID}@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn ${WCPATH} # Working Copy PATH }}} == !Branching/Merging {{{#!th Create a branch }}} {{{#!td {{{#!sh $ svn copy {${URL},${WCPATH}}[@${REV}] {${URL},${WCPATH}} }}} }}} |- {{{#!th Update to a different URL }}} {{{#!td Mirror a different branch $i.e$ traversing branch in the same repository (__hazardous!! __) {{{#!sh $ 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 {{{#!sh $ svn switch --relocate ${URL1}[@${REV1}] ${URL2}[@${REV2}] }}} }}} |- {{{#!th Merging sources }}} {{{#!td Apply the differences between two sources to a working copy path {{{#!sh $ svn merge {${URL1},${WCPATH1}}[@${REV1}] {${URL1},${WCPATH2}}[@${REV2}] [${WCPATH}] }}} }}} == Manage versioned items {{{#!th !Add/Remove a item \\ (file or folder) }}} {{{#!td {{{#!sh $ svn {add,del} ${WCPATH} }}} }}} |- {{{#!th Info / Status / Log }}} {{{#!td Display information about a local or remote item {{{#!sh $ svn info [{${WCPATH},${URL}}][@${REV}] }}} Display the current state of the working path wrt the one mirrored in the repository {{{#!sh $ svn status [-[qu]] [${WCPATH}] }}} Display all commits performed to your working path since its creation {{{#!sh $ svn log --verbose --stop-on-copy ${WCPATH} }}} }}} |- {{{#!th Revert local changes }}} {{{#!td {{{#!sh $ svn revert ${WCPATH} }}} }}} == Manage versioned SVN properties on items === Set properties {{{#!th `svn:keywords`: log record of last commit in routine }}} {{{#!td {{{#!sh $ svn propset svn:keywords Id on ${WCPATH} }}} }}} |- {{{#!th `svn:mime-type`: syntax highlighting and merging process }}} {{{#!td }}} |- {{{#!th `svn:executable`: executable permissions of shell scripts }}} {{{#!td {{{#!sh $ svn propset svn:executable on ${WCPATH} }}} }}} |- {{{#!th `svn:externals`: defining external sources }}} {{{#!td Single external example {{{#!sh $ svn propset svn:externals ${URL}[@${REV}] ${WCPATH} }}} Multi externals example using an editor {{{#!sh $ svn propedit svn:externals ${WCPATH} }}} }}} === Delete a property {{{#!sh $ svn propdel ${SVN_PROPERTY} ${WCPATH} }}} == Push changes to the repository {{{#!sh $ svn ci [-m 'log message in one line'] items }}} ==== Then in the appropriate directory {{{#!sh # 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`)''' {{{#!sh $ svn ci --include-externals ... }}} ---- With the new layout of the repository, some may encounter downloading or updating issues with {{{#!sh $ svn co -r ${REV} ${URL} }}} Use instead the more robust syntax {{{#!sh $ svn co ${URL}@${REV} }}} See ​http://svnbook.red-bean.com/en/1.7/svn.advanced.REVs.html for more.