Some fixes to the 'diff' view.
While this would appear to fix the problems Aaron Craven <viewcvs@vickerscraven.net> has been seeing with respect to HTML escaping levels of diff output, this is a fluke. A real problem (not addressed here) is that raw_diff() is that basically, any time raw_diff() is called with 'parseheader' set, it is treating the whole diff output as headers (the early outs aren't firing). This is broken, and rather defeats the point of attempting streamy diffs since we're collecting the whole thing into an array in memory. * lib/viewcvs.py (raw_diff): Don't forget to htmlize() headers if so requested. (view_diff): Use 'unidiff' as the diff format choice if asked to make a patch for 'side-by-side' mode. 'Unidiff' and 'context diff' are the only valid patch formats, as far as we are concerned. Also, fix a little comment typo. Finally, revert my previous change, where I added an extra MarkupPipeWrapper around the file object returned from raw_diff() -- this was bogus, as raw_diff() should have been htmlifying stuff anyway. git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1052 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/tags/1.0.0-rc1
parent
5fb004046a
commit
949c6a196d
|
@ -2490,6 +2490,8 @@ def raw_diff(rootpath, fp, sym1, sym2, unified, parseheader, htmlize):
|
|||
if sym2:
|
||||
line = line[:-1] + ' %s\n' % sym2
|
||||
parsing = 0
|
||||
if htmlize:
|
||||
line = htmlify(line)
|
||||
header_lines.append(line)
|
||||
|
||||
return date1, date2, MarkupPipeWrapper(fp, string.join(header_lines, ''),
|
||||
|
@ -2560,9 +2562,10 @@ def view_diff(request):
|
|||
format = query_dict.get('diff_format', cfg.options.diff_format)
|
||||
makepatch = int(request.query_dict.get('makepatch', 0))
|
||||
|
||||
# If 'makepatch' was specified with a colored diff, just fall back
|
||||
# to straight unidiff (though, we could throw an error).
|
||||
if makepatch and (format == 'h' or format == 'l'):
|
||||
# If 'makepatch' was specified with any diff besides unidiff or
|
||||
# context diff, just fall back to straight unidiff (though, we could
|
||||
# throw an error).
|
||||
if makepatch and format != 'u' and format != 'c':
|
||||
format = 'u'
|
||||
|
||||
if format == 'c':
|
||||
|
@ -2594,11 +2597,12 @@ def view_diff(request):
|
|||
args.append('-w')
|
||||
if cfg.options.hr_ignore_keyword_subst and request.roottype == 'cvs':
|
||||
# -kk isn't a regular diff option. it exists only for rcsdiff
|
||||
# (as in "-ksubst") ,so 'svn' roottypes can't use it.
|
||||
# (as in "-ksubst"), so 'svn' roottypes can't use it.
|
||||
args.append('-kk')
|
||||
|
||||
file1 = None
|
||||
file2 = None
|
||||
|
||||
if request.roottype == 'cvs':
|
||||
rcsfile = request.repos.rcsfile(request.path_parts, 1)
|
||||
args[len(args):] = ['-r' + rev1, '-r' + rev2, rcsfile]
|
||||
|
@ -2671,7 +2675,6 @@ def view_diff(request):
|
|||
else:
|
||||
date1, date2, raw_diff_fp = raw_diff(request.repos.rootpath, fp,
|
||||
sym1, sym2, unified, parseheaders, 1)
|
||||
raw_diff_fp = MarkupPipeWrapper(raw_diff_fp, htmlize=1)
|
||||
|
||||
data.update({
|
||||
'date1' : date1 and rcsdiff_date_reformat(date1),
|
||||
|
|
Loading…
Reference in New Issue