Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/buildstream/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,9 @@ def workspace_reset(self, targets, *, soft):

nonexisting = []
for element in elements:
if not self.workspace_exists(element.name):
nonexisting.append(element.name)
name = element._get_full_name()
if not self.workspace_exists(name):
nonexisting.append(name)
if nonexisting:
raise StreamError("Workspace does not exist", detail="\n".join(nonexisting))

Expand Down
26 changes: 26 additions & 0 deletions tests/frontend/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,32 @@ def test_reset_soft(cli, tmpdir, datafiles):
assert key_1 != key_3


@pytest.mark.datafiles(DATA_DIR)
def test_reset_junction_workspace(cli, tmpdir, datafiles):
project = str(datafiles)
workspace = os.path.join(str(tmpdir), "junction-workspace")
target = "nested.bst:import-etc.bst"

_yaml.roundtrip_dump(
{"kind": "junction", "sources": [{"kind": "local", "path": "files/sub-project"}]},
os.path.join(project, "elements", "nested.bst"),
)

result = cli.run(project=project, args=["workspace", "open", "--directory", workspace, target])
result.assert_success()

result = cli.run(project=project, args=["workspace", "reset", target])
result.assert_success()

result = cli.run(project=project, args=["workspace", "list"])
result.assert_success()
loaded = _yaml.load_data(result.output)
workspaces = loaded.get_sequence("workspaces")
assert len(workspaces) == 1
space = workspaces.mapping_at(0)
assert space.get_str("element") == target


@pytest.mark.datafiles(DATA_DIR)
def test_reset_multiple(cli, tmpdir, datafiles):
# Open the workspaces
Expand Down