Commit:    311b929c81d58a3e5e446d39bff4447a7ecc3651
Author:    Anatol Belski <[email protected]>         Fri, 15 Sep 2017 14:41:11 +0200
Parents:   7886bfcb221e56c2f53491eaa510aadad5ffa9bc
Branches:  master

Link:       
http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=311b929c81d58a3e5e446d39bff4447a7ecc3651

Log:
If only one build was requested, don't write all the available into db

Changed paths:
  M  include/Branch.php
  M  script/snap.php


Diff:
diff --git a/include/Branch.php b/include/Branch.php
index 91ba18f..fd9edd2 100644
--- a/include/Branch.php
+++ b/include/Branch.php
@@ -58,7 +58,7 @@ class Branch {
                return file_put_contents($this->db_path, $json, LOCK_EX);
        }
 
-       private function addBuildList()
+       private function addBuildList($build_name = NULL)
        {
                $builds = $this->config->getBuildList();
 
@@ -68,13 +68,16 @@ class Branch {
                                        throw new \Exception("Builds for '$n' 
are already done or in progress");
                                }
                                $this->data->builds[] = $n;
+                               if ($build_name && $n == $build_name) {
+                                       break;
+                               }
                        }
                } else {
                                throw new \Exception("No build configuration");
                }
        }
 
-       public function update()
+       public function update($build_name = NULL)
        {
                $last_id = $this->repo->getLastCommitId();
                
@@ -92,7 +95,7 @@ class Branch {
                }
                
                if ($this->hasUnfinishedBuild()) {
-                       $this->addBuildList();
+                       $this->addBuildList($build_name);
                }
                
                $this->writeData();
diff --git a/script/snap.php b/script/snap.php
index e9512fd..fab95a2 100644
--- a/script/snap.php
+++ b/script/snap.php
@@ -48,7 +48,7 @@ for ($i = 0; $i < count($builds_top) && ($force || 
$branch->hasNewRevision()); $
        }*/
        
        try {
-               if (!$branch->update()) {
+               if (!$branch->update("all" == $build_type ? NULL : 
$build_type)) {
                        goto out_here;
                }
        } catch (\Exception $e) {


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to