source: trunk/scripts/git-migration/git-migrate @ 1875

Last change on this file since 1875 was 1875, checked in by broder, 16 years ago

Pointless housekeeping.

  • Property svn:executable set to *
File size: 1.2 KB
RevLine 
[1866]1#!/usr/bin/python
2
[1874]3import os
[1866]4import sys
5import subprocess
[1869]6import shutil
[1866]7
8def clonePackage(base, pkg):
[1874]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.
[1875]14        subprocess.check_call(['git', 'svn', 'clone',
15                               '--no-follow-parent',
[1874]16                               '-Aauthors',
17                               '-q',
[1875]18                               '--no-metadata',
19                               '%s/packages/%s' % (base, pkg)],
[1874]20                              stdout=subprocess.PIPE)
21       
22        # Then make the repository bare, because git-svn can't do this
23        shutil.move('%s/.git' % pkg, '%s.git' % pkg)
[1875]24        shutil.rmtree(pkg)
25        subprocess.check_call(['git', 'config', 'core.bare', 'true'],
26                              cwd='%s.git' % pkg)
[1866]27
28def cloneAllPackages(base):
29    for pkg in open('package-list'):
30        clonePackage(base, pkg.strip())
31
32if __name__ == '__main__':
33    try:
34        base = sys.argv[1]
35    except:
36        base = 'svn://invirt.mit.edu/trunk'
37   
38    cloneAllPackages(base)
Note: See TracBrowser for help on using the repository browser.