#NEWLINE# def _split_into_hunks( lines ) : #NEWLINE# #INDENT# '\n    Given an array of lines from the output of a `git-diff` command, yield\n    slices of the lines that correspond to the hunks in the diff.\n    ' #NEWLINE# lines = lines [ 4 : ] #NEWLINE# lines_iter = enumerate ( lines ) #NEWLINE# start = 0 #NEWLINE# if ( len ( lines ) < 1 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for ( line_number , line ) in lines_iter : #NEWLINE# #INDENT# if ( ( not line . startswith ( ( '+' , '-' , '\\' ) ) ) and ( line_number != 0 ) ) : #NEWLINE# #INDENT# ( yield islice ( lines , start , line_number ) ) #NEWLINE# #UNINDENT# if line . startswith ( '@@' ) : #NEWLINE# #INDENT# start = line_number #NEWLINE# #UNINDENT# #UNINDENT# ( yield islice ( lines , start , ( line_number + 1 ) ) )