#!/usr/bin/python
# Reverse chronological order of Debian changelogs.
# Copyright 2002 David D. Smith <ultrasoul@ultrasoul.com>
# Carries the same same license and warranty as apt-listchanges version 2.24
def rev_changes(file):
	from sys import exit
	from string import join
	(changes, entry, newchanges) = (["\n"] + file.readlines(), [], [])
	while len(changes):
		entry.append(changes.pop(0))
		if entry[-1].startswith(" --"):
			newchanges = entry + newchanges
			entry = []
	print "".join(newchanges[1:]).lstrip()
if __name__ == "__main__":
	from sys import stdin, argv
	if len(argv) > 1: rev_changes(file(argv[1]))
	else: rev_changes(stdin)
