1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Don't parse mercurial usernames without email address as an email address

Summary:
This leads to information being lost when others do `arc patch` because the name is used as the email address.

For example:
  username = Richard van Velzen

Would give:
  'authorName' => null,
  'authorEmail' => 'Richard van Velzen'

Test Plan:
ran it through my head a couple of times, and tested it with the common options which all gave the expected result:
  'rvanvelzen@company.com',
  'Richard van Velzen',
  'Richard van Velzen <rvanvelzen@company.com>',
  'Richard van Velzen rvanvelzen@company.com',

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9605
This commit is contained in:
Richard van Velzen 2014-06-17 11:46:42 -07:00 committed by epriestley
parent d7541c70dd
commit 680ec3670c

View file

@ -247,9 +247,16 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
list($node, $rev, $full_author, $date, $branch, $tag,
$parents, $desc) = explode("\1", $log, 9);
// Not everyone enters their email address as a part of the username
// field. Try to make it work when it's obvious
if (strpos($full_author, '@') === false) {
$author = $full_author;
$author_email = null;
} else {
$email = new PhutilEmailAddress($full_author);
$author = $email->getDisplayName();
$author_email = $email->getAddress();
}
// NOTE: If a commit has only one parent, {parents} returns empty.
// If it has two parents, {parents} returns revs and short hashes, not