def run_query(server, cfg, form_data, viewvc_link): query = form_to_cvsdb_query(cfg, form_data) db = cvsdb.ConnectDatabaseReadOnly(cfg) db.RunQuery(query) commit_list = query.GetCommitList() if not commit_list: return [], 0 row_limit_reached = query.GetLimitReached() commits = [] files = [] cvsroots = {} viewvc.expand_root_parents(cfg) rootitems = cfg.general.svn_roots.items() + cfg.general.cvs_roots.items() for key, value in rootitems: cvsroots[cvsdb.CleanRepository(value)] = key current_desc = commit_list[0].GetDescription() for commit in commit_list: desc = commit.GetDescription() if current_desc == desc: files.append(commit) continue commits.append( build_commit(server, cfg, current_desc, files, cvsroots, viewvc_link)) files = [commit] current_desc = desc ## add the last file group to the commit list commits.append( build_commit(server, cfg, current_desc, files, cvsroots, viewvc_link)) # Strip out commits that don't have any files attached to them. The # files probably aren't present because they've been blocked via # forbiddenness. def _only_with_files(commit): return len(commit.files) > 0 commits = filter(_only_with_files, commits) return commits, row_limit_reached
def run_query(server, cfg, form_data, viewvc_link): query = form_to_cvsdb_query(cfg, form_data) db = cvsdb.ConnectDatabaseReadOnly(cfg) db.RunQuery(query) commit_list = query.GetCommitList() if not commit_list: return [ ], 0 row_limit_reached = query.GetLimitReached() commits = [ ] files = [ ] cvsroots = {} viewvc.expand_root_parents(cfg) rootitems = cfg.general.svn_roots.items() + cfg.general.cvs_roots.items() for key, value in rootitems: cvsroots[cvsdb.CleanRepository(value)] = key current_desc = commit_list[0].GetDescription() for commit in commit_list: desc = commit.GetDescription() if current_desc == desc: files.append(commit) continue commits.append(build_commit(server, cfg, current_desc, files, cvsroots, viewvc_link)) files = [ commit ] current_desc = desc ## add the last file group to the commit list commits.append(build_commit(server, cfg, current_desc, files, cvsroots, viewvc_link)) # Strip out commits that don't have any files attached to them. The # files probably aren't present because they've been blocked via # forbiddenness. def _only_with_files(commit): return len(commit.files) > 0 commits = filter(_only_with_files, commits) return commits, row_limit_reached