def create_site(repo_path, target_dir): """ Записывает извлекаемые из репозитория данные в виде статического HTML-сайта в каталог target_dir """ r = Repo.open(repo_path) print "Repo loaded." print "Blaming the authors..." r.compute_blame() print "Done." print "Saving data..." r.save() print "Done." print "Stats for the latest revision:" print r.commits[r.head].snapshot_blame print "Plotting..." if not os.path.isdir(target_dir): os.makedirs(target_dir) copy_common_files(target_dir) longest_path = r.get_longest_path() print "Found longest_path, len = ", len(longest_path) png, commit_coords = commitgraph.commit_network(r, set(longest_path)) f = open(os.path.join(target_dir, 'graph.png'), 'wb') f.write(png) f.close() print "Plotting blame..." png = plot.plot_snapshot_blame(r, longest_path, commit_coords, relative=False) f = open(os.path.join(target_dir, 'blame-abs.png'), 'wb') f.write(png) f.close() print "Plotting blame (relative)..." png = plot.plot_snapshot_blame(r, longest_path, commit_coords, relative=True) f = open(os.path.join(target_dir, 'blame-rel.png'), 'wb') f.write(png) f.close() print "Done" print "Writing commit information..." f = open(os.path.join(target_dir, 'commits-data.js'), 'w') r.dump_commit_info_js(f, commit_coords) f.close() print "Done" root = dirtree.Directory.from_revision_blames(r.commits[r.head].snapshot_file_blames) print "Writing dirtree information..." f = open(os.path.join(target_dir, 'dirtree-data.js'), 'w') root.dump_to_js(f) f.close() print "Done"