本文整理汇总了Python中repo.Repo.loadFromValues方法的典型用法代码示例。如果您正苦于以下问题:Python Repo.loadFromValues方法的具体用法?Python Repo.loadFromValues怎么用?Python Repo.loadFromValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repo.Repo
的用法示例。
在下文中一共展示了Repo.loadFromValues方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
def find(query, components):
conn = DB.getConn()
c = conn.cursor()
c.execute(query, components)
commitrows = c.fetchall()
commitfiles = []
if commitrows:
allcommitids = ",".join([str(int(commit[0])) for commit in commitrows])
#This is poor practice, but we assured ourselves the value is composed only of ints first
DB.execute(c, "SELECT * from " + DB.commitfile._table + " WHERE commitid IN (" + allcommitids + ")")
commitfiles = c.fetchall()
DB.execute(c, "SELECT * from " + DB.commitkeyword._table + " WHERE commitid IN (" + allcommitids + ")")
commitkeywords = c.fetchall()
commits = []
for i in commitrows:
r = Repo()
r.loadFromValues(i[DB.commit._numColumns + 0], i[DB.commit._numColumns + 1], i[DB.commit._numColumns + 2],
i[DB.commit._numColumns + 3], i[DB.commit._numColumns + 4], i[DB.commit._numColumns + 5])
files = [file[DB.commitfile.file] for file in commitfiles
if file[DB.commitfile.commitid] == i[DB.commit.id]]
keywords = [keyword[DB.commitkeyword.keyword] for keyword in commitkeywords
if keyword[DB.commitkeyword.commitid] == i[DB.commit.id]]
c = Commit()
c.loadFromDatabase(r, i, files, keywords)
commits.append(c)
return commits
示例2: findByKeywords
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
def findByKeywords(keywords):
conn = DB.getConn()
c = conn.cursor()
getcommitsSQL = "SELECT c.*, r.* " + \
"FROM " + DB.commit._table + " c " + \
"INNER JOIN " + DB.repo._table + " r " + \
" ON r.id = c.repoid "
whereClause = " 1=1 "
components = []
if keywords:
keywordsTree = KeywordsParser(keywords)
getcommitsSQL += "LEFT OUTER JOIN " + DB.commitkeyword._table + " ck " + \
" ON c.id = ck.commitid "
whereClause, components = keywordsTree.getWhereClause("ck.keyword", "r.tagname", "r.maturity")
getcommitsSQL += "WHERE " + whereClause
getcommitsSQL += "ORDER BY c.date DESC "
c.execute(getcommitsSQL, components)
commitrows = c.fetchall()
commitfiles = []
if commitrows:
allcommitids = ",".join([str(int(commit[0])) for commit in commitrows])
#This is poor practice, but we assured ourselves the value is composed only of ints first
c.execute("SELECT * from " + DB.commitfile._table + " WHERE commitid IN (" + allcommitids + ")")
commitfiles = c.fetchall()
commits = []
for i in commitrows:
r = Repo()
r.loadFromValues(i[DB.commit._numColumns + 0], i[DB.commit._numColumns + 1], i[DB.commit._numColumns + 2],
i[DB.commit._numColumns + 3], i[DB.commit._numColumns + 4], i[DB.commit._numColumns + 5])
files = [file[DB.commitfile.file] for file in commitfiles
if file[DB.commitfile.commitid] == i[DB.commit.id]]
c = Commit()
c.loadFromDatabase(r, i, files)
commits.append(c)
return commits
示例3: find
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
def find(query, components):
conn = DB.getConn()
c = conn.cursor()
c.execute(query, components)
commitrows = c.fetchall()
commitfiles = []
if commitrows:
allcommitids = ",".join([str(int(commit[0])) for commit in commitrows])
#This is poor practice, but we assured ourselves the value is composed only of ints first
DB.execute(c, "SELECT * from " + DB.commitfile._table + " WHERE commitid IN (" + allcommitids + ")")
commitfiles = c.fetchall()
DB.execute(c, "SELECT * from " + DB.commitkeyword._table + " WHERE commitid IN (" + allcommitids + ")")
commitkeywords = c.fetchall()
DB.execute(c, "SELECT commitid, case when length(data) < 307200 then data else 'TOOLARGE' end as data from " + DB.commitdiffs._table + " WHERE commitid IN (" + allcommitids + ")")
commitdata = c.fetchall()
commits = []
for i in commitrows:
r = Repo()
r.loadFromValues(i[DB.commit._numColumns + DB.repo.id], i[DB.commit._numColumns + DB.repo.name], i[DB.commit._numColumns + DB.repo.repotypeid], i[DB.commit._numColumns + DB.repo.url],
i[DB.commit._numColumns + DB.repo.viewlink], i[DB.commit._numColumns + DB.repo.tagname], i[DB.commit._numColumns + DB.repo.tagmaturity])
files = [file[DB.commitfile.file] for file in commitfiles
if file[DB.commitfile.commitid] == i[DB.commit.id]]
keywords = [keyword[DB.commitkeyword.keyword] for keyword in commitkeywords
if keyword[DB.commitkeyword.commitid] == i[DB.commit.id]]
data = [cdata[DB.commitdiffs.data] for cdata in commitdata
if cdata[DB.commitdiffs.commitid] == i[DB.commit.id]][0]
if i[DB.commit._numColumns + DB.repo.repotypeid] == Repo.Type.GIT:
c = GitCommit()
elif i[DB.commit._numColumns + DB.repo.repotypeid] == Repo.Type.SVN:
c = SVNCommit()
else:
c = Commit()
c.loadFromDatabase(r, i, files, keywords, data)
commits.append(c)
return commits
示例4: findByIDs
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
def findByIDs(project, uniqueid):
conn = DB.getConn()
c = conn.cursor()
getcommitsSQL = "SELECT c.*, r.* " + \
"FROM " + DB.commit._table + " c " + \
"INNER JOIN " + DB.repo._table + " r " + \
" ON r.id = c.repoid "
whereClause = " 1=1 "
components = []
if project and uniqueid:
whereClause += "AND r.tagname = %s AND c.uniqueid = %s "
components = [project, uniqueid]
getcommitsSQL += "WHERE " + whereClause
getcommitsSQL += "ORDER BY c.date DESC "
DB.execute(c, getcommitsSQL, components)
commitrows = c.fetchall()
commitfiles = []
if commitrows:
allcommitids = ",".join([str(int(commit[0])) for commit in commitrows])
#This is poor practice, but we assured ourselves the value is composed only of ints first
DB.execute(c, "SELECT * from " + DB.commitfile._table + " WHERE commitid IN (" + allcommitids + ")")
commitfiles = c.fetchall()
commits = []
for i in commitrows:
r = Repo()
r.loadFromValues(i[DB.commit._numColumns + 0], i[DB.commit._numColumns + 1], i[DB.commit._numColumns + 2],
i[DB.commit._numColumns + 3], i[DB.commit._numColumns + 4], i[DB.commit._numColumns + 5])
files = [file[DB.commitfile.file] for file in commitfiles
if file[DB.commitfile.commitid] == i[DB.commit.id]]
c = Commit()
c.loadFromDatabase(r, i, files)
commits.append(c)
return commits
示例5: Commit
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
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
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Given a repo url, a startdate and enddate, process the commits between."
)
parser.add_argument("repo")
parser.add_argument("startdate")
parser.add_argument("enddate")
args = parser.parse_args()
args.startdate, args.enddate = fixDates(args.startdate, args.enddate)
r = Repo()
r.loadFromValues(-1, Repo.Type.GIT, args.repo, "", "", "")
commits = getCommits(r, args.startdate, args.enddate)
for c in commits:
c.pprint()
c.save()
示例6: Commit
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
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
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Given a repo url, a startdate and enddate, process the commits between.')
parser.add_argument('repo')
parser.add_argument('startdate')
parser.add_argument('enddate')
args = parser.parse_args()
args.startdate, args.enddate = fixDates(args.startdate, args.enddate)
r = Repo()
r.loadFromValues(-1, Repo.Type.SVN, args.repo, '', '', '')
commits = getCommits(r, args.startdate, args.enddate)
for c in commits:
c.pprint()
c.save()
示例7: GitCommit
# 需要导入模块: from repo import Repo [as 别名]
# 或者: from repo.Repo import loadFromValues [as 别名]
for m in msgs:
if m.committed_date > enddate: continue
# TODO BUG: We are unable to get a git diff of the first commit.
# http://osdir.com/ml/version-control.git/2005-05/msg01309.html
# http://git.661346.n2.nabble.com/git-diff-tree-against-the-root-commit-td5685272.html
if not m.parents: continue
c = GitCommit()
alldiffs = c.getChangedTexts(m)
c.loadFromSource(repo, m.message, m.committed_date, m.stats.files.keys(), m.__str__(), alldiffs)
commits.append(c)
return commits
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Given a repo url, a startdate and enddate, process the commits between.')
parser.add_argument('repo')
parser.add_argument('startdate')
parser.add_argument('enddate')
args = parser.parse_args()
args.startdate, args.enddate = fixDates(args.startdate, args.enddate)
r = Repo()
r.loadFromValues(-1, "", Repo.Type.GIT, args.repo, '', '', '')
commits = getCommits(r, args.startdate, args.enddate)
for c in commits:
print "========================================="
c.pprint()
c.save()