本文整理汇总了Python中repo.Repo.open方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.open方法的具体用法?Python Repo.open怎么用?Python Repo.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repo.Repo
的用法示例。
在下文中一共展示了Repo.open方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_site
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import open [as 别名]
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"