Date post: | 21-Dec-2015 |
Category: |
Documents |
View: | 227 times |
Download: | 7 times |
CS311 – Lecture 08 Outline
• Subversion (SVN)
*All information taken from “SVN Book” O’Reilly
Lecture 08 1CS 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/
Lecture 08 CS 311 - Operating Systems I 2
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 08 3CS 311 - Operating Systems I
Difference between file server
• What happens when a user updates a file which is already being accessed by another?
Lecture 08 4CS 311 - Operating Systems I
Problems with file sharing
Lecture 08 5CS 311 - Operating Systems I
Lock-Modify-Unlock
• What are the problems with this model?Lecture 08 6CS 311 - Operating Systems I
Problems with Lock-Modify-Unlock
• Administrative problems• Unnecessary serialization• Creates a false sense of security• Restrictive
Lecture 08 7CS 311 - Operating Systems I
Copy-Modify-Merge solution
Lecture 08 8CS 311 - Operating Systems I
Copy-Modify-Merge Solution
Lecture 08 9CS 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)
Lecture 08 10CS 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.
Lecture 08 11CS 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”.
Lecture 08 CS 311 - Operating Systems I 12
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/calcA calc/Makefile (“A” means files are added)A calc/integer.cA calc/button.cChecked out revision 56.$ ls -A calcMakefile button.c integer.c .svn/
Lecture 08 13CS 311 - Operating Systems I
Publishing changes
Lecture 08 14CS 311 - Operating Systems I
To publish changes use “svn commit”$ svn commit button.c -m "Fixed a typo in button.c."Sending button.cTransmitting file data .Committed revision 57.
When your teammates now update their working copies using “svn update”$ svn updateU button.cUpdated to revision 57.
Always remember to update your working copy before committing changes to avoid conflicts.
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 08 15CS 311 - Operating Systems I
Creating a SVN Repository
Lecture 08 16CS 311 - Operating Systems I
• To create a SVN repository usesvnadmin create repo-nameEx: svnadmin create /var/svn/newrepos
• To add files into the repository usesvn import files path-to-reposvn import mytree file:///var/svn/newrepos/some/project -m "Initial import"Adding mytree/bar.cAdding mytree/subdirAdding mytree/subdir/quux.hCommitted revision 1.
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 08 17CS 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
modificationsLecture 08 CS 311 - Operating Systems I 18
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;}
Lecture 08 CS 311 - Operating Systems I 19