CSC/ECE 517 Fall 2011/ch1 1f sv

From Expertiza_Wiki
Jump to navigation Jump to search

Comparing version - control systems from the programmer's stand point

Introduction : Version Control Systems

Version Control System (VCS) is a software that allows to manage changes of documents, programs, images and other information that is stored in form of computer files. Changes are usually identified by an incrementing number or letter code also known as revision number or revision.The simplest usage of versioning is to enable developers to easily go back to the previous working version of their files, should they mess up something with the latest changes. The changes made to the files could range from a minor edit as in correcting a typo or to a huge refactoring in a project, comprising of hundreds of files. Each change usually has name of the person introduced it, time of the change and an optional description message.

We shall look at the different types of Version Control Systems available and a few examples of the same, discussing about their features and limitations from a programmer's stand point.

Terminology

  • Repository: A repository is where the current and historical data of the files under a project are stored, often on a server. It is sometimes also called a depot in VCS like PreForce.
  • Branch: A set of files under version control may be branched or forked at a point in time so that, from that time forward, two copies of those files may develop at different speeds or in different ways independently of each other.
  • Trunk: The unique line of development that is not a branch. This is sometimes also known as the mainline.
  • Tag: A tag or label refers to an important snapshot in time, consistent across many files. These files at that point may all be tagged with a user-friendly, meaningful name or revision number.
  • Working copy: The working copy is the local copy of files from a repository, at a specific time or revision. All work done to the files in a repository is initially done on a working copy, hence the name. Conceptually, it is a sandbox.
  • Check-out: A check-out (or co) is the act of creating a local working copy from the repository. A user may specify a specific revision or obtain the latest. The term 'checkout' can also be used as a noun to describe the working copy.
  • Commit: A commit (check-in) is the action of writing or merging the changes made in the working copy back to the repository.
  • Merge: A merge or integration is an operation in which two sets of changes are applied to a file or set of files.
  • Promote: The act of copying file content from a less controlled location into a more controlled location.

Types of Version Control Systems

We shall compare the different VCS based on the below features grouped as follows:

General Properties
  • The repository model: describes relationship between the various copies of the source code repository.
  • The concurrency model:describes how can simultaneous edits to the working copy can be done without stepping on ther users feet.
  • Platform: specifies the operating system that the software supports.
Technical Properties
  • Scope of change: describes if changes are recorded on a file basis or a directory basis.
  • Version IDs: describes if version number is based on hashed content of the file, or sequential numbering of files etc.
Features
  • Atomic commits: ensures either all the changes are committed or none are.
  • File renames: describes if the software allows files to be renamed while retaining their version history.
  • Merge file renames:describes if the software can merge changes made to a file on one branch into the same file that has been renamed on another branch.
  • Symbolic links: describes if the software allows version control of symbolic links as with regular files.
  • Merge tracking: describes if the software tracks the changes which have been merged between respeictive branches and only merges the changes that are missing when merging one branch into another.

The version control systems can be classified into three categories:

1. Local version Control

In the local-only approach, all developers must use the same computer system. These software often manage single files individually and are largely replaced or embedded within newer software.

Examples of this approach are:

Revision Control System

Revision Control System (RCS) stores the latest version and backward deltas for fastest access to the trunk tip compared to SCCS and an improved user interface, at the cost of slow branch tip access and missing support for included/excluded deltas.

Features of RCS
  • Mulitple copies of the same file are maintained.
  • RCS stores deltas.

Limitations of RCS
  • It is error-prone.

Source Code Control System

Source Code Control System (SCCS) is a part of UNIX and is based on interleaved deltas, and can construct versions as arbitrary sets of revisions. Extracting an arbitrary version takes essentially the same speed and is thus more useful in environments that rely heavily on branching and merging with multiple "current" and identical versions.

Features of SCCS
a.

2. Client - Server Model (Centralized Version Control)

In the client-server model, developers use a shared single repository.

Open Source

Concurrent Versions System

Concurrent Versions System (CVS) was originally built on RCS and licensed under the GPL.It uses a client–server architecture in which clients connect to the server where the current versions of a project and its history is stored and "check out" a complete copy of the project, work on this copy and then later "check in" their changes. The client and server can connect over a LAN or over the Internet, or client and server may both run on the same machine if track of the version history of a project with only local developers is required.

Features of CVS
  • Several developers can work concurrently on the same project, each one "checking out" files of the project within their "working copy", and "checking in" their changes to the server.
  • The problem of users stepping on others feet is avoided as the server allows users to "check-in" to the most recent version of the file.
  • Developers are therefore expected to keep their working copy up-to-date by incorporating other people's changes on a regular basis.
  • A successful check - in operation, increments the version numbers of all files involved automatically, and the CVS-server writes a user-supplied description line, the date and the author's name to its log files.

Clients can also compare versions, request a complete history of changes, or check out a historical snapshot of the project as of a given date or as of a revision number.

CVS labels a single project (set of related files) which it manages as a module. A CVS server stores the modules it manages in its repository. Programmers acquire copies of modules by checking out. The checked-out files serve as a working copy, sandbox or workspace. Changes to the working copy will be reflected in the repository by committing them. To update is to acquire or merge the changes in the repository with the working copy.

Limitations of CVS
  • Revisions created by a commit are per file, rather than spanning the collection of files that make up the project or spanning the entire repository.
  • CVS does not version the moving or renaming of files and directories.
  • Versioning of symbolic links is not enabled.
  • Limited support for Unicode and non-ASCII filenames.
  • Commits are not atomic.
  • Branch operations are expensive.

Subversion

Subversion (svn) is an open-source, Apache License versioning control system inspired by CVS and is available on the major operating systems.

Repository types and Branching

SVN offers two types of repository storage :

  • FSFS and
  • Berkeley DB.

SVN employs the inter-file branching model of trunks, branches and tags to handle versioning.

A new branch is created by using the 'svn copy' command. This creates old and new version copies which are linked together internally and history is perserved for both. The copied versions take up only a small amount of space as only the differences from the original versions are saved in the repository. All the versions in each branch, maintain the history of the file up to the point of the copy, plus any changes made since. One can "merge" changes back into the trunk or between branches.

General Properties of SVN
  • SVN uses a client - server (centralized) repository model.
  • SVN uses a merge/lock concurrency model.
Technical Properties of SVN
Features of SVN

SVN provides developers with the following advantages when compared to legacy CVS:

  • All commits are atomic operations.
  • Full revision history is maintained for files renamed/copied/moved/removed.
  • Versioning is maintained for directories, renames, and file metadata which enables developers to move and/or copy entire directory-trees while retaining the entire revision history.
  • Versioning of symbolic links.
  • Branching as a cheap operation, independent of file size.
  • Files which cannot be merged, are locked by developers which is known as "Reserved checkouts".
Limitations of SVN
  • It does not have repository administration and management features.
  • It does not store the timestamps of modifications.
  • It stores additional copies of data on the local machine which can cause space issues for large projects.
  • It does not provide support for merge of file renames.

3. Distributed Version Control

In this model of version control, clients do not check out individual files, but mirror the entire repository. Each developer works directly on their own local repository, and the changes are shared among the repositories in a separate step.

GIT

GIT is a distributed version control system where the emphasis is laid on speed. In this, the working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. It comes with a simple design and offers strong support for non-linear development. It is fully distributed and can handle large projects like the Linux Kernel efficiently.

GIT differs from the other types of version control systems in the way it thinks about its data. It thinks of its data more like a set of snapshots of mini file system rather than a list of file-based changes.

The Three States

GIT has three states in which a file can reside : Committed, Modified and Staged.

  • Committed: Data is stored safely in the database.
  • Modified: The file has been changed but not yet merged to the database.
  • Staged: A modified file has been marked in its current version to go into the next commit snapshot.
Workflow of GIT
  • Developer modifies files in the working directory.
  • The files are staged, snapshots of which are added to the staging area.
  • The changes are committed, which takes the files from the staging area and the snaphots are stored permanently in the GIT directory.
General Properties of GIT
  • GIT employs a distributed repository model.
  • GIT uses a merge concurrency model.
  • GIT is primarily developed for Linux based systems, but runs also on UNIX - like operating systems, POSIX based systems and Windows.
Technical Properties of GIT
  • Version IDs are checksummed with SHA - 1 hash which is a 40 character string based on the content of the file.
  • GIT knows everything by hash and not by file name.
Features of GIT
  • All commits are atomic operations.
  • GIT provides partial support for file renames. It does not explicitly track file renames as it does not track individual files.
  • GIT provides support for merge file renames.
  • Versioning of symbolic links is enabled.
  • Everytime a commit is performed, GIT takes a snapshot of the files.
  • Files that have not been modified are not copied.
  • All operations like browse history and commit are local.