~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Alexander Belchenko
  • Date: 2009-03-11 08:58:17 UTC
  • mto: (4108.1.4 jamesw-integration)
  • mto: This revision was merged to the branch mainline in revision 4128.
  • Revision ID: bialix@ukr.net-20090311085817-ohdgobxgnat17xll
Fixed problem with `log -p` and non-ascii content of files: show_diff should write the diff to exact [stdout] stream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1143
1143
          let the log formatter decide.
1144
1144
        """
1145
1145
        self.to_file = to_file
 
1146
        # 'exact' stream used to show diff, it should print content 'as is'
 
1147
        # and should not try to decode/encode it to unicode to avoid bug #328007
 
1148
        self.to_exact_file = getattr(to_file, 'stream', to_file)
1146
1149
        self.show_ids = show_ids
1147
1150
        self.show_timezone = show_timezone
1148
1151
        if delta_format is None:
1246
1249
            to_file.write(indent + 'diff:\n')
1247
1250
            # Note: we explicitly don't indent the diff (relative to the
1248
1251
            # revision information) so that the output can be fed to patch -p0
1249
 
            self.show_diff(to_file, revision.diff, indent)
 
1252
            self.show_diff(self.to_exact_file, revision.diff, indent)
1250
1253
 
1251
1254
 
1252
1255
class ShortLogFormatter(LogFormatter):
1310
1313
            revision.delta.show(to_file, self.show_ids, indent=indent + offset,
1311
1314
                                short_status=self.delta_format==1)
1312
1315
        if revision.diff is not None:
1313
 
            self.show_diff(to_file, revision.diff, '      ')
 
1316
            self.show_diff(self.to_exact_file, revision.diff, '      ')
1314
1317
        to_file.write('\n')
1315
1318
 
1316
1319