/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 bzrlib/patches.py

  • Committer: Aaron Bentley
  • Date: 2008-10-16 19:04:48 UTC
  • mto: (3363.19.4 fix-iter-changes)
  • mto: This revision was merged to the branch mainline in revision 3781.
  • Revision ID: aaron@aaronbentley.com-20081016190448-2a4ilw7bqsw08190
Updates from review (and a doc update)

Show diffs side-by-side

added added

removed removed

Lines of Context:
393
393
    """Iterate through a series of lines with a patch applied.
394
394
    This handles a single file, and does exact, not fuzzy patching.
395
395
    """
396
 
    patch_lines = iter_lines_handle_nl(patch_lines.__iter__())
 
396
    patch_lines = iter_lines_handle_nl(iter(patch_lines))
397
397
    get_patch_names(patch_lines)
398
398
    return iter_patched_from_hunks(orig_lines, iter_hunks(patch_lines))
399
399
 
 
400
 
400
401
def iter_patched_from_hunks(orig_lines, hunks):
 
402
    """Iterate through a series of lines with a patch applied.
 
403
    This handles a single file, and does exact, not fuzzy patching.
 
404
 
 
405
    :param orig_lines: The unpatched lines.
 
406
    :param hunks: An iterable of Hunk instances.
 
407
    """
401
408
    seen_patch = []
402
409
    line_no = 1
403
410
    if orig_lines is not None:
404
 
        orig_lines = orig_lines.__iter__()
 
411
        orig_lines = iter(orig_lines)
405
412
    for hunk in hunks:
406
413
        while line_no < hunk.orig_pos:
407
414
            orig_line = orig_lines.next()