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
b4630e33
Commit
b4630e33
authored
7 years ago
by
Yuya Nishihara
Browse files
Options
Downloads
Patches
Plain Diff
templater: drop unneeded generator from mappable object
Per the definition of the show() interface, it can return a bytes.
parent
8c84dc82
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/templateutil.py
+3
-5
3 additions, 5 deletions
mercurial/templateutil.py
with
3 additions
and
5 deletions
mercurial/templateutil.py
+
3
−
5
View file @
b4630e33
...
...
@@ -113,9 +113,8 @@
"""
def
__init__
(
self
,
gen
,
key
,
value
,
makemap
):
if
gen
is
not
None
:
self
.
_gen
=
gen
# generator or function returning generator
self
.
_gen
=
gen
# generator or function returning generator
self
.
_key
=
key
self
.
_value
=
value
# may be generator of strings
self
.
_makemap
=
makemap
...
...
@@ -118,10 +117,7 @@
self
.
_key
=
key
self
.
_value
=
value
# may be generator of strings
self
.
_makemap
=
makemap
def
_gen
(
self
):
yield
pycompat
.
bytestr
(
self
.
_value
)
def
tomap
(
self
):
return
self
.
_makemap
(
self
.
_key
)
...
...
@@ -131,6 +127,8 @@
def
show
(
self
,
context
,
mapping
):
# TODO: switch gen to (context, mapping) API?
gen
=
self
.
_gen
if
gen
is
None
:
return
pycompat
.
bytestr
(
self
.
_value
)
if
callable
(
gen
):
return
gen
()
return
gen
...
...
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