85 m = self.HunkHeaderRegexp.match(line) |
85 m = self.HunkHeaderRegexp.match(line) |
86 if m: |
86 if m: |
87 self.__hunks.append(self.__initHunk()) |
87 self.__hunks.append(self.__initHunk()) |
88 self.__hunks[-1]["start"] = lineIdx |
88 self.__hunks[-1]["start"] = lineIdx |
89 (self.__hunks[-1]["oldStart"], |
89 (self.__hunks[-1]["oldStart"], |
90 self.__hunks[-1]["oldCount"]) = \ |
90 self.__hunks[-1]["oldCount"]) = self.__parseRange( |
91 self.__parseRange(m.group(1)) |
91 m.group(1)) |
92 (self.__hunks[-1]["newStart"], |
92 (self.__hunks[-1]["newStart"], |
93 self.__hunks[-1]["newCount"]) = \ |
93 self.__hunks[-1]["newCount"]) = self.__parseRange( |
94 self.__parseRange(m.group(2)) |
94 m.group(2)) |
95 self.__hunks[-1]["heading"] = m.group(3) |
95 self.__hunks[-1]["heading"] = m.group(3) |
96 elif not self.__hunks: |
96 elif not self.__hunks: |
97 raise AssertionError("Malformed hunk header: '{0}'" |
97 raise AssertionError("Malformed hunk header: '{0}'" |
98 .format(line)) |
98 .format(line)) |
99 self.__hunks[-1]["lines"].append(line) |
99 self.__hunks[-1]["lines"].append(line) |
197 start=hunk["start"] + 1): |
197 start=hunk["start"] + 1): |
198 lineType = line[0] |
198 lineType = line[0] |
199 lineContent = line[1:] |
199 lineContent = line[1:] |
200 |
200 |
201 if not (startIndex <= lineIndex <= endIndex): |
201 if not (startIndex <= lineIndex <= endIndex): |
202 if (not reverse and lineType == ADDITION) or \ |
202 if ( |
203 (reverse and lineType == DELETION): |
203 (not reverse and lineType == ADDITION) or |
|
204 (reverse and lineType == DELETION) |
|
205 ): |
204 previousLineSkipped = True |
206 previousLineSkipped = True |
205 continue |
207 continue |
206 |
208 |
207 elif (not reverse and lineType == DELETION) or \ |
209 elif ( |
208 (reverse and lineType == ADDITION): |
210 (not reverse and lineType == DELETION) or |
|
211 (reverse and lineType == ADDITION) |
|
212 ): |
209 lineType = CONTEXT |
213 lineType = CONTEXT |
210 |
214 |
211 if lineType == NONEWLINE and previousLineSkipped: |
215 if lineType == NONEWLINE and previousLineSkipped: |
212 continue |
216 continue |
213 |
217 |