comparison mercurial/hgweb/webutil.py @ 9402:5d49fdef6fd0

hgweb: show diff header line in raw diffs
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 26 Aug 2009 14:58:09 +0200
parents 46293a0c7e9f
children 8d5de52431f2 25e572394f5c
comparison
equal deleted inserted replaced
9388:f7968bba2307 9402:5d49fdef6fd0
151 for f in files[:max]: 151 for f in files[:max]:
152 yield tmpl('filedifflink', node=hex(node), file=f) 152 yield tmpl('filedifflink', node=hex(node), file=f)
153 if len(files) > max: 153 if len(files) > max:
154 yield tmpl('fileellipses') 154 yield tmpl('fileellipses')
155 155
156 def diffs(repo, tmpl, ctx, files, parity): 156 def diffs(repo, tmpl, ctx, files, parity, style):
157 157
158 def countgen(): 158 def countgen():
159 start = 1 159 start = 1
160 while True: 160 while True:
161 yield start 161 yield start
193 for chunk in patch.diff(repo, node1, node2, m, opts=diffopts): 193 for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
194 if chunk.startswith('diff') and block: 194 if chunk.startswith('diff') and block:
195 yield tmpl('diffblock', parity=parity.next(), 195 yield tmpl('diffblock', parity=parity.next(),
196 lines=prettyprintlines(''.join(block))) 196 lines=prettyprintlines(''.join(block)))
197 block = [] 197 block = []
198 if chunk.startswith('diff'): 198 if chunk.startswith('diff') and style != 'raw':
199 chunk = ''.join(chunk.splitlines(True)[1:]) 199 chunk = ''.join(chunk.splitlines(True)[1:])
200 block.append(chunk) 200 block.append(chunk)
201 yield tmpl('diffblock', parity=parity.next(), 201 yield tmpl('diffblock', parity=parity.next(),
202 lines=prettyprintlines(''.join(block))) 202 lines=prettyprintlines(''.join(block)))
203 203