Merge lp:~jelmer/lptools/migrate-list-bugs into lp:lptools

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 17
Proposed branch: lp:~jelmer/lptools/migrate-list-bugs
Merge into: lp:lptools
Diff against target: 65 lines (+61/-0)
1 file modified
bin/lp-list-bugs (+61/-0)
To merge this branch: bzr merge lp:~jelmer/lptools/migrate-list-bugs
Reviewer Review Type Date Requested Status
lptools Hackers Pending
Review via email: mp+69272@code.launchpad.net

Description of the change

Import the lp-list-bugs command from ubuntu-dev-tools, which is Launchpad specific.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'bin/lp-list-bugs'
2--- bin/lp-list-bugs 1970-01-01 00:00:00 +0000
3+++ bin/lp-list-bugs 2011-07-26 12:55:23 +0000
4@@ -0,0 +1,61 @@
5+#! /usr/bin/python
6+# -*- coding: UTF-8 -*-
7+"""Briefly list status of Launchpad bugs."""
8+
9+# Copyright (c) 2010 Canonical Ltd.
10+#
11+# lp-set-dup is free software; you can redistribute it and/or modify it
12+# under the terms of the GNU General Public License as published by the
13+# Free Software Foundation; either version 3, or (at your option) any
14+# later version.
15+#
16+# lp-set-dup is distributed in the hope that it will be useful, but
17+# WITHOUT ANY WARRANTY; without even the implied warranty of
18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19+# General Public License for more details.
20+#
21+# You should have received a copy of the GNU General Public License
22+# along with lp-set-dup; see the file COPYING. If not, write to the Free
23+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24+# 02110-1301, USA.
25+#
26+# Authors:
27+# Colin Watson <cjwatson@ubuntu.com>
28+
29+import sys
30+from optparse import OptionParser
31+
32+from lptools import config
33+
34+from launchpadlib.errors import HTTPError
35+
36+
37+def main():
38+ usage = "Usage: %prog <bug> [...]"
39+ parser = OptionParser(usage)
40+ args = parser.parse_args()[1]
41+ if len(args) < 1:
42+ parser.error("Need at least one bug number")
43+
44+ launchpad = config.get_launchpad("list-bugs")
45+
46+ for bugnum in args:
47+ try:
48+ bug = launchpad.bugs[bugnum]
49+ print "Bug %s: %s" % (bugnum, bug.title)
50+ for task in bug.bug_tasks:
51+ print " %s: %s" % (task.bug_target_name, task.status)
52+ except HTTPError, error:
53+ if error.response.status == 401:
54+ print >> sys.stderr, \
55+ ("E: Don't have enough permissions to access bug %s" %
56+ bugnum)
57+ print >> sys.stderr, error.content
58+ continue
59+ elif error.response.status == 404:
60+ print >> sys.stderr, "E: Bug %s not found" % bugnum
61+ else:
62+ raise
63+
64+if __name__ == '__main__':
65+ main()

Subscribers

People subscribed via source and target branches