# HG changeset patch # User Yuya Nishihara # Date 2018-04-04 12:14:30 # Node ID 4e407c7b1fbdc3d08f28cbe55c2184985b610d92 # Parent c0ccbf4fbe472d54c82ba30b01c42db57d13c598 hgweb: rename 'context' argument of webutil.compare() to avoid name conflicts The meaning of 'context' depends on context. Here it is the number of the context lines in unified diff. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -622,14 +622,14 @@ def _getcompblock(leftlines, rightlines, return templateutil.mappinggenerator(_getcompblockgen, args=args, name='comparisonline') -def compare(tmpl, context, leftlines, rightlines): +def compare(tmpl, contextnum, leftlines, rightlines): '''Generator function that provides side-by-side comparison data.''' s = difflib.SequenceMatcher(None, leftlines, rightlines) - if context < 0: + if contextnum < 0: l = _getcompblock(leftlines, rightlines, s.get_opcodes()) yield tmpl.generate('comparisonblock', {'lines': l}) else: - for oc in s.get_grouped_opcodes(n=context): + for oc in s.get_grouped_opcodes(n=contextnum): l = _getcompblock(leftlines, rightlines, oc) yield tmpl.generate('comparisonblock', {'lines': l})