# HG changeset patch # User Pierre-Yves David # Date 1490533512 -7200 # Node ID bf6b44da1d8e922229a4002778f70293ceb6bfab # Parent 277b3e2d711bd7ddc11be0ecc1004c3fe0e75f65 crecord: extract most of 'main' into a sub function There are some setup and cleanup necessary around the main code, that setup/cleanup code needs multiple adjustments so we extract the core code into its own function first for clarity. diff -r 277b3e2d711b -r bf6b44da1d8e mercurial/crecord.py --- a/mercurial/crecord.py Mon Apr 03 23:13:49 2017 +0900 +++ b/mercurial/crecord.py Sun Mar 26 15:05:12 2017 +0200 @@ -1616,6 +1616,10 @@ origsigwinchhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler) + return self._main(stdscr) + signal.signal(signal.SIGWINCH, origsigwinchhandler) + + def _main(self, stdscr): self.stdscr = stdscr # error during initialization, cannot be printed in the curses # interface, it should be printed by the calling code @@ -1667,4 +1671,3 @@ keypressed = "foobar" if self.handlekeypressed(keypressed): break - signal.signal(signal.SIGWINCH, origsigwinchhandler)