Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,17 +401,20 @@ def lineno(self):
# process line first
if re.match(b"^[- \\+\\\\]", line):
# gather stats about line endings
rc_count = line.strip(b"\r\n").count('\r')
if line.endswith(b"\r\n"):
p.hunkends["crlf"] += 1
elif line.endswith(b"\n"):
p.hunkends["lf"] += 1
elif line.endswith(b"\r"):
p.hunkends["cr"] += 1
p.hunkends["cr"] += rc_count

if line.startswith(b"-"):
hunkactual["linessrc"] += 1
elif line.startswith(b"+"):
hunkactual["linestgt"] += 1
hunkactual["linestgt"] += rc_count
elif not line.startswith(b"\\"):
hunkactual["linessrc"] += 1
hunkactual["linestgt"] += 1
Expand Down