annotate bin/reportstatus.py @ 214:4307e25d2afe

Activate version number patching for KDEPIM enterprise4 packages.
author Bernhard Herzog <bh@intevation.de>
date Thu, 18 Dec 2008 14:31:58 +0000
parents cfeb0251055b
children 15de52d55432
rev   line source
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python2.4
145
123e9a5f31fa Rework treepkg/report.py to prepare for other report types. Adapt
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
2 # Copyright (C) 2007, 2008 by Intevation GmbH
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3 # Authors:
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
5 #
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 """Reports the current status of the tree packager"""
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
10
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 import sys
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 import os
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 from optparse import OptionParser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 import treepkgcmd
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 from treepkg.options import create_parser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 from treepkg.report import get_packager_group, prepare_report
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 def parse_commandline():
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
20 parser = create_parser()
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
21 parser.set_defaults(sort_on="start-date")
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
22 parser.add_option("--sort-on",
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
23 help=("Field to sort on;"
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
24 " either start-date (the default) or revision"))
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
25 return parser.parse_args()
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
27
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
28 def report_text(group, sort_on):
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
29 report = prepare_report(group)
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
30 if sort_on == "revision":
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
31 sorted = (col for revno, row in report.revisions.sorted_by_revision()
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
32 for col in row
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
33 if col)
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
34 elif sort_on == "start-date":
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
35 sorted = (row for start, row in report.revisions.sorted_by_startdate())
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
36 else:
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
37 raise ValueError("Unknown sort field %r" % sort_on)
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
38
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
39 for item in sorted:
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
40 print "%s %s: %s" % (item.name, item.revno, item.status.desc)
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
41 print " Start:", item.status.start
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
42 print " Stop:", item.status.stop
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
43 print
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
44
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
45 def main():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
46 options, args = parse_commandline()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
47 group = get_packager_group(options.config_file)
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
48 report_text(group, options.sort_on)
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
49
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
50
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
51 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)