~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rio.py

  • Committer: Aaron Bentley
  • Date: 2007-03-01 18:16:00 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-20070301181600-vs3elfjgigoskuuk
Reduce max width to 72

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
    else:     # didn't see any content
317
317
        return None    
318
318
 
319
 
def to_patch_lines(stanza):
 
319
def to_patch_lines(stanza, max_width=72):
 
320
    assert max_width > 6
 
321
    max_rio_width = max_width - 4
320
322
    lines = []
321
323
    for pline in stanza.to_lines():
322
324
        for line in pline.split('\n')[:-1]:
323
325
            line = re.sub('\\\\', '\\\\\\\\', line)
324
326
            while len(line) > 0:
325
 
                partline = line[:72]
326
 
                line = line[72:]
 
327
                partline = line[:max_rio_width]
 
328
                line = line[max_rio_width:]
327
329
                if len(line) > 0:
328
330
                    partline += '\\'
329
331
                lines.append('# ' + re.sub('\r', '\\\\r', partline+ '\n'))