+def mergeHistory(old_pkg, new_pkg, n):
+ cwd = os.getcwd()
+ subprocess.check_call(['git', 'push',
+ 'file:///%s/%s.git' % (cwd, new_pkg),
+ 'master:refs/heads/%s' % old_pkg],
+ cwd=new_pkg)
+
+def mergeHistories():
+ for line in open('grafts'):
+ line = line.strip()
+ if line[0] == '#' or line == '':
+ continue
+
+ old_pkg, new_pkg, n = line.split()
+ mergeHistory(old_pkg, new_pkg, int(n))
+