Download presentation
Presentation is loading. Please wait.
1
CS311 – Lecture 08 Outline Subversion (SVN) *All information taken from “SVN Book” O’Reilly Lecture 081CS 311 - Operating Systems I
2
Software needed SVN is installed in flip server Windows users use Tortoise SVN. Linux and MAC users visit this website for installation instructions. - http://subversion.tigris.org/ Lecture 08CS 311 - Operating Systems I2
3
3 What is SVN? Centralized system for sharing information. Data stored in the system in the form of a file system tree. Any number of users with access to the system can read-write data. When user writes data into repository it becomes publicly available. Lecture 083CS 311 - Operating Systems I
4
Difference between file server What happens when a user updates a file which is already being accessed by another? Lecture 084CS 311 - Operating Systems I
5
Problems with file sharing Lecture 085CS 311 - Operating Systems I
6
Lock-Modify-Unlock What are the problems with this model? Lecture 086CS 311 - Operating Systems I
7
Problems with Lock-Modify-Unlock Administrative problems Unnecessary serialization Creates a false sense of security Restrictive Lecture 087CS 311 - Operating Systems I
8
Copy-Modify-Merge solution Lecture 088CS 311 - Operating Systems I
9
Copy-Modify-Merge Solution Lecture 089CS 311 - Operating Systems I
10
Merits and demerits of copy- modify-merge solution Merits – No problem of serialization. – Administering the files much easier. – Resolving conflicts Demerits – Not all type of files can be merged (Eg. Audio) Lecture 0810CS 311 - Operating Systems I
11
Subversion Uses copy-modify-merge system but still occasionally implements locks on a file. Very helpful for collaborative work. In-built tools to view changes in a file and resolve conflicts. Ability to browse through every revisions a file has gone through and also revert to any revision. In-built tools to merge changes. Lecture 0811CS 311 - Operating Systems I
12
SVN Repository and Working Copy Repository is a place in the file system where all data exists. Working copy is a place in the file system where modifications are done to the data and then updated to the repository. To get a working copy use “svn checkout path-to- repository”. If the repository resides on a network use “http://path-to-repository” or if in a local system use “file:///path-to-repo”. Lecture 08CS 311 - Operating Systems I12
13
Working Copies “.svn” folder in the working copy called the administrative directory. It holds all changes, outdated revisions, the information about the working copy, etc. To get the info about working copy use “svn info” from inside the working copy. $ svn checkout http://svn.example.com/repos/calc A calc/Makefile(“A” means files are added) A calc/integer.c A calc/button.c Checked out revision 56. $ ls -A calc Makefile button.c integer.c.svn/ Lecture 0813CS 311 - Operating Systems I
14
Publishing changes Lecture 0814CS 311 - Operating Systems I To publish changes use “svn commit” $ svn commit button.c -m "Fixed a typo in button.c." Sending button.c Transmitting file data. Committed revision 57. When your teammates now update their working copies using “svn update” $ svn update U button.c Updated to revision 57. Always remember to update your working copy before committing changes to avoid conflicts.
15
How working copy tracks changes.svn folder is the administrative folder. It keeps track of these What revision are your files currently on Last update of working copy “svn log” command gives you the history of changes. Lecture 0815CS 311 - Operating Systems I
16
Creating a SVN Repository Lecture 0816CS 311 - Operating Systems I To create a SVN repository use svnadmin create repo-name Ex: svnadmin create /var/svn/newrepos To add files into the repository use svn import files path-to-repo svn import mytree file:///var/svn/newrepos/some/project -m "Initial import" Adding mytree/bar.c Adding mytree/subdir Adding mytree/subdir/quux.h Committed revision 1.
17
Making changes to repository To inform svn repo that you are making changes use the svn command. svn add file#add file to repo svn delete file #delete file from repo svn copy file1 file2 svn move file1 file2 svn mkdir folder After making all changes to repository do not forget to commit the changes (svn commit) Use svn help command to know more about commands. Lecture 0817CS 311 - Operating Systems I
18
Status of files in working copy To know the status of files in the working copy use command “svn status” – ? scratch.c # file is not under version control – A stuff/loot/bloo.h # file is scheduled for addition – C stuff/loot/lump.c # file has textual conflicts from an update – D stuff/fish.c # file is scheduled for deletion – M bar.c # the content in bar.c has local modifications Lecture 08CS 311 - Operating Systems I18
19
Using svn diff diff finds the modifications done to a file. Also used to generate patch. (svn diff file > patch) $ svn diff bar.c --- bar.c (revision 3) +++ bar.c (working copy) @@ -1,3 +1,2 @@ +#include int main(void) { - printf("Sixty-four slices of American Cheese...\n"); + printf("Sixty-five slices of American Cheese...\n"); return 0; } Lecture 08CS 311 - Operating Systems I19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.