Merge lp:~dannf/laika/configurable-bug-patterns into lp:laika

Proposed by dann frazier
Status: Merged
Merged at revision: 17
Proposed branch: lp:~dannf/laika/configurable-bug-patterns
Merge into: lp:laika
Diff against target: 90 lines (+18/-4)
2 files modified
laika (+15/-4)
laika.1 (+3/-0)
To merge this branch: bzr merge lp:~dannf/laika/configurable-bug-patterns
Reviewer Review Type Date Requested Status
Alex Chiang Approve
Review via email: mp+70768@code.launchpad.net

Description of the change

Add --bug-pattern option

To post a comment you must log in.
Revision history for this message
Alex Chiang (achiang) wrote :

Looks good, thanks Dann!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'laika'
--- laika 2010-11-24 00:10:09 +0000
+++ laika 2011-08-08 17:37:25 +0000
@@ -17,6 +17,7 @@
17import os17import os
18import re18import re
19import sys19import sys
20from string import Template
2021
21from launchpadlib.launchpad import Launchpad22from launchpadlib.launchpad import Launchpad
2223
@@ -54,13 +55,14 @@
5455
55 bugs = {}56 bugs = {}
5657
57 def __init__(self, user, window, ppas):58 def __init__(self, user, window, bugpattern, ppas):
58 cachedir = os.path.expanduser("~/.launchpadlib/cache")59 cachedir = os.path.expanduser("~/.launchpadlib/cache")
59 self.launchpad = Launchpad.login_with('laika', 'production', cachedir)60 self.launchpad = Launchpad.login_with('laika', 'production', cachedir)
6061
61 self.user = self.launchpad.people[user]62 self.user = self.launchpad.people[user]
62 self.window = window63 self.window = window
63 self.since = UTCNOW - datetime.timedelta(window)64 self.since = UTCNOW - datetime.timedelta(window)
65 self.bugpattern = bugpattern
64 self.ppas = ppas66 self.ppas = ppas
65 self.status = ["New",67 self.status = ["New",
66 "Incomplete",68 "Incomplete",
@@ -105,7 +107,8 @@
105 ago += "%d minute%s" % (minutes, "s" if minutes > 1 else "")107 ago += "%d minute%s" % (minutes, "s" if minutes > 1 else "")
106108
107 print task.title109 print task.title
108 print "https://launchpad.net/bugs/" + str(task.bug.id)110 t = Template(self.bugpattern)
111 print t.substitute(bugid=str(task.bug.id))
109 print "last updated", ago, "ago"112 print "last updated", ago, "ago"
110113
111 def print_assignments(self):114 def print_assignments(self):
@@ -219,6 +222,8 @@
219 return os.getenv("USER")222 return os.getenv("USER")
220 def default_window():223 def default_window():
221 return 8224 return 8
225 def default_bugpattern():
226 return 'https://launchpad.net/bugs/$bugid'
222 def default_ppas():227 def default_ppas():
223 return ''228 return ''
224229
@@ -231,7 +236,7 @@
231 return config236 return config
232237
233def main():238def main():
234 opts = ['user', 'window', 'ppas']239 opts = ['user', 'window', 'bugpattern', 'ppas']
235 config = get_config(opts)240 config = get_config(opts)
236241
237 parser = OptionParser()242 parser = OptionParser()
@@ -243,13 +248,19 @@
243 default=config['window'],248 default=config['window'],
244 help='Number of days of past activity to look for. '249 help='Number of days of past activity to look for. '
245 'Defaults to 8 days')250 'Defaults to 8 days')
251 parser.add_option('-b', '--bug-pattern', dest='bugpattern', type='string',
252 default=config['bugpattern'],
253 help='Use this string when displaying a bug reference. '
254 'Occurrences of $bugid will be replaced by the actual bug number. '
255 'Defaults to \'https://launchpad.net/bugs/$bugid\'')
246 parser.add_option('--ppas', dest='ppas',256 parser.add_option('--ppas', dest='ppas',
247 default=config['ppas'],257 default=config['ppas'],
248 help='Search for activity in specified PPAs')258 help='Search for activity in specified PPAs')
249259
250 options, arguments = parser.parse_args()260 options, arguments = parser.parse_args()
251261
252 report = Report(options.user, options.window, options.ppas)262 report = Report(options.user, options.window, options.bugpattern,
263 options.ppas)
253 report.render()264 report.render()
254265
255if __name__ == "__main__":266if __name__ == "__main__":
256267
=== modified file 'laika.1'
--- laika.1 2010-10-21 12:47:53 +0000
+++ laika.1 2011-08-08 17:37:25 +0000
@@ -16,6 +16,9 @@
16\fB\-w\fR \fIWINDOW\fR, \fB\-\-window\fR=\fIWINDOW\fR16\fB\-w\fR \fIWINDOW\fR, \fB\-\-window\fR=\fIWINDOW\fR
17number of days of past activity to look for; defaults to 8 days17number of days of past activity to look for; defaults to 8 days
18.TP18.TP
19\fB\-b\fR \fIBUGPATTERN\fR, \fB\-\-bugpattern\fR=\fIBUGPATTERN\fR
20pattern to use when displaying the bug id; occurrences of the substring $bugid will be replaced by the actual bug id number; defaults to 'https://launchpad.net/bugs/$bugid'
21.TP
19\fB\-\-ppas\fR=\fIPPA[,PPA[,...]]\fR22\fB\-\-ppas\fR=\fIPPA[,PPA[,...]]\fR
20search for activity in the specified PPAs; use a comma to separate multiple PPAs23search for activity in the specified PPAs; use a comma to separate multiple PPAs
21.TP24.TP

Subscribers

People subscribed via source and target branches