diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2011-11-02 16:49:23 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2011-11-02 16:49:23 +0000 |
commit | b3151f7ff6637e651362e1843da149ba59477295 (patch) | |
tree | 838b2c371cb66decf4fc77a5e39e3e45d86d25fd | |
parent | 7c7579a64a779e71add42a8677dc7b82a46e7122 (diff) | |
download | lorry-b3151f7ff6637e651362e1843da149ba59477295.tar.gz |
Add support for Mercurial
-rwxr-xr-x | lorry | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -57,6 +57,7 @@ class Lorry(cliapp.Application): 'bzr': self.gitify_bzr, 'cvs': self.gitify_cvs, 'git': self.mirror_git, + 'hg': self.gitify_hg, 'svn': self.gitify_svn, } vcstype = spec['type'] @@ -117,6 +118,22 @@ class Lorry(cliapp.Application): self.run_program(['git', 'cvsimport', '-d', spec['url'], '-C', gitdir, spec['module']]) + def gitify_hg(self, dirname, gitdir, spec): + hgdir = os.path.join(dirname, 'hg') + if os.path.exists(hgdir): + self.progress('.. updating hg branch') + self.run_program(['hg', 'pull', '--quiet'], cwd=hgdir) + else: + self.progress('.. doing initial hg branch') + self.run_program(['hg', 'clone', '--quiet', spec['url'], hgdir]) + + if not os.path.exists(gitdir): + self.run_program(['git', 'init', gitdir]) + + self.progress('.. fast-exporting into git') + self.run_program(['hg-fast-export', '--quiet', '-r', '../hg'], + cwd=gitdir) + def push_to_gitorious(self, project_name, gitdir): out = self.run_program(['git', 'remote', 'show'], cwd=gitdir) if 'gitorious' not in out.splitlines(): |