Skip to content

Commit 81dcf63

Browse files
author
epriestley
committedDec 23, 2013
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
1 parent 6daa2b6 commit 81dcf63

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed
 

‎src/applications/repository/engine/PhabricatorRepositoryPullEngine.php

+13-16
Original file line numberDiff line numberDiff line change
@@ -82,32 +82,29 @@ public function pullRepository() {
8282
$this->executeSubversionCreate();
8383
}
8484
} 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()) {
10086
$this->logPull(
10187
pht(
10288
"Updating the working copy for repository '%s'.",
10389
$callsign));
10490
if ($is_git) {
10591
$this->executeGitUpdate();
106-
} else {
92+
} else if ($is_hg) {
10793
$this->executeMercurialUpdate();
10894
}
10995
}
11096
}
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+
111108
} catch (Exception $ex) {
112109
$this->abortPull(
113110
pht('Pull of "%s" failed: %s', $callsign, $ex->getMessage()),

0 commit comments

Comments
 (0)
Failed to load comments.