[python-bugzilla] [PATCH] modify: new option --dependson

Cole Robinson crobinso at redhat.com
Tue Mar 12 13:55:03 UTC 2013


On 03/12/2013 09:40 AM, Don Zickus wrote:
> On Mon, Mar 11, 2013 at 05:33:19PM -0400, Cole Robinson wrote:
>> On 03/11/2013 05:25 PM, Don Zickus wrote:
>>> A lot of our bugs are collected into higher level bugzillas.  Having the
>>> ability to add, remove, overwrite the --dependson field becomes necessary.
>>>
>>> All the backend logic exists, just implement the front end logic.
>>>
>>> The patch is pretty straightforward except for the duplicate code to handle
>>> comma seperated lists.
>>>
>>> The expected command is
>>>
>>> bugzilla modify --dependons=123456,456789 987654
>>>
>>> This would add bugs 123456 and 456789 to the depends on field for bz987654
>>>
>>
>> Sounds good to me.
>>
>>>  
>>> +    def parse_triset_list(val):
>>> +        val = val or ""
>>> +        add_val = None
>>> +        rm_val = None
>>> +        set_val = None
>>> +
>>> +        if val.startswith("+"):
>>> +            add_val = val[1:].split(",")
>>> +        elif val.startswith("-"):
>>> +            rm_val = val[1:].split(",")
>>> +        elif val.startswith("="):
>>> +            set_val = val[1:].split(",")
>>> +        else:
>>> +            add_val = val.split(",")
>>> +        return add_val, rm_val, set_val
>>> +
>>
>> Rather than duplicate the parse_triset() logic, just call it and .split(",")
>> each returned value.
> 
> I thought about that, then wondered what happens if the whiteboard has a
> ',' in it?  It might get accidentally stripped.
> 
> Actually, just tried that and noticed that in the bottom of
> bin/bugzilla::_do_modify is this snippet:
> 
>     for bug in bz.getbugs(bugid_list):
>         if add_wb:
>             bug.addtag(add_wb)
>         if rm_wb:
>             bug.deltag(rm_wb)
> 
> Which requires the *_wb stuff to be a string and not an array. :-(
> 
> Not sure how much of the array you want to propogate to the backend.
> 
> Thoughts?

I meant

def parse_triset_list(val):
   add_val, rm_val, set_val = parse_triset(val)
   return add_val.split(","), rm_val.split(","), set_val.split(",")

And leave the whiteboard stuff untouched.

Thanks,
Cole



More information about the python-bugzilla mailing list