Patchwork D1381: crecord: fix revert -r '.^' crash caused by 3649c3f2cd

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2017, 2:22 a.m.
Message ID <differential-rev-PHID-DREV-spt3oxaa22hg4qfqvgys-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25540/
State Superseded
Headers show

Comments

phabricator - Nov. 14, 2017, 2:22 a.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/rHG3649c3f2cd90c8aec395ca8af5adae33defff12c (revert: do not reverse hunks in interactive when REV is not
  parent (issue5096)) changed the record "operation" for the text version but
  missed the curses version. Without this patch, running
  `hg revert -r '.^' --config ui.interface=curses` would crash with:
  
    ProgrammingError: unexpected operation: apply

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1381

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 14, 2017, 8:22 a.m.
lothiraldan accepted this revision.
lothiraldan added a comment.


  LGTM, I could reproduce the crash by adding the `-i` option to @quark command.
  
  I'm not sure how we could test this case but we should in my opinion.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1381

To: quark, #hg-reviewers, lothiraldan
Cc: lothiraldan, mercurial-devel
phabricator - Nov. 14, 2017, 5:15 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> crecord.py:559
> +    'apply': _('Select hunks to apply'),
>      'revert': _('Select hunks to revert'),
>      'discard': _('Select hunks to discard'),

Can this line be deleted?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1381

To: quark, #hg-reviewers, lothiraldan, dlax
Cc: martinvonz, lothiraldan, mercurial-devel
phabricator - Nov. 14, 2017, 6:49 p.m.
quark marked an inline comment as done.
quark added a comment.


  Testing the curses code has been brought up a few times but nobody really knows how to test it cleanly.

INLINE COMMENTS

> martinvonz wrote in crecord.py:559
> Can this line be deleted?

Yes. Good catch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1381

To: quark, #hg-reviewers, lothiraldan, dlax
Cc: martinvonz, lothiraldan, mercurial-devel
phabricator - Nov. 15, 2017, 8:10 a.m.
lothiraldan added a comment.


  I wanted (and still) want to take some time playing with https://asciinema.org/ that can actually record curses interfaces pretty well. I think that a combination of expect + asciinema recording (which is a JSON file). Anyone interested to team up making a POC?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1381

To: quark, #hg-reviewers, lothiraldan, dlax
Cc: martinvonz, lothiraldan, mercurial-devel

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -555,6 +555,7 @@ 
     return chunkselector.opts
 
 _headermessages = { # {operation: text}
+    'apply': _('Select hunks to apply'),
     'revert': _('Select hunks to revert'),
     'discard': _('Select hunks to discard'),
     None: _('Select hunks to record'),