[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.5-18-g71c972d

Sandro Tosi morph at debian.org
Tue Jul 28 14:21:09 UTC 2009


The following commit has been merged in the master branch:
commit 71c972d25f8ad339f649ed6612e07adc68a0e35c
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Jul 28 12:22:46 2009 +0200

    added -b/--buglist option to display a bugs list for the given package; thanks to Andrew Ferrier for the report and Carl Chenet for the patch; Closes: #222621

diff --git a/bin/querybts b/bin/querybts
index c259d9b..f4c0b7a 100755
--- a/bin/querybts
+++ b/bin/querybts
@@ -51,6 +51,7 @@ USAGE = ("querybts - Examine the state of a debbugs server.\n\n"
          "Usage: querybts [options] {<package> | <report number> [report2] ...}\n"
          "Supported options (see man page for long forms):\n"
          "  -A: Browse archived bugs.\n"
+         "  -b: Display a bugs list for the given package.\n"
          "  -B: Specify an alternate debbugs BTS. *\n"
          "  -h: Display this help message.\n"
          "  -s: Query for source packages rather than binary packages.\n"
@@ -66,6 +67,7 @@ def main():
     use_browser = source = False
     mirrors = None
     mbox = False
+    buglist = False
 
     args = utils.parse_config_files()
     for option, arg in args.items():
@@ -80,11 +82,12 @@ def main():
 
     try:
         (opts, args) = getopt.getopt(
-            sys.argv[1:], 'AB:hlmsuvw', ['help', 'version',
+            sys.argv[1:], 'AB:bhlmsuvw', ['help', 'version',
                                         'bts=', 'web', 'mbox',
                                         'archive', 'source',
                                         'http_proxy=', 'proxy=',
-                                        'ui=', 'interface='])
+                                        'ui=', 'interface=',
+                                        'buglist'])
     except getopt.error, msg:
         print msg
         sys.exit(1)
@@ -100,6 +103,8 @@ def main():
             http_proxy = arg
         elif option in ('-m', '--mbox'):
             mbox = True
+        elif option in ('-b', '--buglist'):
+            buglist = True
         elif option in ('--archive', '-A'):
             archived = True
         elif option in ('-s', '--source'):
@@ -142,6 +147,9 @@ def main():
         sys.exit(1)
 
     if use_browser:
+        if use_browser and buglist:
+            print "--web and --buglist can't work together, exiting."
+            sys.exit(1)
         package = args[0]
         m = re.match('^#?(\d+)$', package)
         if m:
@@ -167,6 +175,9 @@ def main():
     ui.initialize ()
 
     if mbox:
+        if mbox and buglist:
+            print "--mbox and --buglist can't work together, exiting."
+            sys.exit(1)
         for bugnum in args:
             package = bugnum
             m = re.match('^#?(\d+)$', bugnum)
@@ -216,7 +227,7 @@ def main():
                                       archived=archived)
         ui.handle_bts_query(package, system, mirrors, http_proxy,
                             queryonly=True, title=VERSION, archived=archived,
-                            source=source)
+                            source=source, buglist=buglist)
     except NoPackage:
         ui.long_message('Package appears not to exist in the BTS.\n')
     except NoBugs:
diff --git a/debian/changelog b/debian/changelog
index 7657258..70e798f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,12 +25,15 @@ reportbug (4.6) UNRELEASED; urgency=low
     - querybts is now able to handle multiple bug numbers, package names or any
       mix of them when using --mbox option; thanks to Carl Chenet for the report
       and patch; Closes: #535560
+    - added -b/--buglist option to display a bugs list for the given package;
+      thanks to Andrew Ferrier for the report and Carl Chenet for the patch;
+      Closes: #222621
   * bin/reportbug, reportbug/ui/text_ui.py
     - provide a default reply subject ('Re: ' + <original subject>) when
       providing additional information to a bug report; thanks to Carl Chenet
       for the report and patch; Closes: #537929
 
- -- Sandro Tosi <morph at debian.org>  Tue, 28 Jul 2009 11:39:11 +0200
+ -- Sandro Tosi <morph at debian.org>  Tue, 28 Jul 2009 12:17:33 +0200
 
 reportbug (4.5) unstable; urgency=low
 
diff --git a/man/querybts.1 b/man/querybts.1
index da04268..c95c88a 100644
--- a/man/querybts.1
+++ b/man/querybts.1
@@ -36,6 +36,9 @@ You can specify
 .B help
 to get a list of supported servers.
 .TP
+.B \-b, \-\-buglist
+Display a bugs list for the given package
+.TP
 .B \-m, \-\-mbox
 Retrieve the given bug number(s) or package name(s) as a mailbox file, instead of viewing
 it. It will be dumped to standard output.
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 317e534..450d7c3 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -466,7 +466,7 @@ def show_report(number, system, mirrors,
 
 def handle_bts_query(package, bts, mirrors=None, http_proxy="",
                      queryonly=False, title="", screen=None, archived='no',
-                     source=False, version=None, mbox=False):
+                     source=False, version=None, mbox=False, buglist=None):
     root = debianbts.SYSTEMS[bts].get('btsroot')
     if not root:
         ewrite('%s bug tracking system has no web URL; bypassing query\n',
@@ -516,6 +516,21 @@ def handle_bts_query(package, bts, mirrors=None, http_proxy="",
                         mboxbuglist.append(int(match.group(1)))
             return mboxbuglist
 
+        if buglist:
+            for entry in hierarchy:
+                # second item is a list of bugs report
+                for bug in entry[1]:
+                    match = bug_re.match(bug)
+                    if match:
+                        # we take the info we need (bug number and subject)
+                        #bugs_new.append("#" + match.group(1) + "  " + match.group(2))
+                        # and at the same time create a list of bug number
+                        #bugs.append(int(match.group(1)))
+                        msg = "#" + match.group(1) + "  " + match.group(2)
+                        msg = msg.encode(charset, 'replace')
+                        print msg
+            sys.exit(0)
+
         for entry in hierarchy:
             # first item is the title of the section
             entry_new = entry[0]

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list