/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 bzrlib/log.py

  • Committer: Andrew Bennetts
  • Date: 2009-12-18 08:22:42 UTC
  • mfrom: (4906 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4909.
  • Revision ID: andrew.bennetts@canonical.com-20091218082242-f7wy9tlk0yxvkkju
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1293
1293
    preferred_levels = 0
1294
1294
 
1295
1295
    def __init__(self, to_file, show_ids=False, show_timezone='original',
1296
 
            delta_format=None, levels=None, show_advice=False):
 
1296
            delta_format=None, levels=None, show_advice=False,
 
1297
            to_exact_file=None):
1297
1298
        """Create a LogFormatter.
1298
1299
 
1299
1300
        :param to_file: the file to output to
 
1301
        :param to_exact_file: if set, gives an output stream to which 
 
1302
             non-Unicode diffs are written.
1300
1303
        :param show_ids: if True, revision-ids are to be displayed
1301
1304
        :param show_timezone: the timezone to use
1302
1305
        :param delta_format: the level of delta information to display
1309
1312
        self.to_file = to_file
1310
1313
        # 'exact' stream used to show diff, it should print content 'as is'
1311
1314
        # and should not try to decode/encode it to unicode to avoid bug #328007
1312
 
        self.to_exact_file = getattr(to_file, 'stream', to_file)
 
1315
        if to_exact_file is not None:
 
1316
            self.to_exact_file = to_exact_file
 
1317
        else:
 
1318
            # XXX: somewhat hacky; this assumes it's a codec writer; it's better
 
1319
            # for code that expects to get diffs to pass in the exact file
 
1320
            # stream
 
1321
            self.to_exact_file = getattr(to_file, 'stream', to_file)
1313
1322
        self.show_ids = show_ids
1314
1323
        self.show_timezone = show_timezone
1315
1324
        if delta_format is None:
1494
1503
                                short_status=False)
1495
1504
        if revision.diff is not None:
1496
1505
            to_file.write(indent + 'diff:\n')
 
1506
            to_file.flush()
1497
1507
            # Note: we explicitly don't indent the diff (relative to the
1498
1508
            # revision information) so that the output can be fed to patch -p0
1499
1509
            self.show_diff(self.to_exact_file, revision.diff, indent)
 
1510
            self.to_exact_file.flush()
1500
1511
 
1501
1512
    def get_advice_separator(self):
1502
1513
        """Get the text separating the log from the closing advice."""