Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions author_postprocessing/author_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,24 @@ def is_github_noreply_author(name, email):
commit_data_file = path.join(data_path, commits_list)
commit_data = csv_writer.read_from_csv(commit_data_file)
commit_hash_to_author = {commit[7]: commit[2:4] for commit in commit_data}

author_name_to_data = {author[1]: author[1:3] for author in author_data_new}
issue_data_new = []

for event in issue_data:
# replace author if necessary
if is_github_noreply_author(event[9], event[10]) and event[8] == commit_added_event:
# extract commit hash from event info 1
commit_hash = event[12]

name = event[13][1:-1]
# extract commit author from commit data, if available
if commit_hash in commit_hash_to_author:
event[9] = commit_hash_to_author[commit_hash][0]
event[10] = commit_hash_to_author[commit_hash][1]
issue_data_new.append(event)
elif name in author_name_to_data:
event[9] = author_name_to_data[name][0]
event[10] = author_name_to_data[name][1]
issue_data_new.append(event)
else:
# the added commit is not part of the commit data. In most cases, this is due to merge commits
# appearing in another pull request, as Codeface does not keep track of merge commits. As we
Expand Down
8 changes: 8 additions & 0 deletions issue_processing/issue_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def merge_issue_events(issue_data):
# it is a commit which was added to the pull request
if rel_commit["type"] == "commitAddedToPullRequest":
rel_commit["event"] = "commit_added"
rel_commit["event_info_2"] = rel_commit["commit"]["author"]

# if the related commit was mentioned in an issue comment:
elif rel_commit["type"] == "commitMentionedInIssue":
Expand Down Expand Up @@ -745,6 +746,9 @@ def get_user_from_id(idx, buffer_db=user_buffer):
for event in issue["eventsList"]:
event["user"] = get_id_and_update_user(event["user"])

if event["event"] == "commit_added":
event["event_info_2"] = get_id_and_update_user(event["event_info_2"])

# check database for the reference-target user if needed
if event["ref_target"] != "":
event["ref_target"] = get_id_and_update_user(event["ref_target"])
Expand All @@ -758,6 +762,10 @@ def get_user_from_id(idx, buffer_db=user_buffer):
for event in issue["eventsList"]:
event["user"] = get_user_from_id(event["user"])

# for commit_added events, save the commit's author's name in event_info_2
if event["event"] == "commit_added":
event["event_info_2"] = get_user_from_id(event["event_info_2"])["name"]

# get the reference-target user if needed
if event["ref_target"] != "":
event["ref_target"] = get_user_from_id(event["ref_target"])
Expand Down