/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/patches.py

  • Committer: Breezy landing bot
  • Author(s): Martin
  • Date: 2017-05-26 09:35:13 UTC
  • mfrom: (6634.2.2 next_up_next)
  • Revision ID: breezy.the.bot@gmail.com-20170526093513-funr1gww70uc4mag
Make iterator objects and use of next Python 3 compatible

Merged from https://code.launchpad.net/~gz/brz/next_up_next/+merge/324586

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
 
35
35
def get_patch_names(iter_lines):
36
 
    line = iter_lines.next()
 
36
    line = next(iter_lines)
37
37
    try:
38
38
        match = re.match(binary_files_re, line)
39
39
        if match is not None:
45
45
    except StopIteration:
46
46
        raise MalformedPatchHeader("No orig line", "")
47
47
    try:
48
 
        line = iter_lines.next()
 
48
        line = next(iter_lines)
49
49
        if not line.startswith("+++ "):
50
50
            raise PatchSyntax("No mod name")
51
51
        else:
244
244
        orig_size = 0
245
245
        mod_size = 0
246
246
        while orig_size < hunk.orig_range or mod_size < hunk.mod_range:
247
 
            hunk_line = parse_line(iter_lines.next())
 
247
            hunk_line = parse_line(next(iter_lines))
248
248
            hunk.lines.append(hunk_line)
249
249
            if isinstance(hunk_line, (RemoveLine, ContextLine)):
250
250
                orig_size += 1
483
483
        orig_lines = iter(orig_lines)
484
484
    for hunk in hunks:
485
485
        while line_no < hunk.orig_pos:
486
 
            orig_line = orig_lines.next()
 
486
            orig_line = next(orig_lines)
487
487
            yield orig_line
488
488
            line_no += 1
489
489
        for hunk_line in hunk.lines:
491
491
            if isinstance(hunk_line, InsertLine):
492
492
                yield hunk_line.contents
493
493
            elif isinstance(hunk_line, (ContextLine, RemoveLine)):
494
 
                orig_line = orig_lines.next()
 
494
                orig_line = next(orig_lines)
495
495
                if orig_line != hunk_line.contents:
496
496
                    raise PatchConflict(line_no, orig_line, "".join(seen_patch))
497
497
                if isinstance(hunk_line, ContextLine):