Show More
@@ -757,12 +757,16 b' class changeset_templater(changeset_prin' | |||||
757 | def __init__(self, ui, repo, patch, diffopts, mapfile, buffered): |
|
757 | def __init__(self, ui, repo, patch, diffopts, mapfile, buffered): | |
758 | changeset_printer.__init__(self, ui, repo, patch, diffopts, buffered) |
|
758 | changeset_printer.__init__(self, ui, repo, patch, diffopts, buffered) | |
759 | formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) |
|
759 | formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) | |
|
760 | defaulttempl = { | |||
|
761 | 'parent': '{rev}:{node|formatnode} ', | |||
|
762 | 'manifest': '{rev}:{node|formatnode}', | |||
|
763 | 'file_copy': '{name} ({source})', | |||
|
764 | 'extra': '{key}={value|stringescape}' | |||
|
765 | } | |||
|
766 | # filecopy is preserved for compatibility reasons | |||
|
767 | defaulttempl['filecopy'] = defaulttempl['file_copy'] | |||
760 | self.t = templater.templater(mapfile, {'formatnode': formatnode}, |
|
768 | self.t = templater.templater(mapfile, {'formatnode': formatnode}, | |
761 |
cache= |
|
769 | cache=defaulttempl) | |
762 | 'parent': '{rev}:{node|formatnode} ', |
|
|||
763 | 'manifest': '{rev}:{node|formatnode}', |
|
|||
764 | 'filecopy': '{name} ({source})', |
|
|||
765 | 'extra': '{key}={value|stringescape}'}) |
|
|||
766 | self.cache = {} |
|
770 | self.cache = {} | |
767 |
|
771 | |||
768 | def use_template(self, t): |
|
772 | def use_template(self, t): |
@@ -34,6 +34,10 b' keywords are usually available for templ' | |||||
34 | :files: List of strings. All files modified, added, or removed |
|
34 | :files: List of strings. All files modified, added, or removed | |
35 | by this changeset. |
|
35 | by this changeset. | |
36 | :file_adds: List of strings. Files added by this changeset. |
|
36 | :file_adds: List of strings. Files added by this changeset. | |
|
37 | :file_copies: List of strings. Files copied in this changeset with | |||
|
38 | their sources. | |||
|
39 | :file_copies_switch: List of strings. Like "file_copies" but displayed | |||
|
40 | only if the --copied switch is set. | |||
37 | :file_mods: List of strings. Files modified by this changeset. |
|
41 | :file_mods: List of strings. Files modified by this changeset. | |
38 | :file_dels: List of strings. Files removed by this changeset. |
|
42 | :file_dels: List of strings. Files removed by this changeset. | |
39 | :node: String. The changeset identification hash, as a |
|
43 | :node: String. The changeset identification hash, as a |
@@ -77,8 +77,14 b' class engine(object):' | |||||
77 | raise SyntaxError(_("error expanding '%s%%%s'") % (key, format)) |
|
77 | raise SyntaxError(_("error expanding '%s%%%s'") % (key, format)) | |
78 | lm = map.copy() |
|
78 | lm = map.copy() | |
79 | for i in v: |
|
79 | for i in v: | |
80 | lm.update(i) |
|
80 | if isinstance(i, dict): | |
81 | yield self.process(format, lm) |
|
81 | lm.update(i) | |
|
82 | yield self.process(format, lm) | |||
|
83 | else: | |||
|
84 | # v is not an iterable of dicts, this happen when 'key' | |||
|
85 | # has been fully expanded already and format is useless. | |||
|
86 | # If so, return the expanded value. | |||
|
87 | yield i | |||
82 |
|
88 | |||
83 | def _filter(self, expr, get, map): |
|
89 | def _filter(self, expr, get, map): | |
84 | if expr not in self.cache: |
|
90 | if expr not in self.cache: |
@@ -94,7 +94,7 b' cat changelog' | |||||
94 |
|
94 | |||
95 | echo "# keys work" |
|
95 | echo "# keys work" | |
96 | for key in author branches date desc file_adds file_dels file_mods \ |
|
96 | for key in author branches date desc file_adds file_dels file_mods \ | |
97 |
|
|
97 | file_copies file_copies_switch files \ | |
98 | manifest node parents rev tags diffstat extras; do |
|
98 | manifest node parents rev tags diffstat extras; do | |
99 | for mode in '' --verbose --debug; do |
|
99 | for mode in '' --verbose --debug; do | |
100 | hg log $mode --template "$key$mode: {$key}\n" |
|
100 | hg log $mode --template "$key$mode: {$key}\n" |
@@ -380,60 +380,60 b' file_mods--debug: c' | |||||
380 | file_mods--debug: |
|
380 | file_mods--debug: | |
381 | file_mods--debug: |
|
381 | file_mods--debug: | |
382 | file_mods--debug: |
|
382 | file_mods--debug: | |
383 |
file_copies |
|
383 | file_copies: fourth (second) | |
384 |
file_copies |
|
384 | file_copies: | |
385 |
file_copies |
|
385 | file_copies: | |
386 |
file_copies |
|
386 | file_copies: | |
387 |
file_copies |
|
387 | file_copies: | |
388 |
file_copies |
|
388 | file_copies: | |
389 |
file_copies |
|
389 | file_copies: | |
390 |
file_copies |
|
390 | file_copies: | |
391 |
file_copies |
|
391 | file_copies: | |
392 |
file_copies |
|
392 | file_copies--verbose: fourth (second) | |
393 |
file_copies |
|
393 | file_copies--verbose: | |
394 |
file_copies |
|
394 | file_copies--verbose: | |
395 |
file_copies |
|
395 | file_copies--verbose: | |
396 |
file_copies |
|
396 | file_copies--verbose: | |
397 |
file_copies |
|
397 | file_copies--verbose: | |
398 |
file_copies |
|
398 | file_copies--verbose: | |
399 |
file_copies |
|
399 | file_copies--verbose: | |
400 |
file_copies |
|
400 | file_copies--verbose: | |
401 |
file_copies |
|
401 | file_copies--debug: fourth (second) | |
402 |
file_copies |
|
402 | file_copies--debug: | |
403 |
file_copies |
|
403 | file_copies--debug: | |
404 |
file_copies |
|
404 | file_copies--debug: | |
405 |
file_copies |
|
405 | file_copies--debug: | |
406 |
file_copies |
|
406 | file_copies--debug: | |
407 |
file_copies |
|
407 | file_copies--debug: | |
408 |
file_copies |
|
408 | file_copies--debug: | |
409 |
file_copies |
|
409 | file_copies--debug: | |
410 |
file_copies_switch |
|
410 | file_copies_switch: | |
411 |
file_copies_switch |
|
411 | file_copies_switch: | |
412 |
file_copies_switch |
|
412 | file_copies_switch: | |
413 |
file_copies_switch |
|
413 | file_copies_switch: | |
414 |
file_copies_switch |
|
414 | file_copies_switch: | |
415 |
file_copies_switch |
|
415 | file_copies_switch: | |
416 |
file_copies_switch |
|
416 | file_copies_switch: | |
417 |
file_copies_switch |
|
417 | file_copies_switch: | |
418 |
file_copies_switch |
|
418 | file_copies_switch: | |
419 |
file_copies_switch |
|
419 | file_copies_switch--verbose: | |
420 |
file_copies_switch |
|
420 | file_copies_switch--verbose: | |
421 |
file_copies_switch |
|
421 | file_copies_switch--verbose: | |
422 |
file_copies_switch |
|
422 | file_copies_switch--verbose: | |
423 |
file_copies_switch |
|
423 | file_copies_switch--verbose: | |
424 |
file_copies_switch |
|
424 | file_copies_switch--verbose: | |
425 |
file_copies_switch |
|
425 | file_copies_switch--verbose: | |
426 |
file_copies_switch |
|
426 | file_copies_switch--verbose: | |
427 |
file_copies_switch |
|
427 | file_copies_switch--verbose: | |
428 |
file_copies_switch |
|
428 | file_copies_switch--debug: | |
429 |
file_copies_switch |
|
429 | file_copies_switch--debug: | |
430 |
file_copies_switch |
|
430 | file_copies_switch--debug: | |
431 |
file_copies_switch |
|
431 | file_copies_switch--debug: | |
432 |
file_copies_switch |
|
432 | file_copies_switch--debug: | |
433 |
file_copies_switch |
|
433 | file_copies_switch--debug: | |
434 |
file_copies_switch |
|
434 | file_copies_switch--debug: | |
435 |
file_copies_switch |
|
435 | file_copies_switch--debug: | |
436 |
file_copies_switch |
|
436 | file_copies_switch--debug: | |
437 | files: fourth second third |
|
437 | files: fourth second third | |
438 | files: second |
|
438 | files: second | |
439 | files: |
|
439 | files: |
@@ -141,7 +141,7 b' diff --git a/rename2 b/rename3-2' | |||||
141 | rename from rename2 |
|
141 | rename from rename2 | |
142 | rename to rename3-2 |
|
142 | rename to rename3-2 | |
143 | EOF |
|
143 | EOF | |
144 |
hg log -vr. --template '{rev} {files} / {file_copies |
|
144 | hg log -vr. --template '{rev} {files} / {file_copies}\n' | |
145 |
|
145 | |||
146 | hg locate rename2 rename3 rename3-2 |
|
146 | hg locate rename2 rename3 rename3-2 | |
147 | hg cat rename3 |
|
147 | hg cat rename3 |
@@ -32,23 +32,23 b' echo % many renames' | |||||
32 | hg log -vf e |
|
32 | hg log -vf e | |
33 |
|
33 | |||
34 | echo '% log copies with --copies' |
|
34 | echo '% log copies with --copies' | |
35 |
hg log -vC --template '{rev} {file_copies |
|
35 | hg log -vC --template '{rev} {file_copies}\n' | |
36 | echo '% log copies switch without --copies' |
|
36 | echo '% log copies switch without --copies, with old filecopy template' | |
37 | hg log -v --template '{rev} {file_copies_switch%filecopy}\n' |
|
37 | hg log -v --template '{rev} {file_copies_switch%filecopy}\n' | |
38 | echo '% log copies switch with --copies' |
|
38 | echo '% log copies switch with --copies' | |
39 |
hg log -vC --template '{rev} {file_copies_switch |
|
39 | hg log -vC --template '{rev} {file_copies_switch}\n' | |
40 |
|
40 | |||
41 | echo % log copies, non-linear manifest |
|
41 | echo % log copies, non-linear manifest | |
42 | hg up -C 3 |
|
42 | hg up -C 3 | |
43 | hg mv dir/b e |
|
43 | hg mv dir/b e | |
44 | echo foo > foo |
|
44 | echo foo > foo | |
45 | hg ci -Ame2 -d '6 0' |
|
45 | hg ci -Ame2 -d '6 0' | |
46 |
hg log -v --template '{rev} {file_copies |
|
46 | hg log -v --template '{rev} {file_copies}\n' -r 5 | |
47 |
|
47 | |||
48 | echo % log copies, execute bit set |
|
48 | echo % log copies, execute bit set | |
49 | chmod +x e |
|
49 | chmod +x e | |
50 | hg ci -me3 -d '7 0' |
|
50 | hg ci -me3 -d '7 0' | |
51 |
hg log -v --template '{rev} {file_copies |
|
51 | hg log -v --template '{rev} {file_copies}\n' -r 6 | |
52 |
|
52 | |||
53 | echo '% log -p d' |
|
53 | echo '% log -p d' | |
54 | hg log -pv d |
|
54 | hg log -pv d |
@@ -82,7 +82,7 b' 3 b (a)' | |||||
82 | 2 dir/b (b) |
|
82 | 2 dir/b (b) | |
83 | 1 b (a) |
|
83 | 1 b (a) | |
84 | 0 |
|
84 | 0 | |
85 | % log copies switch without --copies |
|
85 | % log copies switch without --copies, with old filecopy template | |
86 | 4 |
|
86 | 4 | |
87 | 3 |
|
87 | 3 | |
88 | 2 |
|
88 | 2 |
@@ -387,10 +387,10 b" hg ci -m 'change foo'" | |||||
387 | hg up -C 1 |
|
387 | hg up -C 1 | |
388 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
388 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' | |
389 | cat .hg/patches/bar |
|
389 | cat .hg/patches/bar | |
390 |
hg log -v --template '{rev} {file_copies |
|
390 | hg log -v --template '{rev} {file_copies}\n' -r . | |
391 | hg qrefresh --git |
|
391 | hg qrefresh --git | |
392 | cat .hg/patches/bar |
|
392 | cat .hg/patches/bar | |
393 |
hg log -v --template '{rev} {file_copies |
|
393 | hg log -v --template '{rev} {file_copies}\n' -r . | |
394 | hg qrefresh |
|
394 | hg qrefresh | |
395 | grep 'diff --git' .hg/patches/bar |
|
395 | grep 'diff --git' .hg/patches/bar | |
396 |
|
396 | |||
@@ -403,12 +403,12 b' hg mv bar quux' | |||||
403 | hg mv baz bleh |
|
403 | hg mv baz bleh | |
404 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
404 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' | |
405 | cat .hg/patches/bar |
|
405 | cat .hg/patches/bar | |
406 |
hg log -v --template '{rev} {file_copies |
|
406 | hg log -v --template '{rev} {file_copies}\n' -r . | |
407 | hg mv quux fred |
|
407 | hg mv quux fred | |
408 | hg mv bleh barney |
|
408 | hg mv bleh barney | |
409 | hg qrefresh --git |
|
409 | hg qrefresh --git | |
410 | cat .hg/patches/bar |
|
410 | cat .hg/patches/bar | |
411 |
hg log -v --template '{rev} {file_copies |
|
411 | hg log -v --template '{rev} {file_copies}\n' -r . | |
412 |
|
412 | |||
413 | echo % refresh omitting an added file |
|
413 | echo % refresh omitting an added file | |
414 | hg qnew baz |
|
414 | hg qnew baz |
General Comments 0
You need to be logged in to leave comments.
Login now