Version Control

Revised 2014 Sep 2: - Added revert/checkout (undoing changes)

Version Control Systems

Also called revision control systems, source control systems, etc. Originally but not necessarily always for computer software source code.

Goals:

For example, if you’re currently working on version 2.5.6, and someone reports a bug in version 1.2.3, which you’re still supporting, you need to be able to recreate version 1.2.3 to reproduce, diagnose, and fix the bug.

Concepts

Variations

With file locking, only a single developer can check out a file for editing at one time. Version merging allows multiple developers to do so, and their changes have to be somehow merged when committed or checked din.

The disadvantages of a centralized system with the client/server model are that every operation you perform with the version control system requires access to the server. Therefore, it can be slow, due to network lag, or impossible, due to network inaccesibility.

Most newer version control systems therefore tend to take the distributed approach. Each developer’s computer contains a “complete” repository and the whole version control software — not just the current snapshot. The developer can therefore work on the project without network access. Of course, sharing changes does require network access, and there is often a central project site, such as on GitHub, for sharing.

Examples

I have never used SCCS or RCS.

My first experience was with CVS. Since Subversion claimed to be “a better CVS” or “CVS done right,” I switched to it. In both of these I found branching and merging hard.

Since then, I have used darcs and (occasionally, with much frustration) git.

Darcs Concepts

Basic Darcs Commands

Create project in working directory:

$ darcs init

Get an existing project (“checkout”):

$ darcs get REPO_PATH

Add files to project:

$ darcs add FILE ...

Basic Darcs Commands 2

See what’s changed:

$ darcs whatsnew [-l]

Record changes (local “checkin”):

$ darcs record [--all]

Go back to last recorded version:

$ darcs revert FILE ...

Label the current version with a tag:

$ darcs tag VERSION_LABEL

Basic Darcs Commands 3

See the history of changes:

$ darcs changes

Share changes (makes “checkin” non-local):

$ darcs push [REPO_PATH]

Get changes from collaborators:

$ darcs pull [REPO_PATH]

Try It

[Setup:

  1. cd /home/info/share/i320
  2. mkdir darcsdemo
  3. chmod g=rwx,o=rwx darcsdemo
  4. cd darcsdemo
  5. darcs init
  6. Add some file(s)
  7. darcs record
  8. chmod g=rwx,o=rwx darcsdemo

]

Participatory demonstration

  1. $ darcs get USER@merlin.iue.edu:/home/info/share/i320/darcsdemo or on merlin, just $ darcs get /home/info/share/i320/darcsdemo
  2. $ cd darcsdemo
  3. Edit some file(s)
  4. Optionally add some file(s): $ darcs add FILENAME …
  5. Record changes: $ darcs record
  6. $ darcs push
  7. Resolve conflicts??

Darcs Reference

Advantages of Darcs

Drawbacks of Darcs

Git

Slides

See the slides for more information about git.

Resources

Darcs

Darcs Hosting

Fossil

Git

Git Hosting

Subversion

The Darcs Rosetta Stone