Changeset 1874


Ignore:
Timestamp:
Dec 24, 2008, 5:46:11 PM (15 years ago)
Author:
broder
Message:

Make the script skip packages when the checkout already exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/git-migration/git-migrate

    r1873 r1874  
    11#!/usr/bin/python
    22
     3import os
    34import sys
    45import subprocess
     
    67
    78def clonePackage(base, pkg):
    8     # Use --no-follow-parent because we're going to handle that with
    9     # grafts.
    10     subprocess.check_call(['git', 'svn', 'clone', '--no-follow-parent',
    11                            '-Aauthors',
    12                            '-q',
    13                            '--no-metadata', '%s/packages/%s' % (base, pkg)],
    14                     stdout=subprocess.PIPE)
    15    
    16     # Then make the repository bare, because git-svn can't do this
    17     shutil.move('%s/.git' % pkg, '%s.git' % pkg)
    18     shutil.rmtree('%s' % pkg)
    19     subprocess.check_call(['git', 'config', 'core.bare', 'true'], cwd='%s.git' % pkg)
     9    if not os.path.isdir('%s.git' % pkg):
     10        if os.path.isdir(pkg):
     11            shutil.rmtree(pkg)
     12        # Use --no-follow-parent because we're going to handle that with
     13        # grafts.
     14        subprocess.check_call(['git', 'svn', 'clone', '--no-follow-parent',
     15                               '-Aauthors',
     16                               '-q',
     17                               '--no-metadata', '%s/packages/%s' % (base, pkg)],
     18                              stdout=subprocess.PIPE)
     19       
     20        # Then make the repository bare, because git-svn can't do this
     21        shutil.move('%s/.git' % pkg, '%s.git' % pkg)
     22        shutil.rmtree('%s' % pkg)
     23        subprocess.check_call(['git', 'config', 'core.bare', 'true'], cwd='%s.git' % pkg)
    2024
    2125def cloneAllPackages(base):
Note: See TracChangeset for help on using the changeset viewer.