Mercurial > treepkg
comparison bin/listpackages.py @ 251:243f206574cb
Make bin/listpackages.py prefer the newest packages by start-time, not
revision number. Change test_listpackages.py so that it uses more
realistic status files for the individual revisions and adapt the test
cases to the new behavior.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Thu, 09 Apr 2009 18:59:44 +0000 |
parents | 5dd710b167d2 |
children | 2e0b373414b8 |
comparison
equal
deleted
inserted
replaced
250:b3f9cc956acc | 251:243f206574cb |
---|---|
60 | 60 |
61 revisions = track.get_revisions() | 61 revisions = track.get_revisions() |
62 if not revisions and main_rev is None: | 62 if not revisions and main_rev is None: |
63 return | 63 return |
64 | 64 |
65 revisions = sorted(revisions, key=lambda r: r.status.start, reverse=True) | |
66 | |
65 if main_rev is None: | 67 if main_rev is None: |
66 revpkg = revisions[-1] | 68 revpkg = revisions[0] |
67 else: | 69 else: |
68 # iterate in reverse, so that we pick up the newest revision | 70 # iterate in reverse, so that we pick up the newest revision |
69 # packager with the desired revision first if rules_rev is None | 71 # packager with the desired revision first if rules_rev is None |
70 for revpkg in revisions[::-1]: | 72 for revpkg in revisions: |
71 if revpkg.revision == main_rev: | 73 if revpkg.revision == main_rev: |
72 if rules_rev is None or revpkg.rules_revision == rules_rev: | 74 if rules_rev is None or revpkg.rules_revision == rules_rev: |
73 break | 75 break |
74 else: | 76 else: |
75 revpkg = None | 77 revpkg = None |