Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 44098:19533e4c3450
py3: fix curses chunkselector fallback (when diffs are too large) on py3
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.
Differential Revision: https://phab.mercurial-scm.org/D7912
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 16 Jan 2020 12:17:03 -0800 |
parents | 6cfaebb625d3 |
children | b339faf3f843 d4c1501225c4 |
comparison
equal
deleted
inserted
replaced
44097:2f1d6180737f | 44098:19533e4c3450 |
---|---|
384 | 384 |
385 return crecordmod.filterpatch( | 385 return crecordmod.filterpatch( |
386 ui, originalhunks, recordfn, operation | 386 ui, originalhunks, recordfn, operation |
387 ) | 387 ) |
388 except crecordmod.fallbackerror as e: | 388 except crecordmod.fallbackerror as e: |
389 ui.warn(b'%s\n' % e.message) # pytype: disable=attribute-error | 389 ui.warn(b'%s\n' % e) |
390 ui.warn(_(b'falling back to text mode\n')) | 390 ui.warn(_(b'falling back to text mode\n')) |
391 | 391 |
392 return patch.filterpatch(ui, originalhunks, match, operation) | 392 return patch.filterpatch(ui, originalhunks, match, operation) |
393 | 393 |
394 | 394 |