Gives a project-wide undo button; nothing is final, mistakes are easily rolled back.
Allows multiple developers to work on the same code base in a controlled manner.
Keeps a record of the changes made over time.
Supports multiple releases at the same time as you continue with the main line of development. No more code breeze just before release.
A project-wide time machine. Essential for regenerating prior releases for customer with problems.
The developers are hard code CVS users, and are aware of its shortcomings
Versioning for files, directories and metadata (properties)
Excellent networking support (svn, ssh, web)
Cheap branching, tagging and merging
True cross-platform support
Open source and free :-)
What is Version Control?
A place to store all of the various revisions of the stuff you write while developing an application.
It all goes to the repository, a central place that holds the master copy of all versions of your project’s files.
Should be safe, secure, reliable, gets backed up regularly.
Now they are networked, but you can do online/offline operations.
Some are decentralized (BitKeeper, SVK, etc).
What Should We Store?
Build scripts, scripts to create a release
Test data used by QA
Project settings (when everybody’s using the same IDE)
Project documentation (internal and external)
Significant e-mails, minutes of meetings, info from the Web
Basically anything that contributes to the project
Working copy: local copy of all the things that we need from the repo to work on our part of the project.
Check out: extract to working copy. Ensures that you get up-to-date copies of the files you request and that these files are copied into a directory structure that mirrors that of the repository.
Commit: save changes back to repo.
Update: receive the latest set of file from the repo.
How Things are Organized
At the lowest level, Subversion deals with individual files
Projects > Modules > Files
Organized into directories
Complex code sharing: externals (include another Subversion repo location in any directory in your project).
Where Do Versions Come In?
Subversion stores every version of each of the files in its care
Subversion uses repo-wide numbering scheme (as opposed to file-specific numbering), starting from 0.
Retrieve a specific revision of a file
Check out everything exactly as it appeared n months ago
Tell you what changed in a particular file between revisions
People are not good at numbers.
Assign names to a group of files (or directories or an entire project) at a particular point in time.
A great way of keeping track of significant events in the life of your project’s code.
Trunk: main line of development
Consider the time when a new release is about to be shipped. One small sub team of developers may be preparing the software for that release, fixing last-minute bugs, working with the release engineers, and helping the SQ team. During this vital period, they need stability; it would set back their efforts if other developers were also editing the code, adding features intended for the next release.
Freeze new development? The rest of the team is effectively sitting idle.
Copy the source software out onto a spare machine and then have the release team just use this machine? What happens to the changes they make after the copy? How do we keep track of them? If they find and fix bugs that are also in the trunk, how to efficiently and reliably merge these fixes back in? And once they release the software, how do we fix bugs that customers report; how can we guarantee to find the source code in the same state as when we shipped the release?
Multiple parallel futures
The release team check in/out from the branch
Like having a totally separate repository
Each branch has its own history and track changes
Branches are stores as named directories, created simply by copying the trunk to a new location, using lazy copy
Avoid excessive branching!
When you fix a bug in the release branch and realize that the same bug will be present in the trunk code, you can tell Subversion to work out the changes you made on the release branch to fix the bug and then apply those changes to the code in the trunk. You can even merge them into different release branches.
Subversion uses optimistic locking (as opposed to strict locking).
Repo will not allow you to check in a file that has been updated in the repository since you last checked it out. Instead, it asks you to update your local copy of the file to include the latest repository changes before checking in. VCS will attempt to merge the repo changes with your changes.
Using a simple file property you can ask Subversion to enforce strict locking on individual files, such as sound, graphics, or other unmergeable files.