@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.

Make `repository pull` install hooks the first time

Summary:
Ref T4257. Currently, the pull logic looks like this:

if (new) {
create();
} else {
if (hosted) {
install_hooks();
} else {
update();
}
}

This means that the first time you run `repository pull`, hooks aren't installed, which makes debugging trickier. Instead, reorganize the logic:

if (new) {
create();
} else {
if (!hosted) {
update();
}
}

if (hosted) {
install_hooks();
}

Test Plan: Ran `bin/repository pull` on a new `hg` repo and got hooks installed immediately.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4257

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

+13 -16
+13 -16
src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
··· 82 82 $this->executeSubversionCreate(); 83 83 } 84 84 } else { 85 - if ($repository->isHosted()) { 86 - if ($is_git) { 87 - $this->installGitHook(); 88 - } else if ($is_svn) { 89 - $this->installSubversionHook(); 90 - } else if ($is_hg) { 91 - $this->installMercurialHook(); 92 - } else { 93 - $this->logPull( 94 - pht( 95 - "Repository '%s' is hosted, so Phabricator does not pull ". 96 - "updates for it.", 97 - $callsign)); 98 - } 99 - } else { 85 + if (!$repository->isHosted()) { 100 86 $this->logPull( 101 87 pht( 102 88 "Updating the working copy for repository '%s'.", 103 89 $callsign)); 104 90 if ($is_git) { 105 91 $this->executeGitUpdate(); 106 - } else { 92 + } else if ($is_hg) { 107 93 $this->executeMercurialUpdate(); 108 94 } 109 95 } 110 96 } 97 + 98 + if ($repository->isHosted()) { 99 + if ($is_git) { 100 + $this->installGitHook(); 101 + } else if ($is_svn) { 102 + $this->installSubversionHook(); 103 + } else if ($is_hg) { 104 + $this->installMercurialHook(); 105 + } 106 + } 107 + 111 108 } catch (Exception $ex) { 112 109 $this->abortPull( 113 110 pht('Pull of "%s" failed: %s', $callsign, $ex->getMessage()),