#!/usr/bin/python
+import glob
import os
import sys
import subprocess
cwd='%s.git' % pkg)
def clonePackage(base, pkg):
+ path = '%s/%s' % (base, pkg)
+ pkg = os.path.basename(pkg)
+
if not os.path.isdir('%s.git' % pkg):
if os.path.isdir(pkg):
shutil.rmtree(pkg)
'-Aauthors',
'-q',
'--no-metadata',
- '%s/packages/%s' % (base, pkg)],
+ '%s' % path],
stdout=subprocess.PIPE)
# Then make the repository bare, because git-svn can't do this
'--',
'--all'],
cwd='%s.git' % new_pkg)
+
+ subprocess.call(['git', 'branch',
+ '-D',
+ old_pkg],
+ cwd='%s.git' % new_pkg)
+ shutil.rmtree('%s.git/refs/original' % new_pkg, True)
def mergeHistories():
merges = []
for merge in merges:
mergeHistory(*merge)
+
+ for merge in merges:
+ shutil.rmtree('%s.git' % merge[0])
+
+def cleanupRepos():
+ for pkg in glob.glob('*.git'):
+ subprocess.check_call(['git', 'tag', '-d', 'base'],
+ cwd='%s' % pkg)
+
+ subprocess.check_call(['git', 'gc'],
+ cwd='%s' % pkg)
if __name__ == '__main__':
try:
cloneAllPackages(base)
mergeHistories()
+ cleanupRepos()