/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: Martin Pool
  • Date: 2009-03-13 03:01:14 UTC
  • mfrom: (4138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4144.
  • Revision ID: mbp@sourcefrog.net-20090313030114-y723gefxl8tfynsd
merge trunk

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
 
1371
1374
        return self.truncate(prefix + " ".join(out).rstrip('\n'), max_chars)
1372
1375
 
1373
1376
 
1374
 
class ChangeLogLogFormatter(LogFormatter):
 
1377
class GnuChangelogLogFormatter(LogFormatter):
1375
1378
 
1376
1379
    supports_merge_revisions = True
1377
1380
    supports_delta = True
1378
 
    supports_tags = True
1379
1381
 
1380
1382
    def log_revision(self, revision):
1381
1383
        """Log a revision, either merged or not."""
1389
1391
        committer_str = revision.rev.committer.replace (' <', '  <')
1390
1392
        to_file.write('%s  %s\n\n' % (date_str,committer_str))
1391
1393
 
1392
 
        if revision.delta is not None:
 
1394
        if revision.delta is not None and revision.delta.has_changed():
1393
1395
            for c in revision.delta.added + revision.delta.removed + revision.delta.modified:
1394
1396
                path, = c[:1]
1395
1397
                to_file.write('\t* %s:\n' % (path,))
1437
1439
                                'Detailed log format')
1438
1440
log_formatter_registry.register('line', LineLogFormatter,
1439
1441
                                'Log format with one line per revision')
1440
 
log_formatter_registry.register(
1441
 
    'gnu-changelog', ChangeLogLogFormatter,
1442
 
    'Format used by GNU ChangeLog files')
 
1442
log_formatter_registry.register('gnu-changelog', GnuChangelogLogFormatter,
 
1443
                                'Format used by GNU ChangeLog files')
1443
1444
 
1444
1445
 
1445
1446
def register_formatter(name, formatter):