Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4234
Get authored date on Diffusion for Git commits (kludge)
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Jul 11 2015, 20:20
2015-07-11 20:20:15 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
Get authored date on Diffusion for Git commits (kludge)
View Options
From d5aa1df97553d678c69139fbbab6d2667bb7d602 Mon Sep 17 00:00:00 2001
From: Nasqueron Operations <ops-noreply@nasqueron.org>
Date: Sat, 11 Jul 2015 20:16:44 +0000
Subject: [PATCH] Kludge to get commit authored date
---
.../diffusion/controller/DiffusionCommitController.php | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
index 74441be..f0bd340 100644
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -523,13 +523,25 @@ final class DiffusionCommitController extends DiffusionController {
}
}
+ $commit_epoch = $commit->getEpoch();
+
$author_phid = $data->getCommitDetail('authorPHID');
$author_name = $data->getAuthorName();
if (!$repository->isSVN()) {
+ if ($repository->isGit()) {
+ $path = $repository->getDetails()['local-path'];
+ $commitIdentifier = $commit->getCommitIdentifier();
+ $authored_epoch = `cd $path ; git show -s --format="%at" $commitIdentifier`;
+ } else {
+ $authored_epoch = null;
+ }
+
$authored_info = id(new PHUIStatusItemView());
- // TODO: In Git, a distinct authorship date is available. When present,
- // we should show it here.
+ if ($authored_epoch && abs($authored_epoch - $commit_epoch) > 59) {
+ $authored_info
+ ->setNote(phabricator_datetime($authored_epoch, $viewer));
+ }
if ($author_phid) {
$authored_info->setTarget($handles[$author_phid]->renderLink());
--
2.1.1
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4122
Default Alt Text
Get authored date on Diffusion for Git commits (kludge) (1 KB)
Attached To
Mode
P94 Get authored date on Diffusion for Git commits (kludge)
Attached
Detach File
Event Timeline
Log In to Comment