summaryrefslogtreecommitdiff
path: root/buildstream/_stream.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_stream.py')
-rw-r--r--buildstream/_stream.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 365709c46..dcefc64f1 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -476,7 +476,7 @@ class Stream():
# Check for workspace config
workspace = workspaces.get_workspace(target._get_full_name())
- if workspace:
+ if workspace and not force:
raise StreamError("Workspace '{}' is already defined at: {}"
.format(target.name, workspace.path))
@@ -495,6 +495,10 @@ class Stream():
"fetch the latest version of the " +
"source.")
+ if workspace:
+ workspaces.delete_workspace(target._get_full_name())
+ workspaces.save_config()
+ shutil.rmtree(directory)
try:
os.makedirs(directory, exist_ok=True)
except OSError as e: