STR (works on 4.2): $ hg init repo $ cd repo $ echo 0 > a $ hg ci -qAm 0 $ printf 1 >> a $ hg ci -qAm 1 $ cat a 0 1 (no-eol) $ hg revert -ir.^ --config ui.interactive=1 <<EOF > y > y > EOF reverting a diff --git a/a b/a 1 hunks, 1 lines changed examine changes to 'a'? [Ynesfdaq?] y @@ -1,1 +1,2 @@ 0 +1 \ No newline at end of file revert this change to 'a'? [Ynesfdaq?] y $ cat a 0 $ cd .. On 4.3-rc: + Traceback (most recent call last): + File "hg", line 45, in <module> + mercurial.dispatch.run() + File "mercurial/dispatch.py", line 86, in run + status = (dispatch(req) or 0) & 255 + File "mercurial/dispatch.py", line 167, in dispatch + ret = _runcatch(req) + File "mercurial/dispatch.py", line 307, in _runcatch + return _callcatch(ui, _runcatchfunc) + File "mercurial/dispatch.py", line 315, in _callcatch + return scmutil.callcatch(ui, func) + File "mercurial/scmutil.py", line 145, in callcatch + return func() + File "mercurial/dispatch.py", line 297, in _runcatchfunc + return _dispatch(req) + File "mercurial/dispatch.py", line 927, in _dispatch + cmdpats, cmdoptions) + File "mercurial/dispatch.py", line 663, in runcommand + ret = _runcommand(ui, options, cmd, d) + File "mercurial/dispatch.py", line 935, in _runcommand + return cmdfunc() + File "mercurial/dispatch.py", line 924, in <lambda> + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) + File "mercurial/util.py", line 1056, in check + return func(*args, **kwargs) + File "mercurial/commands.py", line 4520, in revert + return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) + File "mercurial/cmdutil.py", line 3332, in revert + _performrevert(repo, parents, ctx, actions, interactive, tobackup) + File "mercurial/cmdutil.py", line 3434, in _performrevert + chunks = patch.reversehunks(chunks) + File "mercurial/patch.py", line 1526, in reversehunks + c = c.reversehunk() + File "mercurial/patch.py", line 970, in reversehunk + hunk = ['%s%s' % (m[l[0]], l[1:]) for l in self.hunk] + KeyError: '\\' + [1] The first bad revision is: changeset: 43372:66117dae87f9 user: Jun Wu <quark@fb.com> date: Tue Jun 20 23:22:38 2017 -0700 summary: patch: rewrite reversehunks (issue5337)
Bug was set to UNCONFIRMED for 30 days, bumping
Fixed by 5707bfe04deb "record: fix revert -i for lines without newline (issue5651)"