This text looks at different forms of version control.

The Basic Tools of Version Control

edit

What is Version Control?

edit

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

edit

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.

[Date]
Monday 5th January 2009

[Starters]
Starter of the day.

[Main]
Dish of the day.

----
FILE: menu.txt

The next day we add some additional items.

[Date]
Tuseday 6th January 2009

[Starters]
Starter of the day.
Chicken Soup

[Main]
Dish of the day.
Mushroom Ommelette

----
FILE: menu.txt

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.

[Date]
Monday 5th January 2009

[Starters]
Starter of the day.

[Main]
Dish of the day.

----
FILE: menu-20090105.txt
[Date]
Tuseday 6th January 2009

[Starters]
Starter of the day.
Chicken Soup

[Main]
Dish of the day.
Mushroom Ommelette

----
FILE: menu-20090106.txt

TODO: note on file names.

Types of Version Control

edit
  • Centralized
  • Distributed

Outline of Examples

edit
  • 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

edit

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

edit

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 (Ubuntu)

edit

Using diff (Windows XP)

edit

We will start by looking at the differences between the menu on Monday and the Menu on Tuesday.

~Menus>diff menu-20090105.txt menu-20090106.txt
2c2
< Monday 5th January 2009
---
> Tuesday 6th January 2009
5a6
> Chicken Soup
11c12
< Creme Brulee
---
> Ice Cream

~Menus>

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>.

~Menus>diff menu-20090106.txt menu-20090107.txt
2c2
< Tuesday 6th January 2009
---
> Wednesday 7th January 2009
6d5
< Chicken Soup
12c11
< Ice Cream
---
> Creme Brulee

~Menus>

Scenario 2: Single User Version Control of Multiple Files

edit

White Noise

edit

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 3: Single User Version Control of Multiple Files and Branches

edit

Scenario 4: Multiple Users Version Control of Multiple Files

edit

Scenario 5: Multiple Users Version Control of Multiple Files and Branches

edit

Scenario 6: Multiple Users Using Centralized Version Control

edit

Scenario 7: Multiple Users Using Distributed Version Control

edit

SourceAnywhere

edit

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

edit

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

edit

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

edit

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

edit

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

edit

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

edit

Books

edit

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