Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14841607
D19265.id46121.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19265.id46121.diff
View Options
diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
--- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
+++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
@@ -126,7 +126,6 @@
public function execute() {
$ref_updates = $this->findRefUpdates();
- $all_updates = $ref_updates;
$caught = null;
try {
@@ -140,21 +139,32 @@
throw $ex;
}
- $this->applyHeraldRefRules($ref_updates, $all_updates);
-
$content_updates = $this->findContentUpdates($ref_updates);
+ $all_updates = array_merge($ref_updates, $content_updates);
+
+ // If this is an "initial import" (a sizable push to a previously empty
+ // repository) we'll allow enormous changes and disable Herald rules.
+ // These rulesets can consume a large amount of time and memory and are
+ // generally not relevant when importing repository history.
+ $is_initial_import = $this->isInitialImport($all_updates);
+
+ if (!$is_initial_import) {
+ $this->applyHeraldRefRules($ref_updates);
+ }
try {
- $this->rejectEnormousChanges($content_updates);
+ if (!$is_initial_import) {
+ $this->rejectEnormousChanges($content_updates);
+ }
} catch (DiffusionCommitHookRejectException $ex) {
// If we're rejecting enormous changes, flag everything.
$this->rejectCode = PhabricatorRepositoryPushLog::REJECT_ENORMOUS;
throw $ex;
}
- $all_updates = array_merge($all_updates, $content_updates);
-
- $this->applyHeraldContentRules($content_updates, $all_updates);
+ if (!$is_initial_import) {
+ $this->applyHeraldContentRules($content_updates);
+ }
// Run custom scripts in `hook.d/` directories.
$this->applyCustomHooks($all_updates);
@@ -186,12 +196,10 @@
throw $caught;
}
- // If this went through cleanly, detect pushes which are actually imports
- // of an existing repository rather than an addition of new commits. If
- // this push is importing a bunch of stuff, set the importing flag on
- // the repository. It will be cleared once we fully process everything.
+ // If this went through cleanly and was an import, set the importing flag
+ // on the repository. It will be cleared once we fully process everything.
- if ($this->isInitialImport($all_updates)) {
+ if ($is_initial_import) {
$repository = $this->getRepository();
$repository->markImporting();
}
@@ -281,28 +289,21 @@
/* -( Herald )------------------------------------------------------------- */
- private function applyHeraldRefRules(
- array $ref_updates,
- array $all_updates) {
+ private function applyHeraldRefRules(array $ref_updates) {
$this->applyHeraldRules(
$ref_updates,
- new HeraldPreCommitRefAdapter(),
- $all_updates);
+ new HeraldPreCommitRefAdapter());
}
- private function applyHeraldContentRules(
- array $content_updates,
- array $all_updates) {
+ private function applyHeraldContentRules(array $content_updates) {
$this->applyHeraldRules(
$content_updates,
- new HeraldPreCommitContentAdapter(),
- $all_updates);
+ new HeraldPreCommitContentAdapter());
}
private function applyHeraldRules(
array $updates,
- HeraldAdapter $adapter_template,
- array $all_updates) {
+ HeraldAdapter $adapter_template) {
if (!$updates) {
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 2, 5:12 PM (2 h, 37 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7084830
Default Alt Text
D19265.id46121.diff (3 KB)
Attached To
Mode
D19265: Disable Herald and enormous change protection for repository initial imports
Attached
Detach File
Event Timeline
Log In to Comment