* lib/viewcvs.py
  (raw_diff): Rootpath only shows up in Subversion diffs, not CVS.  So
    look for headers in a slightly less demanding way, replacing the
    rootpath if it appears, but certainly not caching the whole diff
    in memory if it doesn't.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1056 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
cmpilato 2005-04-18 23:35:37 +00:00
parent c6cef2c309
commit 543de7e0f7
1 changed files with 12 additions and 6 deletions

View File

@ -2462,27 +2462,33 @@ def raw_diff(rootpath, fp, sym1, sym2, unified, parseheader, htmlize):
# the filepointer.
if parseheader:
if unified:
f1 = '--- ' + rootpath
f2 = '+++ ' + rootpath
f1 = '--- '
f2 = '+++ '
else:
f1 = '*** ' + rootpath
f2 = '--- ' + rootpath
f1 = '*** '
f2 = '--- '
parsing = 1
len_f1 = len(f1)
len_f2 = len(f2)
while parsing:
line = fp.readline()
if not line:
break
if line[:len(f1)] == f1:
# Hide the rootpath, if present at the start of the path.
if string.find(line, rootpath) == len_f1:
line = line[:len_f1] + line[len_f1+len(rootpath):]
match = _re_extract_rev.match(line)
if match:
date1 = match.group(1)
line = string.replace(line, rootpath + '/', '')
if sym1:
line = line[:-1] + ' %s\n' % sym1
elif line[:len(f2)] == f2:
line = string.replace(line, rootpath + '/', '')
# Hide the rootpath, if present at the start of the path.
if string.find(line, rootpath) == len_f2:
line = line[:len_f2] + line[len_f2+len(rootpath):]
match = _re_extract_rev.match(line)
if match:
date2 = match.group(1)