Commit: 4515772d8121ae352f3917f47245940913b47811 Author: Anatol Belski <[email protected]> Mon, 18 Sep 2017 11:26:14 +0200 Parents: 9920e2f5d82d1fceb558c4d5cde008da017481a2 Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=4515772d8121ae352f3917f47245940913b47811 Log: Rework update and cleanup in parallel build Changed paths: M include/Branch.php M script/snap.php Diff: diff --git a/include/Branch.php b/include/Branch.php index c10db48..d3e2a47 100644 --- a/include/Branch.php +++ b/include/Branch.php @@ -52,6 +52,10 @@ class Branch { $data->builds = array(); } + if ($data->build_num > self::REQUIRED_BUILDS_NUM) { + throw new \Exception("Inconsistent db, build number can't be {$data->build_num}."); + } + return $data; } @@ -101,16 +105,12 @@ class Branch { if (!$last_id) { throw new \Exception("last revision id is empty"); } - - if ($this->requiredBuildRunsReached() && $this->hasNewRevision() || NULL == $this->data->revision_last) { + + /* Update this only for the first build for the current revision. */ + if (0 == $this->numBuildsRunning() && $this->hasNewRevision() || NULL == $this->data->revision_last) { $this->data->revision_previous = $this->data->revision_last; $this->data->revision_last = $last_id; } - - if ($this->requiredBuildRunsReached()) { - $this->data->builds = array(); - $this->data->build_num = 0; - } if ($this->hasUnfinishedBuild()) { $this->addBuildList($build_name); @@ -272,11 +272,12 @@ class Branch { $this->writeData(); } - function resetBuildNum() + function resetBuildInfo() { - if (rm\Branch::REQUIRED_BUILDS_NUM <= $branch->numBuildsRunning()) { + if (self::REQUIRED_BUILDS_NUM <= $branch->numBuildsRunning()) { $this->data = $this->readdata(); $this->data->build_num = 0; + $this->data->builds = array(); $this->writeData(); } } diff --git a/script/snap.php b/script/snap.php index 2f64dc8..c7dfce9 100644 --- a/script/snap.php +++ b/script/snap.php @@ -222,7 +222,7 @@ if ($branch->hasNewRevision() || $branch->hasUnfinishedBuild() || $force) { } $branch->setLastRevisionExported($last_rev); - $branch->resetBuildNum(); + $branch->resetBuildInfo(); } out_here: -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
