py3: flush ui after each message in interactive patch filtering
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 09 Oct 2019 15:24:14 +0200
changeset 43119 c9093ae8d6c4
parent 43118 57efd5bd2ca2
child 43120 97f80dd21312
py3: flush ui after each message in interactive patch filtering Otherwise, actions from ui.write() are buffered and displayed at end of interactive session.
mercurial/patch.py
--- a/mercurial/patch.py	Wed Oct 09 15:28:16 2019 +0200
+++ b/mercurial/patch.py	Wed Oct 09 15:24:14 2019 +0200
@@ -1188,9 +1188,11 @@
             # chars is a good target) because of issue6158.
             r = ui.promptchoice(b"%s\n(enter ? for help) %s" % (query, resps))
             ui.write(b"\n")
+            ui.flush()
             if r == 8:  # ?
                 for c, t in ui.extractchoices(resps)[1]:
                     ui.write(b'%s - %s\n' % (c, encoding.lower(t)))
+                    ui.flush()
                 continue
             elif r == 0:  # yes
                 ret = True
@@ -1200,10 +1202,12 @@
                 if chunk is None:
                     ui.write(_(b'cannot edit patch for whole file'))
                     ui.write(b"\n")
+                    ui.flush()
                     continue
                 if chunk.header.binary():
                     ui.write(_(b'cannot edit patch for binary file'))
                     ui.write(b"\n")
+                    ui.flush()
                     continue
                 # Patch comment based on the Git one (based on comment at end of
                 # https://mercurial-scm.org/wiki/RecordExtension)
@@ -1304,6 +1308,7 @@
         for i, chunk in enumerate(h.hunks):
             if skipfile is None and skipall is None:
                 chunk.pretty(ui)
+                ui.flush()
             if total == 1:
                 msg = messages[b'single'][operation] % chunk.filename()
             else: