欧美三区_成人在线免费观看视频_欧美极品少妇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)論
主站蜘蛛池模板: 免费久久网站 | 亚洲性人人天天夜夜摸 | 粉色视频高清大全免费观看1 | 国产99久久精品一区二区永久免费 | 污污网站国产精品白丝袜 | 国产在线视频网址 | 欧美日韩一区二区视频在线观看 | 亚洲娇小性色xxxx | 夜夜操av| 国产一区二区三区久久久久久久久 | 国产精品久久久久无毒 | 国产成年人网站 | 清纯唯美第一页 | 免费中日高清无专码有限公司 | 亚洲国产日韩欧美高清片a 高清视频在线播放 | 国产精品黄大片观看 | 久久99国产亚洲精品观看 | 久久精彩 | 在线看片h站 | 99在线热播精品免费 | 中文字幕亚洲综合久久2 | 国产人妻精品无码AV在线浪潮 | 欧美爽爽爽爽爽爽视频 | cao视频| 无码一区二区三区曰本A片 欧美综合激情网 | 中文字幕 国产精品 | 成人毛片网站 | 成人免费毛片aaaaaa片 | 91久久精品国产91久久 | 日本阿v视频高清在线 | 丁香六月综合 | 欧美一区二区大片 | 国产大片免费观看中文字幕 | 久草在线精品视频 | 久久99精品视频 | 全黄裸片武则天一级第4季 亚洲一区国产 | www.999abab.com| 欧美精品一区二区三区蜜桃视频 | 生死博弈| 日本www.在线中文字幕 | 一区二区三区四区高清视频 |