← Back to team overview

launchpad-dev team mailing list archive

Re: Automatically setting the bug task status from the branch scanner

 

On 12 April 2010 08:11, Bjorn Tillenius <bjorn@xxxxxxxxxxxxx> wrote:
> On Mon, Apr 12, 2010 at 08:01:24AM +0100, Graham Binns wrote:
>> On 12 April 2010 06:04, Tim Penhey <tim.penhey@xxxxxxxxxxxxx> wrote:
>> > Hi Deryck,
>> >
>> > As discussed before I'm tackling the JFDI approach and I'm going to get the
>> > scanner to update the bug-task status [1].
>> >
>> > I'd like the bug-task to be set to in-progress when it is linked to the
>> > branch, and fix-committed if it is linked to a branch that was marked as merged
>> > through a merge proposal.
>> >
>> > Since the scanner is a script, what do you think the best approach is so that
>> > the appropriate subscribers get notified?  I had a brief look at the bug code
>> > but it was not clear to me exactly how to proceed.
>>
>> The simplest way I can think of, though not a particularly elegant one,
>> is to do something like this:
>>
>>     from lp.bugs.adapters.bugchange import BugTaskStatusChange
>>     change = BugTaskStatusChange(
>>         bug_task=bug_task, when=UTC_NOW, person=current_person,
>>         what_changed='status', old_value=old_bugtask_status.title,
>>         new_value=new_bugtask_status.title)
>>     bug_task.bug.addChange(change)
>>
>> However, I'd be inclined to say "use whatever the API uses," but I don't
>> actually know what that is (just from a bit of looking around at pre-8am
>> I can't find it, anyway).
>
> The easiest way is probably to use IBug.setStatus(). It will do the
> right thing (including notifying people about changes), even if you pass
> in an IProductSeries.
>

If anything tells me I should start the day with coffee, not tea, it
is this thread.

*sigh*

I'll be looking for my dignity...


-- 
Graham Binns | PGP Key: EC66FA7D



References