Show More
@@ -28,6 +28,7 b' class _hybrid(object):' | |||
|
28 | 28 | and to access raw values: |
|
29 | 29 | - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" |
|
30 | 30 | - "{get(extras, key)}" |
|
31 | - "{files|json}" | |
|
31 | 32 | """ |
|
32 | 33 | |
|
33 | 34 | def __init__(self, gen, values, makemap, joinfmt): |
@@ -43,8 +44,11 b' class _hybrid(object):' | |||
|
43 | 44 | return x in self._values |
|
44 | 45 | def __len__(self): |
|
45 | 46 | return len(self._values) |
|
47 | def __iter__(self): | |
|
48 | return iter(self._values) | |
|
46 | 49 | def __getattr__(self, name): |
|
47 | if name != 'get': | |
|
50 | if name not in ('get', 'items', 'iteritems', 'iterkeys', 'itervalues', | |
|
51 | 'keys', 'values'): | |
|
48 | 52 | raise AttributeError(name) |
|
49 | 53 | return getattr(self._values, name) |
|
50 | 54 |
@@ -3392,6 +3392,13 b' Test get function:' | |||
|
3392 | 3392 | hg: parse error: get() expects a dict as first argument |
|
3393 | 3393 | [255] |
|
3394 | 3394 | |
|
3395 | Test json filter applied to hybrid object: | |
|
3396 | ||
|
3397 | $ hg log -r0 -T '{files|json}\n' | |
|
3398 | ["a"] | |
|
3399 | $ hg log -r0 -T '{extras|json}\n' | |
|
3400 | {"branch": "default"} | |
|
3401 | ||
|
3395 | 3402 | Test localdate(date, tz) function: |
|
3396 | 3403 | |
|
3397 | 3404 | $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n' |
General Comments 0
You need to be logged in to leave comments.
Login now