diff --git a/resources/sql/autopatches/20160419.pushlog.1.sql b/resources/sql/autopatches/20160419.pushlog.1.sql new file mode 100644 index 0000000000..3625f5860e --- /dev/null +++ b/resources/sql/autopatches/20160419.pushlog.1.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_repository.repository_pushlog + ADD devicePHID VARBINARY(64); diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php index 857ae76da3..54fa32a6a3 100644 --- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php +++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php @@ -1058,8 +1058,16 @@ final class DiffusionCommitHookEngine extends Phobject { // up. $phid = id(new PhabricatorRepositoryPushLog())->generatePHID(); + $device = AlmanacKeys::getLiveDevice(); + if ($device) { + $device_phid = $device->getPHID(); + } else { + $device_phid = null; + } + return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer()) ->setPHID($phid) + ->setDevicePHID($device_phid) ->setRepositoryPHID($this->getRepository()->getPHID()) ->attachRepository($this->getRepository()) ->setEpoch(time()); diff --git a/src/applications/diffusion/view/DiffusionPushLogListView.php b/src/applications/diffusion/view/DiffusionPushLogListView.php index 73a44794e8..b3d78f2369 100644 --- a/src/applications/diffusion/view/DiffusionPushLogListView.php +++ b/src/applications/diffusion/view/DiffusionPushLogListView.php @@ -38,6 +38,7 @@ final class DiffusionPushLogListView extends AphrontView { } $rows = array(); + $any_host = false; foreach ($logs as $log) { $repository = $log->getRepository(); @@ -59,6 +60,14 @@ final class DiffusionPushLogListView extends AphrontView { $log->getRefOldShort()); } + $device_phid = $log->getDevicePHID(); + if ($device_phid) { + $device = $handles[$device_phid]->renderLink(); + $any_host = true; + } else { + $device = null; + } + $rows[] = array( phutil_tag( 'a', @@ -75,6 +84,7 @@ final class DiffusionPushLogListView extends AphrontView { $handles[$log->getPusherPHID()]->renderLink(), $remote_address, $log->getPushEvent()->getRemoteProtocol(), + $device, $log->getRefType(), $log->getRefName(), $old_ref_link, @@ -100,6 +110,7 @@ final class DiffusionPushLogListView extends AphrontView { pht('Pusher'), pht('From'), pht('Via'), + pht('Host'), pht('Type'), pht('Name'), pht('Old'), @@ -116,10 +127,20 @@ final class DiffusionPushLogListView extends AphrontView { '', '', '', + '', 'wide', 'n', 'n', 'right', + )) + ->setColumnVisibility( + array( + true, + true, + true, + true, + true, + $any_host, )); return $table; diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php index b054423d26..320558de21 100644 --- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php @@ -95,7 +95,12 @@ final class PhabricatorRepositoryPushLogSearchEngine protected function getRequiredHandlePHIDsForResultList( array $logs, PhabricatorSavedQuery $query) { - return mpull($logs, 'getPusherPHID'); + $phids = array(); + $phids[] = mpull($logs, 'getPusherPHID'); + $phids[] = mpull($logs, 'getDevicePHID'); + $phids = array_mergev($phids); + $phids = array_filter($phids); + return $phids; } protected function renderResultList( diff --git a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php index f16784bbf1..4c449b4a84 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php +++ b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php @@ -34,6 +34,7 @@ final class PhabricatorRepositoryPushLog protected $epoch; protected $pusherPHID; protected $pushEventPHID; + protected $devicePHID; protected $refType; protected $refNameHash; protected $refNameRaw; @@ -81,6 +82,7 @@ final class PhabricatorRepositoryPushLog 'refNew' => 'text40', 'mergeBase' => 'text40?', 'changeFlags' => 'uint32', + 'devicePHID' => 'phid?', ), self::CONFIG_KEY_SCHEMA => array( 'key_repository' => array(