Skip to content
Permalink
Browse files
[contributors.json] Support GitHub usernames
https://bugs.webkit.org/show_bug.cgi?id=231400
<rdar://problem/84005266>

Reviewed by Dewei Zhu.

.:

* metadata/contributors.json: Add some GitHub usernames.

Tools:

* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/contributor.py:
(Contributor.Encoder.default): Add GitHub and BitBucket username.
(Contributor.Mapping.load): Ditto.
(Contributor.Mapping.add): Ditto.
(Contributor.__init__): Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/contributor_unittest.py:
(TestContributor):
(TestContributor.test_github):
(TestContributor.test_bitbucket):
* Scripts/webkitpy/common/config/committers.py:
(Contributor.__init__): Add GitHub username.
(Contributor.as_dict): Ditto.
(Committer.__init__): Ditto.
(Reviewer.__init__): Ditto.
(Bot.__init__): Ditto.
(CommitterList.load_json): Ditto.


Canonical link: https://commits.webkit.org/242713@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed Oct 8, 2021
1 parent 65ebda9 commit 8718eef3979d82e7732364e0741f3242f270f5ba
Showing 8 changed files with 130 additions and 20 deletions.
@@ -1,3 +1,13 @@
2021-10-08 Jonathan Bedard <jbedard@apple.com>

[contributors.json] Support GitHub usernames
https://bugs.webkit.org/show_bug.cgi?id=231400
<rdar://problem/84005266>

Reviewed by Dewei Zhu.

* metadata/contributors.json: Add some GitHub usernames.

2021-10-07 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Reenable -fvisibility=hidden
@@ -1,3 +1,30 @@
2021-10-08 Jonathan Bedard <jbedard@apple.com>

[contributors.json] Support GitHub usernames
https://bugs.webkit.org/show_bug.cgi?id=231400
<rdar://problem/84005266>

Reviewed by Dewei Zhu.

* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/contributor.py:
(Contributor.Encoder.default): Add GitHub and BitBucket username.
(Contributor.Mapping.load): Ditto.
(Contributor.Mapping.add): Ditto.
(Contributor.__init__): Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/contributor_unittest.py:
(TestContributor):
(TestContributor.test_github):
(TestContributor.test_bitbucket):
* Scripts/webkitpy/common/config/committers.py:
(Contributor.__init__): Add GitHub username.
(Contributor.as_dict): Ditto.
(Committer.__init__): Ditto.
(Reviewer.__init__): Ditto.
(Bot.__init__): Ditto.
(CommitterList.load_json): Ditto.

2021-10-08 Jonathan Bedard <jbedard@apple.com>

[webkitcorepy] Not possible to autoinstall a package with micro version 0
@@ -29,7 +29,7 @@ def readme():

setup(
name='webkitscmpy',
version='2.2.6',
version='2.2.7',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
@@ -46,7 +46,7 @@ def _maybe_add_webkitcorepy_path():
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(2, 2, 6)
version = Version(2, 2, 7)

AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('monotonic', Version(1, 5)))
@@ -1,4 +1,4 @@
# Copyright (C) 2020 Apple Inc. All rights reserved.
# Copyright (C) 2020, 2021 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -47,6 +47,10 @@ def default(self, obj):
result['status'] = obj.status
if obj.emails:
result['emails'] = [str(email) for email in obj.emails]
if obj.github:
result['github'] = obj.github
if obj.bitbucket:
result['bitbucket'] = obj.bitbucket

return result

@@ -61,6 +65,13 @@ def load(cls, file):
continue
created = result.create(name, *contributor.get('emails', []))
created.status = contributor.get('status', created.status)
created.github = contributor.get('github', created.github)
created.bitbucket = contributor.get('bitbucket', created.bitbucket)

if created.github:
result[created.github] = created
if created.bitbucket:
result[created.bitbucket] = created

for contributor in contents:
constructed = result.get(contributor.get('name'))
@@ -94,7 +105,18 @@ def save(self, file):
def add(self, contributor):
if not isinstance(contributor, Contributor):
raise ValueError("'{}' is not a Contributor object".format(type(contributor)))
return self.create(contributor.name, *contributor.emails)

result = self.create(contributor.name, *contributor.emails)
result.status = contributor.status or result.status
result.github = contributor.github or result.github
result.bitbucket = contributor.bitbucket or result.bitbucket

if result.github:
self[result.github] = result
if result.bitbucket:
self[result.bitbucket] = result

return result

def create(self, name=None, *emails):
emails = [email for email in emails or []]
@@ -168,10 +190,12 @@ def from_scm_log(cls, line, contributors=None):
return contributors.create(author, email)
return cls(author or email, emails=[email])

def __init__(self, name, emails=None, status=None):
def __init__(self, name, emails=None, status=None, github=None, bitbucket=None):
self.name = string_utils.decode(name)
self.emails = list(filter(string_utils.decode, emails or []))
self.status = status
self.github = github
self.bitbucket = bitbucket

@property
def email(self):
@@ -1,4 +1,4 @@
# Copyright (C) 2020 Apple Inc. All rights reserved.
# Copyright (C) 2020, 2021 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -183,3 +183,44 @@ def test_iteration(self):
sorted(['jbedard@apple.com', 'slewis@apple.com']),
sorted([contributor.email for contributor in mapping]),
)

def test_github(self):
mapping = Contributor.Mapping()
mapping.add(Contributor(
'Jonathan Bedard',
emails=['jbedard@apple.com'],
github='JonWBedard',
))
mapping.add(Contributor(
'Jonathan Bedard',
emails=['jbedard@apple.com'],
github='JonWBedard',
))
mapping.add(Contributor(
'Kocsen Chung',
emails=['kocsen_chung@apple.com'],
github='kocsenc',
))

self.assertEqual(mapping['JonWBedard'], mapping['jbedard@apple.com'])
self.assertEqual(mapping['kocsenc'], mapping['kocsen_chung@apple.com'])
self.assertEqual(mapping['jbedard@apple.com'].github, 'JonWBedard')
self.assertEqual(mapping['kocsen_chung@apple.com'].github, 'kocsenc')

def test_bitbucket(self):
mapping = Contributor.Mapping()
mapping.add(Contributor(
'Jonathan Bedard',
emails=['jbedard@apple.com'],
bitbucket='jonathan_bedard',
))
mapping.add(Contributor(
'Kocsen Chung',
emails=['kocsen_chung@apple.com'],
bitbucket='kocsen_chung',
))

self.assertEqual(mapping['jonathan_bedard'], mapping['jbedard@apple.com'])
self.assertEqual(mapping['kocsen_chung'], mapping['kocsen_chung@apple.com'])
self.assertEqual(mapping['jbedard@apple.com'].bitbucket, 'jonathan_bedard')
self.assertEqual(mapping['kocsen_chung@apple.com'].bitbucket, 'kocsen_chung')
@@ -1,4 +1,4 @@
# Copyright (c) 2011, Apple Inc. All rights reserved.
# Copyright (c) 2011, 2021 Apple Inc. All rights reserved.
# Copyright (c) 2009, 2011, 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@


class Contributor(object):
def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None, alias_or_aliases=None, expertise=None):
def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None, alias_or_aliases=None, expertise=None, github=None):
assert(name)
assert(email_or_emails)
self.full_name = name
@@ -52,6 +52,7 @@ def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None, alias_
self.emails = email_or_emails
self._case_preserved_emails = self.emails
self.emails = list(map(lambda email: email.lower(), self.emails)) # Emails are case-insensitive.
self.github = github

if isinstance(irc_nickname_or_nicknames, str):
self.irc_nicknames = [irc_nickname_or_nicknames]
@@ -177,7 +178,8 @@ def as_dict(self):
name=self.full_name,
emails=self._case_preserved_emails,
)

if self.github:
info["github"] = self.github
if self.aliases:
info["aliases"] = self.aliases

@@ -199,20 +201,20 @@ def as_dict(self):


class Committer(Contributor):
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None):
Contributor.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise)
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None, github=None):
Contributor.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise, github)
self.can_commit = True


class Reviewer(Committer):
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None):
Committer.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise)
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None, github=None):
Committer.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise, github)
self.can_review = True


class Bot(Contributor):
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None):
Contributor.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise)
def __init__(self, name, email_or_emails, irc_nickname=None, alias_or_aliases=None, expertise=None, github=None):
Contributor.__init__(self, name, email_or_emails, irc_nickname, alias_or_aliases, expertise, github)
self.is_bot = True


@@ -252,16 +254,16 @@ def load_json(self):
if not name:
continue
if status == "reviewer":
contributor = Reviewer(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'))
contributor = Reviewer(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'), data.get('github'))
self._reviewers.append(contributor)
self._committers.append(contributor)
elif status == "committer":
contributor = Committer(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'))
contributor = Committer(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'), data.get('github'))
self._committers.append(contributor)
elif status == 'bot':
contributor = Bot(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'))
contributor = Bot(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'), data.get('github'))
else:
contributor = Contributor(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'))
contributor = Contributor(name, data.get('emails'), data.get('nicks'), data.get('aliases'), data.get('expertise'), data.get('github'))

self._contributors.append(contributor)

@@ -229,6 +229,7 @@
"emails" : [
"alancoon@apple.com"
],
"github" : "alancoon",
"name" : "Alan Coon",
"nicks" : [
"alancoon"
@@ -400,6 +401,7 @@
"ap@webkit.org",
"ap@apple.com"
],
"github" : "aproskuryakov",
"name" : "Alexey Proskuryakov",
"nicks" : [
"ap"
@@ -3529,6 +3531,7 @@
"jbedard@webkit.org"
],
"expertise" : "webkitpy, Python, testing",
"github" : "JonWBedard",
"name" : "Jonathan Bedard",
"nicks" : [
"jbedard",
@@ -4020,6 +4023,7 @@
"emails" : [
"kocsen_chung@apple.com"
],
"github" : "kocsenc",
"name" : "Kocsen Chung",
"status" : "committer"
},
@@ -4527,6 +4531,7 @@
"emails" : [
"jlewis3@apple.com"
],
"github" : "rancored-mongoose",
"name" : "Matt Lewis",
"nicks" : [
"mattlewis"
@@ -5601,6 +5606,7 @@
"emails" : [
"ryanhaddad@apple.com"
],
"github" : "ryanhaddad",
"name" : "Ryan Haddad",
"nicks" : [
"ryanhaddad"
@@ -6910,4 +6916,4 @@
],
"status" : "reviewer"
}
]
]

0 comments on commit 8718eef

Please sign in to comment.