Bug 217732 - [git-webkit] Use contributors.json
Summary: [git-webkit] Use contributors.json
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-14 14:56 PDT by Jonathan Bedard
Modified: 2020-12-04 12:04 PST (History)
5 users (show)

See Also:


Attachments
Patch (6.25 KB, patch)
2020-10-14 15:03 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (25.46 KB, patch)
2020-12-03 12:13 PST, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (25.55 KB, patch)
2020-12-03 12:32 PST, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (25.69 KB, patch)
2020-12-04 08:03 PST, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2020-10-14 14:56:06 PDT
git-webkit should rely on contributors.json, this will allow us to be more explicit about the author of a given change.
Comment 1 Radar WebKit Bug Importer 2020-10-14 14:56:20 PDT
<rdar://problem/70309518>
Comment 2 Jonathan Bedard 2020-10-14 15:03:40 PDT
Created attachment 411376 [details]
Patch
Comment 3 Dean Johnson 2020-10-14 16:29:27 PDT
Comment on attachment 411376 [details]
Patch

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

> Tools/Scripts/git-webkit:32
> +for contributor in CommitterList().contributors():

Nit: Can we reformat this file with the standard `if __name__ == '__main__'` and a main() function to go with it?

> Tools/Scripts/git-webkit:38
> +            Contributor.bank[alias] = c

My previous concern about this approach was that we were modifying values on a static object then relying on those values existing in other scripts/modules. 

Can we find a way to organize the code so we are explicit about creating some kind of ContributorList, then pass that around? Or call a function which returns that list, then provide that result as an argument to the parser?
Comment 4 Jonathan Bedard 2020-10-14 16:38:32 PDT
Comment on attachment 411376 [details]
Patch

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

>> Tools/Scripts/git-webkit:38
>> +            Contributor.bank[alias] = c
> 
> My previous concern about this approach was that we were modifying values on a static object then relying on those values existing in other scripts/modules. 
> 
> Can we find a way to organize the code so we are explicit about creating some kind of ContributorList, then pass that around? Or call a function which returns that list, then provide that result as an argument to the parser?

I think the question here is what the most clear architecture is, because we have some limitations. The first forbids the simplest "function which returns a list" approach, because webkitscmpy is not supposed to know the specifics about contributors.json. We could pass a generator function in, but that seems strictly worse than passing a list in.

We could pass a list in, but then we would either need to a) set the list to some kind of global store of contributors for webkitscmpy to consume (which is basically what we're doing now, just explicitly) or b) pass the list to the repository classes which would then use those lists to normalize contributor names.

I figured that the global approach would usually be more correct because in the rare case where a single script knows about multiple repositories, it seems desirable for a person contributing to both repositories to resolve to the same contributor object.
Comment 5 Jonathan Bedard 2020-12-03 12:13:41 PST
Created attachment 415322 [details]
Patch
Comment 6 Jonathan Bedard 2020-12-03 12:18:47 PST
The uploaded patch has the repository own the record of contributors. The one downside to this architecture is that commits which are orphaned from a repository need to specify a Contributor and can't rely on an in-process global record. The compromize is to allow json encoding of the full contributor object.
Comment 7 Jonathan Bedard 2020-12-03 12:32:26 PST
Created attachment 415323 [details]
Patch
Comment 8 Jonathan Bedard 2020-12-04 08:03:19 PST
Created attachment 415416 [details]
Patch
Comment 9 dewei_zhu 2020-12-04 11:15:11 PST
r=me. Using mapping is clearer than 'bank'.
Comment 10 EWS 2020-12-04 12:04:19 PST
Committed r270447: <https://trac.webkit.org/changeset/270447>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415416 [details].