190 likes | 328 Views
CS311 – Lecture 08 Outline. Subversion (SVN) *All information taken from “SVN Book” O’Reilly. 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/. What is SVN?.
E N D
CS311 – Lecture 08 Outline • Subversion (SVN) • *All information taken from “SVN Book” O’Reilly CS 311 - Operating Systems I
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/ CS 311 - Operating Systems I
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. CS 311 - Operating Systems I 3
Difference between file server • What happens when a user updates a file which is already being accessed by another? CS 311 - Operating Systems I
Problems with file sharing CS 311 - Operating Systems I
Lock-Modify-Unlock • What are the problems with this model? CS 311 - Operating Systems I
Problems with Lock-Modify-Unlock • Administrative problems • Unnecessary serialization • Creates a false sense of security • Restrictive CS 311 - Operating Systems I
Copy-Modify-Merge solution CS 311 - Operating Systems I
Copy-Modify-Merge Solution CS 311 - Operating Systems I
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) CS 311 - Operating Systems I
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. CS 311 - Operating Systems I
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”. CS 311 - Operating Systems I
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/ CS 311 - Operating Systems I
Publishing changes • 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. CS 311 - Operating Systems I
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. CS 311 - Operating Systems I
Creating a SVN Repository • 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. CS 311 - Operating Systems I
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. CS 311 - Operating Systems I
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 CS 311 - Operating Systems I
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 <stdio.h> int main(void) { - printf("Sixty-four slices of American Cheese...\n"); + printf("Sixty-five slices of American Cheese...\n"); return 0; } CS 311 - Operating Systems I