本文整理汇总了Python中commit.Commit.loadFromSource方法的典型用法代码示例。如果您正苦于以下问题:Python Commit.loadFromSource方法的具体用法?Python Commit.loadFromSource怎么用?Python Commit.loadFromSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类commit.Commit
的用法示例。
在下文中一共展示了Commit.loadFromSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getCommits
# 需要导入模块: from commit import Commit [as 别名]
# 或者: from commit.Commit import loadFromSource [as 别名]
def getCommits(repo, startdate, enddate):
end_rev = pysvn.Revision(pysvn.opt_revision_kind.date, enddate)
start_rev = pysvn.Revision(pysvn.opt_revision_kind.date, startdate)
c = pysvn.Client()
commits = []
msgs = c.log(repo.url, revision_start=start_rev, revision_end=end_rev, discover_changed_paths=True)
msgs.reverse()
for m in msgs:
date = m.data['revprops']['svn:date']
message = m.data['message']
paths = [p.path for p in m.data['changed_paths']]
c = Commit()
c.loadFromSource(repo, message, date, paths, m.data['revision'].number)
commits.append(c)
return commits
示例2: getCommits
# 需要导入模块: from commit import Commit [as 别名]
# 或者: from commit.Commit import loadFromSource [as 别名]
def getCommits(repo, startdate, enddate):
localfolder = urlToFolder(repo.url)
differ = gdiff.diff_match_patch()
repoloc = "git-repos/" + localfolder + "/"
if os.path.exists(repoloc):
c = pygit.Repo(repoloc)
else:
os.makedirs(repoloc)
c = pygit.Repo.init(repoloc)
c.create_remote("origin", repo.url)
c.remotes.origin.fetch()
c.remotes.origin.pull("master")
commits = []
msgs = c.iter_commits(since=unixToGitDateFormat(startdate))
for m in msgs:
if m.committed_date > enddate:
continue
alldiffs = []
for d in m.diff("HEAD~1").iter_change_type("M"): # Changed
left = d.a_blob.data_stream.read()
right = d.b_blob.data_stream.read()
diffs = differ.diff_main(left, right)
if diffs:
differ.diff_cleanupSemantic(diffs)
for d in diffs:
if d[0] != 0 and d[1].strip():
alldiffs.append(d)
for d in m.diff().iter_change_type("A"): # Added
pass
for d in m.diff().iter_change_type("D"): # Deleted
pass
for d in m.diff().iter_change_type("R"): # Renamed
pass
c = Commit()
c.loadFromSource(repo, m.message, m.committed_date, m.stats.files.keys(), m.__str__(), alldiffs)
commits.append(c)
return commits
示例3: getCommits
# 需要导入模块: from commit import Commit [as 别名]
# 或者: from commit.Commit import loadFromSource [as 别名]
def getCommits(repo, startdate, enddate):
localfolder = urlToFolder(repo.url)
repoloc = 'git-repos/' + localfolder + '/'
if os.path.exists(repoloc):
c = pygit.Repo(repoloc)
else:
os.makedirs(repoloc)
c = pygit.Repo.init(repoloc)
c.create_remote('origin', repo.url)
c.remotes.origin.fetch()
c.remotes.origin.pull('master')
commits = []
msgs = c.iter_commits(since=unixToGitDateFormat(startdate))
for m in msgs:
if m.committed_date > enddate: continue
c = Commit()
c.loadFromSource(repo, m.message, m.committed_date, m.stats.files.keys(), m.__str__())
commits.append(c)
return commits