Show More
@@ -255,10 +255,7 def parsepatch(fp): | |||
|
255 | 255 | |
|
256 | 256 | def filterpatch(ui, chunks): |
|
257 | 257 | """Interactively filter patch chunks into applied-only chunks""" |
|
258 | chunks = list(chunks) | |
|
259 | chunks.reverse() | |
|
260 | seen = set() | |
|
261 | def consumefile(): | |
|
258 | def consumefile(chunks): | |
|
262 | 259 | """fetch next portion from chunks until a 'header' is seen |
|
263 | 260 | NB: header == new-file mark |
|
264 | 261 | """ |
@@ -266,10 +263,12 def filterpatch(ui, chunks): | |||
|
266 | 263 | while chunks: |
|
267 | 264 | if isinstance(chunks[-1], header): |
|
268 | 265 | break |
|
269 | else: | |
|
270 | consumed.append(chunks.pop()) | |
|
266 | consumed.append(chunks.pop()) | |
|
271 | 267 | return consumed |
|
272 | 268 | |
|
269 | chunks = list(chunks) | |
|
270 | chunks.reverse() | |
|
271 | seen = set() | |
|
273 | 272 | resp_all = [None] # this two are changed from inside prompt, |
|
274 | 273 | resp_file = [None] # so can't be usual variables |
|
275 | 274 | applied = {} # 'filename' -> [] of chunks |
@@ -332,7 +331,7 def filterpatch(ui, chunks): | |||
|
332 | 331 | fixoffset = 0 |
|
333 | 332 | hdr = ''.join(chunk.header) |
|
334 | 333 | if hdr in seen: |
|
335 | consumefile() | |
|
334 | consumefile(chunks) | |
|
336 | 335 | continue |
|
337 | 336 | seen.add(hdr) |
|
338 | 337 | if resp_all[0] is None: |
@@ -342,9 +341,9 def filterpatch(ui, chunks): | |||
|
342 | 341 | if r: |
|
343 | 342 | applied[chunk.filename()] = [chunk] |
|
344 | 343 | if chunk.allhunks(): |
|
345 | applied[chunk.filename()] += consumefile() | |
|
344 | applied[chunk.filename()] += consumefile(chunks) | |
|
346 | 345 | else: |
|
347 | consumefile() | |
|
346 | consumefile(chunks) | |
|
348 | 347 | else: |
|
349 | 348 | # new hunk |
|
350 | 349 | if resp_file[0] is None and resp_all[0] is None: |
General Comments 0
You need to be logged in to leave comments.
Login now