Skip to content

Commit

Permalink
Merge pull request #266 from dholth/mail-alias
Browse files Browse the repository at this point in the history
update num_commits to account for multiple aliases per email
  • Loading branch information
saraedum authored Jan 16, 2023
2 parents 7939472 + 14d257c commit 46dbba9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
24 changes: 24 additions & 0 deletions news/265-single-count-aliases.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* <news item>

**Changed:**

* Don't double-count contributions when users have multiple aliases per e-mail.
(#265)

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
4 changes: 3 additions & 1 deletion rever/authors.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def update_metadata(filename, write=True, validation_error=True):
cpe = vcsutils.commits_per_email()
fcpe = None
for x in y:
x["num_commits"] = cpe.get(x["email"], 0) + sum([cpe.get(a, 0) for a in x.get("alternate_emails", [])])
# if duplicate nicknames A <foo@example>, A B <foo@example>
unique_emails = set([x["email"]] + x.get("alternate_emails", []))
x["num_commits"] = sum([cpe.get(a, 0) for a in unique_emails])
# only compute first commits if needed.
if "first_commit" not in x:
if fcpe is None:
Expand Down

0 comments on commit 46dbba9

Please sign in to comment.