Implemented history for the command line hint tester (patch from dato).

master
Fabio Tranchitella 16 years ago
parent 2cb47f7af2
commit 752b3aab77

@ -2341,7 +2341,8 @@ class Britney:
nuninst_end, extra = None, None nuninst_end, extra = None, None
if nuninst_end: 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("final: %s\n" % ",".join(sorted(selected)))
self.output_write("start: %s\n" % self.eval_nuninst(nuninst_start)) self.output_write("start: %s\n" % self.eval_nuninst(nuninst_start))
if not force: if not force:
@ -2503,6 +2504,11 @@ class Britney:
self.__log("> Calculating current uninstallability counters", type="I") self.__log("> Calculating current uninstallability counters", type="I")
self.nuninst_orig = self.get_nuninst() 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: while True:
# read the command from the command line # read the command from the command line
try: try:
@ -2510,13 +2516,21 @@ class Britney:
except EOFError: except EOFError:
print "" print ""
break break
except KeyboardInterrupt:
print ""
continue
# quit the hint tester # quit the hint tester
if input and input[0] in ('quit', 'exit'): if input and input[0] in ('quit', 'exit'):
break break
# run a hint # run a hint
elif input and input[0] in ('easy', 'hint', 'force-hint'): elif input and input[0] in ('easy', 'hint', 'force-hint'):
self.do_hint(input[0], 'hint-tester', try:
[k.rsplit("/", 1) for k in input[1:] if "/" in k]) 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): def do_hint(self, type, who, pkgvers):
"""Process hints """Process hints

Loading…
Cancel
Save