summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-11-02 16:49:23 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-11-02 16:49:23 +0000
commitb3151f7ff6637e651362e1843da149ba59477295 (patch)
tree838b2c371cb66decf4fc77a5e39e3e45d86d25fd /lorry
parent7c7579a64a779e71add42a8677dc7b82a46e7122 (diff)
downloadlorry-b3151f7ff6637e651362e1843da149ba59477295.tar.gz
Add support for Mercurial
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry17
1 files changed, 17 insertions, 0 deletions
diff --git a/lorry b/lorry
index 97979eb..4ec1060 100755
--- a/lorry
+++ b/lorry
@@ -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():