Matt Harbison <matt_harbison@yahoo.com> [Sat, 25 Mar 2017 13:50:17 -0400] rev 31694
color: stop mutating the default effects map
A future change will make color.setup() callable a second time when the pager is
spawned, in order to honor the 'color.pagermode' setting. The problem was that
when 'color.mode=auto' was resolved to 'win32' in the first pass, the default
ANSI effects were overwritten, making it impossible to honor 'pagermode=ansi'.
Also, the two separate maps didn't have the same keys. The symmetric difference
is 'dim' and 'italic' (from ANSI), and 'bold_background' (from win32). Thus,
the update left entries that didn't belong for the current mode. This bled
through `hg debugcolor`, where the unsupported ANSI keys were listed in 'win32'
mode.
As an added bonus, this now correctly enables color with MSYS `less` for a
command like this, where pager is forced on:
$ hg log --config color.pagermode=ansi --pager=yes --color=auto
Previously, the output was corrupted. The raw output, as seen through the ANSI
blind `more.com` was:
<-[-1;6mchangeset: 34840:3580d1197af9<-[-1m
...
which MSYS `less -FRX` rendered as:
1;6mchangeset: 34840:3580d1197af91m
...
(The two '<-' instances were actually an arrow character that TortoiseHg warned
couldn't be encoded, and notepad++ translated to a single '?'.)
Returning an empty map for 'ui._colormode == None' seems better that defaulting
to '_effects' (since some keys are mode dependent), and is better than None,
which blows up `hg debugcolor --color=never`.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:43:47 -0700] rev 31693
pager: do not read from environment variable
$PAGER is converted to the pager.pager config item. So it's no longer
necessary to read $PAGER in ui.pager().
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:41:42 -0700] rev 31692
ui: simplify geteditor
Now $EDITOR and $VISUAL will affect ui.editor directly. So it's no longer
necessary to test them in ui.geteditor.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:40:22 -0700] rev 31691
debugconfig: list environment variables in debug output
Since we print "read config from" for config files, printing environment
variables will make it more consistent.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:33:37 -0700] rev 31690
rcutil: let environ override system configs (BC)
This is BC because system configs won't be able to override $EDITOR, $PAGER.
The new behavior is arguably more rational.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:27:02 -0700] rev 31689
rcutil: add a method to convert environment variables to config items
Handling config and environ priorities has been messy. Partially because we
don't have config layers - you either get all configs (sys + user), or none.
Ideally, environ like $EDITOR, $PAGER should be able to override the system
configs "ui.editor", "pager.pager". This patch provides the ability to
convert them into config items, so they can be inserted into the middle
config layer between system rc and user rc.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 21:04:29 -0700] rev 31688
rcutil: let rccomponents return different types of configs (API)
The next patches will convert environ to raw config items, and insert the
config items between systemrcpath and userrcpath. This patch teaches
rccomponents to return the type information so the caller could distinguish
between "path" and raw config "items".
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 20:48:00 -0700] rev 31687
rcutil: rename rcpath to rccomponents (API)
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 20:46:05 -0700] rev 31686
rcutil: extract rc directory listing logic
The logic of listing a ".rc" directory is duplicated in two functions,
extract it to a single function to make the code cleaner.
Jun Wu <quark@fb.com> [Sun, 26 Mar 2017 20:21:32 -0700] rev 31685
rcutil: split osrcpath to return default.d paths (API)
After this change, there are 3 rcpath functions:
- defaultrcpath
- systemrcpath
- userrcpath
This will allow us to insert another config layer in the middle.