X-Git-Url: http://xvm.mit.edu/gitweb/invirt/scripts/git-migration.git/blobdiff_plain/37182158cf8b32cc011e99cbcb8ae81da21274c6..3441edb43dec231bf01192c1911063e98100138f:/git-migrate diff --git a/git-migrate b/git-migrate index aac76df..f3ef98e 100755 --- a/git-migrate +++ b/git-migrate @@ -1,21 +1,29 @@ #!/usr/bin/python +import os import sys import subprocess import shutil def clonePackage(base, pkg): - # Use --no-follow-parent because we're going to handle that with - # grafts. - subprocess.check_call(['git', 'svn', 'clone', '--no-follow-parent', - '-Aauthors', - '--no-metadata', '%s/packages/%s' % (base, pkg)], - stdout=subprocess.PIPE) - - # Then make the repository bare, because git-svn can't do this - shutil.move('%s/.git' % pkg, '%s.git' % pkg) - shutil.rmtree('%s' % pkg) - subprocess.check_call(['git', 'config', 'core.bare', 'true'], cwd='%s.git' % pkg) + if not os.path.isdir('%s.git' % pkg): + if os.path.isdir(pkg): + shutil.rmtree(pkg) + # Use --no-follow-parent because we're going to handle that with + # grafts. + subprocess.check_call(['git', 'svn', 'clone', + '--no-follow-parent', + '-Aauthors', + '-q', + '--no-metadata', + '%s/packages/%s' % (base, pkg)], + stdout=subprocess.PIPE) + + # Then make the repository bare, because git-svn can't do this + shutil.move('%s/.git' % pkg, '%s.git' % pkg) + shutil.rmtree(pkg) + subprocess.check_call(['git', 'config', 'core.bare', 'true'], + cwd='%s.git' % pkg) def cloneAllPackages(base): for pkg in open('package-list'):