New bts command: followup

In Debian I'm pretty sure we have many perfectionists. Sadly, I'm one of them: I can't help loosing lots of time fixing silly things totally useless with respect to a more important task which is waiting to be completed.

An example? Following up on BTS bugs.

If I have the original bug report in my mailbox that's easy, I just hit r on mutt and reply as usual (ok, I will still loose some time getting rid of unneeded quoted text, but that's not too much).

If I don't have it ... tragedy! I then have to open the bug log in the browser and compose from scratch a new mail including several information which I have to manually grab from the bug log web page:

  • proper recipients (usually one or more of xxxxxx{-submitter,-done,-forwarded,}@bugs.debian.org)
  • proper headers:
    • a Subject starting with Re: and then continuing with the original subject
    • a In-Reply-To header containing the original Message-Id (can I dare breaking threading, of course not!)
  • proper body:
    • which should start with a On ... Random J Developer wrote: ...
    • ... and continue with the quoted text of the original bug report

(Yeah, I know, it looks like I'm hopeless, but I'm confident some of the people reading do actually share this and similar dramas.)

Missing (or maybe overlooking) a tool helping me out on this, I've patched devscripts's bts to automate the above steps. Now I can do:

bts followup 430986

to end up in a mutt mail composing session with proper (according to the definition of "proper" above) recipients, headers, and quoted text:

From: Stefano Zacchiroli <zack@debian.org>
To: 430986@bugs.debian.org, 430986-submitter@bugs.debian.org
Cc: 
Bcc: 
Subject: Re: when reporting bugs by maintainer, please include Uploaders
Reply-To: 
In-Reply-To: <20070628174236.13848.57178.reportbug@aquarium.takhisis.invalid>

On Thu, 28 Jun 2007 19:42:36 +0200, Stefano Zacchiroli wrote:
> Package: bugs.debian.org
> Severity: wishlist
> 
> Browsing bugs by maintainer (and with this I mean something like
> http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=zack@debian.org, or
> it shorter form http://bugs.debian.org/zack@debian.org) used to be
> terribly useful as a TODO list. Using that I used to have a simple entry
> point for knowing what I have to do "for Debian" regarding my packages.
> 
> This usefulness has diminished a lot with the spreading of team
> maintenance. To know all bugs that apply to me indeed I know have to
> repeat browse by maintainer for each team I'm a member of.
> 
> It would be terribly useful to include bugs which apply to packages in
> which I'm mentioned as an Uploader in the report by maintainer pages.
<snip>

Now I just need to actually perform the original task, the problem now being that in the meantime I've forgotten what was it about ...


Try it out:

  • bts with super followup powers
  • the patch which adds super followup powers to bts of devscripts version 2.10.13

Comments?
Anyone else find this useful? If so I can just go ahead and commit it to devscripts mainline ...


Update: some changes to the code, thanks to Adam Barrat for the feedback.
Changelog:

  • safer handling of RFC822 line continuation
  • instead of always mailing -submitter, mail the author of the message we are replying to (the bug report is always on Cc though)
  • bug message number is now 1-based, following the convention of the BTS get_bug_log method
  • add the possibility to specify "last" (and even "last-1" and so on) for pointing to messages in the bug log starting from log bottom