/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 grep.py

  • Committer: Parth Malwankar
  • Date: 2010-03-16 18:13:12 UTC
  • mto: (0.44.2 grep) (6531.3.1 merge-grep)
  • mto: This revision was merged to the branch mainline in revision 6555.
  • Revision ID: parth.malwankar@gmail.com-20100316181312-9f5tewwid6t4flh5
replaced split with splitlines

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
    if print_revno and line_number:
222
222
 
223
223
        pfmt = "~%s:%d:%s".encode(_terminal_encoding)
224
 
        for index, line in enumerate(file_text.split("\n")):
 
224
        for index, line in enumerate(file_text.splitlines()):
225
225
            if patternc.search(line):
226
226
                line = line.decode(_terminal_encoding, 'replace')
227
227
                outf.write(path + (pfmt % (revno, index+1, line)) + eol_marker)
229
229
    elif print_revno and not line_number:
230
230
 
231
231
        pfmt = "~%s:%s".encode(_terminal_encoding)
232
 
        for line in file_text.split("\n"):
 
232
        for line in file_text.splitlines():
233
233
            if patternc.search(line):
234
234
                line = line.decode(_terminal_encoding, 'replace')
235
235
                outf.write(path + (pfmt % (revno, line)) + eol_marker)
237
237
    elif not print_revno and line_number:
238
238
 
239
239
        pfmt = ":%d:%s".encode(_terminal_encoding)
240
 
        for index, line in enumerate(file_text.split("\n")):
 
240
        for index, line in enumerate(file_text.splitlines()):
241
241
            if patternc.search(line):
242
242
                line = line.decode(_terminal_encoding, 'replace')
243
243
                outf.write(path + (pfmt % (index+1, line)) + eol_marker)
245
245
    else:
246
246
 
247
247
        pfmt = ":%s".encode(_terminal_encoding)
248
 
        for line in file_text.split("\n"):
 
248
        for line in file_text.splitlines():
249
249
            if patternc.search(line):
250
250
                line = line.decode(_terminal_encoding, 'replace')
251
251
                outf.write(path + (pfmt % (line,)) + eol_marker)