sapling/hgext
FUJIWARA Katsunori 80da112aee win32mbcs: avoid unintentional failure at colorization
Since 1d07d9da84a0, pycompat.bytestr() wrapped by win32mbcs returns
unicode object, if an argument is not byte-str object. And this causes
unexpected failure at colorization.

pycompat.bytestr() is used to convert from color effect "int" value to
byte-str object in color module. Wrapped pycompat.bytestr() returns
unicode object for such "int" value, because it isn't byte-str.

If this returned unicode object is used to colorize non-ASCII byte-str
in cases below, UnicodeDecodeError is raised at an operation between
them.

  - colorization uses "ansi" color mode, or

    Even though this isn't default on Windows, user might use this
    color mode for third party pager.

  - ui.write() is buffered with labeled=True

    Buffering causes "ansi" color mode internally, regardless of
    actual color mode. With "win32" color mode, extra escape sequences
    are omitted at writing data out.

    For example, with "win32" color mode, "hg status" doesn't fail for
    non-ASCII filenames, but "hg log" does for non-ASCII text, because
    the latter implies buffered formatter.

There are many "color effect" value lines in color.py, and making them
byte-str objects isn't suitable for fixing on stable. In addition to
it, pycompat.bytestr will be used to get byte-str object from any
types other than int, too.

To resolve this issue, this patch does:

  - replace pycompat.bytestr in checkwinfilename() with newly added
    hook point util._filenamebytestr, and

  - make win32mbcs reverse-wrap util._filenamebytestr
    (this is a replacement of 1d07d9da84a0)

This patch does two things above at same time, because separately
applying the former change adds broken revision (from point of view of
win32mbcs) to stable branch.

"_" prefix is added to "filenamebytestr", because it is win32mbcs
specific hook point.
2017-05-31 23:44:33 +09:00
..
convert convert: fix the handling of empty changlist descriptions in P4 2017-03-22 14:12:58 -05:00
fsmonitor fsmonitor: match watchman and filesystem encoding 2017-03-08 09:03:42 -05:00
highlight extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
largefiles largefiles: make sure debugstate command is populated before wrapping 2017-05-04 15:23:51 +09:00
zeroconf zeroconf: fail nicely on IPv6 only system 2017-02-08 08:08:41 -08:00
__init__.py hgext: officially turn 'hgext' into a namespace package 2016-02-27 12:56:26 +01:00
acl.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
automv.py automv: use lowercase for docstring title 2017-03-23 21:15:39 -07:00
blackbox.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
bugzilla.py bugzilla: use util.urlreq.urlparse 2017-03-21 22:39:52 -07:00
censor.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
children.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
churn.py churn: use the non-deprecated template option in the examples 2017-05-08 23:05:01 -04:00
clonebundles.py clonebundles: fix missing newline character 2017-05-24 22:59:59 -04:00
color.py color: fix grammar in help text 2017-03-25 13:29:23 -04:00
eol.py util: extract pure tolf/tocrlf() functions from eol extension 2017-03-29 21:28:54 +09:00
extdiff.py util: wrap s.encode('string_escape') call for future py3 compatibility 2017-03-15 23:06:50 +09:00
factotum.py url: extract password database from password manager 2016-06-05 23:36:23 +02:00
fetch.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
gpg.py gpg: use 'wvfs' instead of 'wfile' 2017-03-15 00:28:21 -07:00
graphlog.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
hgk.py hgk: don't use mutable default argument value 2017-03-14 23:48:25 -07:00
histedit.py histedit: make check for unresolved conflicts explicit (issue5545) 2017-04-20 17:18:08 -07:00
journal.py journal: use lowercase for docstring title 2017-03-23 21:16:29 -07:00
keyword.py keyword: directly use repo.vfs.join 2017-03-08 16:51:57 -08:00
logtoprocess.py logtoprocess: use lowercase for docstring title 2017-03-23 21:16:55 -07:00
mq.py mq: reject new patch name containing leading/trailing whitespace 2017-03-20 11:38:37 +09:00
notify.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
pager.py pager: if old pager extensions is enabled, respect pager.attend 2017-03-13 21:43:17 -07:00
patchbomb.py pager: flush outputs before firing pager process 2017-02-25 17:29:30 +09:00
purge.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
rebase.py help: apply bulk fixes for indentation and literal blocking issues 2017-05-01 05:52:32 +09:00
record.py record: get rid of ui.backupconfig 2017-03-16 14:34:35 -07:00
relink.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
schemes.py schemes: use br'' literal to define bytes regexp 2017-03-09 19:41:40 -08:00
share.py share: directly use repo.vfs.join 2017-03-08 16:52:30 -08:00
shelve.py shelve: rename nodestoprune to nodestoremove 2017-04-10 15:32:09 -07:00
show.py show: rename "underway" to "work" 2017-04-18 10:49:46 -07:00
strip.py extensions: change magic "shipped with hg" string 2016-08-23 11:26:08 -04:00
transplant.py transplant: directly use repo.vfs.join 2017-03-08 16:52:49 -08:00
win32mbcs.py win32mbcs: avoid unintentional failure at colorization 2017-05-31 23:44:33 +09:00
win32text.py win32text: directly use repo.vfs.join 2017-03-08 16:52:57 -08:00