summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-01-11 17:08:25 +0000
committerAngelos Evripiotis <jevripiotis@bloomberg.net>2019-01-28 16:06:26 +0000
commit199d01c280579e4fe17e60580b4a481210fb2ecf (patch)
tree24392981fb311d8e393c9e9b269e8f8eb471d238
parent383569322b44cb9cbdf77394bcc6b81ee0f5edbc (diff)
downloadbuildstream-aevri/are_you_sure.tar.gz
BREAK:remove unconditional 'are you sure?' promptsaevri/are_you_sure
This is a breaking change, as it affects behaviour that people might be relying on. An entry has been added to NEWS. As proposed on the mailing list, this change removes the unconditional prompts on: o: bst workspace reset o: bst workspace close --remove-dir If interactive, these commands would always interrupt you with a prompt like this: This will remove all your changes, are you sure? This seems like it may just save someone's work some time. It may also condition folks to hit 'y' quickly without thinking. This change also makes the non-interactive behaviour consistent with the interactive behaviour in the default case. There is also the case of the prompt configured by 'really-workspace-close-project-inaccessible', which may be tackled in later work. This change also removes the new config options to suppress those prompts, and their associated news entry. The relevant bit of the mailing list conversation is here: https://mail.gnome.org/archives/buildstream-list/2018-December/msg00106.html The issue to make interactive and non-interactive behaviour consistent is here: https://gitlab.com/BuildStream/buildstream/issues/744
-rw-r--r--NEWS11
-rw-r--r--buildstream/_context.py14
-rw-r--r--buildstream/_frontend/cli.py10
-rw-r--r--buildstream/data/userconfig.yaml16
4 files changed, 5 insertions, 46 deletions
diff --git a/NEWS b/NEWS
index ae1485dc5..449a23ff1 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,11 @@ buildstream 1.3.1
an error message and a hint instead, to avoid bothering folks that just
made a mistake.
+ o BREAKING CHANGE: The unconditional 'Are you sure?' prompts have been
+ removed. These would always ask you if you were sure when running
+ 'bst workspace close --remove-dir' or 'bst workspace reset'. They got in
+ the way too often.
+
o Failed builds are included in the cache as well.
`bst checkout` will provide anything in `%{install-root}`.
A build including cached fails will cause any dependant elements
@@ -87,12 +92,6 @@ buildstream 1.3.1
instead of just a specially-formatted build-root with a `root` and `scratch`
subdirectory.
- o The buildstream.conf file learned new
- 'prompt.really-workspace-close-remove-dir' and
- 'prompt.really-workspace-reset-hard' options. These allow users to suppress
- certain confirmation prompts, e.g. double-checking that the user meant to
- run the command as typed.
-
o Due to the element `build tree` being cached in the respective artifact their
size in some cases has significantly increased. In *most* cases the build trees
are not utilised when building targets, as such by default bst 'pull' & 'build'
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 29a016065..1d049f7a6 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -122,17 +122,9 @@ class Context():
self.pull_buildtrees = None
# Boolean, whether we double-check with the user that they meant to
- # remove a workspace directory.
- self.prompt_workspace_close_remove_dir = None
-
- # Boolean, whether we double-check with the user that they meant to
# close the workspace when they're using it to access the project.
self.prompt_workspace_close_project_inaccessible = None
- # Boolean, whether we double-check with the user that they meant to do
- # a hard reset of a workspace, potentially losing changes.
- self.prompt_workspace_reset_hard = None
-
# Whether elements must be rebuilt when their dependencies have changed
self._strict_build_plan = None
@@ -260,16 +252,10 @@ class Context():
prompt = _yaml.node_get(
defaults, Mapping, 'prompt')
_yaml.node_validate(prompt, [
- 'really-workspace-close-remove-dir',
'really-workspace-close-project-inaccessible',
- 'really-workspace-reset-hard',
])
- self.prompt_workspace_close_remove_dir = _node_get_option_str(
- prompt, 'really-workspace-close-remove-dir', ['ask', 'yes']) == 'ask'
self.prompt_workspace_close_project_inaccessible = _node_get_option_str(
prompt, 'really-workspace-close-project-inaccessible', ['ask', 'yes']) == 'ask'
- self.prompt_workspace_reset_hard = _node_get_option_str(
- prompt, 'really-workspace-reset-hard', ['ask', 'yes']) == 'ask'
# Load per-projects overrides
self._project_overrides = _yaml.node_get(defaults, Mapping, 'projects', default_value={})
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index 34217aee5..163a05790 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -841,11 +841,6 @@ def workspace_close(app, remove_dir, all_, elements):
if nonexisting:
raise AppError("Workspace does not exist", detail="\n".join(nonexisting))
- if app.interactive and remove_dir and app.context.prompt_workspace_close_remove_dir:
- if not click.confirm('This will remove all your changes, are you sure?'):
- click.echo('Aborting', err=True)
- sys.exit(-1)
-
for element_name in elements:
app.stream.workspace_close(element_name, remove_dir=remove_dir)
@@ -879,11 +874,6 @@ def workspace_reset(app, soft, track_, all_, elements):
if all_ and not app.stream.workspace_exists():
raise AppError("No open workspaces to reset")
- if app.interactive and not soft and app.context.prompt_workspace_reset_hard:
- if not click.confirm('This will remove all your changes, are you sure?'):
- click.echo('Aborting', err=True)
- sys.exit(-1)
-
if all_:
elements = tuple(element_name for element_name, _ in app.context.get_workspaces().list())
diff --git a/buildstream/data/userconfig.yaml b/buildstream/data/userconfig.yaml
index 6351619aa..0834b93f6 100644
--- a/buildstream/data/userconfig.yaml
+++ b/buildstream/data/userconfig.yaml
@@ -112,14 +112,6 @@ logging:
#
prompt:
- # Whether to really proceed with 'bst workspace close --remove-dir' removing
- # a workspace directory, potentially losing changes.
- #
- # ask - Ask the user if they are sure.
- # yes - Always remove, without asking.
- #
- really-workspace-close-remove-dir: ask
-
# Whether to really proceed with 'bst workspace close' when doing so would
# stop them from running bst commands in this workspace.
#
@@ -127,11 +119,3 @@ prompt:
# yes - Always close, without asking.
#
really-workspace-close-project-inaccessible: ask
-
- # Whether to really proceed with 'bst workspace reset' doing a hard reset of
- # a workspace, potentially losing changes.
- #
- # ask - Ask the user if they are sure.
- # yes - Always hard reset, without asking.
- #
- really-workspace-reset-hard: ask