[PATCH 2 of 2] py3: flush ui after each message in interactive patch filtering
Denis Laxalde
denis at laxalde.org
Wed Oct 9 13:29:24 UTC 2019
# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1570627454 -7200
# Wed Oct 09 15:24:14 2019 +0200
# Node ID 0cdeb24af4076eae433de3f63fda36da4e6fc0d0
# Parent 99f06850be3ecc521ba461684686865c1191c5a0
py3: flush ui after each message in interactive patch filtering
Otherwise, actions from ui.write() are buffered and displayed at end of
interactive session.
diff --git a/mercurial/patch.py b/mercurial/patch.py
index 374d5d6..e27d0ca 100644
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1188,9 +1188,11 @@ def filterpatch(ui, headers, match, oper
# 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 @@ def filterpatch(ui, headers, match, oper
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 @@ the hunk is left unchanged.
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:
More information about the Mercurial-devel
mailing list