== SVN == This Page contains a collection of the most used svn command including some examples. {{{ svn co https://svn.orxonox.net/data/trunk data svn up svn ci -m "some message" svn add myFile.cc myFile.h svn rm trash-folder svn mv myFile.cc myFile.h myFolder svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test svn resolved somefile.cc svn diff svn revert }}} If not noted otherwise all commands are recursive. === checkout (co) === the checkout command is used to create a local copy of a svn subtree on the local computer. the syntax used is ''svn co -r '', if -r is omitted, the HEAD revision is assumed, which is also the newest one, if is omitted the last remote folder will be used as . This will create a folder orxonox-trunk with the contents of the trunk {{{ svn co https://svn.orxonox.net/orxonox/trunk orxonox-trunk }}} This will create a folder called test, with the content of the test branch at revision 200. {{{ svn co -r 200 https://svn.orxonox.net/orxonox/branches/test }}} === update (up) === update is closely related to checkout, as it also download - or updates - the svn tree. while checkout is normally only used once, update is used all the time. the syntax is ''svn up '', if is omitted the current update will be allied to the current directory. This will update the current folder including subfolders. {{{ svn up }}} This will update the trunk and the test-branch. {{{ svn up trunk branches/test }}} Updates may cause conflicts if the remote and local file has been changed in the same place. to resolve a conflict see [wiki:SVN#resolved here]. === checkin (ci) === sometime also called commit, does the opposite of checkout or update, it upload changes made to the local the to the server. The syntax is ''svn ci -m '', if is omitted, the current directory is assumed, if -m is ommited, an editor will pop up where you can (and should) write a meaningful commit message. this will checkin the current directory including subfolders with the comment "initial upload" {{{ svn ci -m "initial upload" }}} A checkin is only possible if the local version is up-to-date. if it isn't you will get an error, and the commit will fail. the solution then is to do an [wiki:SVN#updateup update]. === add === adding a new file to the local svn copy, that it get upload with the next commit. the syntax is ''svn add '' this will add the files myFile.cc and myFile.h in the folder myFolder to the svn {{{ svn add myFolder/myFile.cc myFolder/myFile.h }}} === remove (rm) === also called delete, which deletes an item from the svn tree. please note that this also removed the file/folder from the local harddrive. the syntax is ''svn rm ''. you still need to commit it to the server. this will remove the file myOldFile.cc from the svn tree {{{ svn rm myOldFile.cc }}} === move (mv) === sometime called rename - as a rename is the same as a move. The command simplifies the rearranging of files in the svn tree. the syntax is ''svn mv '' this will move the files myFile.cc and myFile.h to myFolder {{{ svn mv myFile.cc myFile.h myFolder }}} this will rename the file myFiel.cc to myFile.cc - to correct a typo. please note the mv and rename are the same command {{{ svn rename myFiel.cc myfile.cc }}} === copy (cp) === a command which is rarely used on the local tree - why would someone need a file twice in the same tree? - but it is rather useful to create new branches. though it is normally done by the supervisors, it can be done by the students. this will create a new branch called test from the current version of the trunk {{{ svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test }}} === resolved === if a conflict arises - this normally happens if someone change a file on the server (committed it) while you were doing changes in the same place. This command '''does not solve''' the conflict, but it removes the other unnecessary files. this will resolve the conflict in in myConflictFile.cc, and make the copy committable again. {{{ svn resolved myConflictFile.cc }}}