603
609
return PackageDiff(
604
610
from_source=self, to_source=to_sourcepackagerelease,
605
611
requester=requester, status=status)
613
def aggregate_changelog(self, since_version):
614
"""See `ISourcePackagePublishingHistory`."""
615
if self.changelog is None:
620
changelog = self.changelog
621
# The python-debian API for parsing changelogs is pretty awful. The
622
# only useful way of extracting info is to use the iterator on
623
# Changelog and then compare versions.
625
for block in Changelog(changelog.read()):
626
version = block._raw_version
627
if (since_version and
628
apt_pkg.VersionCompare(version, since_version) <= 0):
630
# Poking in private attributes is not nice but again the
631
# API is terrible. We want to ensure that the name/date
632
# line is omitted from these composite changelogs.
633
block._no_trailer = True
635
# python-debian adds an extra blank line to the chunks
636
# so we'll have to sort this out.
637
chunks.append(str(block).rstrip())
638
except ChangelogCreateError:
640
if not since_version:
641
# If a particular version was not requested we just
642
# return the most recent changelog entry.
644
except ChangelogParseError:
647
output = "\n\n".join(chunks)
648
return output.decode("utf-8", "replace")