User Tools

Site Tools


Version Control notes


I prefer using Mercurial or Bazaar when possible (I don't use Bazaar much any more). Github is a good argument for git, but hg-git may mitigate that somewhat. Mercurial (as of TortoiseHg 2.0) has my favorite standalone GUI, the TortoiseHg Workbench.

Git can track content across files. If you ever want to do a 'blame' across files for another VCS (to find the commit that originally created a particular snippet), you can use git-svn, hg-git, or some other conversion to get a git repository, then run git blame -M -C on the file.

Conversions / Interoperability


Converts between multiple DVCS repositories, as well from SVN dumps. Package available in EPEL.


Git, Mercurial, and Bazaar all have plugins that inter-operate with SVN.

  • Bazaar's seems to be the most transparent (currently). It stores extra information about revisions it creates as SVN properties to avoid losing information. For example, when you later use bzr to view the log, it will show the original date/times instead of the date/time of the SVN commit (i.e. the time it was pushed to SVN).
    • I've had some issues with bzr-svn, but sometimes it has to do with the repository setup (authentication, hooks); see bazaar. To see if that's the case, you could try pushing to a fresh new test repository with no authentication or hooks.
  • hgsubversion seems to do a good job of importing trunk/tags/branches into a single Mercurial repository.
    • Unlike Bazaar, it seems that you can't push to a new directory (e.g. if you started working in Mercurial and want to move the code to SVN); you have to put something in the directory in SVN first
    • There also seem to be issues creating branches
    • Looks like it does not follow renamed directories
    • For Windows installation, TortoiseHg comes with the necessary extensions; see mercurial for details
  • bzr-svn seems to be able to follow copies (at least of the base directory) to get a full history, but hgsubversion doesn't do this (2011-10-17)
  • For git-svn, SmartGit looks like it may provide a good interface and better integration:
  • Start in Git, push to Subversion then work with git-svn (Wayback Machine archive of a dead blog)

Conversion Articles


hg-git is bidirectional, but its primary use case is to work with git repositories with hg, so it's possible but harder to do the other way around. For example: How to work in Git and push changes to Mercurial using hg-git.

For a one-time conversion, you can use fast-import to convert to git from hg or bzr.

For Windows installation, TortoiseHg comes with the necessary extensions; see mercurial for details

Bazaar to Mercurial

See also

The simplest solution would be the convert extension:

# The project-hg directory should not exist yet
hg convert project-bzr project-hg

This requires that Bazaar is installed, presumably to the same instance of Python, so it won't work with the standard Windows install of Mercurial. I was able to do it through a virtualenv in Cygwin: pip install mercurial and bzr.

There is also a fast-import extension for Mercurial.

Mercurial to Bazaar

See also

There is a bzr-hg plugin, but it's pull-only and seems to be mostly unmaintained.

bzr fast-export-from-hg followed by bzr fast-import is probably the way to go.

Tools that work with more than one VCS


The mr(1) command can checkout, update, or perform other actions on a set of repositories as if they were one combined respository. It supports any combination of subversion, git, cvs, mecurial, bzr and darcs repositories, and support for other revision control systems can easily be added. (There are extensions adding support for unison and git-svn.)

Keeping your home directory (also /etc) under version control

Generic Tips

Reverting Only Whitespace Changes

Sometimes an editor will automatically make whitespace changes. Sometimes you have real changes, which should ideally not be mixed in with major whitespace changes.

In general, make a diff using one of the whitespace options, revert the file(s), and apply the diffs.

In SVN, "svn diff" has a "-x" option, so you can run e.g. svn diff -x -w.

info/vcs.txt · Last modified: 2016-10-27 00:06 by sam