Mercurial > hg
comparison mercurial/hgweb/webutil.py @ 38566:1770416de208
webutil: pass a diffopts object to context.diff
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sat, 23 Jun 2018 14:42:58 +0200 |
parents | 4455e5d4d59c |
children | 66eb74f9d87d |
comparison
equal
deleted
inserted
replaced
38565:6ec996e8c9bc | 38566:1770416de208 |
---|---|
39 ui as uimod, | 39 ui as uimod, |
40 util, | 40 util, |
41 ) | 41 ) |
42 | 42 |
43 from ..utils import ( | 43 from ..utils import ( |
44 diffutil, | |
44 stringutil, | 45 stringutil, |
45 ) | 46 ) |
46 | 47 |
47 archivespecs = util.sortdict(( | 48 archivespecs = util.sortdict(( |
48 ('zip', ('application/zip', 'zip', '.zip', None)), | 49 ('zip', ('application/zip', 'zip', '.zip', None)), |
204 if len(siblings) == 1 and siblings[0].rev() == hiderev: | 205 if len(siblings) == 1 and siblings[0].rev() == hiderev: |
205 siblings = [] | 206 siblings = [] |
206 return templateutil.mappinggenerator(_ctxsgen, args=(siblings,)) | 207 return templateutil.mappinggenerator(_ctxsgen, args=(siblings,)) |
207 | 208 |
208 def difffeatureopts(req, ui, section): | 209 def difffeatureopts(req, ui, section): |
209 diffopts = patch.difffeatureopts(ui, untrusted=True, | 210 diffopts = diffutil.difffeatureopts(ui, untrusted=True, |
210 section=section, whitespace=True) | 211 section=section, whitespace=True) |
211 | 212 |
212 for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): | 213 for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): |
213 v = req.qsparams.get(k) | 214 v = req.qsparams.get(k) |
214 if v is not None: | 215 if v is not None: |
215 v = stringutil.parsebool(v) | 216 v = stringutil.parsebool(v) |
655 name='comparisonblock') | 656 name='comparisonblock') |
656 | 657 |
657 def diffstatgen(ctx, basectx): | 658 def diffstatgen(ctx, basectx): |
658 '''Generator function that provides the diffstat data.''' | 659 '''Generator function that provides the diffstat data.''' |
659 | 660 |
661 diffopts = patch.diffopts(ctx._repo.ui, {'noprefix': False}) | |
660 stats = patch.diffstatdata( | 662 stats = patch.diffstatdata( |
661 util.iterlines(ctx.diff(basectx, opts={'noprefix': False}))) | 663 util.iterlines(ctx.diff(basectx, opts=diffopts))) |
662 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats) | 664 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats) |
663 while True: | 665 while True: |
664 yield stats, maxname, maxtotal, addtotal, removetotal, binary | 666 yield stats, maxname, maxtotal, addtotal, removetotal, binary |
665 | 667 |
666 def diffsummary(statgen): | 668 def diffsummary(statgen): |