changeset 43155:a83c9c79b722

py3: only flush before prompting during interactive patch filtering Follows up on c9093ae8d6c4. It's enough to flush just before each prompt.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 10 Oct 2019 10:03:01 +0200
parents f05d10ef42e3
children 0e6a7ce81dde
files mercurial/patch.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Aug 28 17:45:18 2019 -0700
+++ b/mercurial/patch.py	Thu Oct 10 10:03:01 2019 +0200
@@ -1183,16 +1183,15 @@
         if skipfile is not None:
             return skipfile, skipfile, skipall, newpatches
         while True:
+            ui.flush()
             resps = messages[b'help'][operation]
             # IMPORTANT: keep the last line of this prompt short (<40 english
             # 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
@@ -1202,12 +1201,10 @@
                 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)
@@ -1308,7 +1305,6 @@
         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: