ICS 121: Version control
Overview
- What is version control?
- Why use vesion control?
- Version control concepts
- Popular version control tools
What is Version Control?
- Version control server-side:
- A server with a repository of all versions of all source files and technical documents
- A log of all changes: who, what, when, and why
- Storage for multiple branches of development
- Access controls: limited access, read-only, read-write, etc.
- Version control client-side:
- A client that developers use to access the repository
- Common operations: check out, add, remove, edit, commit,
update, diff, tag, branch, merge
- Also called: "configuration management", "CM", "SCM", "VC"
- Sometimes people include issue tracking and build systems in the term SCM
- Thinking more generally, CM for products may include both hardware and software assets
- Facilities 1
- Facilities 2
Why use Version Control?
- Software development is a process of constant change to a valuable asset
- Not all changes are good, sometimes you want to go back
- You need to see why changes were made, and who made them
- You will want to apply the same changes to multiple branches of development
- Keeps all software assets on a secure server
- No lost laptop can cost the company months of work
- Controlled set of users with permission to access the files
- History allows review of changes and rollback to previous version
- Helps integrate the changes made by many developers
- Supports multiple branches of development
- Experimental changes on private branches
- Parallel work between groups with periodic integration
- Concurrent releases: low-risk maintenance and higher-risk new development
- Tracks the changes that have been put into a release
- Know with certainty that the code released is the same code that was tested
Version Control Concepts
- Server keeps history of changes on every file
- Each version of a file is numbered (e.g., 1.1, 1.2., 1.3) and can be tagged with a name (e.g., v1_0_0RC1)
- The "HEAD" version of a file is the latest version on the main branch of development, it is checked out by default
- A branch of development is a sequence of versions that is parallel to other versions in other branches
- A "diff" is the set of source code lines that changed between one version and another. A.k.a, changes, change-set, or patch.
- The commit log contains developer comments that explain each change
- Developers use a client to check out a working copy, make changes, commit the changes
- A "working copy" is a copy of the source code on the developer's harddisk
- A "check out" is downloading files from server to create a new working copy
- An "update" is downloading recent changes from server to an existing working copy
- A "check in" / "commit" is uploading files from a working copy to the server, with a commit log comment
- A developer makes several related changes, tests them, then commits them together
- Conflicts may occur when two developers edit the same file at the same time
- Locking: one developer locks a file on the server, no one else can change it until it is unlocked
- Merging: multiple developers can make changes at the same time, conflicts are detected and resolved as needed
- Some changes can be automatically merged before the commit
- Other changes require one of the developers to manually resolve the conflict
- It is never the case that changes overwrite each other without any developer noticing
Popular Version Control Tools
- CVS (Concurrent Versions System):
- Open source tool
- Developed over 10 years ago, based on earlier RCS system
- Used by almost all open source projects
- Easy to start with, but many complex options to learn
- Some major disadvantages: e.g., directories are not versioned, some limits on scalability
- Integrated with many IDEs
- Rational ClearCase:
- Working copy appears as virtual drive
- Integrated with many IDEs
- Integrated with ClearQuest issue tracking tool
- MS Visual SourceSafe:
- Roughly the same architecture as CVS, with the same problems
- Integrated with MS development tools
- Subversion:
- Open source tool
- New development at http://subversion.tigris.org/, will reach 1.0.0 in 2004
- Easy to start with, but many complex options to learn
- Web-based: uses HTTP or HTTPS protocols
- Designed to avoid the limitations of CVS
example use case templatesample test plan templateProject plan template