Patchwork [08,of,10] hgweb: rename 'context' argument of webutil.compare() to avoid name conflicts

login
register
mail settings
Submitter Yuya Nishihara
Date May 12, 2018, 3:35 a.m.
Message ID <94ed335f53c7c5fb2b2c.1526096115@mimosa>
Download mbox | patch
Permalink /patch/31538/
State Accepted
Headers show

Comments

Yuya Nishihara - May 12, 2018, 3:35 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522844070 -32400
#      Wed Apr 04 21:14:30 2018 +0900
# Node ID 94ed335f53c7c5fb2b2c9b36d452c3ae47d0c8f1
# Parent  7abacae707546867c2a1cd0f2046297805b89299
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.

Patch

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})