Improve Diffusion parser linking of author names
Summary: See T502. Under some VCS setups, we get full email addresses instead of
usernames or real names. Try harder to find matches, by falling back to email
address parsing if we don't get hits on the straight-up token parsing.
Test Plan:
This is difficult to test because it depends on the account state and repository
state, and hard to pull out so it's more testable without better mocking
facilities. I just dumped this into the parser to verify the behavior:
foreach (array( 'epriestley', 'Evan Priestley', 'epriestley@epriestley.com', 'derp <epriestley@epriestley.com>', '"Evan Priestley" <derpderpderp@derpderpderp.com>', 'quackderp <derpderpderp@derpderpderp.com>', ) as $email) { echo "{$email} = ".$this->resolveUserPHID($email)."\n"; } die(); Running PhabricatorRepositoryGitCommitMessageParserWorker... epriestley = PHID-USER-79f25616ea2635089a31 Evan Priestley = PHID-USER-79f25616ea2635089a31 epriestley@epriestley.com = PHID-USER-1bec59b91be6223f07fd derp <epriestley@epriestley.com> = PHID-USER-1bec59b91be6223f07fd "Evan Priestley" <derpderpderp@derpderpderp.com> =
PHID-USER-79f25616ea2635089a31
quackderp <derpderpderp@derpderpderp.com> =
This is expected (all variations of my identity parsed correctly, and the bogus
one failed). There are two different user PHIDs in the result set because I have
like 30 different similar accounts on my local, including one called "derp" and
another one with address "derp@derp.com", which prevented an earlier version of
this test case from working correctly.
Reviewers: zachallia, aran, Makinde, jungejason, nh, tuomaspelkonen
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 968