Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
bb638588
Commit
bb638588
authored
8 years ago
by
Pierre-Yves David
Browse files
Options
Downloads
Patches
Plain Diff
color: move configstyles into the core module
The extension is getting thinner as we speak!
parent
683606a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hgext/color.py
+1
-17
1 addition, 17 deletions
hgext/color.py
mercurial/color.py
+18
-0
18 additions, 0 deletions
mercurial/color.py
with
19 additions
and
17 deletions
hgext/color.py
+
1
−
17
View file @
bb638588
...
...
@@ -332,22 +332,6 @@
stop
=
_effect_str
(
'
none
'
)
return
''
.
join
([
start
,
text
,
stop
])
def
configstyles
(
ui
):
for
status
,
cfgeffects
in
ui
.
configitems
(
'
color
'
):
if
'
.
'
not
in
status
or
status
.
startswith
((
'
color.
'
,
'
terminfo.
'
)):
continue
cfgeffects
=
ui
.
configlist
(
'
color
'
,
status
)
if
cfgeffects
:
good
=
[]
for
e
in
cfgeffects
:
if
color
.
valideffect
(
e
):
good
.
append
(
e
)
else
:
ui
.
warn
(
_
(
"
ignoring unknown color/effect %r
"
"
(configured in color.%s)
\n
"
)
%
(
e
,
status
))
color
.
_styles
[
status
]
=
'
'
.
join
(
good
)
class
colorui
(
uimod
.
ui
):
_colormode
=
'
ansi
'
def
write
(
self
,
*
args
,
**
opts
):
...
...
@@ -420,7 +404,7 @@
mode
=
_modesetup
(
ui_
,
opts
[
'
color
'
])
colorui
.
_colormode
=
mode
if
mode
and
mode
!=
'
debug
'
:
configstyles
(
ui_
)
color
.
configstyles
(
ui_
)
return
orig
(
ui_
,
opts
,
cmd
,
cmdfunc
)
def
colorgit
(
orig
,
gitsub
,
commands
,
env
=
None
,
stream
=
False
,
cwd
=
None
):
if
gitsub
.
ui
.
_colormode
and
len
(
commands
)
and
commands
[
0
]
==
"
diff
"
:
...
...
This diff is collapsed.
Click to expand it.
mercurial/color.py
+
18
−
0
View file @
bb638588
...
...
@@ -7,6 +7,8 @@
from
__future__
import
absolute_import
from
.i18n
import
_
try
:
import
curses
# Mapping from effect name to terminfo attribute name (or raw code) or
...
...
@@ -114,6 +116,22 @@
def
loadcolortable
(
ui
,
extname
,
colortable
):
_styles
.
update
(
colortable
)
def
configstyles
(
ui
):
for
status
,
cfgeffects
in
ui
.
configitems
(
'
color
'
):
if
'
.
'
not
in
status
or
status
.
startswith
((
'
color.
'
,
'
terminfo.
'
)):
continue
cfgeffects
=
ui
.
configlist
(
'
color
'
,
status
)
if
cfgeffects
:
good
=
[]
for
e
in
cfgeffects
:
if
valideffect
(
e
):
good
.
append
(
e
)
else
:
ui
.
warn
(
_
(
"
ignoring unknown color/effect %r
"
"
(configured in color.%s)
\n
"
)
%
(
e
,
status
))
_styles
[
status
]
=
'
'
.
join
(
good
)
def
valideffect
(
effect
):
'
Determine if the effect is valid or not.
'
return
((
not
_terminfo_params
and
effect
in
_effects
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment