Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 19 and Version 20 of code/tools/SVN


Ignore:
Timestamp:
Sep 23, 2008, 11:47:48 PM (16 years ago)
Author:
bknecht
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/tools/SVN

    v19 v20  
    11= SVN =
    2 [[TracNav(TracNav/TOC_Development)]]
    3 
    4 == SVN Clients ==
     2
     3{{{
     4#!html
     5<table width=100% border=0 cellpadding=0 cellspacing=0>
     6  <tr valign=top>
     7    <td>
     8      <table width=100% border=0 cellpadding=10 cellspacing=5>
     9        <tr valign=top>
     10          <td style="background-color:#FFFFDD;border:3px solid #000000;">
     11<h2 style="margin:0;">SVN Clients</h2>
     12}}}
    513There are many SVN clients, the two below are just examples. Of course you can use whatever client you like.
    614 * Windows: [http://tortoisesvn.tigris.org/ TortoiseSVN]
    715 * Linux: [http://rapidsvn.tigris.org/ RapidSVN]
    8 
    9 == SVN command description ==
     16{{{
     17#!html
     18          </td>
     19        </tr>
     20      </table>
     21    </td>
     22    <td rowspan=2 style="padding:5px;">
     23}}}
     24[[TracNav(TracNav/TOC_Development)]]
     25{{{
     26#!html
     27&nbsp;
     28    </td>
     29  </tr>
     30  <tr>
     31    <td>
     32      <table width=100% border=0 cellpadding=10 cellspacing=5>
     33        <tr valign=top>
     34          <td style="background-color:#F4F4FF;border:3px solid #000000;">
     35<h2 style="margin:0;">SVN Command Description</h2>
     36}}}
    1037This section below contains a collection of the most used svn commands including some examples. This page does not claim to be complete. For further reading use the built-in help function from svn. The syntax is ''svn help <command>'', if command is omitted, a complete list of valid svn command in printed to the comsole. Furthermore it is assumed that the user has a basic understanding of the shell and knows the way around in the file structure. Svn allows for most of the flexibilities the bash shell allow.[[br]][[br]]
    1138
    1239These are some examples, which are elaborated further down.
    1340{{{
    14 svn co https://svn.orxonox.net/data/trunk data
     41#!html
     42<pre class="wiki" style="white-space:normal;">
     43svn co https://svn.orxonox.net/data/trunk data<br/>
     44svn up<br/>
     45svn ci -m "some message"<br/>
     46svn add myFile.cc myFile.h<br/>
     47svn rm trash-folder<br/>
     48svn mv myFile.cc myFile.h myFolder<br/>
     49svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test<br/>
     50svn resolved somefile.cc<br/>
     51svn revert<br/>
     52svn diff<br/>
     53</pre>
     54}}}
     55
     56Read the [http://svnbook.red-bean.com/en/1.1/index.html official guide to subversion] or its [http://www.onlamp.com/pub/a/onlamp/2002/10/31/subversion.html shorter version] for further information.
     57
     58If not noted otherwise all commands are recursive.
     59{{{
     60#!html
     61          </td>
     62        </tr>
     63      </table>
     64    </td>
     65  </tr>
     66</table>
     67
     68<table width=100% border=0 cellpadding=10 cellspacing=5>
     69  <tr valign=top>
     70    <td width=100%% style="background-color:#F7F7F7;border:1px solid #888888;">
     71<h3 style="margin:0;">checkout (co)</h3>
     72}}}
     73
     74The checkout command is used to create a local copy of a svn subtree on the local computer.
     75
     76The syntax used is ''svn co -r <revision> <remote-path> <local-path>'', if -r <revision> is omitted, the HEAD revision is assumed, which is also the newest one, if <local-path> is omitted the last remote folder will be used as <local-path>.
     77
     78This will create a folder orxonox-trunk with the contents of the trunk
     79{{{
     80svn co https://svn.orxonox.net/orxonox/trunk orxonox-trunk
     81}}}
     82
     83This will create a folder called test, with the content of the test branch at revision 200.
     84{{{
     85svn co -r 200 https://svn.orxonox.net/orxonox/branches/test
     86}}}
     87{{{
     88#!html
     89<hr style="margin:0px;">
     90<br/>
     91<h3 style="margin:0;">update (up)</h3>
     92}}}
     93Update 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.
     94
     95The syntax is ''svn up <local-path>'', if <local-path> is omitted the current update will be allied to the current directory.
     96
     97This will update the current folder including subfolders.
     98{{{
    1599svn up
    16 svn ci -m "some message"
    17 svn add myFile.cc myFile.h
    18 svn rm trash-folder
     100}}}
     101
     102This will update the trunk and the test-branch.
     103{{{
     104svn up trunk branches/test
     105}}}
     106
     107Updates 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].
     108{{{
     109#!html
     110<hr style="margin:0px;">
     111<br/>
     112<h3 style="margin:0;">commit (ci)</h3>
     113}}}
     114Sometimes also called checkin, does the opposite of checkout or update, it upload changes made to the local copy to the server.
     115
     116The syntax is ''svn ci -m <commit message> <local-path>'', if <local-path> is omitted, the current directory is assumed, if -m <commit message> is ommited, an editor will pop up where you can (and should) write a meaningful commit message.
     117
     118This will checkin the current directory including subfolders with the comment "initial upload"
     119{{{
     120svn ci -m "initial upload"
     121}}}
     122
     123A commit 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].
     124{{{
     125#!html
     126<hr style="margin:0px;">
     127<br/>
     128<h3 style="margin:0;">add</h3>
     129}}}
     130Adding a new file to the local svn copy, that it gets uploaded with the next commit.
     131
     132
     133The syntax is ''svn add <file>''
     134
     135This will add the files myFile.cc and myFile.h in the folder myFolder to the svn
     136{{{
     137svn add myFolder/myFile.cc myFolder/myFile.h
     138}}}
     139{{{
     140#!html
     141<hr style="margin:0px;">
     142<br/>
     143<h3 style="margin:0;">remove (rm)</h3>
     144}}}
     145Also called delete (del), which deletes an item from the svn tree. Please note that this also removes the file/folder from the local harddrive.
     146
     147The syntax is ''svn rm <file/folder>''.
     148
     149This will remove the file myOldFile.cc from the svn tree
     150{{{
     151svn rm myOldFile.cc
     152}}}
     153{{{
     154#!html
     155<hr style="margin:0px;">
     156<br/>
     157<h3 style="margin:0;">move (mv)</h3>
     158}}}
     159Sometimes called rename (ren) - as a rename is the same as a move. The command simplifies the rearranging of files in the svn tree.
     160
     161The syntax is ''svn mv <source files> <target-folder>''
     162
     163This will move the files myFile.cc and myFile.h to myFolder
     164{{{
    19165svn mv myFile.cc myFile.h myFolder
     166}}}
     167
     168This will rename the file myFiel.cc to myFile.cc - to correct a typo. Please note the mv and rename are the same command
     169{{{
     170svn ren myFiel.cc myfile.cc
     171}}}
     172{{{
     173#!html
     174<hr style="margin:0px;">
     175<br/>
     176<h3 style="margin:0;">copy (cp)</h3>
     177}}}
     178A 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.
     179
     180The syntax is ''svn cp <source-tree> <target-tree>'' or ''svn cp <source-files> <target>''
     181
     182This will create a new branch called test from the current version of the trunk
     183{{{
    20184svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test
    21 svn resolved somefile.cc
    22 svn revert
    23 svn diff
    24 }}}
    25 
    26 Read the [http://svnbook.red-bean.com/en/1.1/index.html official guide to subversion] or its [http://www.onlamp.com/pub/a/onlamp/2002/10/31/subversion.html shorter version] for further information.
    27 
    28 If not noted otherwise all commands are recursive.
    29 ----
    30 === checkout (co) ===
    31 The checkout command is used to create a local copy of a svn subtree on the local computer.
    32 
    33 The syntax used is ''svn co -r <revision> <remote-path> <local-path>'', if -r <revision> is omitted, the HEAD revision is assumed, which is also the newest one, if <local-path> is omitted the last remote folder will be used as <local-path>.
    34 
    35 This will create a folder orxonox-trunk with the contents of the trunk
    36 {{{
    37 svn co https://svn.orxonox.net/orxonox/trunk orxonox-trunk
    38 }}}
    39 
    40 This will create a folder called test, with the content of the test branch at revision 200.
    41 {{{
    42 svn co -r 200 https://svn.orxonox.net/orxonox/branches/test
    43 }}}
    44 ----
    45 === update (up) ===
    46 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.
    47 
    48 The syntax is ''svn up <local-path>'', if <local-path> is omitted the current update will be allied to the current directory.
    49 
    50 This will update the current folder including subfolders.
    51 {{{
    52 svn up
    53 }}}
    54 
    55 This will update the trunk and the test-branch.
    56 {{{
    57 svn up trunk branches/test
    58 }}}
    59 
    60 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].
    61 ----
    62 === commit (ci) ===
    63 Sometimes also called checkin, does the opposite of checkout or update, it upload changes made to the local copy to the server.
    64 
    65 The syntax is ''svn ci -m <commit message> <local-path>'', if <local-path> is omitted, the current directory is assumed, if -m <commit message> is ommited, an editor will pop up where you can (and should) write a meaningful commit message.
    66 
    67 This will checkin the current directory including subfolders with the comment "initial upload"
    68 {{{
    69 svn ci -m "initial upload"
    70 }}}
    71 
    72 A commit 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].
    73 ----
    74 === add ===
    75 Adding a new file to the local svn copy, that it gets uploaded with the next commit.
    76 
    77 
    78 The syntax is ''svn add <file>''
    79 
    80 This will add the files myFile.cc and myFile.h in the folder myFolder to the svn
    81 {{{
    82 svn add myFolder/myFile.cc myFolder/myFile.h
    83 }}}
    84 ----
    85 === remove (rm) ===
    86 Also called delete (del), which deletes an item from the svn tree. Please note that this also removes the file/folder from the local harddrive.
    87 
    88 The syntax is ''svn rm <file/folder>''.
    89 
    90 This will remove the file myOldFile.cc from the svn tree
    91 {{{
    92 svn rm myOldFile.cc
    93 }}}
    94 ----
    95 === move (mv) ===
    96 Sometimes called rename (ren) - as a rename is the same as a move. The command simplifies the rearranging of files in the svn tree.
    97 
    98 The syntax is ''svn mv <source files> <target-folder>''
    99 
    100 This will move the files myFile.cc and myFile.h to myFolder
    101 {{{
    102 svn mv myFile.cc myFile.h myFolder
    103 }}}
    104 
    105 This will rename the file myFiel.cc to myFile.cc - to correct a typo. Please note the mv and rename are the same command
    106 {{{
    107 svn ren myFiel.cc myfile.cc
    108 }}}
    109 ----
    110 === copy (cp) ===
    111 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.
    112 
    113 The syntax is ''svn cp <source-tree> <target-tree>'' or ''svn cp <source-files> <target>''
    114 
    115 This will create a new branch called test from the current version of the trunk
    116 {{{
    117 svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test
    118 }}}
    119 ----
    120 === resolved ===
     185}}}
     186{{{
     187#!html
     188<hr style="margin:0px;">
     189<br/>
     190<h3 style="margin:0;">resolved</h3>
     191}}}
    121192If a conflict arises - this normally happens if someone changes 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.
    122193
     
    127198svn resolved myConflictFile.cc
    128199}}}
    129 ----
    130 === revert ===
     200{{{
     201#!html
     202<hr style="margin:0px;">
     203<br/>
     204<h3 style="margin:0;">revert</h3>
     205}}}
    131206One of the major advantages of a version control system, is that you can always revert to a known saved state - in this case the last updated local revision. Revert removes all local changes and restores the file to a state prior editing, i.e discarding all local changes.
    132207
     
    137212svn revert myFile.cc
    138213}}}
    139 ----
    140 === diff (di) ===
     214{{{
     215#!html
     216<hr style="margin:0px;">
     217<br/>
     218<h3 style="margin:0;">diff (di)</h3>
     219}}}
    141220Another rarely used but very useful command. It shows the difference between the downloaded revision and the current state, which basically what will be uploaded at the next commit. It is also useful to check if all new files have been added to the svn tree - it happens very often, that there are two commits in short time, first the updates, then the new files.
    142221
     
    147226svn di .
    148227}}}
    149 
    150 
    151 === merge ===
     228{{{
     229#!html
     230<hr style="margin:0px;">
     231<br/>
     232<h3 style="margin:0;">merge</h3>
     233}}}
    152234
    153235For those of you, who are courageous enough to merge two branches, or adequate, here's a little description about merge:
     
    164246svn diff <remote-trunk> -rOLDREVISION:NEWREVISION > patch-file && cd <destination> && patch -p0 < <path-to-patch-file>
    165247}}}
     248{{{
     249#!html
     250    </td>
     251  </tr>
     252</table>
     253}}}