mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-03-27 19:50:19 +01:00
Record commit email information from arc
Summary: Record author email information in `arc diff`, so we can recreate it in `arc patch` and elsewhere without creating any kind of email exposure issues. In Mercurial, we currently store the whole string ("username <email@domain.com>"). Make this consistent with Git. Test Plan: Created git and hg diffs, saw authorEmail populated. Reviewers: btrahan, edward, vrana Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D4825
This commit is contained in:
parent
bd71ba675e
commit
99feb5c28e
2 changed files with 12 additions and 8 deletions
|
@ -101,7 +101,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
: 'log %C --format=%s --',
|
||||
$against,
|
||||
// NOTE: "%B" is somewhat new, use "%s%n%n%b" instead.
|
||||
'%H%x01%T%x01%P%x01%at%x01%an%x01%s%x01%s%n%n%b%x02');
|
||||
'%H%x01%T%x01%P%x01%at%x01%an%x01%aE%x01%s%x01%s%n%n%b%x02');
|
||||
|
||||
$commits = array();
|
||||
|
||||
|
@ -112,8 +112,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
|
||||
$info = explode("\2", $info);
|
||||
foreach ($info as $line) {
|
||||
list($commit, $tree, $parents, $time, $author, $title, $message)
|
||||
= explode("\1", trim($line), 7);
|
||||
list($commit, $tree, $parents, $time, $author, $author_email,
|
||||
$title, $message) = explode("\1", trim($line), 8);
|
||||
$message = rtrim($message);
|
||||
|
||||
$commits[$commit] = array(
|
||||
|
@ -124,6 +124,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
'author' => $author,
|
||||
'summary' => $title,
|
||||
'message' => $message,
|
||||
'authorEmail' => $author_email,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,9 +177,11 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
if ($this->localCommitInfo === null) {
|
||||
list($info) = $this->execxLocal(
|
||||
"log --template '%C' --rev %s --branch %s --",
|
||||
"{node}\1{rev}\1{author}\1{date|rfc822date}\1".
|
||||
"{branch}\1{tag}\1{parents}\1{desc}\2",
|
||||
'(ancestors(.) - ancestors('.$this->getBaseCommit().'))',
|
||||
"{node}\1{rev}\1{author|emailuser}\1{author|email}\1".
|
||||
"{date|rfc822date}\1{branch}\1{tag}\1{parents}\1{desc}\2",
|
||||
hgsprintf(
|
||||
'(ancestors(.) - ancestors(%s))',
|
||||
$this->getBaseCommit()),
|
||||
$this->getBranchName());
|
||||
$logs = array_filter(explode("\2", $info));
|
||||
|
||||
|
@ -189,8 +191,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
|
||||
$commits = array();
|
||||
foreach ($logs as $log) {
|
||||
list($node, $rev, $author, $date, $branch, $tag, $parents, $desc) =
|
||||
explode("\1", $log);
|
||||
list($node, $rev, $author, $author_email, $date, $branch, $tag,
|
||||
$parents, $desc) = explode("\1", $log, 9);
|
||||
|
||||
// NOTE: If a commit has only one parent, {parents} returns empty.
|
||||
// If it has two parents, {parents} returns revs and short hashes, not
|
||||
|
@ -222,6 +224,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
'parents' => $commit_parents,
|
||||
'summary' => head(explode("\n", $desc)),
|
||||
'message' => $desc,
|
||||
'authorEmail' => $author_email,
|
||||
);
|
||||
|
||||
$last_node = $node;
|
||||
|
|
Loading…
Add table
Reference in a new issue