[PATCH 1 of 3 V2] crecord: extract ui refresh code after edition of hunk in a function

Laurent Charignon lcharignon at fb.com
Fri Jun 12 15:36:48 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1433536372 25200
#      Fri Jun 05 13:32:52 2015 -0700
# Node ID a0318381fde8e05a9e52c090757855a6a962a61f
# Parent  c39640d26a4c7546faef00b9e5c02af45ab8bf5e
crecord: extract ui refresh code after edition of hunk in a function

This is useful to reuse the logic to implement the continuation of the crecord
session if the user edits a hunk and the editor exits with a non-zero status.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1419,6 +1419,13 @@
         """
             edit the currently chelected chunk
         """
+        def updateui(self):
+            self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
+            self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
+            self.updatescroll()
+            self.stdscr.refresh()
+            self.statuswin.refresh()
+            self.stdscr.keypad(1)
 
         def editpatchwitheditor(self, chunk):
             if chunk is None:
@@ -1501,12 +1508,7 @@
         self.currentselecteditem = header
 
         if not test:
-            self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
-            self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
-            self.updatescroll()
-            self.stdscr.refresh()
-            self.statuswin.refresh()
-            self.stdscr.keypad(1)
+            updateui(self)
 
     def emptypatch(self):
         item = self.headerlist


More information about the Mercurial-devel mailing list