diff --git a/scripts/__init_env__.php b/scripts/__init_env__.php index faf5fedcea..1089069377 100644 --- a/scripts/__init_env__.php +++ b/scripts/__init_env__.php @@ -40,3 +40,5 @@ phutil_load_library('arcanist/src'); foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) { phutil_load_library($library); } + +PhutilErrorHandler::initialize(); diff --git a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php index 1671c6ff83..9983150496 100644 --- a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php +++ b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php @@ -66,10 +66,12 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { if (!$diff) { continue; } + $id = $revision->getID(); $results[] = array( - 'id' => $revision->getID(), + 'id' => $id, 'phid' => $revision->getPHID(), 'name' => $revision->getTitle(), + 'uri' => PhabricatorEnv::getProductionURI('/D'.$id), 'dateCreated' => $revision->getDateCreated(), 'authorPHID' => $revision->getAuthorPHID(), 'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus( diff --git a/src/applications/conduit/method/differential/find/__init__.php b/src/applications/conduit/method/differential/find/__init__.php index 872766e494..f468d032ec 100644 --- a/src/applications/conduit/method/differential/find/__init__.php +++ b/src/applications/conduit/method/differential/find/__init__.php @@ -9,6 +9,7 @@ phutil_require_module('phabricator', 'applications/conduit/method/base'); phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus'); phutil_require_module('phabricator', 'applications/differential/data/revisionlist'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phutil', 'utils'); diff --git a/src/applications/conduit/method/diffusion/getcommits/ConduitAPI_diffusion_getcommits_Method.php b/src/applications/conduit/method/diffusion/getcommits/ConduitAPI_diffusion_getcommits_Method.php index 511fc47cfa..29800e95de 100644 --- a/src/applications/conduit/method/diffusion/getcommits/ConduitAPI_diffusion_getcommits_Method.php +++ b/src/applications/conduit/method/diffusion/getcommits/ConduitAPI_diffusion_getcommits_Method.php @@ -126,7 +126,12 @@ class ConduitAPI_diffusion_getcommits_Method extends ConduitAPIMethod { ); // Upgrade git short references into full commit identifiers. - $commits[$name]['commitIdentifier'] = $cobj->getCommitIdentifier(); + $identifier = $cobj->getCommitIdentifier(); + $commits[$name]['commitIdentifier'] = $identifier; + + $callsign = $commits[$name]['callsign']; + $uri = "/r{$callsign}{$identifier}"; + $commits[$name]['uri'] = PhabricatorEnv::getProductionURI($uri); } if (!$commits) { diff --git a/src/applications/conduit/method/diffusion/getcommits/__init__.php b/src/applications/conduit/method/diffusion/getcommits/__init__.php index d20db59423..27e8490a51 100644 --- a/src/applications/conduit/method/diffusion/getcommits/__init__.php +++ b/src/applications/conduit/method/diffusion/getcommits/__init__.php @@ -12,6 +12,7 @@ phutil_require_module('phabricator', 'applications/repository/constants/reposito phutil_require_module('phabricator', 'applications/repository/storage/commit'); phutil_require_module('phabricator', 'applications/repository/storage/commitdata'); phutil_require_module('phabricator', 'applications/repository/storage/repository'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'storage/qsprintf'); phutil_require_module('phabricator', 'storage/queryfx'); diff --git a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php index 66f13db382..3fd7acb40f 100644 --- a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php +++ b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php @@ -113,6 +113,8 @@ final class PhabricatorIRCBot extends PhabricatorDaemon { private function runSelectLoop() { do { + $this->stillWorking(); + $read = array($this->socket); if (strlen($this->writeBuffer)) { $write = array($this->socket); diff --git a/src/infrastructure/daemon/irc/handler/objectname/PhabricatorIRCObjectNameHandler.php b/src/infrastructure/daemon/irc/handler/objectname/PhabricatorIRCObjectNameHandler.php index 5da7bfceb1..0851e426e0 100644 --- a/src/infrastructure/daemon/irc/handler/objectname/PhabricatorIRCObjectNameHandler.php +++ b/src/infrastructure/daemon/irc/handler/objectname/PhabricatorIRCObjectNameHandler.php @@ -35,24 +35,76 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler { $message = $message->getMessageText(); $matches = null; $phids = array(); - if (preg_match_all('/(?:^|\b)D(\d+)(?:\b|$)/', $message, $matches)) { - if ($matches[1]) { - $revisions = $this->getConduit()->callMethodSynchronous( - 'differential.find', - array( - 'query' => 'revision-ids', - 'guids' => $matches[1], - )); - // TODO: This is utter hacks until phid.find or similar lands. - foreach ($revisions as $revision) { - $phids[$revision['phid']] = - 'D'.$revision['id'].' '.$revision['name'].' - '. - PhabricatorEnv::getProductionURI('/D'.$revision['id']); + $pattern = + '@'. + '(? $description) { + + $pattern = + '@'. + '(?getConduit()->callMethodSynchronous( + 'differential.find', + array( + 'query' => 'revision-ids', + 'guids' => $revision_ids, + )); + foreach ($revisions as $revision) { + $output[] = + 'D'.$revision['id'].' '.$revision['name'].' - '. + $revision['uri']; + } + } + + // TODO: Support tasks in Conduit. + + if ($commit_names) { + $commits = $this->getConduit()->callMethodSynchronous( + 'diffusion.getcommits', + array( + 'commits' => $commit_names, + )); + foreach ($commits as $commit) { + if (isset($commit['error'])) { + continue; + } + $output[] = $commit['uri']; + } + } + + foreach ($output as $description) { $this->write('PRIVMSG', "{$channel} :{$description}"); } break; diff --git a/src/infrastructure/daemon/irc/handler/objectname/__init__.php b/src/infrastructure/daemon/irc/handler/objectname/__init__.php index fe1f69ba65..1b2f54cc85 100644 --- a/src/infrastructure/daemon/irc/handler/objectname/__init__.php +++ b/src/infrastructure/daemon/irc/handler/objectname/__init__.php @@ -7,7 +7,6 @@ phutil_require_module('phabricator', 'infrastructure/daemon/irc/handler/base'); -phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_source('PhabricatorIRCObjectNameHandler.php');