本文整理汇总了Python中git.Repo.diff方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.diff方法的具体用法?Python Repo.diff怎么用?Python Repo.diff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.Repo
的用法示例。
在下文中一共展示了Repo.diff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Repo
# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import diff [as 别名]
username = sys.argv[1] # bob
password = sys.argv[2] # foobar
ftpsite = sys.argv[3] # example.com
base = sys.argv[4] # /www/www (must already exist!)
reposite = sys.argv[5] # /home/bob/website
# Windows doesn't like env
Git.git_binary = "git"
repo = Repo(reposite)
commit = repo.commits("master", 1)[0]
tree = commit.tree
ftp = ftplib.FTP(ftpsite, username, password)
# Check revision
hashFile = cStringIO.StringIO()
try:
ftp.retrbinary("RETR " + base + "/git-rev.txt", hashFile.write)
hash = hashFile.getvalue()
except ftplib.error_perm:
hash = 0
if not hash:
# Perform full upload
uploadAll(tree, ftp, base)
else:
uploadDiff(repo.diff(hash, commit.id).split("\n"), tree, ftp, base)
ftp.storbinary("STOR " + base + "/git-rev.txt", cStringIO.StringIO(commit.id))
ftp.quit()