Mercurial > treepkg
diff bin/listpackages.py @ 248:5dd710b167d2
Make bin/listpackages.py handle corner cases like no revisions built or
--revision referring to non-exisiting revisions better. Add tests for this.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Fri, 06 Mar 2009 19:57:04 +0000 |
parents | 59e2d8e26635 |
children | 243f206574cb |
line wrap: on
line diff
--- a/bin/listpackages.py Fri Mar 06 19:22:53 2009 +0000 +++ b/bin/listpackages.py Fri Mar 06 19:57:04 2009 +0000 @@ -48,14 +48,19 @@ return revision, rulesrev +def format_revision(main_rev, rules_rev): + formatted = str(main_rev) + if rules_rev is not None: + formatted += "-" + str(rules_rev) + return formatted + def list_track_packages(track, revision, source, binary): main_rev, rules_rev = revision revisions = track.get_revisions() - if not revisions: - print >>sys.stderr, "No revisions have been packaged" - sys.exit(1) + if not revisions and main_rev is None: + return if main_rev is None: revpkg = revisions[-1] @@ -77,7 +82,7 @@ for filename in revpkg.list_binary_files(): print filename else: - print >>sys.stderr, "No revision", repr(revision) + print >>sys.stderr, "No revision", format_revision(main_rev, rules_rev) sys.exit(1) def list_packages(config_file, trackname, revision, source, binary):