"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/cvsdb.py" between
viewvc-1.1.28.tar.gz and viewvc-1.2.1.tar.gz

About: ViewVC is a browser interface for CVS and Subversion version control repositories.

cvsdb.py  (viewvc-1.1.28):cvsdb.py  (viewvc-1.2.1)
skipping to change at line 15 skipping to change at line 15
# By using this file, you agree to the terms and conditions set forth in # By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC # the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html. # distribution or at http://viewvc.org/license-1.html.
# #
# For more information, visit http://viewvc.org/ # For more information, visit http://viewvc.org/
# #
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
import os import os
import sys import sys
import string
import time import time
import fnmatch import fnmatch
import re import re
import vclib import vclib
import dbi import dbi
## Current commits database schema version number. ## Current commits database schema version number.
## ##
## Version 0 was the original Bonsai-compatible version. ## Version 0 was the original Bonsai-compatible version.
skipping to change at line 373 skipping to change at line 372
data = '^' + data data = '^' + data
if data[-7:] == '\Z(?ms)': if data[-7:] == '\Z(?ms)':
data = data[:-7] + '$' data = data[:-7] + '$'
elif query_entry.match == "regex": elif query_entry.match == "regex":
match = " REGEXP " match = " REGEXP "
elif query_entry.match == "notregex": elif query_entry.match == "notregex":
match = " NOT REGEXP " match = " NOT REGEXP "
sqlList.append("%s%s%s" % (field, match, self.db.literal(data))) sqlList.append("%s%s%s" % (field, match, self.db.literal(data)))
return "(%s)" % (string.join(sqlList, " OR ")) return "(%s)" % (" OR ".join(sqlList))
def CreateSQLQueryString(self, query, detect_leftover=0): def CreateSQLQueryString(self, query, detect_leftover=0):
commits_table = self.GetCommitsTable() commits_table = self.GetCommitsTable()
tableList = [(commits_table, None)] tableList = [(commits_table, None)]
condList = [] condList = []
if len(query.repository_list): if len(query.repository_list):
tableList.append(("repositories", tableList.append(("repositories",
"(%s.repositoryid=repositories.id)" "(%s.repositoryid=repositories.id)"
% (commits_table))) % (commits_table)))
skipping to change at line 452 skipping to change at line 451
## conditions from table names. In future, the join conditions ## conditions from table names. In future, the join conditions
## might be handled by INNER JOIN statements instead of WHERE ## might be handled by INNER JOIN statements instead of WHERE
## clauses, but MySQL 3.22 apparently doesn't support them well. ## clauses, but MySQL 3.22 apparently doesn't support them well.
tables = [] tables = []
joinConds = [] joinConds = []
for (table, cond) in tableList: for (table, cond) in tableList:
if table not in tables: if table not in tables:
tables.append(table) tables.append(table)
if cond is not None: joinConds.append(cond) if cond is not None: joinConds.append(cond)
tables = string.join(tables, ",") tables = ",".join(tables)
conditions = string.join(joinConds + condList, " AND ") conditions = " AND ".join(joinConds + condList)
conditions = conditions and "WHERE %s" % conditions conditions = conditions and "WHERE %s" % conditions
## apply the query's row limit, if any (so we avoid really ## apply the query's row limit, if any (so we avoid really
## slamming a server with a large database) ## slamming a server with a large database)
limit = "" limit = ""
if query.limit: if query.limit:
if detect_leftover: if detect_leftover:
limit = "LIMIT %s" % (str(query.limit + 1)) limit = "LIMIT %s" % (str(query.limit + 1))
else: else:
limit = "LIMIT %s" % (str(query.limit)) limit = "LIMIT %s" % (str(query.limit))
skipping to change at line 910 skipping to change at line 909
cfg.cvsdb.database_name) cfg.cvsdb.database_name)
db.Connect() db.Connect()
return db return db
def ConnectDatabaseReadOnly(cfg): def ConnectDatabaseReadOnly(cfg):
return ConnectDatabase(cfg, 1) return ConnectDatabase(cfg, 1)
def GetCommitListFromRCSFile(repository, path_parts, revision=None): def GetCommitListFromRCSFile(repository, path_parts, revision=None):
commit_list = [] commit_list = []
directory = string.join(path_parts[:-1], "/") directory = "/".join(path_parts[:-1])
file = path_parts[-1] file = path_parts[-1]
revs = repository.itemlog(path_parts, revision, vclib.SORTBY_DEFAULT, revs = repository.itemlog(path_parts, revision, vclib.SORTBY_DEFAULT,
0, 0, {"cvs_pass_rev": 1}) 0, 0, {"cvs_pass_rev": 1})
for rev in revs: for rev in revs:
commit = CreateCommit() commit = CreateCommit()
commit.SetRepository(repository.rootpath) commit.SetRepository(repository.rootpath)
commit.SetDirectory(directory) commit.SetDirectory(directory)
commit.SetFile(file) commit.SetFile(file)
commit.SetRevision(rev.string) commit.SetRevision(rev.string)
commit.SetAuthor(rev.author) commit.SetAuthor(rev.author)
commit.SetDescription(rev.log) commit.SetDescription(rev.log)
commit.SetTime(rev.date) commit.SetTime(rev.date)
if rev.changed: if rev.changed:
# extract the plus/minus and drop the sign # extract the plus/minus and drop the sign
plus, minus = string.split(rev.changed) plus, minus = rev.changed.split()
commit.SetPlusCount(plus[1:]) commit.SetPlusCount(plus[1:])
commit.SetMinusCount(minus[1:]) commit.SetMinusCount(minus[1:])
if rev.dead: if rev.dead:
commit.SetTypeRemove() commit.SetTypeRemove()
else: else:
commit.SetTypeChange() commit.SetTypeChange()
else: else:
commit.SetTypeAdd() commit.SetTypeAdd()
 End of changes. 5 change blocks. 
6 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)