Versions housekeeping with "subversion"

Useful links (given to me by David Schweikert):

 


How to use the "subversion" facility for software projects

(by Ray Ballisti and Roman Plessl - June 2005)
===========================================================================
  
Summary of what one have to do:

1) the name of the repository you wish to be created should be sent 
   to the ISG.EE support (support@ee.ethz.ch) and ask them to create
   it for you. You should also deliver a responsible person for the 
   repository and a list of users who can have full access to it.

2) ISG will send you the passwords and create the repository on the svn server.


Now you can start:

3) create a subdirectory in your home directory. Best is with the same
   name as the repository, which at best will correspond to one of
   your projects.
   Example:
   boaz:[emcboss] % mkdir emc05

4) Take the first contact with the svn server: you will be asked to enter
   your password, which will be saved somewhere and you will not be asked
   anymore:
  boaz:[emcboss] % svn checkout svn://svn.ee.ethz.ch/emc05
  Authentication realm:  emc05
  Password for 'emcboss': 
  Checked out revision 0.
  boaz:[emcboss] % ls -lA emc05
  total 8
  drwxr-xr-x   7 emcboss  emc06        512 May 27 18:11 .svn/

 ==> the svn system has created a subdirectory ".svn" in which it will
     remember which project (repository) this is and many other things.

5) Now you can create some structure inside this project.
   We recommend a "trunk", a "releases" and a "tags" directories.
   The first is for the main development (working directory), the second is 
   to put some miles stones of your development's (i.e. fixed released without
   known bugs) and in tags you can put some fixed steps in your development
   toward a new release (but feel free to organise your work as you like).
   First example (not so good, but just to show how it can works): 
   cd emc05 ; mkdir trunk tags releases ; svn add trunk tags releases

6) Better way to do the same (here you create the structure directly on the 
   server, so you do not need "svn add ..."):
   boaz:[emcboss] % cd emc05
   boaz:[emc05] % svn mkdir trunk tags releases


7) You can start now to "populate" the working directory. Example:
   boaz:[emc05] % svn checkout svn://svn.ee.ethz.ch/emc05
   A  emc05/trunk
   A  emc05/revisions
   A  emc05/tags

   Please note that in this case you do not create the subdirectories
   yourself: let svn do it for you, because the system will add some
   necessary informations in the .svn subdirectory.
   
   boaz:[emc05] % cp ~/php3/*.php3 trunk

8) You can now let the svn system know that there some some 
   files to store for the first time. This happens
   with the command "svn add file_name":
   Example:
   boaz:[emc05] % cd trunk
   New directory is : /home/emcboss/emc05/trunk
   boaz:[trunk] % svn add *
   A         admin_portal.php3
   A         adv_reg_portal.php3
   A         assign_to_reviewer.php3
   A         assign_to_tc.php3
   A         attendees.php3
   A         build_sessions.php3
   A         change_cont_pass.php3
   A         change_rev_pass.php3
   A         change_tc_pass.php3
   A         countrylist.php3
   A         edit_papers.php3
   .... long list....

9) Let say that this version of the files should be stored.
   Tell it to the svn system with the 'commit' command:
   Example: 

   boaz:emcboss:[trunk]:313 % svn commit -m "Saving the first version"

   Adding         trunk
   Adding         trunk/admin_portal.php3
   Adding         trunk/adv_reg_portal.php3
   Adding         trunk/assign_to_reviewer.php3
   Adding         trunk/assign_to_tc.php3
   Adding         trunk/attendees.php3
   Adding         trunk/build_sessions.php3
   Adding         trunk/change_cont_pass.php3
   Adding         trunk/change_rev_pass.php3
   Adding         trunk/change_tc_pass.php3
   Adding         trunk/countrylist.php3
   Adding         trunk/edit_papers.php3
   .....
   Adding         trunk/view_edit.php3
   Transmitting file data ..............................................
   Committed revision 1.

10) We could now clear up the trunk directory in your home and
    fetch again those file that belong to the last revision:
    ( this is not a meaningsful procedure, I do it just as an example)
    boaz:emcboss:[emcboss]:162 % cd emc05
    New directory is : /home/emcboss/emc05
    boaz:emcboss:[emc05]:164 % rm -r trunk

11) Fetch the file you want to edit from the repository:
    
    boaz:emcboss:[emc05]:167 % svn checkout svn://svn.ee.ethz.ch/emc06/trunk/
    Password for 'emcboss': 
   A  trunk/logadmin.php
   A  trunk/submit_paper.php
   A  trunk/enroll.php
   A  trunk/include
   A  trunk/include/header_one.inc
   .....
   A  trunk/portal.php
   ...
   A  trunk/resend_admin.php
   Checked out revision 4.

Please note: steps 10 and 11 are not meaningsfull and I put them here just
to demonstrate the way svn works. Use the command "svn update" to bring
all file to the last revision level.

12) Edit one file, for instance admin_portal.php:
   boaz:[emc05] % gvim trunk/admin_portal.php

13) Commit the changes:
  boaz:[emc05] % svn commit -m "saving admin_portal.php" trunk
  Sending        trunk/admin_portal.php
  Transmitting file data .
  Committed revision 5.

Please note: Revision 5 is a set to the repository tree, i.e. to ALL 
the files, even if the only difference between rev. 4 and 5 is the 
file admin_portal.php !!

14) Generating a "tag" (snapshot of the last revision):

  As a first important step check-in all changed files of the trunk/
  svn commit -m "pretagging commit" trunk 

  then do the tagging directly on the server

  svn copy -m "tagging version release-1.0" svn://svn.ee.ethz.ch/emc06/trunk 
      svn://svn.ee.ethz.ch/emc06/tags/release-1.0

  To remove a wrong tagged version in repository you can
  directly remove the tagged version on the svn server:

  svn rm svn://svn.ee.ethz.ch/emc06/tags/GYMMM 

  if GYMMM was a failure.

  To have a look which taged versions are available use

  svn ls svn://svn.ee.ethz.ch/emc06/tags/

15) To move whole branches from one place in the repository
    to another use
   
    svn mv svn://svn.ee.ethz.ch/emc06/trunk/test/subdir
 	   svn://svn.ee.ethz.ch/emc06/trunk/plan/