##// END OF EJS Templates
rust: module policy with importrust...
rust: module policy with importrust We introduce two rust+c module policies and a new `policy.importrust()` that makes use of them. This simple approach provides runtime switching of implementations, which is crucial for the performance measurements such as those Octobus does with ASV. It can also be useful for bug analysis. It also has the advantage of making conditionals in Rust callers more uniform, in particular abstracting over specifics like `demandimport` At this point, the build stays unchanged, with the rust-cpython based `rustext` module being built if HGWITHRUSTEXT=cpython. More transparency for the callers, i.e., just using `policy.importmod` would be a much longer term and riskier effort for the following reasons: 1. It would require to define common module boundaries for the three or four cases (pure, c, rust+ext, cffi) and that is premature with the Rust extension currently under heavy development in areas that are outside the scope of the C extensions. 2. It would imply internal API changes that are not currently wished, as the case of ancestors demonstrates. 3. The lack of data or property-like attributes (tp_member and tp_getset) in current `rust-cpython` makes it impossible to achieve direct transparent replacement of pure Python classes by Rust extension code, meaning that the caller sometimes has to be able to make adjustments or provide additional wrapping.

File last commit:

r39406:46f3ff64 default
r42651:810f66b4 default
Show More
map-cmdline.default
91 lines | 3.5 KiB | text/plain | TextLexer
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766 # Base templates. Due to name clashes with existing keywords, we have
# to replace some keywords with 'lkeyword', for 'labelled keyword'
Yuya Nishihara
templater: load template fragments from [templates] section in map file...
r34715
[templates]
Yuya Nishihara
templates: rename "user" to "luser" defined in default map file (API)...
r38982 changeset = '{cset}{branches}{bookmarks}{tags}{parents}{luser}{ldate}{ltroubles}{lobsfate}{summary}\n'
Yuya Nishihara
templates: fix "log -q" output of default style...
r24304 changeset_quiet = '{lnode}'
Yuya Nishihara
templates: rename "user" to "luser" defined in default map file (API)...
r38982 changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{luser}{ldate}{ltroubles}{lobsfate}{lfiles}{lfile_copies_switch}{description}\n'
changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{luser}{ldate}{ltroubles}{lobsfate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766
# File templates
lfiles = '{if(files,
label("ui.note log.files",
"files: {files}\n"))}'
lfile_mods = '{if(file_mods,
label("ui.debug log.files",
"files: {file_mods}\n"))}'
lfile_adds = '{if(file_adds,
label("ui.debug log.files",
"files+: {file_adds}\n"))}'
lfile_dels = '{if(file_dels,
label("ui.debug log.files",
"files-: {file_dels}\n"))}'
lfile_copies_switch = '{if(file_copies_switch,
label("ui.note log.copies",
"copies: {file_copies_switch
% ' {name} ({source})'}\n"))}'
# General templates
Yuya Nishihara
templates: introduce labelcset() function in map-cmdline.default as example
r34717 cset = '{labelcset("changeset: {rev}:{node|short}")}\n'
fullcset = '{labelcset("changeset: {rev}:{node}")}\n'
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766
lphase = '{label("log.phase",
"phase: {phase}")}\n'
parent = '{label("log.parent changeset.{phase}",
"parent: {rev}:{node|formatnode}")}\n'
Yuya Nishihara
templates: fix "log -q" output of default style...
r24304 lnode = '{label("log.node",
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766 "{rev}:{node|short}")}\n'
manifest = '{label("ui.debug log.manifest",
"manifest: {rev}:{node}")}\n'
branch = '{label("log.branch",
"branch: {branch}")}\n'
tag = '{label("log.tag",
"tag: {tag}")}\n'
bookmark = '{label("log.bookmark",
"bookmark: {bookmark}")}\n'
Yuya Nishihara
templates: rename "user" to "luser" defined in default map file (API)...
r38982 luser = '{label("log.user",
"user: {author}")}\n'
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766
Yuya Nishihara
templates-default: do not show description or summary if empty...
r24637 summary = '{if(desc|strip, "{label('log.summary',
'summary: {desc|firstline}')}\n")}'
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766
ldate = '{label("log.date",
"date: {date|date}")}\n'
Boris Feld
label: rename log.trouble into log.instability...
r33778 ltroubles = '{if(instabilities, "{label('log.instability',
Boris Feld
template: rename troubles templatekw into instabilities...
r33675 'instability: {join(instabilities, ", ")}')}\n")}'
Denis Laxalde
templates: display evolution "troubles" in command line style
r30713
Jordi Gutiérrez Hermoso
log: rewrite default template to use labels (issue2866)...
r22766 extra = '{label("ui.debug log.extra",
"extra: {key}={value|stringescape}")}\n'
Yuya Nishihara
templates-default: do not show description or summary if empty...
r24637 description = '{if(desc|strip, "{label('ui.note log.description',
'description:')}
{label('ui.note log.description',
'{desc|strip}')}\n\n")}'
Matt Mackall
templates: add a default template style for status...
r25514
Yuya Nishihara
status: rename {copy} to {source} for compatibility with {file_copies} (BC)...
r39406 status = '{status} {path|relpath}\n{if(source, " {source|relpath}\n")}'
Yuya Nishihara
templates: introduce labelcset() function in map-cmdline.default as example
r34717
Boris Feld
obsfate: add obsfate to default mapfile...
r34854 # Obsfate templates, it would be removed once we introduce the obsfate
# template fragment
Boris Feld
obsfate: rename obsfate into obsolete in default mapfile...
r34902 lobsfate = '{if(obsfate, "{label('log.obsfate', '{obsfate % "obsolete: {fate}\n"}')}")}'
Boris Feld
obsfate: add obsfate to default mapfile...
r34854
Yuya Nishihara
templates: introduce labelcset() function in map-cmdline.default as example
r34717 [templatealias]
labelcset(expr) = label(separate(" ",
"log.changeset",
"changeset.{phase}",
if(obsolete, "changeset.obsolete"),
if(instabilities, "changeset.unstable"),
Yuya Nishihara
templates: fix missed space between instability labels
r34718 join(instabilities
% "instability.{instability}", " ")),
Yuya Nishihara
templates: introduce labelcset() function in map-cmdline.default as example
r34717 expr)