本文整理汇总了Python中git.Repo.log方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.log方法的具体用法?Python Repo.log怎么用?Python Repo.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.Repo
的用法示例。
在下文中一共展示了Repo.log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_revisions
# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import log [as 别名]
def get_revisions(self, key):
"""
returns a list with all revisions at which ``key`` was changed.
Revisions are Git hashes.
"""
repo = Repo(self.repo_path)
crevs = [r.id for r in repo.log(path=key)]
return crevs[1:] # cut of the head revision-number
示例2: GitBackend
# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import log [as 别名]
class GitBackend(BaseBackend):
"A Git backend"
CommitClass = commit.GitCommit
def __init__(self, connection_string):
from git import Repo
self.repo = Repo(connection_string)
def root(self):
"The first, parentless commit"
return self.CommitClass(self.repo.log(n=1)[0].id, self)
def tip(self):
"The HEAD commit"
return self.CommitClass(self.repo.commit("HEAD"), self)
def heads(self):
"Commits that have no children"
return [self.CommitClass(head.commit, self) for head in self.repo.heads]
示例3: get_verbose_revisions
# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import log [as 别名]
def get_verbose_revisions(self, key):
"""
returns a list with all revisions at which ``key`` was changed.
Revisions are Git hashes.
"""
repo = Repo(self.repo_path)
crevs = [{'id': r.id, 'name': r.author.name, 'message': r.message, 'date': mktime(r.authored_date)} for r in repo.log(path=key)]
return crevs