[MERGE] Add tests for iter_patched_from_hunks

John Arbash Meinel john at arbash-meinel.com
Thu Oct 16 19:44:57 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> Hi all,
> 
> This patch adds iter_patched_from_hunks, which reduces the API friction
> for Shelf 2.
> 
> Aaron

I'm pretty sure the preferred call is:

iter(foo)

rather than foo.__iter__()

v- You also need another blank line here:
- -    if orig_lines is not None:
- -        orig_lines = orig_lines.__iter__()
- -    seen_patch = []
     patch_lines = iter_lines_handle_nl(patch_lines.__iter__())
     get_patch_names(patch_lines)
+    return iter_patched_from_hunks(orig_lines, iter_hunks(patch_lines))
+
+def iter_patched_from_hunks(orig_lines, hunks):
+    seen_patch = []
     line_no = 1
- -    for hunk in iter_hunks(patch_lines):
+    if orig_lines is not None:
+        orig_lines = orig_lines.__iter__()
+    for hunk in hunks:
         while line_no < hunk.orig_pos:
             orig_line = orig_lines.next()
             yield orig_line

BB:tweak

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj3i6kACgkQJdeBCYSNAAPYOACgqGpxzGmXD7482A+PevwmoGkE
RZoAoJAJH3NY1YtBmz8NqZMO6JDZ2M1g
=hIWN
-----END PGP SIGNATURE-----



More information about the bazaar mailing list