@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Treat commit hook execution in observed repositories as a no-op, not an error

Summary:
See PHI24. If you create a hosted Mercurial repository and switch it to observed, you can end up with a hook installed that runs on pulls and complains.

Instead, just bail out if we're running on a pull.

The corresponding Git hook doesn't run on pulls, so there's no issue in Git.

Test Plan: Executed the hook in an observed Mercurial repository, got a clean exit.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D18307

+7 -2
+7 -2
scripts/repository/commit_hook.php
··· 48 48 } 49 49 50 50 if (!$repository->isHosted()) { 51 - // This should be redundant, but double check just in case. 52 - throw new Exception(pht('Repository "%s" is not hosted!', $argv[1])); 51 + // In Mercurial, the "pretxnchangegroup" hook fires for both pulls and 52 + // pushes. Normally we only install the hook for hosted repositories, but 53 + // if a hosted repository is later converted into an observed repository we 54 + // can end up with an observed repository that has the hook installed. 55 + // If we're running hooks from an observed repository, just exit without 56 + // taking action. For more discussion, see PHI24. 57 + return 0; 53 58 } 54 59 55 60 $engine->setRepository($repository);