麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > Python > 正文

Python的高級Git庫 Gittle

2020-02-23 05:49:27
字體:
來源:轉載
供稿:網友

Gittle是一個高級純python git 庫。構建在dulwich之上,提供了大部分的低層機制。

Install it

pip install gittle

Examples :

Clone a repository

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) 

Init repository from a path

repo = Gittle.init(path) 

Get repository information

# Get list of objectsrepo.commits # Get list of branchesrepo.branches # Get list of modified files (in current working directory)repo.modified_files # Get diff between latest commitsrepo.diff('HEAD', 'HEAD~1')

Commit

# Stage single filerepo.stage('file.txt') # Stage multiple filesrepo.stage(['other1.txt', 'other2.txt']) # Do the commitrepo.commit(name="Samy Pesse", email="[email protected]", message="This is a commit")

Pull

repo = Gittle(repo_path, origin_uri=repo_url) # Authentication with RSA private keykey_file = open('/Users/Me/keys/rsa/private_rsa')repo.auth(pkey=key_file) # Do pullrepo.pull()

Push

repo = Gittle(repo_path, origin_uri=repo_url) # Authentication with RSA private keykey_file = open('/Users/Me/keys/rsa/private_rsa')repo.auth(pkey=key_file) # Do pushrepo.push()

Authentication for remote operations

# With a keykey_file = open('/Users/Me/keys/rsa/private_rsa')repo.auth(pkey=key_file) # With username and passwordrepo.auth(username="your_name", password="your_password")

Branch

# Create branch off masterrepo.create_branch('dev', 'master') # Checkout the branchrepo.switch_branch('dev') # Create an empty branch (like 'git checkout --orphan')repo.create_orphan_branch('NewBranchName') # Print a list of branchesprint(repo.branches) # Remove a branchrepo.remove_branch('dev') # Print a list of branchesprint(repo.branches)

Get file version

versions = repo.get_file_versions('gittle/gittle.py')print("Found %d versions out of a total of %d commits" % (len(versions), repo.commit_count()))

Get list of modified files (in current working directory)

repo.modified_files             
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美日韩色片 | 久久综合久久美利坚合众国 | 欧美亚洲黄色 | 毛片在线免费播放 | 美女视频黄a视频免费全过程 | 中文字幕在线观看www | 久草最新| 久久久久久久久日本理论电影 | 久久吊| 曰韩一级片| 黑人三级毛片 | 日韩2区 | 极品大长腿啪啪高潮露脸 | 欧美性色黄大片www 成人免费网站在线观看 | 99国产精品欲a | 91一级毛片 | 久久宗合色 | 欧美一级黄色影院 | 国产一级二级在线播放 | 午夜精品福利影院 | 久久精品中文字幕 | 一级毛片播放 | 久久99精品久久久久久236 | 久久久久久久久久91 | 精品一区二区免费 | 免费在线国产 | 日本一道aⅴ不卡免费播放 久久久久久久高清 | 国产精品呻吟 | 把娇妻调教成暴露狂 | 国产精品久久久久久影院8一贰佰 | 成人做爰s片免费看网站 | 久久亚洲精品国产一区 | 91av亚洲| 九九热精品免费视频 | 国产精选电影免费在线观看网站 | 亚洲午夜不卡 | 毛片视频免费观看 | 国产大片全部免费看 | 国产一区二区三区四区五区精品 | 一区二区美女视频 | 中文字幕在线观看视频www |