Skip to content
Merged
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
8 changes: 4 additions & 4 deletions patch_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def lineno(self):
hunkparsed = False # state after successfully parsed hunk

# regexp to match start of hunk, used groups - 1,3,4,6
re_hunk_start = re.compile(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
re_hunk_start = re.compile(br"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")

self.errors = 0
# temp buffers for header and filenames info
Expand Down Expand Up @@ -575,7 +575,7 @@ def lineno(self):
# strptime function and %z support is patchy, so we drop
# everything from the . onwards and group the year and time
# separately.
re_filename_date_time = b"^--- ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
re_filename_date_time = br"^--- ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
match = re.match(re_filename_date_time, line)
# todo: support spaces in filenames
if match:
Expand Down Expand Up @@ -618,7 +618,7 @@ def lineno(self):
filenames = False
headscan = True
else:
re_filename_date_time = b"^\+\+\+ ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
re_filename_date_time = br"^\+\+\+ ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
match = re.match(re_filename_date_time, line)
if not match:
warning("skipping invalid patch - no target filename at line %d" % (lineno+1))
Expand Down Expand Up @@ -650,7 +650,7 @@ def lineno(self):
continue

if hunkhead:
match = re.match(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line)
match = re.match(br"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line)
if not match:
if not p.hunks:
warning("skipping invalid patch with no hunks for file %s" % p.source)
Expand Down