#!/usr/bin/python
+import glob
import os
import sys
import subprocess
subprocess.check_call(['git', 'reset', '--soft', 'HEAD^'],
cwd='%s.git' % pkg)
+ # Early in the project's history, there were a bunch of double
+ # directory trees - i.e. the source was actually in
+ # trunk/packages/$package/$package. Correct for that
+ cwd = os.getcwd()
+ os.environ['PACKAGE'] = pkg
+ p = subprocess.check_call(['git', 'filter-branch',
+ '--commit-filter', '%s "$@"' % os.path.join(cwd, 'filter-subdirs'),
+ '--tag-name-filter', 'cat',
+ '--',
+ '--all'],
+ cwd='%s.git' % pkg)
+
tagBase(pkg)
def cloneAllPackages(base):
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:
base = sys.argv[1]
cloneAllPackages(base)
mergeHistories()
+ cleanupRepos()