當前位置: 首頁>>代碼示例>>Python>>正文


Python Repo.open方法代碼示例

本文整理匯總了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"
開發者ID:a-kr,項目名稱:git-blamer,代碼行數:53,代碼來源:git-blamer.py


注:本文中的repo.Repo.open方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。