[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 6.0-97-ga91b4ea

Sandro Tosi morph at debian.org
Sun Feb 19 19:00:38 UTC 2012


The following commit has been merged in the master branch:
commit 8d36b260784a0a6a140d2cc3ebd33d1b938acdd7
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Feb 19 18:36:42 2012 +0100

    sort bug numerically; thanks to Matthias Urlichs for the report; Closes: #657616

diff --git a/debian/changelog b/debian/changelog
index 2482e20..8f80ca3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,11 @@ reportbug (6.3.2) UNRELEASED; urgency=low
   * bin/reportbug
     - clarify the menu title when presenting more packages; thanks to Alois
       Mahdal for the report; Closes: #654165
+  * reportbug/ui/{text, urwid}_ui.py
+    - sort bug numerically; thanks to Matthias Urlichs for the report;
+      Closes: #657616
 
- -- Sandro Tosi <morph at debian.org>  Tue, 10 Jan 2012 21:26:34 +0100
+ -- Sandro Tosi <morph at debian.org>  Sun, 19 Feb 2012 18:35:52 +0100
 
 reportbug (6.3.1) unstable; urgency=low
 
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 3d87fc1..0a07dca 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -544,7 +544,7 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
         for entry in hierarchy:
             # first item is the title of the section
             entry_new = entry[0]
-            bugs_new = []
+            bugs_new = {}
             bugs_numbers = []
             # XXX: we can probably simplify this code, with some lists
             # generations and map()
@@ -555,11 +555,12 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
                 if bug.pending == 'done':
                     done = '  [RESOLVED]'
                 # we take the info we need (bug number and subject)
-                bugs_new.append("#%d  %s%s" %(bug.bug_num, bug.subject, done))
+                # we use a dict so it's easy to sort the keys and then values
+                bugs_new[bug.bug_num] = "%s%s" % (bug.subject, done)
                 # and at the same time create a list of bugs numbers
                 bugs_numbers.append(bug.bug_num)
             # then we sort both the lists
-            hierarchy_new.append((entry_new, sorted(bugs_new, reverse=latest_first)))
+            hierarchy_new.append((entry_new, ["#%d  %s" % (k, bugs_new[k]) for k in sorted(bugs_new.keys(), reverse=latest_first)]))
             bugs.extend(sorted(bugs_numbers, reverse=latest_first))
 
         # replace old hierarchy with hierarchy_new
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index 7f235b9..2079a62 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -580,15 +580,15 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
             for (t, bugs) in hierarchy:
                 bcount = len(bugs)
                 buglist.append( ('---', t) )
-                buglist_tmp = []
+                buglist_tmp = {}
                 for bug in bugs:
                     # show if the bugs is already resolved
                     done = ''
                     if bug.pending == 'done':
                         done = '  [RESOLVED]'
-                    buglist_tmp.append( (str(bug.bug_num), bug.subject+done) )
+                    buglist_tmp[bug.bug_num] = bug.subject+done
                 # append the sorted list of bugs for this severity
-                map(buglist.append, sorted(buglist_tmp, reverse=latest_first))
+                map(buglist.append, [(str(k), buglist_tmp[k]) for k in sorted(buglist_tmp, reverse=latest_first)])
 
             p = buglist[1][0]
             #scr.popWindow()

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list