[PATCH 05 of 10] diffhelpers: naming and whitespace cleanup
Yuya Nishihara
yuya at tcha.org
Wed Apr 11 11:33:55 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1523274774 -32400
# Mon Apr 09 20:52:54 2018 +0900
# Node ID 69d8de4156f5a230b8abc73d87e5aeb46ceb5b06
# Parent 79d149236bfa8ebfb221573ad33b8f8f715fde7d
diffhelpers: naming and whitespace cleanup
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1372,7 +1372,7 @@ class hunk(object):
def _fixnewline(self, lr):
l = lr.readline()
if l.startswith('\ '):
- diffhelpers.fix_newline(self.hunk, self.a, self.b)
+ diffhelpers.fixnewline(self.hunk, self.a, self.b)
else:
lr.push(l)
diff --git a/mercurial/pure/diffhelpers.py b/mercurial/pure/diffhelpers.py
--- a/mercurial/pure/diffhelpers.py
+++ b/mercurial/pure/diffhelpers.py
@@ -23,7 +23,7 @@ def addlines(fp, hunk, lena, lenb, a, b)
for i in xrange(num):
s = fp.readline()
if s == "\\ No newline at end of file\n":
- fix_newline(hunk, a, b)
+ fixnewline(hunk, a, b)
continue
if s == "\n":
# Some patches may be missing the control char
@@ -39,7 +39,7 @@ def addlines(fp, hunk, lena, lenb, a, b)
a.append(s)
return 0
-def fix_newline(hunk, a, b):
+def fixnewline(hunk, a, b):
"""Fix up the last lines of a and b when the patch has no newline at EOF"""
l = hunk[-1]
# tolerate CRLF in last line
@@ -55,7 +55,6 @@ def fix_newline(hunk, a, b):
hunk[-1] = hline
return 0
-
def testhunk(a, b, bstart):
"""Compare the lines in a with the lines in b
More information about the Mercurial-devel
mailing list