红色角落在线观看,李斯丹妮丝袜,华佗教你睡觉
gittle是一个高级纯python git 库。构建在dulwich之上,提供了大部分的低层机制。
pip install gittle
from gittle import gittle repo_path = '/tmp/gittle_bare' repo_url = 'git://github.com/friendcode/gittle.git' repo = gittle.clone(repo_url, repo_path)
with authentication (see authentication section for more information) :
auth = gittleauth(pkey=key) gittle.clone(repo_url, repo_path, auth=auth)
or clone bare repository (no working directory) :
repo = gittle.clone(repo_url, repo_path, bare=true)
repo = gittle.init(path)
# get list of objects repo.commits # get list of branches repo.branches # get list of modified files (in current working directory) repo.modified_files # get diff between latest commits repo.diff('head', 'head~1')
# stage single file repo.stage('file.txt') # stage multiple files repo.stage(['other1.txt', 'other2.txt']) # do the commit repo.commit(name="samy pesse", email="samy@friendco.de", message="this is a commit")
repo = gittle(repo_path, origin_uri=repo_url) # authentication with rsa private key key_file = open('/users/me/keys/rsa/private_rsa') repo.auth(pkey=key_file) # do pull repo.pull()
repo = gittle(repo_path, origin_uri=repo_url) # authentication with rsa private key key_file = open('/users/me/keys/rsa/private_rsa') repo.auth(pkey=key_file) # do push repo.push()
# with a key key_file = open('/users/me/keys/rsa/private_rsa') repo.auth(pkey=key_file) # with username and password repo.auth(username="your_name", password="your_password")
# create branch off master repo.create_branch('dev', 'master') # checkout the branch repo.switch_branch('dev') # create an empty branch (like 'git checkout --orphan') repo.create_orphan_branch('newbranchname') # print a list of branches print(repo.branches) # remove a branch repo.remove_branch('dev') # print a list of branches print(repo.branches)
versions = repo.get_file_versions('gittle/gittle.py') print("found %d versions out of a total of %d commits" % (len(versions), repo.commit_count()))
repo.modified_files
repo.commit_count
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")
from gittle import gitserver # read only gitserver('/', 'localhost').serve_forever() # read/write gitserver('/', 'localhost', perm='rw').serve_forever()
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
python求numpy中array按列非零元素的平均值案例
网友评论