Start working on generating a public diff of the changes

This means replacing the emails in the output with their FAS username.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2019-11-21 11:28:24 +01:00 committed by Nils Philippsen
parent 3c504653a7
commit fd66fa51c5

View file

@ -213,24 +213,28 @@ class BugzillaProxy:
return self.userCache[username]['bugzilla_email'].lower()
def add_edit_component(self, package, collection, owner, description=None,
qacontact=None, cclist=None):
qacontact=None, cclist=None, output_user=False):
'''Add or update a component to have the values specified.
'''
# Turn the cclist into something usable by bugzilla
initialCCList = []
initialCCList_username = []
for watcher in cclist:
bz_email = self._get_bugzilla_email(watcher)
if bz_email:
initialCCList.append(bz_email)
initialCCList_username.append(watcher)
else:
print(f"** {watcher} has no bugzilla_email or mailing_list set "
f"({collection}/{package}) **")
# Add owner to the cclist so comaintainers taking over a bug don't
# have to do this manually
owner_name = owner
owner = self._get_bugzilla_email(owner)
if owner not in initialCCList:
initialCCList.append(owner)
initialCCList_username.append(owner_name)
# Lookup product
try:
@ -278,11 +282,14 @@ class BugzillaProxy:
data['component'] = package
if self.config["verbose"]:
print('[EDITCOMP] %s/%s' % (data["product"], data["component"]))
print(f'[EDITCOMP] {data["product"]}/{data["component"]}')
for key in ["initialowner", "description", "initialqacontact", "initialcclist"]:
if data.get(key):
print(f" {key} changed from {product[pkgKey][key]} "
f"to {data.get(key)}")
if output_user and key == "initialcclist":
print(f" {key} changed from to `{initialCCList_username}`")
else:
print(f" {key} changed from `{product[pkgKey][key]} "
f"to `{data.get(key)}`")
# FIXME: initialowner has been made mandatory for some
# reason. Asking dkl why.