[jhbuild] [terminal] ask for confirmation before wiping sources (GNOME bug 585996)
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild] [terminal] ask for confirmation before wiping sources (GNOME bug 585996)
- Date: Sun, 19 Jul 2009 14:25:33 +0000 (UTC)
commit 32eb3f901862aeb48a1661f901d8d57fc875d670
Author: Frédéric Péters <fpeters 0d be>
Date: Sun Jul 19 16:22:20 2009 +0200
[terminal] ask for confirmation before wiping sources (GNOME bug 585996)
jhbuild/frontends/terminal.py | 15 ++++++++++++++-
jhbuild/modtypes/__init__.py | 1 +
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/frontends/terminal.py b/jhbuild/frontends/terminal.py
index 07fa57f..abf293f 100644
--- a/jhbuild/frontends/terminal.py
+++ b/jhbuild/frontends/terminal.py
@@ -316,9 +316,22 @@ class TerminalBuildScript(buildscript.BuildScript):
else:
try:
val = int(val)
- return altphases[val - nb_options]
+ selected_phase = altphases[val - nb_options]
except:
uprint(_('invalid choice'))
+ continue
+ try:
+ needs_confirmation = getattr(
+ getattr(module, 'do_' + selected_phase), 'needs_confirmation')
+ except AttributeError:
+ needs_confirmation = False
+ if needs_confirmation:
+ val = raw_input(uencode(_('Type "yes" to confirm the action: ')))
+ val = val.strip()
+ if val.lower() in ('yes', _('Yes')):
+ return selected_phase
+ continue
+ return selected_phase
assert False, 'not reached'
BUILD_SCRIPT = TerminalBuildScript
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 2f5761b..69dcb17 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -266,6 +266,7 @@ class DownloadableModule():
self.branch.force_checkout(buildscript)
do_force_checkout.error_phases = [PHASE_FORCE_CHECKOUT]
do_force_checkout.label = N_('wipe directory and start over')
+ do_force_checkout.needs_confirmation = True
class MetaModule(Package):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]