mercurial/patch.py
changeset 48941 fd5b8e696b75
parent 48935 2cce2fa5bcf7
child 48946 642e31cb55f0
equal deleted inserted replaced
48940:2974cdda819b 48941:fd5b8e696b75
  1257                         ui.warn(_(b"editor exited with exit code %d\n") % ret)
  1257                         ui.warn(_(b"editor exited with exit code %d\n") % ret)
  1258                         continue
  1258                         continue
  1259                     # Remove comment lines
  1259                     # Remove comment lines
  1260                     patchfp = open(patchfn, 'rb')
  1260                     patchfp = open(patchfn, 'rb')
  1261                     ncpatchfp = stringio()
  1261                     ncpatchfp = stringio()
  1262                     for line in util.iterfile(patchfp):
  1262                     for line in patchfp:
  1263                         line = util.fromnativeeol(line)
  1263                         line = util.fromnativeeol(line)
  1264                         if not line.startswith(b'#'):
  1264                         if not line.startswith(b'#'):
  1265                             ncpatchfp.write(line)
  1265                             ncpatchfp.write(line)
  1266                     patchfp.close()
  1266                     patchfp.close()
  1267                     ncpatchfp.seek(0)
  1267                     ncpatchfp.seek(0)
  2341         procutil.shellquote(patchname),
  2341         procutil.shellquote(patchname),
  2342     )
  2342     )
  2343     ui.debug(b'Using external patch tool: %s\n' % cmd)
  2343     ui.debug(b'Using external patch tool: %s\n' % cmd)
  2344     fp = procutil.popen(cmd, b'rb')
  2344     fp = procutil.popen(cmd, b'rb')
  2345     try:
  2345     try:
  2346         for line in util.iterfile(fp):
  2346         for line in fp:
  2347             line = line.rstrip()
  2347             line = line.rstrip()
  2348             ui.note(line + b'\n')
  2348             ui.note(line + b'\n')
  2349             if line.startswith(b'patching file '):
  2349             if line.startswith(b'patching file '):
  2350                 pf = util.parsepatchoutput(line)
  2350                 pf = util.parsepatchoutput(line)
  2351                 printed_file = False
  2351                 printed_file = False