Difference between revisions of "Subversion edu instructions"

From OSGeo
Jump to navigation Jump to search
(prettified)
Line 3: Line 3:
 
Find out what is there so far: http://svn.osgeo.org/osgeo/education/
 
Find out what is there so far: http://svn.osgeo.org/osgeo/education/
  
'''Install the svn client software (you may already have it)'''
+
===Install the svn client software (you may already have it)===
  
 
     Linux:  * 'subversion' package (RPM for your distro, should
 
     Linux:  * 'subversion' package (RPM for your distro, should
Line 13: Line 13:
 
     Windows: * http://tortoisesvn.tigris.org/
 
     Windows: * http://tortoisesvn.tigris.org/
 
               -> Downloads
 
               -> Downloads
               If you want a pretty Win32 GUI, 'TortoiseSVN'
+
               If you want a pretty graphical user interface, 'TortoiseSVN'
 
               integrates nicely with the Windows Explorer.
 
               integrates nicely with the Windows Explorer.
  
'''Checkout the material from the SVN repository into local directory'''
+
===Checkout the material from the SVN repository into local directory===
  
 
Command line:
 
Command line:
Line 26: Line 26:
 
This will check all the material in UnderDevelopment/ into the local directory 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):
+
'''Now add your material....'''(you need to have commit access - you will be asked for OSGeoID/passwd):
 
    
 
    
 
     cd UnderDevelopment/
 
     cd UnderDevelopment/
Line 40: Line 40:
 
       subdirectories and files to the repository
 
       subdirectories and files to the repository
  
      svn add directory
+
      svn add directory
      svn ci -m "MyTutorial for beginners added" directory
+
      svn ci -m "MyTutorial for beginners added" directory
  
 
       svn add file
 
       svn add file
Line 56: Line 56:
 
         svn ci -m "Introduction modified, grammar fixed" file
 
         svn ci -m "Introduction modified, grammar fixed" file
  
'''Brief SVN reference'''
+
===Brief SVN reference===
  
 
Help:
 
Help:
Line 71: Line 71:
 
     D  Deleted
 
     D  Deleted
 
     U  Updated
 
     U  Updated
     C  Conflict - ZAP! Here check for problems
+
     C  Conflict - ZAP! In this case check for problems
 
     G  merGed
 
     G  merGed
 
     ?  file not under version control (e.g. images)
 
     ?  file not under version control (e.g. images)
Line 118: Line 118:
 
     svn diff -r PREV:BASE file
 
     svn diff -r PREV:BASE file
  
Check history of changes:
+
Check history of changes (see [http://svnbook.red-bean.com/nightly/en/svn.tour.history.html here] for details):
  (see http://svnbook.red-bean.com/nightly/en/svn.tour.history.html for details)
 
 
     svn log file
 
     svn log file
  
  ... on all files:
+
... on all files:
 
     svn log
 
     svn log
  
  ... create ChangeLog file:
+
... create ChangeLog file:
 
     svn log > ChangeLog
 
     svn log > ChangeLog
  
Line 132: Line 131:
  
 
Whenever a conflict occurs, three things typically occur to assist you in noticing and resolving that conflict:
 
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
+
* Subversion prints a C during the update, and remembers that the file is in a state of conflict.
      in a state of conflict.
+
* For every conflicted file, Subversion places up to three extra unversioned files in your working copy
    * For every conflicted file, Subversion places up to three extra
+
* At this point, Subversion will not allow you to commit the file until the three temporary files are removed.
      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 --message "Add a few more things"
 
       svn: Commit failed (details follow):
 
       svn: Commit failed (details follow):
 
       svn: Aborting commit: '/home/sally/svn-work/sandwich.txt' remains in conflict
 
       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:
+
* If you get a conflict, you need to do *one* of three things:
      * Merge the conflicted text 'by hand' (by examining and editing the
+
** Merge the conflicted text 'by hand' (by examining and editing the conflict markers (<<<<< and >>>>>) within the file).
          conflict markers (<<<<< and >>>>>) within the file).
+
** or: Copy one of the temporary files on top of your working 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.
      * 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
 
Once you've resolved the conflict, you need to let Subversion know by running
Line 151: Line 146:
 
considers the file to be in a state of conflict:
 
considers the file to be in a state of conflict:
  
        $ svn resolved sandwich.txt
+
      $ svn resolved sandwich.txt
          Resolved conflicted state of 'sandwich.txt'
+
        Resolved conflicted state of 'sandwich.txt'
  
'''Reference (really good:)'''
+
===Reference (really good)===
  
Version Control with Subversion http://svnbook.red-bean.com/nightly/en/index.html
+
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
+
=== See also ===
 +
Graphical tools for SVN http://en.wikipedia.org/wiki/Subversion_%28software%29#GUI_front-ends.2Fclients
 +
 
 +
[[Category: Education]]

Revision as of 04:46, 31 July 2009

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 graphical user interface, '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 commit access - you will be asked for OSGeoID/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! In this case 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 here 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

See also

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