sapling/mercurial
Yuya Nishihara 7dafbbbbcf templatekw: add new-style template expansion to {manifest}
The goal is to allow us to easily access to nested data. The dot operator
will be introduced later so we can write '{p1.files}' instead of
'{revset("p1()") % "{files}"}' for example.

In the example above, 'p1' needs to carry a mapping dict along with its
string representation. If it were a list or a dict, it could be wrapped
semi-transparently with the _hybrid class, but for non-list/dict types,
it would be difficult to proxy all necessary functions to underlying value
type because several core operations may conflict with the ones of the
underlying value:

 - hash(value) should be different from hash(wrapped(value)), which means
   dict[wrapped(value)] would be invalid
 - 'value == wrapped(value)' would be false, breaks 'ifcontains'
 - len(wrapped(value)) may be either len(value) or len(iter(wrapped(value)))

So the wrapper has no proxy functions and its scope designed to be minimal.
It's unwrapped at eval*() functions so we don't have to care for a wrapped
object unless it's really needed:

  # most template functions just call evalfuncarg()
  unwrapped_value = evalfuncarg(context, mapping, args[n])
  # if wrapped value is needed, use evalrawexp()
  maybe_wrapped_value = evalrawexp(context, mapping, args[n])

Another idea was to wrap every template variable with a tagging class, but
which seemed uneasy without a static type checker.

This patch updates {manifest} to a mappable as an example.
2016-04-24 18:41:23 +09:00
..
cext encoding: check overflow while calculating size of JSON escape buffer 2017-08-31 21:56:40 +09:00
cffi policy: reroute proxy modules internally 2017-07-31 23:40:36 +09:00
default.d mergetools.rc: find OSX FileMerge in the new location inside Xcode 4.3 2015-10-16 11:37:34 +02:00
help progress: make ETA only consider progress made in the last minute 2017-09-27 15:14:59 -07:00
hgweb hgwebdir: read 'web.template' untrusted 2017-09-15 18:57:50 +02:00
httpclient httpclient: update to 54868ef054d2 of httpplus 2016-06-27 11:53:50 -04:00
pure py3: use 'surrogatepass' error handler to process U+DCxx transparently 2017-09-16 22:55:48 +09:00
templates show: pass the minimum length for nodes as a template keyword 2017-08-03 21:51:34 -07:00
__init__.py selector2: vendor selector2 library 2017-07-14 20:19:46 -07:00
ancestor.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
archival.py archive: add an experimental config to control the metadata file template 2017-07-17 00:49:29 -04:00
bdiff.c bdiff: don't check border condition in loop 2016-11-20 16:56:21 -08:00
bdiff.h bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bitmanipulation.h bitmanipulation: add missing include of string.h 2017-06-02 10:32:39 -07:00
bookmarks.py bookmark: deprecate direct del of a bookmark value 2017-07-10 21:49:37 +02:00
branchmap.py branches: correctly show inactive multiheaded branches 2017-08-31 18:24:08 +03:00
bundle2.py pull: remove inadequate use of operations records to update stepdone 2017-09-26 15:55:01 +02:00
bundlerepo.py bundlerepo: update to use new deltaiter api 2017-09-20 09:39:03 -07:00
byterange.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
changegroup.py changegroup: remove dictionary creation from deltachunk 2017-09-20 09:35:45 -07:00
changelog.py revlog: add option to mmap revlog index 2017-09-13 17:26:26 +00:00
chgserver.py demandimport: disable if chg is being used 2017-08-16 10:44:06 -07:00
cmdutil.py scmutil: extract helper functions that returns human-readable change id 2017-09-24 12:43:57 +09:00
color.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
commands.py cmdutil: remove redundant commitfunc parameter in amend (API) 2017-09-01 12:34:36 -07:00
commandserver.py commandserver: do not handle EINTR for selector.select 2017-07-16 11:17:00 -07:00
compat.h encoding: add function to test if a str consists of ASCII characters 2017-04-23 12:59:42 +09:00
config.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
configitems.py progress: make ETA only consider progress made in the last minute 2017-09-27 15:14:59 -07:00
context.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
copies.py copytrace: add a a new config to limit the number of drafts in heuristics 2017-09-21 15:58:44 +05:30
crecord.py editor: use an unambiguous path suffix for editor files 2017-08-30 20:25:56 +00:00
dagop.py revset: optimize "draft() & ::x" pattern 2017-08-28 14:49:00 -07:00
dagparser.py py3: iterate bytes as a byte string in dagparser.py 2017-09-03 15:32:45 +09:00
dagutil.py dagutil: use absolute_import 2015-08-08 19:04:09 -07:00
debugcommands.py phases: move the binary decoding function in the phases module 2017-09-19 22:23:41 +02:00
destutil.py show: implement "stack" view 2017-07-01 22:38:42 -07:00
dirstate.py dirstate: perform transactions with _map using single call, where possible 2017-09-14 09:41:22 -07:00
dirstateguard.py util: add base class for transactional context managers 2017-07-28 22:42:10 -07:00
discovery.py checkheads: use a "lazyancestors" object for allfuturecommon 2017-06-05 13:44:15 +01:00
dispatch.py alias: make alias command lazily resolved 2017-09-23 13:46:12 -07:00
dummycert.pem ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs 2014-09-26 02:19:48 +02:00
encoding.py py3: use 'surrogatepass' error handler to process U+DCxx transparently 2017-09-16 22:55:48 +09:00
error.py error: move patch.PatchError so it can easily implement __bytes__ (API) 2017-09-03 16:45:33 +09:00
exchange.py pull: remove inadequate use of operations records to update stepdone 2017-09-26 15:55:01 +02:00
exewrapper.c exewrapper: prefer HackableMercurial python if availbale 2017-03-13 12:44:13 -07:00
extensions.py extensions: register config item early 2017-09-05 00:34:13 +02:00
fancyopts.py py3: slice over bytes to prevent getting it's ascii value 2017-06-25 08:36:51 +05:30
filelog.py python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>) 2017-08-22 20:06:58 -04:00
filemerge.py filemerge: flush if using deferred writes when running a merge tool 2017-09-11 13:03:27 -07:00
fileset.py py3: use pycompat.bytestr so that we don't get ascii values 2017-05-29 16:21:15 +05:30
formatter.py py3: convert system strings to bytes in doctest of formatter.py 2017-09-17 12:39:53 +09:00
graphmod.py log: add a "graphwidth" template variable 2017-08-15 10:15:31 -07:00
hbisect.py hbisect: avoid shadowing a variable in a list comprehension 2016-11-10 16:33:23 -05:00
help.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
hg.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
hook.py py3: convert keys of kwargs back to bytes using pycompat.byteskwargs() 2017-06-17 15:29:26 +05:30
httpconnection.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
httppeer.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
i18n.py py3: use pycompat.fsencode() to convert __file__ to bytes 2017-02-20 18:40:42 +05:30
keepalive.py keepalive: add more context to bad status line errors 2017-09-25 11:05:16 +02:00
localrepo.py revlog: add option to mmap revlog index 2017-09-13 17:26:26 +00:00
lock.py lock: avoid unintentional lock acquisition at failure of readlock 2017-05-01 19:59:13 +09:00
lsprof.py lsprof: use print function 2016-01-02 11:40:53 -08:00
lsprofcalltree.py lsprofcalltree: use print function 2016-01-02 11:45:29 -08:00
mail.py mail: encode long unicode lines in emails properly (issue5687) 2017-09-26 16:14:57 +03:00
manifest.py revlog: add option to mmap revlog index 2017-09-13 17:26:26 +00:00
match.py match: override visitdir() in nevermatcher to return False 2017-07-19 14:50:50 -07:00
mdiff.py mdiff: add a --ignore-space-at-eol option 2017-08-29 18:20:50 -07:00
merge.py merge: allow a custom working context to be passed to update 2017-09-14 13:14:32 -07:00
mergeutil.py checkunresolved: move to new package to help avoid import cycles 2016-11-21 21:31:45 -05:00
minirst.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
mpatch.c internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
mpatch.h mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
namespaces.py namespaces: record and expose whether namespace is built-in 2017-06-24 14:52:15 -07:00
node.py node: use byte literals to construct nullid and wdirid 2016-03-12 14:04:57 -08:00
obsolete.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
obsutil.py templates: introduce a obsfateoperation() function 2017-09-15 10:43:22 -07:00
parser.py doctest: use print_function and convert bytes to unicode where needed 2017-09-03 14:56:31 +09:00
patch.py py3: fix doctests in patch.py to be compatible with Python 3 2017-09-17 12:23:16 +09:00
pathutil.py py3: use bytes os.sep in doctest of pathutil.py 2017-09-17 12:26:42 +09:00
peer.py wireproto: use new peer interface 2017-08-10 20:58:28 -07:00
phases.py bundle2: only grab a transaction when 'phase-heads' affect the repository 2017-09-20 18:29:10 +02:00
policy.py encoding: add fast path of jsonescape() (issue5533) 2017-04-23 14:47:52 +09:00
posix.py ssh: quote parameters using shellquote (SEC) 2017-08-04 23:54:12 -07:00
profiling.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
progress.py progress: make ETA only consider progress made in the last minute 2017-09-27 15:14:59 -07:00
pushkey.py pushkey: use absolute_import 2015-08-08 19:57:27 -07:00
pvec.py pvec: use absolute_import 2015-12-21 21:32:58 -08:00
pycompat.py py3: select input or raw_input by pycompat 2017-08-16 13:54:24 +09:00
rcutil.py osutil: proxy through util (and platform) modules (API) 2017-04-26 22:26:28 +09:00
registrar.py revset: move weight information to predicate 2017-09-01 19:42:09 -07:00
repair.py merge with stable 2017-09-18 14:12:20 -05:00
repository.py repository: implement generic capability methods on peer class 2017-08-06 16:47:25 -07:00
repoview.py cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 2016-06-10 00:12:33 -04:00
revlog.py revlog: add option to mmap revlog index 2017-09-13 17:26:26 +00:00
revset.py revset: move weight information to predicate 2017-09-01 19:42:09 -07:00
revsetlang.py revset: move weight information to predicate 2017-09-01 19:42:09 -07:00
scmposix.py osutil: proxy through util (and platform) modules (API) 2017-04-26 22:26:28 +09:00
scmutil.py scmutil: extract helper functions that returns human-readable change id 2017-09-24 12:43:57 +09:00
scmwindows.py osutil: proxy through util (and platform) modules (API) 2017-04-26 22:26:28 +09:00
selectors2.py selector2: vendor selector2 library 2017-07-14 20:19:46 -07:00
server.py py3: simply use b'%d\n' to format pid in server.py 2017-06-01 23:05:29 +09:00
setdiscovery.py setdiscovery: improves logged message 2017-06-10 18:47:09 +01:00
similar.py similar: remove caching from the module level 2017-01-13 11:42:36 -08:00
simplemerge.py simplemerge: remove unused repo parameter 2017-09-01 10:35:43 -07:00
smartset.py py3: fix type of attribute name in smartset.py 2017-09-03 17:14:53 +09:00
sparse.py sparse: treat paths as cwd-relative 2017-08-04 05:38:22 -07:00
sshpeer.py ssh: fix flakey ssh errors on BSD systems 2017-09-11 15:59:18 -07:00
sshserver.py wireproto: compress data from a generator 2016-10-16 11:10:21 -07:00
sslutil.py sslutil: inform the user about how to fix an incomplete certificate chain 2017-07-12 18:37:13 -04:00
statichttprepo.py statichttprepo: implement wlock() (issue5613) 2017-07-29 12:50:56 -07:00
statprof.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
store.py py3: iterate bytes as a byte string in store.lowerencode() 2017-09-03 17:28:47 +09:00
streamclone.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
subrepo.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
tagmerge.py tagmerge: use workingfilectx to write merged tags 2017-07-11 16:48:15 -07:00
tags.py tag: use filtered repo when creating new tags (issue5539) 2017-08-29 11:25:22 +02:00
templatefilters.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
templatekw.py templatekw: add new-style template expansion to {manifest} 2016-04-24 18:41:23 +09:00
templater.py templatekw: add new-style template expansion to {manifest} 2016-04-24 18:41:23 +09:00
transaction.py util: add base class for transactional context managers 2017-07-28 22:42:10 -07:00
treediscovery.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
txnutil.py txnutil: factor out the logic to read file in according to HG_PENDING 2017-02-21 01:20:59 +09:00
ui.py ui: fix progress debug log format strings to work on Python 3 2017-09-18 13:37:00 -04:00
unionrepo.py revlog: update signature of dummy addgroup() in bundlerepo and unionrepo 2017-09-15 23:58:45 +09:00
upgrade.py codemod: simplify nested withs 2017-07-13 18:31:35 -07:00
url.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
util.py util: add an mmapread method 2017-09-21 05:54:34 -07:00
verify.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
vfs.py python3: wrap all uses of <exception>.strerror with strtolocal 2017-08-22 20:03:07 -04:00
win32.py python3: wrap all uses of <exception>.strerror with strtolocal 2017-08-22 20:03:07 -04:00
windows.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
wireproto.py pull: use 'phase-heads' to retrieve phase information 2017-09-24 21:27:18 +02:00
worker.py py3: pass str in os.sysconf() 2017-05-31 23:42:58 +05:30