Patchwork D7912: py3: fix curses chunkselector fallback (when diffs are too large) on py3

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2020, 8:20 p.m.
Message ID <differential-rev-PHID-DREV-6sl7k5ssqpiymujoeppg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44451/
State Superseded
Headers show

Comments

phabricator - Jan. 16, 2020, 8:20 p.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously we showed the message using Exception.message, which is removed in
  py3. Since crecordmod.fallbackerror inherits from error.Abort, we can just use
  `b'%s' % exception` to print the message. This does not print the hint, but
  that's fine - we don't set one. We inherit from error.Abort so that if a
  codepath doesn't handle fallback specially, it exits to the terminal with a sane
  message instead of an unknown exception error.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -386,7 +386,7 @@ 
                 ui, originalhunks, recordfn, operation
             )
     except crecordmod.fallbackerror as e:
-        ui.warn(b'%s\n' % e.message)  # pytype: disable=attribute-error
+        ui.warn(b'%s\n' % e)
         ui.warn(_(b'falling back to text mode\n'))
 
     return patch.filterpatch(ui, originalhunks, match, operation)