# Version Control

This text looks at different forms of version control.
* GNU Diff Utils
* Subversion (http://subversion.tigris.org/)
* git (http://git-scm.com/)
* Bazaar (http://bazaar-vcs.org/)
* SourceAnywhere (http://www.dynamsoft.com/Products/version-control-source-control-sourceanywhere.aspx/)
* SCM Anywhere (http://www.scmsoftwareconfigurationmanagement.com/)
* wikis
** MediaWiki (http://www.mediawiki.org/wiki/MediaWiki)
** MoinMoin (http://moinmo.in/MoinMoinWiki)
* browsing publicly available repositories. Add informatiom of how to use ViewVC, Loggerhead, etc.
** apache.org
** tigris.org
** launchpad.net
** SourceForge
** GitHub
** Google Code

# The Basic Tools of Version Control
## What is Version Control?

The following quote from Wikipedia defines version control:
Revision control (also known as version control (system) (VCS), source control or (source) code management (SCM)) is the management of multiple revisions of the same unit of information. It is most commonly used in engineering and software development to manage ongoing development of digital documents like application source code, art resources such as blueprints or electronic models, and other projects that may be worked on by a team of people. Changes to these documents are usually identified by incrementing an associated number or letter code, termed the "revision number", "revision level", or simply "revision" and associated historically with the person making the change. A simple form of revision control, for example, has the initial issue of a drawing assigned the revision number "1". When the first change is made, the revision number is incremented to "2" and so on.
In this text the term Version Control will be used.

### An Example

This section will build up a simple example to illustrate some of the key concepts of version control.
Assume that we're running a restaurant and we want to print a menu. On the first day of business we have the following menu in a file menu.txt.
The next day we add some additional items.
In our file we now only have a record of the last menu we used. If we haven't kept any printed copies of the menu we will have lost the record for Monday 5 January 2009. We could avoid this by keeping each menu in a separate file.
TODO: note on file names.

## Types of Version Control

* Centralized
* Distributed

## Outline of Examples

* Scenario 1: Single User Version Control of a Single File
* Scenario 2: Single User Version Control of Multiple Files
* Scenario 3: Single User Version Control of Multiple Files and Branches
* Scenario 4: Multiple Users Version Control of Multiple Files
* Scenario 5: Multiple Users Version Control of Multiple Files and Branches
* Scenario 6: Multiple Users Using Centralized Version Control
* Scenario 7: Multiple Users Using Distributed Version Control

### Scenario 1: Single User Version Control of a Single File

This scenario will introduce the basic concepts of version control. It is mainly intended for people with no experience of version control. It will cover the concepts of diffs (differences), patches, merging, revisions of an item and some of the subtleties of using version control effectively.
* Example uses a restaurant menu.
* Use GNU Diff Utils initially.
* Keep 7 days of menus.
* Create a patch between each day.
* Apply the patches forwards and backwards.
* Keep latest menu and reverse patches only.
* Compare sizes.
| [Date] Monday 5th January 2009 [Starters] Starter of the day. [Main] Dish of the day. [Desserts] Creme Brulee | [Date] Tuseday 6th January 2009 [Starters] Starter of the day. Chicken Soup [Main] Dish of the day. [Desserts] Ice Cream | [Date] Wednesday 7th January 2009 [Starters] Starter of the day. [Main] Dish of the day. [Desserts] Creme Brulee | [Date] Thursday 8th January 2009 [Starters] Chicken Soup Starter of the day. [Main] Dish of the day. [Desserts] Ice Cream |
| menu-20090105.txt | menu-20090106.txt | menu-20090107.txt | menu-20090108.txt |
| [Date] Friday 9th January 2009 [Starters] Starter of the day. [Main] Dish of the day. Fish and Chips [Desserts] Apple Pie | [Date] Saturday 10th January 2009 [Starters] Starter of the day. Chicken Soup [Main] Dish of the day. | [Date] Sunday 11th January 2009 [Starters] Starter of the day. Prawn Cocktail [Main] Roast Lunch [Desserts] Ice Cream Apple Pie Cheese and Biscuits | |
| menu-20090109.txt | menu-20090110.txt | menu-20090111.txt | |

#### GNU diffutils

The "GNU diffutils" package is a complete set of programs for handling differences between groups of files and merging files. The GNU diffutils package contains the following utilities:
* diff - shows the difference between two files
* cmp compares binary files
* sdiff merges two files interactively
* diff3 shows the differences among three files
* patch applies differences to existing files

#### Using diff (Windows XP)

We will start by looking at the differences between the menu on Monday and the Menu on Tuesday.
The diff shows that there have been three changes, 2c2, 5a6 and 11c12. The summary of a changed is shown in the form <number><alpha><number>.

### Scenario 2: Single User Version Control of Multiple Files
#### White Noise

White noise in version control is where changes are made to files under version control that show up as changes but do not change the "semantics" of the file. White noise is most common when white space is "reorganised" for example when tabs are replaced by spaces. White noise is a problem since it often necessitates having to review diffs on files that haven't really changed.

### Scenario 7: Multiple Users Using Distributed Version Control
# SourceAnywhere

Dynamsoft SourceAnywhere is a SQL Server-based version control software designed to be a replacement/alternative of Microsoft Visual SourceSafe (VSS).
Both standalone and hosted editions are provided: http://www.dynamsoft.com/Products/version-control-source-control-sourceanywhere.aspx

## SourceAnywhere Standalone

Dynamsoft SourceAnywhere Standalone is a SQL-based source code control software designed to be a replacement/alternative of Microsoft Visual SourceSafe (VSS). It is for developers who are ready to migrate away from Microsoft Visual Source Safe (VSS) source code control for performance, security, scalability, and reliability.
Setup guide
Download 30-day trial

## SourceAnywhere Hosted

SourceAnywhere Hosted online source control is a SQL-based source control software delivered as a SaaS application and it provides all of the key features of Microsoft Visual SourceSafe (VSS), plus much more. SourceAnywhere Hosted online source control is hosted in a Bell Data Center to ensure that you have the most reliable access to mission-critical data and uncompromised security.
Secure your source code
Introduction Video
Sign up for a free hosting plan and have a try

# SCM Anywhere

Dynamsoft SCM Anywhere is a SQL Server-based software configuration management (SCM) tool with fully integrated version control, bug tracking and build automation. It is for teams looking for an integrated solution to manage the whole software development life cycle.

## SCM Anywhere Standalone

Dynamsoft SCM Anywhere Standalone is the SQL-based software configuration management (SCM) solution with fully integrated version control, issue tracking and build automation.
Designed for both centralized and distributed development teams, SCM Anywhere Standalone helps development teams deliver software products faster and promotes team collaboration through centralized control of source code files, team activities, work item status and bug reports.
Setup guide
Overview Video
Free Trial

## SCM Anywhere Hosted

SCM Anywhere Hosted is the world's 1st hosted SCM (software configuration management) solution. It is delivered as a SaaS application and comes with fully integrated version control, issue tracking, build automation and professional service to manage your whole software development life cycle. SCM Anywhere Hosted is hosted in a Bell Data Center to ensure that you have the most reliable access to mission-critical data and uncompromised security.
Secure your source code and digital assets
Sign up for a free plan and have a try

# References

* c2:VersionControl discusses several version control systems.
* c2:ExtremeVersionControl describes how the "extra work" of frequent commits to version control actually helps other things get done faster.
* VersionControl at FreeBSD discusses several version control systems.
* Software Development with Continuous Integration/Version Control
* Google Project Hosting: "Choosing a version control system"
* Sam Hart: "Converting from Subversion to Mercurial" has a quick comparison of several modern DVCSes.

## Books

Comparing and Merging files with GNU diff and Patch. David MacKenzie, Paul Eggert, Richrd Stallman, Network Theory Ltd