Changeset View
Changeset View
Standalone View
Standalone View
scripts/repository/commit_hook.php
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | $repository = id(new PhabricatorRepositoryQuery()) | ||||
| ->needProjectPHIDs(true) | ->needProjectPHIDs(true) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$repository) { | if (!$repository) { | ||||
| throw new Exception(pht('No such repository "%s"!', $argv[1])); | throw new Exception(pht('No such repository "%s"!', $argv[1])); | ||||
| } | } | ||||
| if (!$repository->isHosted()) { | if (!$repository->isHosted()) { | ||||
| // This should be redundant, but double check just in case. | // In Mercurial, the "pretxnchangegroup" hook fires for both pulls and | ||||
| throw new Exception(pht('Repository "%s" is not hosted!', $argv[1])); | // pushes. Normally we only install the hook for hosted repositories, but | ||||
| // if a hosted repository is later converted into an observed repository we | |||||
| // can end up with an observed repository that has the hook installed. | |||||
| // If we're running hooks from an observed repository, just exit without | |||||
| // taking action. For more discussion, see PHI24. | |||||
| return 0; | |||||
| } | } | ||||
| $engine->setRepository($repository); | $engine->setRepository($repository); | ||||
| $args = new PhutilArgumentParser($argv); | $args = new PhutilArgumentParser($argv); | ||||
| $args->parsePartial( | $args->parsePartial( | ||||
| array( | array( | ||||
| array( | array( | ||||
| ▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines | |||||