Bug 63351

Summary: webkit-patch should be able to find users and add them to bugzilla groups
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: New BugsAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, aroben, dbates, levin, ojan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 34179    
Attachments:
Description Flags
Patch
none
Fix one exception abarth: review+

Description Eric Seidel (no email) 2011-06-24 13:37:56 PDT
webkit-patch should be able to find users and add them to bugzilla groups
Comment 1 Adam Roben (:aroben) 2011-06-24 13:39:39 PDT
The name "webkit-patch" is getting less and less accurate. Should we be using separate scripts for things like this? Or renaming webkit-patch?
Comment 2 Eric Seidel (no email) 2011-06-24 13:40:46 PDT
Created attachment 98532 [details]
Patch
Comment 3 Adam Barth 2011-06-24 13:41:18 PDT
webkit-patch has never been an accurate name.  Suggestions welcome.

We've also wanted to be able to have separate collections of commands, but never quite finished the refactoring necessary to make that happen.
Comment 4 Ojan Vafai 2011-06-24 13:42:07 PDT
Meh. I prefer having one tool. It means that "webkit-patch --all-commands" shows you each command with a description of what it does instead of just seeing the list of all the scripts without description of what they do.
Comment 5 Eric Seidel (no email) 2011-06-24 13:44:49 PDT
Here is an example of using the new add-users-to-groups command:

webkit-patch add-users-to-groups sullivan@chromium.org
Add users matching "sullivan@chromium.org" which groups?
 1. canconfirm
 2. editbugs
Enter one or more numbers (comma-separated), or "all": 
Logging in as eric@webkit.org...
Found 1 users matching sullivan@chromium.org:
sullivan@chromium.org (15086)
Are you sure you want add 1 users to groups ['canconfirm', 'editbugs']?  (This action cannot be undone using webkit-patch.) [Y/n]: 
Adding sullivan@chromium.org to ['canconfirm', 'editbugs']

With this we could grant editbugs/canconfirm to all of @chromium.org or @mozilla.org at once (or whatever policy decision we'd like to make).
Comment 6 Eric Seidel (no email) 2011-06-24 13:47:26 PDT
Here is an example of running find-users:

webkit-patch find-users chromium.org
Logging in as eric@webkit.org...
Aaron Boodman <aa@chromium.org> (8238) (canconfirm, editbugs)
Andrey Adaikin <aandrey@chromium.org> (14805) (editbugs)
Alice Boxhall <aboxhall@chromium.org> (14625) (canconfirm, editbugs)
Aaron Colwell <acolwell@chromium.org> (13774) (none)
Adam Klein <adamk@chromium.org> (14354) (canconfirm, editbugs)
Mads Ager <ager@chromium.org> (8890) (canconfirm, editbugs)
Adam Langley <agl@chromium.org> (8744) (canconfirm, editbugs)
Albert J. Wong <ajwong@chromium.org> (9759) (canconfirm, editbugs)
 <akalin@chromium.org> (15464) (none)
Alok Priyadarshi <alokp@chromium.org> (11778) (editbugs)
Amanda Walker <amanda@chromium.org> (8123) (none)
Alexey Marinichev <amarinichev@chromium.org> (13251) (editbugs)
Amit Joshi <amit@chromium.org> (9485) (none)


The UI for both of these commands could be improved, but this works for a first-cut.
Comment 7 Eric Seidel (no email) 2011-06-24 13:48:40 PDT
Created attachment 98536 [details]
Fix one exception
Comment 8 Eric Seidel (no email) 2011-06-24 13:51:24 PDT
*** Bug 34179 has been marked as a duplicate of this bug. ***
Comment 9 Eric Seidel (no email) 2011-09-13 16:52:19 PDT
can haz review?

This came up again when another @chromium.org person emailed me to be added to edit bugs.  I'd like to automate this.
Comment 10 Adam Barth 2011-09-13 17:01:12 PDT
Clearly I need to troll pending-review more.
Comment 11 Adam Barth 2011-09-13 17:07:29 PDT
Comment on attachment 98536 [details]
Fix one exception

View in context: https://bugs.webkit.org/attachment.cgi?id=98536&action=review

> Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:54
> +        self._group_name_to_group_string_cache = {}

Should this use a memoized function instead?

> Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:71
> +        soup = BeautifulSoup(results_page, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)

There's no XML version of this page?

> Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:268
> +        self.edit_user_parser = EditUsersParser()

Do we want this to be persistent or instantiated each time?  Maybe it doen't matter since the process isn't long-lived.

> Tools/Scripts/webkitpy/tool/commands/__init__.py:8
> +from webkitpy.tool.commands.adduserstogroups import AddUsersToGroups
>  from webkitpy.tool.commands.bugsearch import BugSearch
>  from webkitpy.tool.commands.bugfortest import BugForTest
>  from webkitpy.tool.commands.download import *
>  from webkitpy.tool.commands.earlywarningsystem import *
> +from webkitpy.tool.commands.findusers import *

Not really related to this patch, but we should clean up whether this file always uses *, etc.
Comment 12 David Levin 2011-09-13 17:15:34 PDT
(In reply to comment #3)
> webkit-patch has never been an accurate name.  Suggestions welcome.
> 

webkit-swiss-army-knife?
Comment 13 Eric Seidel (no email) 2011-09-15 15:00:44 PDT
(In reply to comment #11)
> (From update of attachment 98536 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=98536&action=review
> 
> > Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:54
> > +        self._group_name_to_group_string_cache = {}
> 
> Should this use a memoized function instead?

Possibly.  It gets awkward because we're passing in the edit page.

> > Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:71
> > +        soup = BeautifulSoup(results_page, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
> 
> There's no XML version of this page?

Sadly no.

> > Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py:268
> > +        self.edit_user_parser = EditUsersParser()
> 
> Do we want this to be persistent or instantiated each time?  Maybe it doen't matter since the process isn't long-lived.

Doesn't really matter.  Since bugzilla is a singleton anyway, I'm not going to worry.

> > Tools/Scripts/webkitpy/tool/commands/__init__.py:8
> > +from webkitpy.tool.commands.adduserstogroups import AddUsersToGroups
> >  from webkitpy.tool.commands.bugsearch import BugSearch
> >  from webkitpy.tool.commands.bugfortest import BugForTest
> >  from webkitpy.tool.commands.download import *
> >  from webkitpy.tool.commands.earlywarningsystem import *
> > +from webkitpy.tool.commands.findusers import *
> 
> Not really related to this patch, but we should clean up whether this file always uses *, etc.

Agreed.
Comment 14 Eric Seidel (no email) 2011-09-15 15:09:51 PDT
Committed r95238: <http://trac.webkit.org/changeset/95238>