This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch jennis/subtract_when_required
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d6f958676a3579b0d234842c953f6708ca843af5
Author: James Ennis <[email protected]>
AuthorDate: Mon May 13 12:16:10 2019 +0100

    _stream.py: Don't subtract elements if we have nothing to subtract
---
 buildstream/_stream.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index d4f26e4..4ed0d68 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -242,7 +242,8 @@ class Stream():
                        dynamic_plan=True)
 
         # Remove the tracking elements from the main targets
-        elements = self._pipeline.subtract_elements(elements, track_elements)
+        if track_elements:
+            elements = self._pipeline.subtract_elements(elements, 
track_elements)
 
         # Assert that the elements we're not going to track are consistent
         self._pipeline.assert_consistent(elements)
@@ -1230,9 +1231,9 @@ class Stream():
 
         if track_elements is None:
             track_elements = []
-
-        # Subtract the track elements from the fetch elements, they will be 
added separately
-        fetch_plan = self._pipeline.subtract_elements(elements, track_elements)
+        else:
+            # Subtract the track elements from the fetch elements, they will 
be added separately
+            fetch_plan = self._pipeline.subtract_elements(elements, 
track_elements)
 
         # Assert consistency for the fetch elements
         self._pipeline.assert_consistent(fetch_plan)
@@ -1241,7 +1242,8 @@ class Stream():
         # let the track plan resolve new refs.
         cached = [elt for elt in fetch_plan
                   if not elt._should_fetch(fetch_original)]
-        fetch_plan = self._pipeline.subtract_elements(fetch_plan, cached)
+        if cached:
+            fetch_plan = self._pipeline.subtract_elements(fetch_plan, cached)
 
         # Construct queues, enqueue and run
         #

Reply via email to