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

Sandro Tosi morph at debian.org
Mon Jul 27 09:24:58 UTC 2009


The following commit has been merged in the master branch:
commit ae16302ecd5c643684da499dd69dbbaec24d442f
Author: chaica <chaica at ohmytux.com>
Date:   Sat Jul 25 16:18:14 2009 +0200

    --mbox manages package names

diff --git a/bin/querybts b/bin/querybts
index 5f66f21..c259d9b 100755
--- a/bin/querybts
+++ b/bin/querybts
@@ -152,22 +152,6 @@ def main():
         urlutils.launch_browser(url)
         return
 
-    if mbox:
-        for bugnum in args:
-            m = re.match('^#?(\d+)$', bugnum)
-            if not m:
-                print >> sys.stderr, "You must specify a bug number when using the --mbox option."
-                sys.exit(1)
-            num = int(m.group(1))
-            url = debianbts.get_report_url(system, num, archived, mbox=True)
-            try:
-                report = urlutils.open_url(url)
-                sys.stdout.write(report.read())
-            except urlutils.urllib2.URLError, ex:
-                print >> sys.stderr, "Error while accessing mbox report (%s)." % ex
-                sys.exit(1)
-	return
-
     if interface:
         global ui, ui_mode
         iface = '%(interface)s_ui' % vars()
@@ -182,6 +166,34 @@ def main():
             print
     ui.initialize ()
 
+    if mbox:
+        for bugnum in args:
+            package = bugnum
+            m = re.match('^#?(\d+)$', bugnum)
+            if not m:
+                mboxbuglist = []
+                mboxbuglist = ui.handle_bts_query(package, system, mirrors, http_proxy,
+                                    queryonly=True, title=VERSION, archived=archived,
+                                    source=source, mbox=mbox)
+                for num in mboxbuglist:
+                    url = debianbts.get_report_url(system, num, archived, mbox=True)
+                    try:
+                        report = urlutils.open_url(url)
+                        sys.stdout.write(report.read())
+                    except urlutils.urllib2.URLError, ex:
+                        print >> sys.stderr, "Error while accessing mbox report (%s)." % ex
+            else:
+                num = int(m.group(1))
+                url = debianbts.get_report_url(system, num, archived, mbox=True)
+                try:
+                    report = urlutils.open_url(url)
+                    sys.stdout.write(report.read())
+                except urlutils.urllib2.URLError, ex:
+                    print >> sys.stderr, "Error while accessing mbox report (%s)." % ex
+                    sys.exit(1)
+        return
+
+
     reportre = re.compile(r'^#?(\d+)$')
     try:
         if len(args) > 1:
diff --git a/man/querybts.1 b/man/querybts.1
index 708b57b..da04268 100644
--- a/man/querybts.1
+++ b/man/querybts.1
@@ -37,8 +37,8 @@ You can specify
 to get a list of supported servers.
 .TP
 .B \-m, \-\-mbox
-Retrieve the given bug number as a mailbox file, instead of viewing
-it.  It will be dumped to standard output.
+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.
 .TP
 .B \-\-proxy=PROXY, \-\-http_proxy=PROXY
 Specify the WWW proxy server to use to handle the query of the bug
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index e6f7360..967385b 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -462,7 +462,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):
+                     source=False, version=None, mbox=False):
     root = debianbts.SYSTEMS[bts].get('btsroot')
     if not root:
         ewrite('%s bug tracking system has no web URL; bypassing query\n',
@@ -503,6 +503,15 @@ def handle_bts_query(package, bts, mirrors=None, http_proxy="",
         bug_re = re.compile(r'#(\d+) \[[^]]+\] \[[^]]+\] (.*) Reported by.*')
         hierarchy_new = []
 
+        if mbox:
+            mboxbuglist = []
+            for entry in hierarchy:
+                for bug in entry[1]:
+                    match = bug_re.match(bug)
+                    if match:
+                        mboxbuglist.append(int(match.group(1)))
+            return mboxbuglist
+
         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