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

Sandro Tosi morph at debian.org
Sat Aug 27 12:00:33 UTC 2011


The following commit has been merged in the master branch:
commit cfd7206da5ff4998d1bb8e3f694b75a8252e9a36
Author: Sandro Tosi <morph at debian.org>
Date:   Sat Aug 27 14:00:20 2011 +0200

    introduce the new --latest-first cli options to sort the bug reports lists to show the latest bugs first; thanks to Marcelo Magallon for the bug report and the idea; Closes: #66917

diff --git a/bin/querybts b/bin/querybts
index a642e36..4e372bf 100755
--- a/bin/querybts
+++ b/bin/querybts
@@ -90,6 +90,8 @@ def main():
                       help='Use a web browser instead of the internal interface.')
     parser.add_option('--mbox-reader-cmd', dest='mbox_reader_cmd',
                       help="Specify the program to open the reports mbox.")
+    parser.add_option('--latest-first', action='store_true', dest='latest_first', default=False,
+                      help='Order bugs to show the latest first')
 
 
     # parse cli options
@@ -160,7 +162,7 @@ def main():
                 mboxbuglist = []
                 mboxbuglist = ui.handle_bts_query(package, options.system, options.timeout, options.mirrors, options.http_proxy,
                                     queryonly=True, title=VERSION, archived=options.archived,
-                                    source=options.source, mbox=options.mbox)
+                                    source=options.source, mbox=options.mbox, latest_first=options.latest_first)
                 for num in mboxbuglist:
                     url = debbugs.get_report_url(options.system, num, options.archived, mbox=True)
                     try:
@@ -215,7 +217,7 @@ def main():
             ui.handle_bts_query(package, options.system, options.timeout, options.mirrors, options.http_proxy,
                                 queryonly=True, title=VERSION, archived=options.archived,
                                 source=options.source, buglist=options.buglist,
-                                mbox_reader_cmd=options.mbox_reader_cmd)
+                                mbox_reader_cmd=options.mbox_reader_cmd, latest_first=options.latest_first)
             ui.long_message('This option is not available while using querybts alone.\n')
             x = ui.select_options('What do you want to do now?', 'Qb',
                                   {'q': 'Exit querybts.',
diff --git a/bin/reportbug b/bin/reportbug
index e0e0eb4..3755476 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -968,6 +968,9 @@ def main():
     parser.add_option('--mbox-reader-cmd', dest='mbox_reader_cmd',
                       help="Specify the program to open the reports mbox.")
     parser.add_option('--max-attachment-size', type="int", dest='max_attachment_size', help="Specify the maximum size in byte for an attachment [default: 10485760].")
+    parser.add_option('--latest-first', action='store_true', dest='latest_first', default=False,
+                      help='Order bugs to show the latest first')
+
 
     (options, args) = parser.parse_args()
 
@@ -1680,7 +1683,8 @@ class UI(object):
                                              queryonly=self.options.queryonly,
                                              version=pkgversion,
                                              mbox_reader_cmd=
-                                                 self.options.mbox_reader_cmd)
+                                                 self.options.mbox_reader_cmd,
+                                             latest_first=self.options.latest_first)
             except UINotImplemented:
                 exinfo = None
             except NoNetwork:
diff --git a/debian/changelog b/debian/changelog
index 446d89a..1cc44ca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,8 +33,11 @@ reportbug (6.2) UNRELEASED; urgency=low
       information; now the UI does the visualization part, and we just pass
       objects around storing the info the UI will extract and display;
       implicitly Closes: #571983
+  * introduce the new --latest-first cli options to sort the bug reports lists
+    to show the latest bugs first; thanks to Marcelo Magallon for the bug report
+    and the idea; Closes: #66917
 
- -- Sandro Tosi <morph at debian.org>  Sat, 27 Aug 2011 01:42:04 +0200
+ -- Sandro Tosi <morph at debian.org>  Sat, 27 Aug 2011 13:56:19 +0200
 
 reportbug (6.1) unstable; urgency=low
 
diff --git a/man/querybts.1 b/man/querybts.1
index 140bba4..e2b64e7 100644
--- a/man/querybts.1
+++ b/man/querybts.1
@@ -35,6 +35,9 @@ check \fB\-\-help\fP for an updated list.
 .B \-b, \-\-buglist
 Display a bugs list for the given package.
 .TP
+.B \-\-latest-first
+Display the bug reports list sorted and with the latest reports at the top.
+.TP
 .B \-\-mbox\-reader\-cmd=MBOX_READER_CMD
 Specify a command to open the bug reports mbox file. You can use
 \fB%s\fP to substitute the mbox file to be used, and \fB%%\fP to insert
diff --git a/man/reportbug.1 b/man/reportbug.1
index 1363360..999f190 100644
--- a/man/reportbug.1
+++ b/man/reportbug.1
@@ -208,6 +208,9 @@ Private key to use for PGP/GnuPG signatures.  If not specified, the
 first key in the secret keyring that matches your email address will
 be used.
 .TP
+.B \-\-latest-first
+Display the bug reports list sorted and with the latest reports at the top.
+.TP
 .B \-\-license
 Show \fBreportbug\fP's copyright and license information on standard
 output.
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index c392e64..5998bde 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -844,7 +844,7 @@ class HandleBTSQueryPage (TreePage):
 
     def sync_pre_operation (self, package, bts, timeout, mirrors=None, http_proxy="", queryonly=False, screen=None,
                             archived='no', source=False, title=None,
-                            version=None, buglist=None, mbox_reader_cmd=None):
+                            version=None, buglist=None, mbox_reader_cmd=None, latest_first=False):
         self.bts = bts
         self.mirrors = mirrors
         self.http_proxy = http_proxy
@@ -893,8 +893,11 @@ class HandleBTSQueryPage (TreePage):
                 for category, bugs in hierarchy:
                     buglist = []
                     for bug in bugs:
-                        buglist.append (Bug (bug))
-                    report.append ((category, buglist))
+                        buglist.append (bug)
+                    # XXX: this needs to be fixed in debianbts; Bugreport are
+                    # not sortable (on bug_num) - see #639458
+                    sorted(buglist, reverse=latest_first)
+                    report.append ((category, map(Bug, buglist)))
 
                 return (report, sectitle), {}
 
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 9563cd6..e62279f 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -491,7 +491,7 @@ def show_report(number, system, mirrors,
 def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
                      queryonly=False, title="", screen=None, archived='no',
                      source=False, version=None, mbox=False, buglist=None,
-                     mbox_reader_cmd=None):
+                     mbox_reader_cmd=None, latest_first=False):
     root = debbugs.SYSTEMS[bts].get('btsroot')
     if not root:
         ewrite('%s bug tracking system has no web URL; bypassing query\n',
@@ -551,7 +551,7 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
                 bugs_new.append("#%d  %s" %(bug.bug_num, bug.subject))
                 # and at the same time create a list of bug number
                 bugs.append(bug.bug_num)
-            hierarchy_new.append((entry_new, sorted(bugs_new)))
+            hierarchy_new.append((entry_new, sorted(bugs_new, reverse=latest_first)))
 
         # replace old hierarchy with hierarchy_new
         hierarchy = hierarchy_new
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index 2ec2f58..ae80797 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -531,7 +531,7 @@ def show_report(number, system, mirrors,
 def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
                      queryonly=False, screen=None, title="", archived='no',
                      source=False, version=None, mbox=False, buglist=None,
-                     mbox_reader_cmd=None):
+                     mbox_reader_cmd=None, latest_first=False):
     from reportbug import debbugs
 
     sysinfo = debbugs.SYSTEMS[bts]
@@ -584,7 +584,7 @@ def handle_bts_query(package, bts, timeout, mirrors=None, http_proxy="",
                 for bug in bugs:
                     buglist_tmp.append( (str(bug.bug_num), bug.subject) )
                 # append the sorted list of bugs for this severity
-                map(buglist.append, sorted(buglist_tmp))
+                map(buglist.append, 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