Python的高级Git库 Gittle(2)
List commits : # Get 20 first commits repo . commit_info ( start = 0 , end = 20 ) With a given commit : commit = "a2105a0d528bf770021de874baf72ce36f6c3ccc" Diff with another commit : old_commit = repo
List commits :
# Get 20 first commits repo.commit_info(start=0, end=20)
With a given commit :
commit = "a2105a0d528bf770021de874baf72ce36f6c3ccc"
Diff with another commit :
old_commit = repo.get_previous_commit(commit, n=1) print repo.diff(commit, old_commit)
Explore commit files using :
commit = "a2105a0d528bf770021de874baf72ce36f6c3ccc" # Files tree print repo.commit_tree(commit) # List files in a subpath print repo.commit_ls(commit, "testdir") # Read a file print repo.commit_file(commit, "testdir/test.txt")
Create a GIT server
from gittle import GitServer
# Read only
GitServer('/', 'localhost').serve_forever()
# Read/Write
GitServer('/', 'localhost', perm='rw').serve_forever()
- 上一篇:Python显示进度条的方法
- 下一篇:Python单链表的简单实现方法
精彩图集
精彩文章






