[Reportbug-commits] r666 - in trunk (debian/changelog reportbug/ui/text_ui.py)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Wed Nov 12 18:15:33 UTC 2008


    Date: Wednesday, November 12, 2008 @ 18:15:31
  Author: morph
Revision: 666

backported 3.47 changes to 3.99.x code path

Modified:
  trunk/debian/changelog
  trunk/reportbug/ui/text_ui.py

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-11-12 15:55:30 UTC (rev 665)
+++ trunk/debian/changelog	2008-11-12 18:15:31 UTC (rev 666)
@@ -68,6 +68,14 @@
 
  -- Sandro Tosi <morph at debian.org>  Thu, 23 Oct 2008 16:04:28 +0200
 
+reportbug (3.47) unstable; urgency=low
+
+  * reportbuglib/reportbug_ui_text.py
+    - added filter for bugs reports, removing all the additional info not
+      needed; thanks to Ryo Igarashi for the report; Closes: #504424
+
+ -- Sandro Tosi <morph at debian.org>  Wed, 12 Nov 2008 16:28:40 +0100
+
 reportbug (3.46) unstable; urgency=low
 
   * debian/control

Modified: trunk/reportbug/ui/text_ui.py
===================================================================
--- trunk/reportbug/ui/text_ui.py	2008-11-12 15:55:30 UTC (rev 665)
+++ trunk/reportbug/ui/text_ui.py	2008-11-12 18:15:31 UTC (rev 666)
@@ -478,6 +478,7 @@
         (count, title, hierarchy)=debianbts.get_reports(
             package, bts, mirrors=mirrors, version=version,
             source=source, http_proxy=http_proxy, archived=archived)
+
         if debianbts.SYSTEMS[bts].has_key('namefmt'):
             package2 = debianbts.SYSTEMS[bts]['namefmt'] % package
             (count2, title2, hierarchy2) = \
@@ -489,13 +490,28 @@
             for entry in hierarchy2:
                 hierarchy.append( (package2+' '+entry[0], entry[1]) )
 
-        exp = re.compile(r'#(\d+)[ :]')
-        for entry in hierarchy or []:
+        # remove unneeded info from bugs hierarchy, we leave only bug number and subject
+        # format "#<bug no> [???] [pkg name] subject <all the rest>
+        bug_re = re.compile(r'#(\d+) \[[^]]+\] \[[^]]+\] (.*) Reported by.*')
+        hierarchy_new = []
+
+        for entry in hierarchy:
+            # first item is the title of the section
+            entry_new = entry[0]
+            bugs_new = []
+            # second item is a list of bugs report
             for bug in entry[1]:
-                match = exp.match(bug)
+                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)))
+            hierarchy_new.append( (entry_new,bugs_new))
 
+        # replace old hierarchy with hierarchy_new
+        hierarchy = hierarchy_new
+
         if not count:
             if hierarchy == None:
                 raise NoPackage
@@ -519,6 +535,7 @@
 
 def browse_bugs(hierarchy, count, bugs, bts, queryonly, mirrors,
                 http_proxy, screen, title):
+    output_encoding = locale.getpreferredencoding()
     endcount = catcount = 0
     scount = startcount = 1
     category = hierarchy[0]




More information about the Reportbug-commits mailing list