X-Git-Url: http://xvm.mit.edu/gitweb/invirt/scripts/git-migration.git/blobdiff_plain/3441edb43dec231bf01192c1911063e98100138f..300df9db8cb3cf951e8c95b8bc971e55134445eb:/git-migrate diff --git a/git-migrate b/git-migrate index f3ef98e..edd916c 100755 --- a/git-migrate +++ b/git-migrate @@ -24,11 +24,33 @@ def clonePackage(base, pkg): shutil.rmtree(pkg) subprocess.check_call(['git', 'config', 'core.bare', 'true'], cwd='%s.git' % pkg) + + # Some of these repos have a rev where everything was deleted + # as a result of the move. We don't want that rev to exist. + p = subprocess.Popen(['git', 'ls-files'], + cwd='%s.git' % pkg, + stdout=subprocess.PIPE) + p.wait() + if len(p.stdout.read()) == 0: + subprocess.check_call(['git', 'reset', 'HEAD^'], + cwd='%s.git' % pkg) def cloneAllPackages(base): for pkg in open('package-list'): clonePackage(base, pkg.strip()) +def mergeHistory(old_pkg, new_pkg, n): + pass + +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)) + if __name__ == '__main__': try: base = sys.argv[1] @@ -36,3 +58,4 @@ if __name__ == '__main__': base = 'svn://invirt.mit.edu/trunk' cloneAllPackages(base) + mergeHistories()