From: Evan Broder Date: Wed, 24 Dec 2008 22:46:11 +0000 (-0500) Subject: Make the script skip packages when the checkout already exists. X-Git-Url: http://xvm.mit.edu/gitweb/invirt/scripts/git-migration.git/commitdiff_plain/4befd818889473386ab9b2a361c8e9ed8f6ee4b3?ds=sidebyside Make the script skip packages when the checkout already exists. svn path=/trunk/scripts/git-migration/; revision=1874 --- diff --git a/git-migrate b/git-migrate index 9910ae5..35f3142 100755 --- a/git-migrate +++ b/git-migrate @@ -1,22 +1,26 @@ #!/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', - '-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('%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('%s' % pkg) + subprocess.check_call(['git', 'config', 'core.bare', 'true'], cwd='%s.git' % pkg) def cloneAllPackages(base): for pkg in open('package-list'):