From 38ffe45f8e25a7ea6cbf54a6aeaa37775f1af19e Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 25 Apr 2012 20:02:11 -0700 Subject: [PATCH] Use committer date instead of author date for Git epoch Summary: This is somewhat controversial but push date is usually more useful than commit date (which can be for example a month before other people can see the commit). We can also store both dates. Test Plan: git log --pretty="%ct %at" Reviewers: epriestley Reviewed By: epriestley CC: nh, aran, Koolvin Differential Revision: https://secure.phabricator.com/D2319 --- .../PhabricatorRepositoryGitCommitDiscoveryDaemon.php | 2 +- .../PhabricatorRepositoryCommitMessageParserWorker.php | 9 +-------- ...PhabricatorRepositorySvnCommitMessageParserWorker.php | 4 ---- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/applications/repository/daemon/commitdiscovery/git/PhabricatorRepositoryGitCommitDiscoveryDaemon.php b/src/applications/repository/daemon/commitdiscovery/git/PhabricatorRepositoryGitCommitDiscoveryDaemon.php index c76729b64c..ee6d09fbbd 100644 --- a/src/applications/repository/daemon/commitdiscovery/git/PhabricatorRepositoryGitCommitDiscoveryDaemon.php +++ b/src/applications/repository/daemon/commitdiscovery/git/PhabricatorRepositoryGitCommitDiscoveryDaemon.php @@ -119,7 +119,7 @@ final class PhabricatorRepositoryGitCommitDiscoveryDaemon while (true) { $target = array_pop($insert); list($epoch) = $repository->execxLocalCommand( - 'log -n1 --pretty="%%at" %s', + 'log -n1 --pretty="%%ct" %s', $target); $epoch = trim($epoch); diff --git a/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php index 3c54d4f7ab..eeab1b2731 100644 --- a/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php @@ -96,10 +96,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker if ($revision->getStatus() != ArcanistDifferentialRevisionStatus::CLOSED) { - $date_committed = $this->getDateCommitted($commit); - if ($date_committed) { - $revision->setDateCommitted($date_committed); - } + $revision->setDateCommitted($commit->getEpoch()); $message = null; $committer = $data->getCommitDetail('authorPHID'); @@ -118,10 +115,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker } } - protected function getDateCommitted(PhabricatorRepositoryCommit $commit) { - return null; - } - /** * When querying for revisions by hash, more than one revision may be found. * This function identifies the "best" revision from such a set. Typically, diff --git a/src/applications/repository/worker/commitmessageparser/svn/PhabricatorRepositorySvnCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/svn/PhabricatorRepositorySvnCommitMessageParserWorker.php index bd295c0f79..fafcbf6f41 100644 --- a/src/applications/repository/worker/commitmessageparser/svn/PhabricatorRepositorySvnCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/svn/PhabricatorRepositorySvnCommitMessageParserWorker.php @@ -54,8 +54,4 @@ final class PhabricatorRepositorySvnCommitMessageParserWorker return array(); } - protected function getDateCommitted(PhabricatorRepositoryCommit $commit) { - return $commit->getEpoch(); - } - }