You are on page 1of 22

Ex.no.06 03/10/12 1.

Objective:

VERSION CONTROL SYSTEM

To study about the various version control systems like RCS, CVS and SVN and work with them.The system should be able to track changes to the files/folders and a period of time and revert if necessary 2.Introduction: Version control is the concept of managing all changes to a repository. The repository could be containing any type of file. In computer software engineering, revision control is any practice that tracks and provides control over changes to source code. Software developers sometimes use revision control software to maintain documentation and configuration files as well as source code. -> Version control of the management of changes to document, programs and other information stored as computer files. -> It is most commonly used in software development where a team of people may change the files. -> Each revision is associated with a time stamp and the change. -> Trunk-> New versions added and Branch-> Debugged file. 3.RCS: RCS is Revision Control System. It assumes collaborators are logged in to the same computer (at least computers sharing the same file system) and have access to a shared repository directory. -> It manages multiple revision of files. -> It is useful for text and is revised frequently. 3.1Installation: ->yum install rcs. 3.2Working: (Setup )

->One of the team members creates a repository directory somewhere on this shared file system. % mkdir repositoryDirectory ->Make sure this directory is writable by the group.
%chmod g+rw repositoryDirectory ->Each collaborator should create his/her own working directory %cd %mkdir workingDirectory In the working directory, each collaborator should make a symbolic link to the repository and name it RCS %cd workingDirectory %ln-s repositoryDirectory RCS ->Create an RCS sub-directory and create a file to check in RCS. $mkdir RCS. $cat >d.c RCS provides two commands: check-in (ci) and check-out (co). You have the option to lock and unlock. By default, you check out a read-only copy to your working directory. Before making a change, you should lock the file. When you are done, you check in the changes back into the repository.

->To view, compile or distribute, enter the following: $co d.c(or)$co u d.c ->To check out a file for editing: $co l d.c -> Checking out a previous session: $co l 1.1 d.c ->Displaying the differences: $resdiff d.c ->Viewing the log: $relog d.c

Command % ci file(s)

Meaning

Side effect

check in a file into the remove working copy from your working directory. repository (linked by the RCS Modifies the corresponding file in the repository. If you link) and unlock have $Id:$ or other tags, they get updated, too. check inthe file into the repository and unlock check in the file into the repository and keep the lock check out the file(s) from the repository check outand lock the file(s) from the repository check in file with version number 2.1 check out all the files in the repository keeps the working copy in your working directory. Makes your copy read-only. keeps the working copy overwrite the file(s) in your working directory overwrites the file(s) in your working directory, but warns you if you have a writable overrides the default version number. same (side) effect as co

% ci -ufile(s) % ci -lfile(s) % cofile(s) % co -lfile(s) % ci -r2.1file(s) % co RCS/*,v

4.SVN: Subversion is the software versioning and a revision control system. SVN, which stands for Subversion, can be seen as further improvement on CVS with many of the same commands. Where CVS tracks versions as individual files, SVN tracks snapshots of your working directory. The reason is that you might make 27 modifications to file A but only 2 modifications to file B. CVS doesn't tell you which combination of version of A and version of B makes a valid build, if you ever have to go back and dig up something. SVN, on the other hand, lets you commit snapshots, so that each build is a (hopefully) consistent snapshot as seen by the committer. The commands for SVN are also similar to those in CVS, but SVN keeps track of more details for the user. Also, SVN can do merging just like CVS.

4.1Advantages over CVS: -> Commit to repositories are done as automatic operations. -> Maintains versions for entire directories. -> Entire directories can be copied/moved quickly while retaining full revision history. 4.2Setting up the SVN repositories: ->Choose a directory where you want to create SVN repository. ->Use the command SVN admin: ->SVNnadmin create repo-SVN ->This creates the repository folder repo-SVN. 4.3Working with SVN: -> Project directories can be re-direct in the SVN repository by using import. ->To import a particular directory pwd in the terminal should be the parent directory. 4.4 Setup Unlike CVS, which builds on RCS and uses the plain file system to track each file in a mostly human readable form, SVN uses its own file and directory format to track the builds, and it is not meant to be human readable. Also, setting up is entirely different for SVN. You need to use svnadminfor repository actions, andsvnfor working actions. You do need to set up thessh public/private keys

Make sure thesvn(andsvnadmin) path are in your $path variable. If not, add it by editing your .tcshrc
or .bashrc file. If .tcshrc, it is set path=($path /usr/bin/svnpackage/)# assuming /usr/bin/svnpackage contains the executables for svn and svnadmin. You might want to make sure we have group write permission. Also put in your .tcshrc umask 02 To create a repository, login (ssh) to your server and type the command % svnadmin createpathOfRepository Once you have a repository, you would need to go back to your local machine and set up a working directory. You can use eithersvn coorsvn importto establish this binding. Suppose someone else has already set up the repository and initial set of files. You can just do %svncosvn+ssh://user@host/fullPathOfRepositoryOnTheHost Suppose you already have your local directory with files and you want to put them into the repository. You can do %svnimportlocalDirNamesvn+ssh://user@host/fullPathOfRepositoryOnTheHost and then do ansvn cocommand (as described in the previous sub-bullet) to start working. localDirName is optional if you are already in the directory that you want to import (into SVN) 4.5 Update,Commit SVN and CVS share many commands in common. Command % svncosvn+ssh://user@host/dirPath Meaning (Side) effect

checkout files creates some bookkeeping indirPathon the remote files and SVN directory user@host's account withyou your local working directory to keep track of

the remote path update(i.e., copy from repository to your working directory; bring your working directory up to date). % svn update[file(s) or directory] mergesyour local files with Normally you just do changes from repository. svn update without additional files or directory. When necessary, you can also update individual files. unlocks also, if you locked any of the files you are committing. If you have $Id:$ tags or other tags, and you have set the property tag for some files, they get updated, too. the files are not actually submitted to the repository until you do thesvn commit the files are not actually removed untilsvn commit

% svn commit

commit (i.e., check in the snapshot into the repository and unlock)

% svn addfile(s)

mark files to be added to the repository mark the files to be removed from the repository sets the property tag (e.g., $Id:$) to be updated at the time of commit lock the file(s) in the repository unlocks the file(s) in the repository

% svn rmfile(s)

% svn propset svn:keywords "Id"file

not updated until commit

% svn lockfile(s) % svn unlockfile(s)

prevent others from locking enable others to lock

5.CVS: CVS stands for Concurrent Versioning System. It is actually built on top of RCS, but makes several improvements Commands can work remotely, so you don't have to actually login with a shell to ci/co and manually copy files between machines It solves the locking problem by allowing multiple people to edit their (unlocked) copies at the same time, and it will attempt to do a merge when you do commit/update. Branching, though we won't talk about it here.

For terminology, "commit" (in CVS, SVN) means "check in" (in RCS): submit your changes to the repository "update" (in CVS, SVN) means "check out" (in RCS): grab new files from the repository; bring your working directory up to date. "check out" (in CVS, SVN) means to set up a local directory to be a working directory tied to a repository. After the set up, you can then do commit and update, etc. "import" (in CVS, SVN) means to import the files in your current directory into the repository's tree by creating a new directory there. however, you would still need to do a checkout afterwards in order to start working. 5.1Installation: ->cvs can be installed as: ->sudo yum install cvs. 5.2Working with CVS: (Setup) Setting up is similar to RCS, in that you just need to create a directory. But we assume you want to be working on your own machine rather than on the server. So, you will also need to set up SSH keys.One of the team members creates a repository directory somewhere on this shared file system.

Make sure this directory is writable by the group. (Same as RCS)


%chmodg+rwrepositoryDirectory If the collaborators are in different (unix) groups, then you may have to usea+rwinstead ofg+rw, but that is less secure. Set up theSSH public/private keys, in case you haven't. To set up your own working copy, you would need to "check out" the repository. It downloads a copy and sets up the server path.

cvs-d:ext:user@hostname:/absolutePath/to/cvsrootcodirectory
This checks out a copy of the (remote) directory to your (local) working copy. ->Setting upon repository: Set CVS root env variable. $CVS init. -> Importing pojects: $CVS import m logmsg name vorg-state This imports all the files in current folder into this project. -> Checking out a project: $CVS checkout projectname This creates a folder with the project name under current folder. ->Adding new files: $CVS add filename This can be done only when project is checked out. -> Updating the repository with the local copy: $CVS commit m logmsg filename ->Releasing/checking in local copy:

The project can be released after modification using $CVS release projectname. 9; 5.3 Update, Commit Unlike RCS, which uses two separate executablesciandco, CVS is one command that takesciandcoas subcommands within thecvsexecutable, but you should usecvs updateandcvs commitmost of the time. Command Meaning checkout files indirPathunder theremoteCvsRootin the remote user@host's account (encoded as path of remoteCvsRoot) (Side) effect creates some bookkeeping files and CVS directory withyou your local working directory to keep track of the remote path

% cvs -d:ext:user@host/remoteCvsRootcodirPath

% cvs update[file(s) or directory]

update(i.e., copy from repository to your working directory; bring your working directory up to date). mergesyour local files with changes If you don't specify files or from repository. directory, then it updates all of the files in the working directory. commit (i.e., check in the file into the repository and unlocks also, if you locked any of unlock. the files you are committing. If If you don't specify files or you have $Id:$ directory, then it commits tags or other tags, all the changed files in the they get updated, working directory. too. the files are not actually submitted to the repository until you do thecvs commit the files are not actually removed untilcvs commit prevent others from locking enable others to lock

% cvs commit[file(s) or directory]

% cvs addfile(s)

mark files to be added to the repository

% cvs rmfile(s)

mark the files to be removed from the repository lock the file(s) in the repository Unlocks the file(s) in the repository

% cvs lockfile(s) % cvs unlockfile(s)

6. Sample Input and Output :

RCS:

[saranya@saranya ~]$ mkdir rcs [saranya@saranya ~]$ cd rcs [saranya@saranya rcs]$ cat>first.txt hi:) saranya,aishwarya,archana,tina,bhargavi ^Z [2]+ Stopped cat > first.txt [saranya@saranya rcs]$ ci first.txt first.txt,v <-- first.txt enter description, terminated with single '.' or end of file: NOTE: This is NOT the log message! >> this is a sample file... >> . initial revision: 1.1 done [saranya@saranya rcs]$ co -u first.txt first.txt,v --> first.txt revision 1.1 (unlocked) done [saranya@saranya rcs]$ co -l first.txt first.txt,v --> first.txt revision 1.1 (locked) done [saranya@saranya rcs]$ cat>>first.txt hello all good to see u again... ^Z [3]+ Stopped cat >> first.txt [saranya@saranya rcs]$ ci -l first.txt first.txt,v <-- first.txt new revision: 1.2; previous revision: 1.1 enter log message, terminated with single '.' or end of file: >> this is a newer version >> . done [saranya@saranya rcs]$ co -u first.txt first.txt,v --> first.txt revision 1.2 (unlocked) writable first.txt exists; remove it? [ny](n): y done [saranya@saranya rcs]$ ci -l first.txt first.txt,v <-- first.txt ci: first.txt,v: no lock set by saranya [saranya@saranya rcs]$ rlogs first.txt bash: rlogs: command not found... Similar command is: 'rlog'

[saranya@saranya rcs]$ rlog first.txt RCS file: first.txt,v Working file: first.txt head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: this is a sample file... ---------------------------revision 1.2 date: 2011/08/03 05:29:58; author: saranya; state: Exp; lines: +2 -0 this is a newer version ---------------------------revision 1.1 date: 2011/08/03 05:28:42; author: saranya; state: Exp; Initial revision ========================================================================= [saranya@saranya rcs]$

CVS:

[saranya@saranya ~]$ su Password: [root@saranya saranya]# cd try/ [root@saranya try]# cd CVSROOT cd..[root@saranya CVSROOT]# cd .. [root@saranya try]# cd .. [root@saranya saranya]# mkdir ~/cvs [root@saranya saranya]# export CVSROOT=~/cvs [root@saranya saranya]# cvs init [root@saranya saranya]# cd projects/ [root@saranya projects]# cd swoop bash: cd: swoop: Not a directory [root@saranya projects]# cd swoop [root@saranya swoop]# cvs import -m "Woxy starts SWOOP project" swoop Woxy start No conflicts created by this import [root@saranya swoop]# cvs checkout CVSROOT cvs checkout: Updating CVSROOT U CVSROOT/checkoutlist U CVSROOT/commitinfo U CVSROOT/config U CVSROOT/cvswrappers U CVSROOT/editinfo U CVSROOT/loginfo U CVSROOT/modules U CVSROOT/notify U CVSROOT/rcsinfo U CVSROOT/taginfo U CVSROOT/verifymsg

[root@saranya swoop]# cvs checkout swoop cvs checkout: Updating swoop [root@saranya swoop]# cd .. [root@saranya projects]# cvs checkout swoop cvs checkout: Updating swoop cvs checkout: Updating swoop/CVSROOT cvs checkout: Updating swoop/swoop [root@saranya projects]# cvs commit swoop cvs commit: Examining swoop cvs commit: Examining swoop/CVSROOT cvs commit: Examining swoop/swoop [root@saranya projects]# cd .. [root@saranya saranya]# cvs commit swoop cvs commit: cannot open CVS/Entries for reading: No such file or directory cvs commit: nothing known about `swoop' cvs [commit aborted]: correct above errors first! [root@saranya saranya]# cd try [root@saranya try]# cd cvsroot bash: cd: cvsroot: No such file or directory [root@saranya try]# cd CVSROOT [root@saranya CVSROOT]# cvs commit swoop cvs commit: nothing known about `swoop' cvs [commit aborted]: correct above errors first! [root@saranya CVSROOT]# cd .. [root@saranya try]# cd .. [root@saranya saranya]# cd projects [root@saranya projects]# cd swoop [root@saranya swoop]# cat jankarman.txt hi haahaa [root@saranya swoop]# cvs commit jankarman.txt cvs commit: nothing known about `jankarman.txt' cvs [commit aborted]: correct above errors first! [root@saranya swoop]# cd .. [root@saranya projects]# cvs commit jankarman.txt cvs commit: cannot open CVS/Entries for reading: No such file or directory cvs commit: nothing known about `jankarman.txt' cvs [commit aborted]: correct above errors first! [root@saranya projects]# cvs commit swoop/jankarman.txt cvs commit: nothing known about `swoop/jankarman.txt' cvs [commit aborted]: correct above errors first! [root@saranya projects]# cvs update swoop cvs update: Updating swoop ? swoop/jankarman.txt cvs update: Updating swoop/CVSROOT cvs update: Updating swoop/swoop [root@saranya projects]# cat >> swoop/jankarman.txt

bye c you ^Z [1]+ Stopped cat >> swoop/jankarman.txt [root@saranya projects]# cvs update swoop cvs update: Updating swoop ? swoop/jankarman.txt cvs update: Updating swoop/CVSROOT cvs update: Updating swoop/swoop [root@saranya projects]# cvs commit swoop cvs commit: Examining swoop cvs commit: Examining swoop/CVSROOT cvs commit: Examining swoop/swoop [root@saranya projects]# cd swoop [root@saranya swoop]# cvs diff jankarman.txt cvs diff: I know nothing about jankarman.txt [root@saranya swoop]# cvs commit jankarman.txt cvs commit: nothing known about `jankarman.txt' cvs [commit aborted]: correct above errors first! [root@saranya swoop]# cvs update jankarman.txt cvs update: use `cvs add' to create an entry for jankarman.txt [root@saranya swoop]# cvs add jankarman.txt cvs add: scheduling file `jankarman.txt' for addition cvs add: use 'cvs commit' to add this file permanently [root@saranya swoop]# cvs commit cvs commit: Examining . cvs commit: Examining CVSROOT cvs commit: Examining swoop RCS file: /root/cvs/swoop/jankarman.txt,v done Checking in jankarman.txt; /root/cvs/swoop/jankarman.txt,v <-- jankarman.txt initial revision: 1.1 done [root@saranya swoop]# cvs diff jankarman.txt [root@saranya swoop]# cat >> jankarman.txt archana and svn ^Z [2]+ Stopped cat >> jankarman.txt [root@saranya swoop]# cvs commit cvs commit: Examining . cvs commit: Examining CVSROOT cvs commit: Examining swoop Checking in jankarman.txt; /root/cvs/swoop/jankarman.txt,v <-- jankarman.txt new revision: 1.2; previous revision: 1.1 done [root@saranya swoop]# cvs update cvs update: Updating . cvs update: Updating CVSROOT cvs update: Updating swoop U swoop/jankarman.txt [root@saranya swoop]# cvs diff cvs diff: Diffing .

cvs diff: Diffing CVSROOT cvs diff: Diffing swoop [root@saranya swoop]# cvs diff jankarman.txt [root@saranya swoop]# cvs add jankarman.txt cvs add: jankarman.txt already exists, with version number 1.2 [root@saranya swoop]# cvs add trial.txt cvs add: nothing known about trial.txt [root@saranya swoop]# cvs add trial.txt cvs add: scheduling file `trial.txt' for addition cvs add: use 'cvs commit' to add this file permanently [root@saranya swoop]# cvs commit cvs commit: Examining . cvs commit: Examining CVSROOT cvs commit: Examining swoop RCS file: /root/cvs/swoop/trial.txt,v done Checking in trial.txt; /root/cvs/swoop/trial.txt,v <-- trial.txt initial revision: 1.1 done [root@saranya swoop]# cvs remove trial.txt cvs remove: file `trial.txt' still in working directory cvs remove: 1 file exists; remove it first [root@saranya swoop]# cvs remove trial.txt cvs remove: file `trial.txt' still in working directory cvs remove: 1 file exists; remove it first [root@saranya swoop]# cvs history O 2011-07-22 02:17 +0000 saranya CVSROOT =CVSROOT= /home/saranya/projects/swoop/* O 2011-07-22 02:20 +0000 saranya swoop =swoop= /home/saranya/projects/* [root@saranya swoop]# cvs log cvs log: Logging . RCS file: /root/cvs/swoop/jankarman.txt,v Working file: jankarman.txt head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------revision 1.2 date: 2011/07/22 02:29:15; author: saranya; state: Exp; lines: +1 -0 nother line added ---------------------------revision 1.1 date: 2011/07/22 02:28:19; author: saranya; state: Exp; we are trying to commit the file : ---------------------------------------------------------------------============================================================================= RCS file: /root/cvs/swoop/trial.txt,v Working file: trial.txt head: 1.1 branch:

locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:31:39; author: saranya; state: Exp; new file :wq ============================================================================= cvs log: Logging CVSROOT RCS file: /root/cvs/CVSROOT/checkoutlist,v Working file: CVSROOT/checkoutlist head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/commitinfo,v Working file: CVSROOT/commitinfo head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ========================================================================== RCS file: /root/cvs/CVSROOT/config,v Working file: CVSROOT/config head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ----------------------------

revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ========================================================================== RCS file: /root/cvs/CVSROOT/cvswrappers,v Working file: CVSROOT/cvswrappers head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/editinfo,v Working file: CVSROOT/editinfo head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/loginfo,v Working file: CVSROOT/loginfo head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/modules,v Working file: CVSROOT/modules head: 1.1

branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/notify,v Working file: CVSROOT/notify head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/rcsinfo,v Working file: CVSROOT/rcsinfo head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/taginfo,v Working file: CVSROOT/taginfo head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ----------------------------

revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= RCS file: /root/cvs/CVSROOT/verifymsg,v Working file: CVSROOT/verifymsg head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:14:17; author: saranya; state: Exp; initial checkin ============================================================================= cvs log: Logging swoop RCS file: /root/cvs/swoop/jankarman.txt,v Working file: swoop/jankarman.txt head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------revision 1.2 date: 2011/07/22 02:29:15; author: saranya; state: Exp; lines: +1 -0 nother line added ---------------------------revision 1.1 date: 2011/07/22 02:28:19; author: saranya; state: Exp; we are trying to commit the file : ---------------------------------------------------------------------============================================================================= RCS file: /root/cvs/swoop/trial.txt,v Working file: swoop/trial.txt head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------revision 1.1 date: 2011/07/22 02:31:39; author: saranya; state: Exp; new file wq

[root@saranya swoop]# checkout -r1.1 jankarman.txt bash: checkout: command not found... [root@saranya swoop]# cvs checkout -r1.1 jankarman.txt cvs checkout: cannot find module `jankarman.txt' - ignored [root@saranya swoop]# cvs co -r1.1 jankarman.txt cvs checkout: cannot find module `jankarman.txt' - ignored [root@saranya swoop]# cvs diff -u jankarman.txt [root@saranya swoop]# cat jankarman.txt hi haahaa one more line bye c you archana and svn [root@saranya swoop]# cat>>jankarman.txt last ^Z [3]+ Stopped cat >> jankarman.txt [root@saranya swoop]# cat jankarman.txt hi haahaa one more line bye c you archana and svn last [root@saranya swoop]# cvs commit cvs commit: Examining . cvs commit: Examining CVSROOT cvs commit: Examining swoop Checking in jankarman.txt; /root/cvs/swoop/jankarman.txt,v <-- jankarman.txt new revision: 1.3; previous revision: 1.2 done [root@saranya swoop]# cvs update -r 1.1 jankarman.txt U jankarman.txt [root@saranya swoop]# cat jankarman.txt hi haahaa one more line bye c you [root@saranya swoop]# cvs update -r 1.2 jankarman.txt U jankarman.txt [root@saranya swoop]# cat jankarman.txt hi haahaa one more line bye c you archana and svn [root@saranya swoop]#

SVN:

[saranya@saranya ~]$ svnadmin create svn.reponame [saranya@saranya ~]$ svn import ./svn file:///home/saranya/svn.reponame -m "initial import" Adding svn/sample.txt Adding svn/svn.reponame Adding svn/svn.reponame/hooks Adding svn/svn.reponame/hooks/pre-revprop-change.tmpl Adding svn/svn.reponame/hooks/post-commit.tmpl Adding svn/svn.reponame/hooks/post-lock.tmpl Adding svn/svn.reponame/hooks/pre-lock.tmpl Adding svn/svn.reponame/hooks/pre-commit.tmpl Adding svn/svn.reponame/hooks/post-unlock.tmpl Adding svn/svn.reponame/hooks/pre-unlock.tmpl Adding svn/svn.reponame/hooks/post-revprop-change.tmpl Adding svn/svn.reponame/hooks/start-commit.tmpl Adding svn/svn.reponame/db Adding svn/svn.reponame/db/txn-current-lock Adding svn/svn.reponame/db/revs Adding svn/svn.reponame/db/write-lock Adding svn/svn.reponame/db/revprops Adding svn/svn.reponame/db/current Adding svn/svn.reponame/db/fsfs.conf Adding svn/svn.reponame/db/min-unpacked-rev Adding svn/svn.reponame/db/uuid Adding svn/svn.reponame/db/fs-type Adding svn/svn.reponame/db/transactions Adding svn/svn.reponame/db/format Adding svn/svn.reponame/db/txn-current Adding svn/svn.reponame/db/txn-protorevs Adding svn/svn.reponame/conf Adding svn/svn.reponame/conf/svnserve.conf Adding svn/svn.reponame/conf/passwd Adding svn/svn.reponame/conf/authz Adding svn/svn.reponame/format Adding svn/svn.reponame/locks Adding svn/svn.reponame/locks/db.lock Adding svn/svn.reponame/locks/db-logs.lock Adding svn/svn.reponame/README.txt Committed revision 1. [saranya@saranya ~]$ svn mkdir file:///home/saranya/svn.reponame/dir1 -m "Created sample directory" Committed revision 2. [saranya@saranya ~]$ svn ls file:///home/saranya/svn.reponame dir1/ sample.txt svn.reponame/ [saranya@saranya ~]$ svn rm file:///home/saranya/svn.reponame/dir1 -m "Remove dumb directory" Committed revision 3. [saranya@saranya ~]$ svn ls file:///home/saranya/svn.reponame sample.txt svn.reponame/ [saranya@saranya ~]$ svn log file:///home/saranya/svn.reponame

-----------------------------------------------------------------------r3 | saranya | 2011-08-03 11:16:15 +0530 (Wed, 03 Aug 2011) | 1 line Remove dumb directory -----------------------------------------------------------------------r2 | saranya | 2011-08-03 11:15:28 +0530 (Wed, 03 Aug 2011) | 1 line Created sample directory -----------------------------------------------------------------------r1 | saranya | 2011-08-03 11:14:54 +0530 (Wed, 03 Aug 2011) | 1 line initial import -----------------------------------------------------------------------[saranya@saranya path]$ cd project [saranya@saranya project]$ tree -a . 0 directories, 0 files [saranya@saranya project]$ cat>sample.cpp hello :) ^Z [5]+ Stopped cat > sample.cpp [saranya@saranya project]$ cat>index.html ^Z [6]+ Stopped cat > index.html [saranya@saranya project]$ tree -a . --------docs ---------sample.cpp --------index.html 1 directory, 2 files [saranya@saranya project]$ svn import file:///home/saranya/svn.reponame/project/trunk -m "Adding the project files" Adding docs Adding docs/sample.cpp Adding index.html Committed revision 4. [saranya@saranya project]$ svn checkout file:///home/saranya/svn.reponame/projectA project/trunk A project/trunk/docs A project/trunk/docs/sample.cpp A project/trunk/index.html Checked out revision 4. [saranya@saranya project]$ cd project [saranya@saranya project]$ ls -a . .. .svn trunk [saranya@saranya project]$ svn info Path: . URL: file:///home/saranya/svn.reponame/project Repository Root: file:///home/saranya/svn.reponame Repository UUID: 4200a71a-1a74-46ac-b24f-61fbc1174a78 Revision: 4 Node Kind: directory Schedule: normal Last Changed Author: saranya Last Changed Rev: 4 Last Changed Date: 2011-08-03 11:20:39 +0530 (Wed, 03 Aug 2011) [saranya@saranya project]$ ls trunk

[saranya@saranya project]$ cd trunk [saranya@saranya trunk]$ cd .. [saranya@saranya project]$ ls trunk [saranya@saranya project]$ cd trunk [saranya@saranya trunk]$ svn checkout -r 3 file:///home/saranya/svn project svn: Unable to open an ra_local session to URL svn: Unable to open repository 'file:///home/saranya/svn' [saranya@saranya trunk]$ svn checkout -r 3 file:///home/saranya/svn.reponame project A project/sample.txt A project/svn.reponame A project/svn.reponame/hooks A project/svn.reponame/hooks/pre-revprop-change.tmpl A project/svn.reponame/hooks/post-commit.tmpl A project/svn.reponame/hooks/post-lock.tmpl A project/svn.reponame/hooks/pre-commit.tmpl A project/svn.reponame/hooks/pre-lock.tmpl A project/svn.reponame/hooks/post-unlock.tmpl A project/svn.reponame/hooks/pre-unlock.tmpl A project/svn.reponame/hooks/post-revprop-change.tmpl A project/svn.reponame/hooks/start-commit.tmpl A project/svn.reponame/conf A project/svn.reponame/conf/svnserve.conf A project/svn.reponame/conf/passwd A project/svn.reponame/conf/authz A project/svn.reponame/db A project/svn.reponame/db/revs A project/svn.reponame/db/revs/0 A project/svn.reponame/db/revs/0/0 A project/svn.reponame/db/txn-current-lock A project/svn.reponame/db/revprops A project/svn.reponame/db/revprops/0 A project/svn.reponame/db/revprops/0/0 A project/svn.reponame/db/write-lock A project/svn.reponame/db/current A project/svn.reponame/db/fsfs.conf A project/svn.reponame/db/min-unpacked-rev A project/svn.reponame/db/uuid A project/svn.reponame/db/fs-type A project/svn.reponame/db/format A project/svn.reponame/db/transactions A project/svn.reponame/db/txn-current A project/svn.reponame/db/txn-protorevs A project/svn.reponame/format A project/svn.reponame/README.txt A project/svn.reponame/locks A project/svn.reponame/locks/db.lock A project/svn.reponame/locks/db-logs.lock Checked out revision 3. [saranya@saranya trunk]$ cd project/ [saranya@saranya project]$ ls sample.txt svn.reponame

[saranya@saranya project]$ mkdir trunk [saranya@saranya project]$ cd trunk [saranya@saranya trunk]$ svn checkout -r 3 file:///home/saranya/svn.reponame project A project/sample.txt A project/svn.reponame A project/svn.reponame/hooks A project/svn.reponame/hooks/pre-revprop-change.tmpl A project/svn.reponame/hooks/post-commit.tmpl A project/svn.reponame/hooks/post-lock.tmpl A project/svn.reponame/hooks/pre-commit.tmpl A project/svn.reponame/hooks/pre-lock.tmpl A project/svn.reponame/hooks/post-unlock.tmpl A project/svn.reponame/hooks/pre-unlock.tmpl A project/svn.reponame/hooks/post-revprop-change.tmpl A project/svn.reponame/hooks/start-commit.tmpl A project/svn.reponame/conf A project/svn.reponame/conf/svnserve.conf A project/svn.reponame/conf/passwd A project/svn.reponame/conf/authz A project/svn.reponame/db A project/svn.reponame/db/revs A project/svn.reponame/db/txn-current-lock A project/svn.reponame/db/revprops A project/svn.reponame/db/write-lock A project/svn.reponame/db/current A project/svn.reponame/db/fsfs.conf A project/svn.reponame/db/min-unpacked-rev A project/svn.reponame/db/uuid A project/svn.reponame/db/fs-type A project/svn.reponame/db/format A project/svn.reponame/db/transactions A project/svn.reponame/db/txn-current A project/svn.reponame/db/txn-protorevs A project/svn.reponame/format A project/svn.reponame/README.txt A project/svn.reponame/locks A project/svn.reponame/locks/db.lock A project/svn.reponame/locks/db-logs.lock Checked out revision 3. [saranya@saranya trunk]$ cd project/ [saranya@saranya project]$ svn checkout file:///home/saranya/svn.reponame/projectA project/trunk A project/trunk/docs A project/trunk/docs/sample.cpp A project/trunk/index.html Checked out revision 4. [saranya@saranya project]$ cd project [saranya@saranya project]$ ls -a . .. .svn trunk

[saranya@saranya project]$ svn info Path: . URL: file:///home/saranya/svn.reponame/project Repository Root: file:///home/saranya/svn.reponame Repository UUID: 4200a71a-1a74-46ac-b24f-61fbc1174a78 Revision: 4 Node Kind: directory Schedule: normal Last Changed Author: saranya Last Changed Rev: 4 Last Changed Date: 2011-08-03 11:20:39 +0530 (Wed, 03 Aug 2011) [saranya@saranya project]$ ls trunk [saranya@saranya project]$ cd trunk [saranya@saranya trunk]$ mkdir project [saranya@saranya trunk]$ cd project [saranya@saranya project]$ ls [saranya@saranya project]$ cd .. [saranya@saranya trunk]$ cd .. [saranya@saranya project]$ ls trunk [saranya@saranya project]$ cd trunk [saranya@saranya trunk]$ svn checkout -r 3 file:///home/saranya/svn.reponame project A project/sample.txt A project/svn.reponame A project/svn.reponame/hooks A project/svn.reponame/hooks/pre-revprop-change.tmpl A project/svn.reponame/hooks/post-commit.tmpl A project/svn.reponame/hooks/post-lock.tmpl A project/svn.reponame/hooks/pre-commit.tmpl A project/svn.reponame/hooks/pre-lock.tmpl A project/svn.reponame/hooks/post-unlock.tmpl A project/svn.reponame/hooks/pre-unlock.tmpl A project/svn.reponame/hooks/post-revprop-change.tmpl A project/svn.reponame/hooks/start-commit.tmpl A project/svn.reponame/conf A project/svn.reponame/conf/svnserve.conf A project/svn.reponame/conf/passwd A project/svn.reponame/conf/authz A project/svn.reponame/db A project/svn.reponame/db/revs A project/svn.reponame/db/txn-current-lock A project/svn.reponame/db/revprops A project/svn.reponame/db/write-lock A project/svn.reponame/db/current A project/svn.reponame/db/fsfs.conf A project/svn.reponame/db/min-unpacked-rev A project/svn.reponame/db/uuid A project/svn.reponame/db/fs-type A project/svn.reponame/db/format A project/svn.reponame/db/transactions A project/svn.reponame/db/txn-current A project/svn.reponame/db/txn-protorevs

A project/svn.reponame/format A project/svn.reponame/README.txt A project/svn.reponame/locks A project/svn.reponame/locks/db.lock A project/svn.reponame/locks/db-logs.lock Checked out revision 3. [saranya@saranya trunk]$ svn checkout -r 2 file:///home/saranya/svn.reponame project A project/dir1 Checked out revision 2. [saranya@saranya trunk]$ svn checkout -r 4 file:///home/saranya/svn.reponame project D project/dir1 A project/project A project/project/trunk A project/project/trunk/docs A project/project/trunk/docs/sample.cpp A project/project/trunk/index.html Checked out revision 4. [saranya@saranya trunk]$ svn checkout -r 1 file:///home/saranya/svn.reponame project D project/project Checked out revision 1. [saranya@saranya trunk]$ cd project/ [saranya@saranya project]$ ls project sample.txt svn.reponame [saranya@saranya project]$ cd project/ [saranya@saranya project]$ svn info trunk/docs/sample.cpp Path: trunk/docs/sample.cpp Name: sample.cpp URL: file:///home/saranya/svn.reponame/project/trunk/docs/sample.cpp Repository Root: file:///home/saranya/svn.reponame Repository UUID: 4200a71a-1a74-46ac-b24f-61fbc1174a78 Revision: 4 Node Kind: file Schedule: normal Last Changed Author: saranya Last Changed Rev: 4 Last Changed Date: 2011-08-03 11:20:39 +0530 (Wed, 03 Aug 2011) Text Last Updated: 2011-08-03 11:24:14 +0530 (Wed, 03 Aug 2011) Checksum: 57ac7e89ccbecd60190e4befac36c187 [saranya@saranya project]$ svn mkdir tags A tags [saranya@saranya project]$ svn copy trunk/ tags/before-qt A tags/before-qt [saranya@saranya project]$ svn commit -m "tagged version before before switching" Adding tags Adding tags/before-qt Committed revision 5. [saranya@saranya project]$ Conclusion :

Thus the version control system setup for managing files using rcs,cvs,svn was successfully studied and verified.

You might also like