noresm:svntutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

noresm:svntutorial [2013-12-10 14:07:58]
alfg
noresm:svntutorial [2022-05-31 09:29:32]
Line 1: Line 1:
-======SVN Branch/Merge tutorial ====== 
- 
-NOTE: THE EXAMPLES ARE DONE ON ALFS PC, AND ANY DIRECTORY NAMES CONTAINING 
-"alfg" ARE NOT VALID ON YOUR PC!! USE SOME NAMES WHICH MAKE SENSE ON YOUR PC! 
- 
-===== PART 1 : Create a repository and put a file there ===== 
- 
-CREATE A REPOSITORY 
-<file> 
-alfg@pc4400:~$svnadmin create $HOME/svnrepos 
-</file> 
- 
-CREATE A WORKING DIRECTORY WITH CODE 
-<file> 
-alfg@pc4400:~$mkdir $HOME/testproject 
-</file> 
- 
-Use the following as the file test.F90: 
- 
-<file> 
-program test 
-    implicit none 
- 
-    real, parameter :: a=4.0 
-    real, parameter :: b=5.0 
- 
-    print*, "a is " , a  
-    print*, "b is " , b  
-    print*, "a+b is " , a+b  
-end program test 
-</file> 
- 
-CD TO WORKING DIRECTORY AND VERIFY THAT THE TEST FILE IS THERE 
-<file> 
-alfg@pc4400:~/testproject$ ls -l 
-total 4 
--rw-rw-r-- 1 alfg alfg 166 Dec  6 14:51 test.F90 
-</file> 
- 
-CD TO THE FRESHLY CREATED REPOSITORY AND CREATE "testproject" 
-<file> 
-alfg@pc4400:~/svnrepos$ svnadmin create testproject 
-</file> 
- 
-IMPORT YOUR WORKING-DIRECTORY TO THE REPOSITORY 
-<file> 
-alfg@pc4400:~$svn import $HOME/testproject/ file://$HOME/svnrepos/testproject/trunk -m "Initial version of testproject" 
-</file> 
- 
-MAKE A BRANCHES-DIRECTORY 
-<file> 
-alfg@pc4400:~$svn mkdir file://$HOME/svnrepos/testproject/branches/ -m "created branches directory" 
-</file> 
- 
-==>YOU NOW HAVE A REPOSITORY CONTAINING TRUNK AND (EMPTY) BRANCHES DIRECTORY. YOU CAN START TO USE IT 
- 
-===== PART 2: Create a working directory for two developers ==== 
- 
-<file> 
-alfg@pc4400:~$mkdir twoDevelopers 
-alfg@pc4400:~$cd twoDevelopers 
-</file> 
- 
-CHECK OUT TRUNK FOR ONE DEVELOPER 
-<file> 
-alfg@pc4400:~$svn checkout file://$HOME/svnrepos/testproject/trunk trunk 
-alfg@pc4400:~$cd trunk 
-</file> 
- 
-CREATE A BRANCH BASED ON TRUNK 
-<file> 
-alfg@pc4400:~/twoDevelopers/trunk$ svn copy file://$HOME/svnrepos/testproject/trunk file://$HOME/svnrepos/testproject/branches/aBranch -m "created branch aBranch" 
-</file> 
- 
-CD BACK ONE STEP AND CHECK OUT THE BRANCH FOR THE OTHER DEVELOPER 
-<file> 
-alfg@pc4400:~/twoDevelopers$ svn checkout file://$HOME/svnrepos/testproject/branches/aBranch aBranch 
-</file> 
- 
- 
-==> THE DIRECTORY "TWODEVELOPERS" NOW HAS TWO DIRECTORIES, ONE WITH TRUNK AND ONE WITH A BRANCH VERIFY THAT THEY ARE THERE 
-USING THE "LS" COMMAND 
- 
-<file> 
-alfg@pc4400:~/twoDevelopers$ ls -trl 
-total 8 
-drwxrwxr-x 3 alfg alfg 4096 Dec  9 08:36 trunk 
-drwxrwxr-x 3 alfg alfg 4096 Dec  9 09:40 aBranch 
-</file> 
- 
- 
-=====Part 3: Create conflict in the file test.F90 ===== 
- 
-EDIT FILE ON TRUNK 
-<file> 
-alfg@pc4400:~/twoDevelopers/trunk$ vim test.F90  
-alfg@pc4400:~/twoDevelopers/trunk$ svn commit -m "added hello" 
-alfg@pc4400:~/twoDevelopers/trunk$ svn update 
-</file> 
- 
-EDIT FILE ON BRANCH 
-<file> 
-alfg@pc4400:~/twoDevelopers/aBranch$ vim test.F90  
-alfg@pc4400:~/twoDevelopers/aBranch$ svn commit -m "added Hi man" 
-alfg@pc4400:~/twoDevelopers/aBranch$ svn update 
-</file> 
- 
-==> We have now created a conflict between the branch "aBranch" and "trunk" 
- 
-<file> 
-alfg@pc4400:~/twoDevelopers$ diff aBranch/test.F90 trunk/test.F90  
-9c9 
-< print*, "Hi Man! a+b is " , a+b 
---- 
-> print*, "Hello a+b is " , a+b 
-</file> 
- 
  
  • noresm/svntutorial.txt
  • Last modified: 2022-05-31 09:29:32
  • (external edit)