Centralized Version Control
rcs kept its repository of history information in the “live” working directories.
Each directory of a project had a separate repository.
Sharing among team members relied on the rather limited Unix protection scheme.
Centralized version control systems keep a project repository in a location separate from the programmer’s work area.
Allows one repository to track a project’s entire directory tree
Encourages/requires use of a network-based sharing scheme
Based on rcs
Uses a centralized store
Check-in and check-out are similar to rcs
No locks, however
By default, scope of commands is an entire directory tree
cvs checkout projectRootDir
makes a copy of projectRootDir in the working directory, checking out the most recent version of everything in the project.
Similarly,
cd projectRootDir
cvs commit -m "Added unit tests"
checks in any changes from the working directory on down.
Where’s the Repository?
The earlier commands presume that we have, somehow, already established a connection with the repository.
Local CVS Repositories
If the repository is on a local file file system,
-d
:cvs -d /usr/local/cvsroot checkout myProject/projectRootDir
or record this info in an environment variable:
setenv CVSROOT /usr/local/cvsroot
cvs checkout myProject/projectRootDir
Remote Repositories
The same techniques (-d, CVSROOT) can be used to specify remote repositories.
`[:method:][[user][:password]@]hostname[:[port]]/path/to/repository`
The method
is a network protocol.
pserver
, for this purpose.ssh
was supported and became the more common choice.pserver Example
sirius:~/temp/tmp> setenv CVSROOT :extssh:zeil@cvs.cs.odu.edu:/home/cvs/dlib
sirius:~/temp/tmp> cvs checkout AlgAE
cvs checkout: Updating AlgAE
U AlgAE/.project
U AlgAE/AlgAE_layout.odg
U AlgAE/LICENSE.txt
U AlgAE/README.txt
U AlgAE/build.xml
U AlgAE/buttons.gif
U AlgAE/buttons.odg
U AlgAE/jhbasic.jar
U AlgAE/junit-4.10.jar
cvs checkout: Updating AlgAE/AlgAE_screenshot.png
⋮
sirius:~/temp/tmp> ls -ld AlgAE
drwxrwxr-x 11 zeil faculty 1024 Feb 21 13:39 AlgAE/
The History Commands
checkout: gets an initial copy of what’s on the server
update: checks to see if something newer than a local file copy is on the server, and if so, replaces the local copy by the remote one
commit: sends any local files that are newer than the server copy to the server as new revisions
add: places files that are not currently being tracked by CVS under version control
import: places a directory tree under version control
release: detaches the directory from the CVS server (if no files need to be committed)
Branches
rcs
2: Right-click on the HEAD project and select “Team ⇒ Merge … ”.
3: CVS will compare the checked-in copy of the branch against the files in your local HEAD project.
This is not a commit of the merged changes to the HEAD branch.
4: Having resolved all changes, you now have a local copy of the project, associated with the HEAD branch in CVS, with a merged copy of code from the former HEAD and from the other branch.
Resolving Conflicts
During synchronization, changes are categorized as
These presumably need to be updated
.
These presumably need to be committed
.
These presumably need to be merged
Conflict Editors
Many IDEs provide special side-by-side editors for reviewing and resolving conflicts.
This, for example, is the Eclipse editor
It allows you to view the differences between the two versions and decide whether
You can save the merged file and then “Mark as Merged”, which moves it from the “Conflicts” status to “Outgoing”
Or you can “Override and Update”, which indicates that you are abandoning your local changes and changing the file’s status to “Incoming”
Subversion
Subversion (a.k.a. svn) is a later version control system based on the same centralized model as CVS.
For the most part, working with it is not all that different from CVS.
It rose to popularity in the open source community in part because of some useful tools for making read-only versions available on the web.
Differences between CVS and Subversion w.r.t. history:
Subversion uses simpler revision numbers
Subversion tracks file and directory creation, deletion, renaming
Subversion does not implement a distinct mechanism for branching.
Subversion does not implement a distinct mechanism for branching.
Each revision (and each checked-out local copy) “knows” its parent revision number.
Subversion does not implement a distinct mechanism for branching.
Each revision (and each checked-out local copy) “knows” its parent revision number.
Revisions can be checked out into distinct local directories from where their parents were located.
Subversion does not implement a distinct mechanism for branching.
Each revision (and each checked-out local copy) “knows” its parent revision number.
Revisions can be checked out into distinct local directories from where their parents were located.
Remember – Subversion tracks moving/renaming of files
… but it Does Branches Anyway
“Branches” are kept in a separate directory from the trunk.
“Merging” is a general operation between revisions
Is This an Improvement?
I can’t decide if Subversion’s approach to branches is inspired or lazy.
The two are not, of course, mutually exclusive.
Is This an Improvement?
I can’t decide if Subversion’s approach to branches is inspired or lazy.
The two are not, of course, mutually exclusive.
Branching and merging is CVS is just complicated enough that it’s easy to mess up.
Is This an Improvement?
I can’t decide if Subversion’s approach to branches is inspired or lazy.
The two are not, of course, mutually exclusive.
Branching and merging is CVS is just complicated enough that it’s easy to mess up.
Is This an Improvement?
I can’t decide if Subversion’s approach to branches is inspired or lazy.
The two are not, of course, mutually exclusive.
Branching and merging is CVS is just complicated enough that it’s easy to mess up.
In svn, you typically check out the trunk or a branch – not the whole repository.
No real differences between CVS and SVN