Show More
@@ -330,11 +330,9 b' def readgitpatch(lr):' | |||
|
330 | 330 | |
|
331 | 331 | class linereader(object): |
|
332 | 332 | # simple class to allow pushing lines back into the input stream |
|
333 |
def __init__(self, fp |
|
|
333 | def __init__(self, fp): | |
|
334 | 334 | self.fp = fp |
|
335 | 335 | self.buf = [] |
|
336 | self.textmode = textmode | |
|
337 | self.eol = None | |
|
338 | 336 | |
|
339 | 337 | def push(self, line): |
|
340 | 338 | if line is not None: |
@@ -345,15 +343,7 b' class linereader(object):' | |||
|
345 | 343 | l = self.buf[0] |
|
346 | 344 | del self.buf[0] |
|
347 | 345 | return l |
|
348 |
|
|
|
349 | if not self.eol: | |
|
350 | if l.endswith('\r\n'): | |
|
351 | self.eol = '\r\n' | |
|
352 | elif l.endswith('\n'): | |
|
353 | self.eol = '\n' | |
|
354 | if self.textmode and l.endswith('\r\n'): | |
|
355 | l = l[:-2] + '\n' | |
|
356 | return l | |
|
346 | return self.fp.readline() | |
|
357 | 347 | |
|
358 | 348 | def __iter__(self): |
|
359 | 349 | while 1: |
@@ -1097,7 +1087,7 b' def scangitpatch(lr, firstline):' | |||
|
1097 | 1087 | fp = lr.fp |
|
1098 | 1088 | except IOError: |
|
1099 | 1089 | fp = cStringIO.StringIO(lr.fp.read()) |
|
1100 |
gitlr = linereader(fp |
|
|
1090 | gitlr = linereader(fp) | |
|
1101 | 1091 | gitlr.push(firstline) |
|
1102 | 1092 | gitpatches = readgitpatch(gitlr) |
|
1103 | 1093 | fp.seek(pos) |
General Comments 0
You need to be logged in to leave comments.
Login now