[Apt-listbugs-commits] [apt-listbugs] 01/02: implement fast bug selection (Closes: #532678)

Francesco Poli frx-guest at moszumanska.debian.org
Tue Jul 15 21:14:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

frx-guest pushed a commit to branch master
in repository apt-listbugs.

commit 84c3106f1a8101c80e3763dc2548ce85cb20770b
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Tue Jul 15 23:08:56 2014 +0200

    implement fast bug selection (Closes: #532678)
---
 debian/changelog          |  2 ++
 lib/apt-listbugs/logic.rb | 57 ++++++++++++++++++++++++++++++++++++++---------
 lib/debian/bug.rb         |  8 ++++---
 3 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 006d1bd..06fe805 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,8 @@ apt-listbugs (0.1.14) UNRELEASED; urgency=medium
     is now added in a way similar to the line added for automatically ignored
     bugs (Closes: #484423)
   * updated Danish translation, thanks to Joe Dalton! (Closes: #754131)
+  * fixed "faster method to select bugs": bugs are now also assigned short
+    identifiers of the form "b<id>" (Closes: #532678)
 
  -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sun, 11 May 2014 16:45:18 +0200
 
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 1ce77d8..e0b7bdb 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -375,6 +375,11 @@ class Viewer
     DeprecatedWarning = _("********** on_hold IS DEPRECATED. USE p INSTEAD to use pin **********")
     DeprecatedWarningHeader = "*" * Unicode.width(DeprecatedWarning)
 
+    def initialize(config)
+      super(config)
+      @bugmap = {}
+    end
+
     def view(new_pkgs, cur_pkgs, bugs)
       if display_bugs(bugs, new_pkgs.keys, cur_pkgs, new_pkgs) == false
         return true
@@ -435,22 +440,46 @@ class Viewer
         when "n"
           return false
 
-        when /^#?(\d+)$/
+        when /^(#|b)?(\d+)$/
           if @config.querybts != nil
-            system("#{@config.querybts} -u text #{$1}")
+            bugnum = nil
+            if $1 == "b"
+              if @bugmap.has_key?($2)
+                bugnum = @bugmap[$2]
+              else
+                @config.frontend.puts sprintf(_("%s is unknown"), "b#{$2}")
+              end
+            else
+              bugnum = $2
+            end
+            if ! bugnum.nil?
+              system("#{@config.querybts} -u text #{bugnum}")
+            end
           else
             @config.frontend.puts sprintf(_("You must install the reportbug package to be able to do this"))
           end
 
-        when /^i\s+(\d+)$/
-          if ! @config.system_ignore_bugs.include?($1)
-            bug = @config.parser.parse_bug($1)
-            @config.system_ignore_bugs.add(bug)
-            @config.system_ignore_bugs.add($1)
-            Factory::BugsFactory.delete_ignore_bugs(bugs)
-            @config.frontend.puts sprintf(_("%s ignored"), $1)
+        when /^i\s+(b)?(\d+)$/
+          bugnum = nil
+          if $1 == "b"
+            if @bugmap.has_key?($2)
+              bugnum = @bugmap[$2]
+            else
+              @config.frontend.puts sprintf(_("%s is unknown"), "b#{$2}")
+            end
           else
-            @config.frontend.puts sprintf(_("%s already ignored"), $1)
+            bugnum = $2
+          end
+          if ! bugnum.nil?
+            if ! @config.system_ignore_bugs.include?(bugnum)
+              bug = @config.parser.parse_bug(bugnum)
+              @config.system_ignore_bugs.add(bug)
+              @config.system_ignore_bugs.add(bugnum)
+              Factory::BugsFactory.delete_ignore_bugs(bugs)
+              @config.frontend.puts sprintf(_("%s ignored"), bugnum)
+            else
+              @config.frontend.puts sprintf(_("%s already ignored"), bugnum)
+            end
           end
 
         when "r"
@@ -534,10 +563,12 @@ class Viewer
             _("     n     - stop the APT installation.\n") +
             _("   <num>   - query the specified bug number (requires reportbug).\n") +
             _("  #<num>   - same as <num>\n") +
+            _("   b<id>   - same as <num>, but query the bug identified by <id>.\n") +
             _("     r     - redisplay bug lists.\n") +
             _(" p <pkg..> - pin pkgs (restart APT session to enable).\n") +
             _(" p         - pin all the above pkgs (restart APT session to enable).\n") +
             _(" i <num>   - mark bug number <num> as ignored.\n") +
+            _(" i b<id>   - mark the bug identified by <id> as ignored.\n") +
             _("     ?     - print this help.\n")
           if @config.browser != nil
             @config.frontend.puts sprintf(_("     w     - display bug lists in HTML (uses %s).\n"), File.basename(@config.browser))
@@ -625,7 +656,11 @@ class Viewer
                 @config.frontend.puts buf
                 bug_exist = 1
               end
-              bug_str = " ##{bug.bug_number} - #{bug.desc}"
+              if bug.id.nil?
+                bug.id = @bugmap.length.next
+                @bugmap[bug.id.to_s] = bug.bug_number
+              end
+              bug_str = " b#{bug.id} - ##{bug.bug_number} - #{bug.desc}"
               # TRANSLATORS: "Found" refers to one singular bug
               bug_str += sprintf(_(" (Found: %s)"), "#{bug.found}") if ( ! bug.found.nil? ) && $DEBUG
               # TRANSLATORS: "Fixed" refers to one singular bug
diff --git a/lib/debian/bug.rb b/lib/debian/bug.rb
index fc27a32..44d2bdb 100644
--- a/lib/debian/bug.rb
+++ b/lib/debian/bug.rb
@@ -2,7 +2,7 @@
 # bug.rb - ruby interface for debian bug
 # Copyright (C) 2002       Masato Taruishi <taru at debian.org>
 # Copyright (C) 2006-2007  Junichi Uekawa <dancer at debian.org>
-# Copyright (C) 2013       Francesco Poli <invernomuto at paranoici.org>
+# Copyright (C) 2013-2014  Francesco Poli <invernomuto at paranoici.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@ module Debian
       @time = time
       @found = nil
       @fixed = nil
+      @id = nil
     end
 
     def to_s
@@ -51,11 +52,12 @@ module Debian
         @desc + " merged with: " + @mergeids.join(', ') +
         @found.to_s + " - " +
         @fixed.to_s + " - " +
-        @time.to_s
+        @time.to_s + " - b" +
+        @id.to_s
     end
 
     attr_accessor :pkg_key, :bug_number, :severity,
-    :stat, :desc, :tags, :mergeids, :log, :time, :found, :fixed
+    :stat, :desc, :tags, :mergeids, :log, :time, :found, :fixed, :id
 
   end
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/apt-listbugs/apt-listbugs.git



More information about the Apt-listbugs-commits mailing list