Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14036837
D14995.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D14995.diff
View Options
diff --git a/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php
--- a/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php
@@ -79,6 +79,7 @@
'repositoryPHID' => $commit->getRepository()->getPHID(),
'identifier' => $commit->getCommitIdentifier(),
'epoch' => $commit->getEpoch(),
+ 'authorEpoch' => $commit_data->getCommitDetail('authorEpoch'),
'uri' => $uri,
'isImporting' => !$commit->isImported(),
'summary' => $commit->getSummary(),
@@ -99,6 +100,7 @@
->withIdentifier($commit->getCommitIdentifier())
->execute();
+ $dict['authorEpoch'] = $lowlevel_commitref->getAuthorEpoch();
$dict['author'] = $lowlevel_commitref->getAuthor();
$dict['authorName'] = $lowlevel_commitref->getAuthorName();
$dict['authorEmail'] = $lowlevel_commitref->getAuthorEmail();
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -492,8 +492,12 @@
if (!$repository->isSVN()) {
$authored_info = id(new PHUIStatusItemView());
- // TODO: In Git, a distinct authorship date is available. When present,
- // we should show it here.
+
+ $author_epoch = $data->getCommitDetail('authorEpoch');
+ if ($author_epoch !== null) {
+ $authored_info->setNote(
+ phabricator_datetime($author_epoch, $viewer));
+ }
if ($author_phid) {
$authored_info->setTarget($handles[$author_phid]->renderLink());
diff --git a/src/applications/diffusion/data/DiffusionCommitRef.php b/src/applications/diffusion/data/DiffusionCommitRef.php
--- a/src/applications/diffusion/data/DiffusionCommitRef.php
+++ b/src/applications/diffusion/data/DiffusionCommitRef.php
@@ -3,6 +3,7 @@
final class DiffusionCommitRef extends Phobject {
private $message;
+ private $authorEpoch;
private $authorName;
private $authorEmail;
private $committerName;
@@ -11,6 +12,7 @@
public static function newFromConduitResult(array $result) {
$ref = id(new DiffusionCommitRef())
+ ->setAuthorEpoch(idx($result, 'authorEpoch'))
->setCommitterEmail(idx($result, 'committerEmail'))
->setCommitterName(idx($result, 'committerName'))
->setAuthorEmail(idx($result, 'authorEmail'))
@@ -38,6 +40,15 @@
return $this->hashes;
}
+ public function setAuthorEpoch($author_epoch) {
+ $this->authorEpoch = $author_epoch;
+ return $this;
+ }
+
+ public function getAuthorEpoch() {
+ return $this->authorEpoch;
+ }
+
public function setCommitterEmail($committer_email) {
$this->committerEmail = $committer_email;
return $this;
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
@@ -52,7 +52,7 @@
'UTF-8',
implode(
'%x00',
- array('%e', '%cn', '%ce', '%an', '%ae', '%T', '%s%n%n%b')),
+ array('%e', '%cn', '%ce', '%an', '%ae', '%T', '%at', '%s%n%n%b')),
$this->identifier);
$parts = explode("\0", $info);
@@ -77,13 +77,19 @@
->setHashValue($parts[4]),
);
+ $author_epoch = (int)$parts[5];
+ if (!$author_epoch) {
+ $author_epoch = null;
+ }
+
return id(new DiffusionCommitRef())
->setCommitterName($parts[0])
->setCommitterEmail($parts[1])
->setAuthorName($parts[2])
->setAuthorEmail($parts[3])
->setHashes($hashes)
- ->setMessage($parts[5]);
+ ->setAuthorEpoch($author_epoch)
+ ->setMessage($parts[6]);
}
private function loadMercurialCommitRef() {
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -58,6 +58,7 @@
->setMaximumBytes(255)
->truncateString((string)$author));
+ $data->setCommitDetail('authorEpoch', $ref->getAuthorEpoch());
$data->setCommitDetail('authorName', $ref->getAuthorName());
$data->setCommitDetail('authorEmail', $ref->getAuthorEmail());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 12:24 PM (1 d, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711012
Default Alt Text
D14995.diff (4 KB)
Attached To
Mode
D14995: Parse and display commit authorship date in Git in Diffusion
Attached
Detach File
Event Timeline
Log In to Comment