[PATCH 1 of 2] crecord: add error reporting for failure in curses interface initialization
Laurent Charignon
lcharignon at fb.com
Fri Jul 17 20:52:12 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1437165677 25200
# Fri Jul 17 13:41:17 2015 -0700
# Node ID 67e626be03062910ce3b09c3ef56a1ed9c9ba802
# Parent 2748bf78a5bf610da4f2d90fd1eea19a3b360c04
crecord: add error reporting for failure in curses interface initialization
Before this patch, we couldn't report to the user any error that occurred:
- after we enabled the curses interface but
- before the interface is set up and drawn
This patch, provides a way to set errors that happens during the initialization
of the interface and log them once the curses interface has been displayed.
diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -483,6 +483,8 @@ def chunkselector(ui, headerlist):
ui.write(_('starting interactive selection\n'))
chunkselector = curseschunkselector(headerlist, ui)
curses.wrapper(chunkselector.main)
+ if chunkselector.initerr is not None:
+ raise util.Abort(chunkselector.initerr)
def testdecorator(testfn, f):
def u(*args, **kwargs):
@@ -1579,6 +1581,9 @@ are you sure you want to review/edit and
"""
signal.signal(signal.SIGWINCH, self.sigwinchhandler)
self.stdscr = stdscr
+ # error during initialization, cannot be printed in the curses
+ # interface, it should be printed by the calling code
+ self.initerr = None
self.yscreensize, self.xscreensize = self.stdscr.getmaxyx()
curses.start_color()
More information about the Mercurial-devel
mailing list