##// END OF EJS Templates
web: include all files in the diffstat...
Steven Brown -
r14561:925d9f2b default
parent child Browse files
Show More
@@ -212,24 +212,23 b' def diffs(repo, tmpl, ctx, files, parity'
212 lines=prettyprintlines(''.join(block)))
212 lines=prettyprintlines(''.join(block)))
213
213
214 def diffstat(tmpl, ctx, parity):
214 def diffstat(tmpl, ctx, parity):
215 '''Return a diffstat template for each file in the cset.'''
215 '''Return a diffstat template for each file in the diff.'''
216
216
217 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
217 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
218 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)
218 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)
219 files = ctx.files()
219
220
220 statsdict = {}
221 def pct(i):
221 if maxtotal > 0:
222 if maxtotal == 0:
222 for filename, adds, removes, isbinary in stats:
223 return 0
223 total = adds + removes
224 return (float(i) / maxtotal) * 100
224 addpct = (float(adds) / maxtotal) * 100
225 removepct = (float(removes) / maxtotal) * 100
226 statsdict[filename] = (total, addpct, removepct)
227
225
228 for f in ctx.files():
226 for filename, adds, removes, isbinary in stats:
229 template = f in ctx and 'diffstatlink' or 'diffstatnolink'
227 template = filename in files and 'diffstatlink' or 'diffstatnolink'
230 total, addpct, removepct = statsdict.get(f, ('', 0, 0))
228 total = adds + removes
231 yield tmpl(template, node=ctx.hex(), file=f, total=total,
229 yield tmpl(template, node=ctx.hex(), file=filename,
232 addpct=addpct, removepct=removepct, parity=parity.next())
230 total=total, addpct=pct(adds), removepct=pct(removes),
231 parity=parity.next())
233
232
234 class sessionvars(object):
233 class sessionvars(object):
235 def __init__(self, vars, start='?'):
234 def __init__(self, vars, start='?'):
General Comments 0
You need to be logged in to leave comments. Login now