当前位置: 首页>>代码示例>>Python>>正文


Python Repo.loadFromValues方法代码示例

本文整理汇总了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
开发者ID:deepcell,项目名称:code-audit-feed,代码行数:37,代码来源:databaseQueries.py

示例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
开发者ID:sirvaliance,项目名称:code-audit-feed,代码行数:48,代码来源:databaseQueries.py

示例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
开发者ID:abeluck,项目名称:code-peer-review,代码行数:48,代码来源:databaseQueries.py

示例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
开发者ID:sirvaliance,项目名称:code-audit-feed,代码行数:46,代码来源:databaseQueries.py

示例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()
开发者ID:deepcell,项目名称:code-audit-feed,代码行数:32,代码来源:gitpuller.py

示例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()
开发者ID:sirvaliance,项目名称:code-audit-feed,代码行数:32,代码来源:svnpuller.py

示例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()
开发者ID:abeluck,项目名称:code-peer-review,代码行数:32,代码来源:gitpuller.py


注:本文中的repo.Repo.loadFromValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。