Changes between Initial Version and Version 1 of Workshops/IntroToHpc2015/svn


Ignore:
Timestamp:
10/19/15 16:29:31 (9 years ago)
Author:
pdejesus
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Workshops/IntroToHpc2015/svn

    v1 v1  
     1[[PageOutline]]
     2= Version Control with Subversion (svn) =
     3== What is SVN? ==
     4* A free/open-source version control system.
     5* Managing files and directories over time, placed into a central repository.
     6* The repository remembers every changes ever made to the files and directories.
     7* Accessible across networks, allowing to be used on different computers.
     8* Runs on Many platforms.
     9
     10[http://subversion.apache.org Home Page]
     11
     12[[Image(SVN_model.png)]]
     13
     14== Good things... ==
     15* If you develop a software with some other people, it keeps track of who did what when and where changes.
     16   * even if you develop a software yourself...
     17* When you made a stupid change and screwed up ....
     18   * Allows you to go back.
     19   * Revert to a previous revision of a file/directory.
     20
     21[[Image(SVN_revision.png)]]
     22
     23== First things to do ==
     24* Create a repository in your home directory on ''Cypress''
     25{{{#!bash
     26[fuji@cypress2 ~]$ svnadmin create $HOME/repos
     27}}}
     28 
     29This creates a repository under '$HOME/repos'.
     30Note that $HOME is your home-directory on ''Cypress''.
     31
     32Once you did this, you don't have to do this again.  Do not delete '$HOME/repos' !!!
     33
     34* Testing your repository
     35On ''Cypress'',
     36{{{#!bash
     37 mkdir mywork
     38 cd mywork
     39 mkdir project1
     40 echo "This is README.txt" > README.txt
     41 svn import file:///$HOME/repos/project1 -m"initial import"
     42}}}
     43Now you have ''project1'' in your repository.
     44
     45Delete ''project1'' then checkout ''project1'' from the repository,
     46{{{#!bash
     47 cd ..
     48 rm -rf project1
     49 svn co file:///$HOME/repos/project1 ./project1
     50}}}
     51
     52=== Working with SVN ===
     53* To download files in a repository, use ''''svn checkout'''' / ''''svn co'''' command.
     54* If you made some changes to the files in your local machine and want to upload these to the repository, use ''''svn commit'''' command.
     55* If you have files on your local machine and want to update these to the latest version in the repository, use ''''svn update'''' command.
     56* If you want to add a file/direcotry, use ''''svn add'''' and commit.
     57* If you want to delete a file/directory, use ''''svn delete'''' and commit.
     58
     59=== What to Control ===
     60* Source Code
     61* Documents
     62* Variable data
     63* Anything you want to share that isn't essentially static data.
     64'''Do not upload.... Large sets of binary files; images, movie, music....'''
     65
     66=== Accessing your Repository over Network ===
     67To access your Repository on ''Cypress' through ''ssh'' from other hosts,
     68{{{#!bash
     69 svn co svn+ssh://''USERNAME''@cypress.tulane.edu/''HOME_DIRCTORY''/repos/project1 ./project1
     70}}}
     71
     72You will be asked for typing your password on ''Cypress''.
     73
     74''USERNAME'' and ''HOME_DIRCTORY'' are your login user name and home directory on ''Cypress''.
     75
     76To see the path of your home directory, on ''Cypress''
     77{{{#!bash
     78 cat $HOME
     79}}}
     80
     81* Using svn-client software with GUI
     82 * There are Windows Versions and Mac OS versions.
     83  *[http://svn-ref.assembla.com/windows-svn-client-reviews.html Client Software Review]
     84
     85=== Try using Your Repository ===
     86==== Check out data ====
     87Somewhere on ''Cypress'',
     88{{{#!bash
     89 svn co file:///$HOME/repos/project1 ./project1
     90}}}
     91go into '''project1''' directory.
     92{{{#!bash
     93 cd project1
     94}}}
     95look at files
     96{{{#!bash
     97 ls
     98}}}
     99
     100==== Edit README.txt ====
     101Edit '''README.txt''' to add your message.
     102
     103then commit it.
     104{{{#!bash
     105 svn commit -m"your message"
     106}}}
     107
     108==== When you made a stupid change or delete a file by mistake ====
     109You can revert to a previous version.
     110
     111To look at the log
     112{{{#!bash
     113 svn log
     114}}}
     115
     116If you want to download version 1,
     117{{{#!bash
     118 svn -r 1 update
     119}}}
     120
     121When you delete '''README.txt by mistake,
     122{{{#!bash
     123 rm '''README.txt'''
     124}}}
     125
     126See the file you deleted does not exist.
     127{{{#!bash
     128 ls
     129}}}
     130Download the missing file,
     131{{{#!bash
     132 svn update
     133}}}
     134
     135==== Add files ====
     136Make a new file, then add it to svn by
     137 svn add NEW_FILE_YOU_MADE
     138
     139then
     140 svn commit -m"your message"
     141
     142==== Check status ====
     143To check the status
     144{{{#!bash
     145 svn stat
     146}}}
     147
     148To see the difference between the repository and your working version
     149 svn diff
     150
     151==== Upload ====
     152To upload your working version to the repository,
     153{{{#!bash
     154 svn commit -m"comment for current version"
     155}}}
     156
     157Look at the status and difference
     158{{{#!bash
     159 svn stat
     160 svn diff
     161}}}
     162
     163==== Help ====
     164{{{#!bash
     165 svn help
     166}}}