Mercurial > treepkg
comparison bin/listpackages.py @ 254:b1776fc8e24a
Correct the help string for listpackages' --newest option and set a
better default for it.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 14 Apr 2009 13:15:41 +0000 |
parents | 7d932fac1055 |
children | 1fcdffbeb9de |
comparison
equal
deleted
inserted
replaced
253:7d932fac1055 | 254:b1776fc8e24a |
---|---|
14 from treepkg.options import create_parser | 14 from treepkg.options import create_parser |
15 from treepkg.report import get_packager_group | 15 from treepkg.report import get_packager_group |
16 | 16 |
17 def parse_commandline(): | 17 def parse_commandline(): |
18 parser = create_parser() | 18 parser = create_parser() |
19 parser.set_defaults(binary=False, source=False) | 19 parser.set_defaults(binary=False, source=False, newest=1) |
20 parser.add_option("--revision", | 20 parser.add_option("--revision", |
21 help=("The revision whose files are to be listed." | 21 help=("The revision whose files are to be listed." |
22 " If not given, the latest revision is used." | 22 " If not given, the latest revision is used." |
23 " The value may be given as REV-RULESREV to specify" | 23 " The value may be given as REV-RULESREV to specify" |
24 " both the main source revision and the revision of" | 24 " both the main source revision and the revision of" |
29 parser.add_option("--source", action="store_true", | 29 parser.add_option("--source", action="store_true", |
30 help=("List source packages")) | 30 help=("List source packages")) |
31 parser.add_option("--binary", action="store_true", | 31 parser.add_option("--binary", action="store_true", |
32 help=("List binary packages")) | 32 help=("List binary packages")) |
33 parser.add_option("--newest", type="int", | 33 parser.add_option("--newest", type="int", |
34 help=("List binary packages")) | 34 help=("Number of newest revisions to list." |
35 " Defaults to 1.")) | |
35 return parser.parse_args() | 36 return parser.parse_args() |
36 | 37 |
37 def parse_revision(raw_revision): | 38 def parse_revision(raw_revision): |
38 if raw_revision is None: | 39 if raw_revision is None: |
39 return None, None | 40 return None, None |
70 | 71 |
71 if main_rev is None: | 72 if main_rev is None: |
72 candidates = [revpkg for revpkg in revisions | 73 candidates = [revpkg for revpkg in revisions |
73 if revpkg.status.status.finished | 74 if revpkg.status.status.finished |
74 and not revpkg.status.status.error] | 75 and not revpkg.status.status.error] |
75 if num_newest is None: | |
76 num_newest = 1 | |
77 candidates = candidates[:num_newest] | 76 candidates = candidates[:num_newest] |
78 else: | 77 else: |
79 for revpkg in revisions: | 78 for revpkg in revisions: |
80 if revpkg.revision == main_rev: | 79 if revpkg.revision == main_rev: |
81 if rules_rev is None or revpkg.rules_revision == rules_rev: | 80 if rules_rev is None or revpkg.rules_revision == rules_rev: |