[PATCH 1 of 5 STABLE] crecord: extra most on 'main' in a sub function

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Apr 12 08:41:16 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1490533512 -7200
#      Sun Mar 26 15:05:12 2017 +0200
# Branch stable
# Node ID a8c09dc71f99e929d2545ee4366231aa98d73d9d
# Parent  8110d49e0558d3b50f8e82b5aa95c8f0e53e47e4
# EXP-Topic crecord-windows
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r a8c09dc71f99
crecord: extra most on 'main' in 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 --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1613,6 +1613,10 @@ are you sure you want to review/edit and
 
         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
@@ -1663,4 +1667,3 @@ are you sure you want to review/edit and
                 keypressed = "foobar"
             if self.handlekeypressed(keypressed):
                 break
-        signal.signal(signal.SIGWINCH, origsigwinchhandler)


More information about the Mercurial-devel mailing list