]> khamidou — GitHub mirrors - arcanist.git/commit
Don't use `emailuser` in Mercurial
authorepriestley <git@epriestley.com>
Tue, 2 Apr 2013 21:06:46 +0000 (14:06 -0700)
committerepriestley <git@epriestley.com>
Tue, 2 Apr 2013 21:06:46 +0000 (14:06 -0700)
commitac0aa330f5972d7ca04483b243e3b9802e2b897a
tree63aa15d7d23874658f7b050d1996ee4df31686f9
parent3f2c6b629fc0fb6d41ac8511a125fc1c4477c0a1
Don't use `emailuser` in Mercurial

Summary:
The `emailuser` template is a relatively recent addition to Mercurial, and a few users have complained about it. It also doesn't actually do what I thought it did, e.g. in an address like this:

  "Abraham Lincoln" <alincoln@whitehouse.gov>
   ^^^^^^^^^^^^^^^   ^^^^^^^^
         (1)            (2)

                     ^^^^^^^^^^^^^^^^^^^^^^^
                              (3)

...I want (1), but `emailuser` means (2). Instead, extract (1) with `getDisplayName()` and (3) with `getAddress()` using PhutilEmailAddress.

The implementation in Mercurial is not particularly sophisticated or magical (it just looks for "@" and "<") so we aren't really missing anything by doing this ourselves, at least today.

Also fix some issues in `arc export`, which literally no one uses, but which is occasionally useful for testing (as here).

Test Plan:
  - Ran `arc diff --only` in an `hg` repo, checked DB to see that name/email were correctly extracted.
  - Ran `arc export --git` in an `hg` repo, didn't get a long series of fatals.

Reviewers: btrahan, DurhamGoode

Reviewed By: DurhamGoode

CC: aran
Maniphest Tasks: T2866, T2858

Differential Revision: https://secure.phabricator.com/D5539
src/repository/api/ArcanistMercurialAPI.php
src/workflow/ArcanistExportWorkflow.php