欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Python的高級(jí)Git庫(kù) Gittle

系統(tǒng) 1859 0

Gittle是一個(gè)高級(jí)純python git 庫(kù)。構(gòu)建在dulwich之上,提供了大部分的低層機(jī)制。

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 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')
        

Commit

          
# 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")
        

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 pull
repo.pull()
        

Push

          
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()
        

Authentication for remote operations

          
# 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")
        

Branch

          
# 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)
        

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
            
          

Count number of commits

            
              repo
            
            
              .
            
            
              commit_count
            
          

Get information for commits

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()
        

更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 欧美高清成人 | 欧美精品一区三区 | 97理论三级九七午夜在线观看 | 超级碰碰碰频视频免费观看 | 魔法骑士在线观看免费完整版高清 | 日本理论片好看理论片 | 国产成人午夜精品5599 | 米奇777四色精品人人爽 | 深夜寂寞影院 | 欧美特黄aaaaaaaa大片 | 国产第113页 | 日韩亚洲人成网站在线播放 | 国产电影网 | 久在线看 | 奇米色777欧美一区二区 | 日韩欧美专区 | 免费日本视频 | 四虎884aa永久播放地址http | 免费a网站 | 免费高清seyeye在线视频观看 | 成人在线中文字幕 | 日韩久操| 日韩视频免费 | 国产精品吹潮在线观看中文 | 成人av免费观看 | 婷婷丁香综合 | A片扒开双腿猛进入免费 | 午夜av免费| 中文在线视频 | 新版天堂资源中文在线 | 亚洲一区二区综合 | 久在线看 | 亚洲成人偷拍 | 99在线视频观看 | 久久精品亚洲精品 | 欧美精品一区二区三区久久 | 欧美精品一区二区三区在线 | 国产色产综合色产在线观看视频 | 亚洲视频在线观看 | 黑丝在线播放 | 三人弄娇妻高潮3p视频 |