Only redirect elements for workspace and track operations
It was redirecting for checkout operations
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index e59b1ba..c75e7ac 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -408,6 +408,10 @@
all: All dependencies of all specified elements
"""
with app.initialized(session_name="Track"):
+ # Substitute 'none' for 'redirect' so that element redirections
+ # will be done
+ if deps == 'none':
+ deps = 'redirect'
app.stream.track(elements,
selection=deps,
except_targets=except_,
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 9f4504d..852abf7 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -44,6 +44,9 @@
# Select only the target elements in the associated targets
NONE = 'none'
+ # As NONE, but redirect elements that are capable of it
+ REDIRECT = 'redirect'
+
# Select elements which must be built for the associated targets to be built
PLAN = 'plan'
@@ -215,6 +218,8 @@
elements = None
if mode == PipelineSelection.NONE:
+ elements = targets
+ elif mode == PipelineSelection.REDIRECT:
# Redirect and log if permitted
elements = []
for t in targets:
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 5013daf..4b699c1 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -263,7 +263,7 @@
# are rewritten inline.
#
def track(self, targets, *,
- selection=PipelineSelection.NONE,
+ selection=PipelineSelection.REDIRECT,
except_targets=None,
cross_junctions=False):
@@ -421,7 +421,9 @@
else:
track_targets = ()
- elements, track_elements = self._load((target,), track_targets)
+ elements, track_elements = self._load((target,), track_targets,
+ selection=PipelineSelection.REDIRECT,
+ track_selection=PipelineSelection.REDIRECT)
target = elements[0]
workdir = os.path.abspath(directory)
@@ -514,7 +516,9 @@
else:
track_targets = ()
- elements, track_elements = self._load(targets, track_targets)
+ elements, track_elements = self._load(targets, track_targets,
+ selection=PipelineSelection.REDIRECT,
+ track_selection=PipelineSelection.REDIRECT)
nonexisting = []
for element in elements:
@@ -699,7 +703,9 @@
else:
output_elements.add(e)
if load_elements:
- loaded_elements, _ = self._load(load_elements, ())
+ loaded_elements, _ = self._load(load_elements, (),
+ selection=PipelineSelection.REDIRECT,
+ track_selection=PipelineSelection.REDIRECT)
for e in loaded_elements:
output_elements.add(e.name)