~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rio.py

  • Committer: Aaron Bentley
  • Date: 2007-03-02 16:08:31 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: abentley@panoramicfeedback.com-20070302160831-awgljsprb3y5lm6f
Indent line continuations in Patch-RIO, to improve readability

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
                if len(line) > 0 and line[0] != [' ']:
330
330
                    break_index = -1
331
331
                    break_index = partline.rfind(' ', -20)
332
 
                    if break_index in (0, -1):
 
332
                    if break_index < 3:
333
333
                        break_index = partline.rfind('-', -20)
334
334
                        break_index += 1
335
 
                    if break_index in (0, -1):
 
335
                    if break_index < 3:
336
336
                        break_index = partline.rfind('/', -20)
337
 
                    if break_index not in (0, -1):
 
337
                    if break_index >= 3:
338
338
                        line = partline[break_index:] + line
339
339
                        partline = partline[:break_index]
 
340
                if len(line) > 0:
 
341
                    line = '  ' + line
340
342
                partline = re.sub('\r', '\\\\r', partline)
341
343
                blank_line = False
342
344
                if len(line) > 0:
346
348
                    blank_line = True
347
349
                lines.append('# ' + partline + '\n')
348
350
                if blank_line:
349
 
                    lines.append('# \n')
 
351
                    lines.append('#   \n')
350
352
    return lines
351
353
 
 
354
 
352
355
def _patch_stanza_iter(line_iter):
353
356
    map = {'\\\\': '\\',
354
357
           '\\r' : '\r',
363
366
        else:
364
367
            assert line.startswith('#')
365
368
            line = line[1:]
 
369
        if last_line is not None and len(line) > 2:
 
370
            line = line[2:]
366
371
        line = re.sub('\r', '', line)
367
372
        line = re.sub('\\\\(.|\n)', mapget, line)
368
373
        if last_line is None:
375
380
    if last_line is not None:
376
381
        yield last_line
377
382
 
 
383
 
378
384
def read_patch_stanza(line_iter):
379
385
    return read_stanza(_patch_stanza_iter(line_iter))