Merge lp:~barry/launchpadlib/475547-cmb into lp:launchpadlib

Proposed by Barry Warsaw
Status: Merged
Approved by: Barry Warsaw
Approved revision: 72
Merged at revision: not available
Proposed branch: lp:~barry/launchpadlib/475547-cmb
Merge into: lp:launchpadlib
Diff against target: 79 lines (+30/-15)
2 files modified
.bzrignore (+1/-0)
contrib/close-my-bugs.py (+29/-15)
To merge this branch: bzr merge lp:~barry/launchpadlib/475547-cmb
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) code Approve
Review via email: mp+14482@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

This fixes contrib/close-my-bugs.py as described in the bug report.

Revision history for this message
Guilherme Salgado (salgado) wrote :

Looks good to me

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-03-19 15:22:56 +0000
3+++ .bzrignore 2009-11-05 20:05:19 +0000
4@@ -9,3 +9,4 @@
5 build
6 *.egg
7 dist
8+eggs
9
10=== modified file 'contrib/close-my-bugs.py'
11--- contrib/close-my-bugs.py 2009-09-29 15:39:26 +0000
12+++ contrib/close-my-bugs.py 2009-11-05 20:05:19 +0000
13@@ -26,21 +26,32 @@
14
15 import os
16 import sys
17+
18+from optparse import OptionParser
19+
20 from launchpadlib.launchpad import Launchpad
21-from optparse import OptionParser
22+from launchpadlib.uris import service_roots
23+
24+COMMASPACE = ', '
25
26
27 def main(args):
28- usage = """%s: project milestone\n%s""" % (sys.argv[0], __doc__)
29+ usage = """%s: project milestone\n\n%s""" % (sys.argv[0], __doc__)
30
31 parser = OptionParser(usage=usage)
32 parser.add_option(
33 '-s', '--system', type='string', default='edge', dest='lpsystem',
34 help=("The Launchpad system to use. Must be one of %s" %
35- sorted(Launchpad.service_roots.keys())))
36+ COMMASPACE.join(sorted(service_roots))))
37+ parser.add_option(
38+ '-y', '--yes', action='store_true', default=False, dest='force',
39+ help="Skip yes/no prompting and do it anyway")
40 parser.add_option(
41 '-f', '--force', action="store_true", default=False, dest='force',
42- help="Skip yes/no prompting and do it anyway")
43+ help='Obsolete synonym for --yes')
44+ parser.add_option(
45+ '-n', '--dry-run', action='store_true',
46+ help='Describe what the script would do without doing it.')
47 options, args = parser.parse_args(args=args)
48 if len(args) != 2:
49 parser.print_usage()
50@@ -61,17 +72,20 @@
51 for task in my_committed_tasks:
52 print "Bug #%s: %s" % (task.bug.id, task.bug.title)
53
54- if not options.force:
55- answer = raw_input("Mark these bugs as Fix Released? [y/N]")
56- if answer in ("n", "N") or not answer:
57- print "Ok, leaving them alone."
58- return
59-
60- for task in my_committed_tasks:
61- print "Releasing %s" % task.bug.id
62- task.transitionToStatus(status='Fix Released')
63-
64- print "Done."
65+ if options.dry_run:
66+ print '\n*** Nothing changed. Re-run without --dry-run/-n to commit.'
67+ else:
68+ if not options.force:
69+ answer = raw_input("Mark these bugs as Fix Released? [y/N]")
70+ if answer in ("n", "N") or not answer:
71+ print "Ok, leaving them alone."
72+ return
73+
74+ for task in my_committed_tasks:
75+ print "Releasing %s" % task.bug.id
76+ task.transitionToStatus(status='Fix Released')
77+ print "Done."
78+
79 return 0
80
81

Subscribers

People subscribed via source and target branches