From 1070a065cead83f9606fb4bf7e5727ed3b42d6b3 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 3 Mar 2008 21:09:17 +0000 Subject: Instead of inverting count all the time, decrease it in every loop Also added a clearer comment about the function of count. --- RepSys/log.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/RepSys/log.py b/RepSys/log.py index 4a74716..25c8548 100644 --- a/RepSys/log.py +++ b/RepSys/log.py @@ -480,8 +480,11 @@ def _split_changelog(stream): except ValueError, e: raise Error, "failed to parse spec changelog: %s" % e curlines = [line] - current = (date, -count, curlines) - count += 1 # used to ensure stable sorting when using tuples + current = (date, count, curlines) + # count used to ensure stable sorting when changelog entries + # have the same date, otherwise it would also compare the + # changelog lines + count -= 1 elif current: curlines.append(line) else: @@ -490,7 +493,7 @@ def _split_changelog(stream): yield current def sort_changelog(stream): - entries = list(_split_changelog(stream)) + entries = _split_changelog(stream)) log = StringIO() for time, count, elines in sorted(entries, reverse=True): log.writelines(elines) -- cgit v1.2.1