mercurial/patch.py
changeset 43119 c9093ae8d6c4
parent 43117 8ff1ecfadcd1
child 43155 a83c9c79b722
equal deleted inserted replaced
43118:57efd5bd2ca2 43119:c9093ae8d6c4
  1186             resps = messages[b'help'][operation]
  1186             resps = messages[b'help'][operation]
  1187             # IMPORTANT: keep the last line of this prompt short (<40 english
  1187             # IMPORTANT: keep the last line of this prompt short (<40 english
  1188             # chars is a good target) because of issue6158.
  1188             # chars is a good target) because of issue6158.
  1189             r = ui.promptchoice(b"%s\n(enter ? for help) %s" % (query, resps))
  1189             r = ui.promptchoice(b"%s\n(enter ? for help) %s" % (query, resps))
  1190             ui.write(b"\n")
  1190             ui.write(b"\n")
       
  1191             ui.flush()
  1191             if r == 8:  # ?
  1192             if r == 8:  # ?
  1192                 for c, t in ui.extractchoices(resps)[1]:
  1193                 for c, t in ui.extractchoices(resps)[1]:
  1193                     ui.write(b'%s - %s\n' % (c, encoding.lower(t)))
  1194                     ui.write(b'%s - %s\n' % (c, encoding.lower(t)))
       
  1195                     ui.flush()
  1194                 continue
  1196                 continue
  1195             elif r == 0:  # yes
  1197             elif r == 0:  # yes
  1196                 ret = True
  1198                 ret = True
  1197             elif r == 1:  # no
  1199             elif r == 1:  # no
  1198                 ret = False
  1200                 ret = False
  1199             elif r == 2:  # Edit patch
  1201             elif r == 2:  # Edit patch
  1200                 if chunk is None:
  1202                 if chunk is None:
  1201                     ui.write(_(b'cannot edit patch for whole file'))
  1203                     ui.write(_(b'cannot edit patch for whole file'))
  1202                     ui.write(b"\n")
  1204                     ui.write(b"\n")
       
  1205                     ui.flush()
  1203                     continue
  1206                     continue
  1204                 if chunk.header.binary():
  1207                 if chunk.header.binary():
  1205                     ui.write(_(b'cannot edit patch for binary file'))
  1208                     ui.write(_(b'cannot edit patch for binary file'))
  1206                     ui.write(b"\n")
  1209                     ui.write(b"\n")
       
  1210                     ui.flush()
  1207                     continue
  1211                     continue
  1208                 # Patch comment based on the Git one (based on comment at end of
  1212                 # Patch comment based on the Git one (based on comment at end of
  1209                 # https://mercurial-scm.org/wiki/RecordExtension)
  1213                 # https://mercurial-scm.org/wiki/RecordExtension)
  1210                 phelp = b'---' + _(
  1214                 phelp = b'---' + _(
  1211                     """
  1215                     """
  1302             applied[h.filename()] += h.hunks
  1306             applied[h.filename()] += h.hunks
  1303             continue
  1307             continue
  1304         for i, chunk in enumerate(h.hunks):
  1308         for i, chunk in enumerate(h.hunks):
  1305             if skipfile is None and skipall is None:
  1309             if skipfile is None and skipall is None:
  1306                 chunk.pretty(ui)
  1310                 chunk.pretty(ui)
       
  1311                 ui.flush()
  1307             if total == 1:
  1312             if total == 1:
  1308                 msg = messages[b'single'][operation] % chunk.filename()
  1313                 msg = messages[b'single'][operation] % chunk.filename()
  1309             else:
  1314             else:
  1310                 idx = pos - len(h.hunks) + i
  1315                 idx = pos - len(h.hunks) + i
  1311                 msg = messages[b'multiple'][operation] % (
  1316                 msg = messages[b'multiple'][operation] % (