bh@287: #! /usr/bin/python bh@237: # Copyright (C) 2007, 2008, 2009 by Intevation GmbH thomas@78: # Authors: thomas@78: # Bernhard Herzog thomas@78: # thomas@78: # This program is free software under the GPL (>=v2) thomas@78: # Read the file COPYING coming with the software for details. thomas@78: thomas@78: """Reports the current status of the tree packager""" thomas@78: thomas@78: import sys thomas@78: import os thomas@78: from optparse import OptionParser thomas@78: thomas@78: import treepkgcmd thomas@78: from treepkg.options import create_parser thomas@78: from treepkg.report import get_packager_group, prepare_report thomas@78: thomas@78: def parse_commandline(): bh@147: parser = create_parser() bh@147: parser.set_defaults(sort_on="start-date") bh@147: parser.add_option("--sort-on", bh@147: help=("Field to sort on;" bh@147: " either start-date (the default) or revision")) bh@147: return parser.parse_args() thomas@78: thomas@78: bh@147: def report_text(group, sort_on): thomas@78: report = prepare_report(group) bh@147: if sort_on == "revision": bh@147: sorted = (col for revno, row in report.revisions.sorted_by_revision() bh@147: for col in row bh@147: if col) bh@147: elif sort_on == "start-date": bh@147: sorted = (row for start, row in report.revisions.sorted_by_startdate()) bh@147: else: bh@147: raise ValueError("Unknown sort field %r" % sort_on) bh@147: bh@147: for item in sorted: bh@237: print "%s %s-%s: %s" % (item.name, item.revno, item.rulesrev, bh@237: item.status.desc) bh@147: print " Start:", item.status.start bh@147: print " Stop:", item.status.stop bh@147: print thomas@78: thomas@78: def main(): thomas@78: options, args = parse_commandline() thomas@78: group = get_packager_group(options.config_file) bh@147: report_text(group, options.sort_on) thomas@78: thomas@78: thomas@78: main()