annotate bin/treepkginfo.py @ 400:48aaffdc1a4f treepkg-status

missed in last commit
author Bjoern Ricks <bricks@intevation.de>
date Mon, 12 Jul 2010 12:21:39 +0000
parents 04310ad0063e
children 94a6ae627b31
rev   line source
392
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
2 # Copyright (C) 2010 by Intevation GmbH
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
3 # Authors:
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
4 # Bjoern Ricks <bjoern.ricks@intevation.de>
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
5 #
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
8
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
9 """Receive the status of a treepkg"""
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
10
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
11 import treepkgcmd
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
12
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
13 from treepkg.info import status
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
14
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
15 from treepkg.options import create_parser
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
16
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
17 def parse_commandline():
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
18 parser = create_parser()
399
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
19 parser.set_defaults(newest=-1)
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
20 parser.add_option("--newest", type="int",
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
21 help=("Number of newest revisions to list."))
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
22 parser.add_option("--pretty", action="store_true", help=("Show XML pretty"
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
23 " output."))
392
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
24
399
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
25
392
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
26 return parser.parse_args()
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
27
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
28 def main():
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
29 options, args = parse_commandline()
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
30
399
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
31 tpkginfo = status.TreepkgInfo(options.config_file, options.newest)
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
32
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
33 if options.pretty:
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
34 print tpkginfo.toxml().toprettyxml()
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
35 else:
04310ad0063e let the user specify num revisions that should be shown in the info
Bjoern Ricks <bricks@intevation.de>
parents: 392
diff changeset
36 print tpkginfo.toxml().toxml()
392
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
37
e2afbd3c2bf1 write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
38 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)