filter.py: Redirect _get_real_element() calls to its build depend

We do this because trying to open/close/reset a workspace on a filter
element doesn't make sense, but is probably meant for the element that
the filter element filters.
diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py
index 2487a97..68f54db 100644
--- a/buildstream/plugins/elements/filter.py
+++ b/buildstream/plugins/elements/filter.py
@@ -32,6 +32,11 @@
 runtime dependencies forward from this filter element onto its reverse
 dependencies.
 
+When workspaces are opened, closed or reset on this element, instead
+of erroring due to a lack of sources, this element will transparently
+pass on the workspace opening/closing/resetting to its sole
+build-dependency.
+
 The default configuration and possible options are as such:
   .. literalinclude:: ../../../buildstream/plugins/elements/filter.yaml
      :language: yaml
@@ -102,6 +107,13 @@
                                    exclude=self.exclude, orphans=self.include_orphans)
         return ""
 
+    def _get_real_element(self):
+        # Filter elements act as proxies for their sole build-dependency
+        build_deps = list(self.dependencies(Scope.BUILD, recurse=False))
+        assert len(build_deps) == 1
+        output_elm = build_deps[0]._get_real_element()
+        return output_elm
+
 
 def setup():
     return FilterElement