Imported source code from Mercurial.