aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/log.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2008-03-03 21:09:17 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2008-03-03 21:09:17 +0000
commit1070a065cead83f9606fb4bf7e5727ed3b42d6b3 (patch)
tree30db6dfac8362f6196dede751ebd0ffbe4582288 /RepSys/log.py
parentda6d172318eb332ad8f6acf2adce04e1cc8499e8 (diff)
downloadmgarepo-1070a065cead83f9606fb4bf7e5727ed3b42d6b3.tar
mgarepo-1070a065cead83f9606fb4bf7e5727ed3b42d6b3.tar.gz
mgarepo-1070a065cead83f9606fb4bf7e5727ed3b42d6b3.tar.bz2
mgarepo-1070a065cead83f9606fb4bf7e5727ed3b42d6b3.tar.xz
mgarepo-1070a065cead83f9606fb4bf7e5727ed3b42d6b3.zip
Instead of inverting count all the time, decrease it in every loop
Also added a clearer comment about the function of count.
Diffstat (limited to 'RepSys/log.py')
-rw-r--r--RepSys/log.py9
1 files 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)