Mercurial > hg
view mercurial/help/environment.txt @ 25596:c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
This patch series is intended to unify the interpretation of string literals.
It is breaking change that boldly assumes
a. string literal "..." never contains template-like fragment or it is
intended to be a template
b. we tend to use raw string literal r"..." for regexp pattern in which "{"
should have different meaning
Currently, we don't have a comprehensible rule how string literals are
evaluated in template functions. For example, fill() takes "initialindent"
and "hangindent" as templates, but not for "text", whereas "text" is a
template in pad() function.
date(date, fmt)
diff(includepattern, excludepattern)
fill(text, width, initialident: T, hangindent: T)
get(dict, key)
if(expr, then: T, else: T)
ifcontains(search, thing, then: T, else: T)
ifeq(expr1, expr2, then: T, else: T)
indent(text, indentchars, firstline)
join(list, sep)
label(label: T, expr: T)
pad(text: T, width, fillchar, right)
revset(query, formatargs...])
rstdoc(text, style)
shortest(node, minlength)
startswith(pattern, text)
strip(text, chars)
sub(pattern, replacement, expression: T)
word(number, text, separator)
expr % template: T
T: interpret "string" or r"rawstring" as template
This patch series adjusts the rule as follows:
a. string literal, '' or "", starts template processing (BC)
b. raw string literal, r'' or r"", disables both \-escape and template
processing (BC, done by subsequent patches)
c. fragment not surrounded by {} is non-templated string
"ccc{'aaa'}{r'bbb'}"
------------------ *: template
--- c: string
--- a: template
--- b: rawstring
Because this can eliminate the compilation of template arguments from the
evaluation phase, "hg log -Tdefault" gets faster.
% cd mozilla-central
% LANG=C HGRCPATH=/dev/null hg log -Tdefault -r0:10000 --time > /dev/null
before: real 4.870 secs (user 4.860+0.000 sys 0.010+0.000)
after: real 3.480 secs (user 3.440+0.000 sys 0.030+0.000)
Also, this will allow us to parse nested templates at once for better error
indication.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 13 Jun 2015 19:49:54 +0900 |
parents | 9f97de157aad |
children | a9ed5a8fc5e0 |
line wrap: on
line source
HG Path to the 'hg' executable, automatically passed when running hooks, extensions or external tools. If unset or empty, this is the hg executable's name if it's frozen, or an executable named 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on Windows) is searched. HGEDITOR This is the name of the editor to run when committing. See EDITOR. (deprecated, use configuration file) HGENCODING This overrides the default locale setting detected by Mercurial. This setting is used to convert data including usernames, changeset descriptions, tag names, and branches. This setting can be overridden with the --encoding command-line option. HGENCODINGMODE This sets Mercurial's behavior for handling unknown characters while transcoding user input. The default is "strict", which causes Mercurial to abort if it can't map a character. Other settings include "replace", which replaces unknown characters, and "ignore", which drops them. This setting can be overridden with the --encodingmode command-line option. HGENCODINGAMBIGUOUS This sets Mercurial's behavior for handling characters with "ambiguous" widths like accented Latin characters with East Asian fonts. By default, Mercurial assumes ambiguous characters are narrow, set this variable to "wide" if such characters cause formatting problems. HGMERGE An executable to use for resolving merge conflicts. The program will be executed with three arguments: local file, remote file, ancestor file. (deprecated, use configuration file) HGRCPATH A list of files or directories to search for configuration files. Item separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set, platform default search path is used. If empty, only the .hg/hgrc from the current repository is read. For each element in HGRCPATH: - if it's a directory, all files ending with .rc are added - otherwise, the file itself will be added HGPLAIN When set, this disables any configuration settings that might change Mercurial's default output. This includes encoding, defaults, verbose mode, debug mode, quiet mode, tracebacks, and localization. This can be useful when scripting against Mercurial in the face of existing user configuration. Equivalent options set via command line flags or environment variables are not overridden. HGPLAINEXCEPT This is a comma-separated list of features to preserve when HGPLAIN is enabled. Currently the only value supported is "i18n", which preserves internationalization in plain mode. Setting HGPLAINEXCEPT to anything (even an empty string) will enable plain mode. HGUSER This is the string used as the author of a commit. If not set, available values will be considered in this order: - HGUSER (deprecated) - configuration files from the HGRCPATH - EMAIL - interactive prompt - LOGNAME (with ``@hostname`` appended) (deprecated, use configuration file) EMAIL May be used as the author of a commit; see HGUSER. LOGNAME May be used as the author of a commit; see HGUSER. VISUAL This is the name of the editor to use when committing. See EDITOR. EDITOR Sometimes Mercurial needs to open a text file in an editor for a user to modify, for example when writing commit messages. The editor it uses is determined by looking at the environment variables HGEDITOR, VISUAL and EDITOR, in that order. The first non-empty one is chosen. If all of them are empty, the editor defaults to 'vi'. PYTHONPATH This is used by Python to find imported modules and may need to be set appropriately if this Mercurial is not installed system-wide.