From 752b3aab77c97cb365d087ea7482ee5f19adcea7 Mon Sep 17 00:00:00 2001 From: Fabio Tranchitella Date: Wed, 23 Apr 2008 17:22:24 +0000 Subject: [PATCH] Implemented history for the command line hint tester (patch from dato). --- britney.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/britney.py b/britney.py index 42532ad..048fd68 100644 --- a/britney.py +++ b/britney.py @@ -2341,7 +2341,8 @@ class Britney: nuninst_end, extra = None, None if nuninst_end: - if not force: self.output_write("Apparently successful\n") + if not force and maxdepth != "easy": + self.output_write("Apparently successful\n") self.output_write("final: %s\n" % ",".join(sorted(selected))) self.output_write("start: %s\n" % self.eval_nuninst(nuninst_start)) if not force: @@ -2503,6 +2504,11 @@ class Britney: self.__log("> Calculating current uninstallability counters", type="I") self.nuninst_orig = self.get_nuninst() + import readline + histfile = os.path.expanduser('~/.britney2_history') + if os.path.exists(histfile): + readline.read_history_file(histfile) + while True: # read the command from the command line try: @@ -2510,13 +2516,21 @@ class Britney: except EOFError: print "" break + except KeyboardInterrupt: + print "" + continue # quit the hint tester if input and input[0] in ('quit', 'exit'): break # run a hint elif input and input[0] in ('easy', 'hint', 'force-hint'): - self.do_hint(input[0], 'hint-tester', - [k.rsplit("/", 1) for k in input[1:] if "/" in k]) + try: + self.do_hint(input[0], 'hint-tester', + [k.rsplit("/", 1) for k in input[1:] if "/" in k]) + except KeyboardInterrupt: + continue + + readline.write_history_file(histfile) def do_hint(self, type, who, pkgvers): """Process hints