summaryrefslogtreecommitdiff
path: root/buildstream/_stream.py
diff options
context:
space:
mode:
authorPhillip Smyth <phillipsmyth@codethink.co.uk>2018-07-18 16:06:52 +0100
committerknownexus <phillip.smyth@codethink.co.uk>2018-07-25 15:15:36 +0100
commit54fee6c8589e79728b5933598f1e4652540ca205 (patch)
tree4a6aadb683a543b0080eaf5efce5c26347a3705e /buildstream/_stream.py
parent889bf23825d2627fec04443cc936f79d836c7486 (diff)
downloadbuildstream-54fee6c8589e79728b5933598f1e4652540ca205.tar.gz
_stream.py: Added functionality for workspace open -f
tests/frontend/workspace.py: Added tests
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: