Subversion edu instructions

From OSGeo
Jump to navigation Jump to search

How to provide and manage your educational material on osgeo svn

Find out what is there so far: http://svn.osgeo.org/osgeo/education/

Install the svn client software (you may already have it)

   Linux:   * 'subversion' package (RPM for your distro, should
              be on the CDROMs/DVD)
   MacOSX:  * http://subversion.tigris.org/
              -> Downloads
   Windows: * http://tortoisesvn.tigris.org/
              -> Downloads
              If you want a pretty Win32 GUI, 'TortoiseSVN'
              integrates nicely with the Windows Explorer.

Checkout the material from the SVN repository into local directory

Command line:

   svn co http://svn.osgeo.org/osgeo/education/UnderDevelopment/ UnderDevelopment

TortoiseSVN:

   Just enter this url: http://svn.osgeo.org/osgeo/education/UnderDevelopment/

This will check all the material in UnderDevelopment/ into the local directory UnderDevelopment/

Now add your material....(you need to have committ access - you will be asked for ID/passwd):

    cd UnderDevelopment/

If you are just starting, add a directory for your institution (svn add is for adding, but you also need to committ by svn ci)

      mkdir MyUniversity
      svn add MyUniversity
      svn ci -m "MyUniversity added - some useful comment" MyUniversity
      cd MyUniversity
      create or copy your material here and then add the relevant
      subdirectories and files to the repository
     svn add directory
     svn ci -m "MyTutorial for beginners added" directory
      svn add file
      svn ci -m "Introduction text added" file

Your group can now work on the material

Before starting the work update to latest version

       svn up

Modify/fix/enhance the material and commit the change

       svn ci -m "Introduction modified, grammar fixed" file

Brief SVN reference

Help:

   svn help
   svn help up
   svn help mv
   ...

Update from SVN server:

   svn up

This can happen:

   A  Added
   D  Deleted
   U  Updated
   C  Conflict - ZAP! Here check for problems
   G  merGed
   ?  file not under version control (e.g. images)

Find out if you have uncommitted changes in your local version:

   svn status

If no output, everything was uploaded to SVN. Congrats.

Verify changes before submitting:

   svn diff

Commit changes to SVN server:

 individual file commit:
   svn ci -m "Some useful comment" file1 [file2 ...]
 or (for global commit of all changes), simply:
   svn ci -m "Some useful comment"

Add new file/directory to SVN repository:

   svn add file
   svn ci -m "Some useful comment" file
   svn add directory
   svn ci -m "Some useful comment" directory

Remove file from SVN server (careful!):

   svn rm file
   svn ci -m "Some useful comment" file

Move file to another directory (this is the cool feature of SVN):

   svn mv file ../some_dir/
   cd ..
   svn ci -m "file moved because ..."

Make new directory (see also svn add above for simplicity):

   svn mkdir newdirectory
   svn ci -m "we need a new directory" newdirectory

Oops - submitted a wrong change? Revert!

   svn revert file

See last changes after updating:

   (BASE: the revision you updated to, PREV: previous)
   svn diff -r PREV:BASE
   svn diff -r PREV:BASE file

Check history of changes:

 (see http://svnbook.red-bean.com/nightly/en/svn.tour.history.html for details)
   svn log file
 ... on all files:
   svn log
 ... create ChangeLog file:
   svn log > ChangeLog

Handling SVN conflicts (please read the svnbook if unsure!):

 http://svnbook.red-bean.com/en/1.1/ch03s05.html

Whenever a conflict occurs, three things typically occur to assist you in noticing and resolving that conflict:

   * Subversion prints a C during the update, and remembers that the file is
      in a state of conflict.
   * For every conflicted file, Subversion places up to three extra
     unversioned files in your working copy
   * At this point, Subversion will not allow you to commit the file until
     the three temporary files are removed.
      $ svn commit --message "Add a few more things"
      svn: Commit failed (details follow):
      svn: Aborting commit: '/home/sally/svn-work/sandwich.txt' remains in conflict
   * If you get a conflict, you need to do *one* of three things:
      *  Merge the conflicted text 'by hand' (by examining and editing the
         conflict markers (<<<<< and >>>>>) within the file).
      * or: Copy one of the temporary files on top of your working file.
      * or: Run svn revert <filename> to throw away all of your local changes.

Once you've resolved the conflict, you need to let Subversion know by running svn resolved. This removes the three temporary files and Subversion no longer considers the file to be in a state of conflict:

       $ svn resolved sandwich.txt
         Resolved conflicted state of 'sandwich.txt'

Reference (really good:)

Version Control with Subversion http://svnbook.red-bean.com/nightly/en/index.html

Graphical tool for SVN http://en.wikipedia.org/wiki/Subversion_%28software%29#GUI_front-ends.2Fclients