Show More
@@ -16,6 +16,7 b' from .node import (' | |||
|
16 | 16 | ) |
|
17 | 17 | from . import ( |
|
18 | 18 | color, |
|
19 | diffutil, | |
|
19 | 20 | encoding, |
|
20 | 21 | error, |
|
21 | 22 | minirst, |
@@ -86,7 +87,8 b' def dict_(context, mapping, args):' | |||
|
86 | 87 | for k, v in args['kwargs'].iteritems()) |
|
87 | 88 | return templateutil.hybriddict(data) |
|
88 | 89 | |
|
89 |
@templatefunc('diff([includepattern [, excludepattern]])', |
|
|
90 | @templatefunc('diff([includepattern [, excludepattern]])', | |
|
91 | requires={'ctx', 'ui'}) | |
|
90 | 92 | def diff(context, mapping, args): |
|
91 | 93 | """Show a diff, optionally |
|
92 | 94 | specifying files to include or exclude.""" |
@@ -102,7 +104,10 b' def diff(context, mapping, args):' | |||
|
102 | 104 | return [] |
|
103 | 105 | |
|
104 | 106 | ctx = context.resource(mapping, 'ctx') |
|
105 | chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1))) | |
|
107 | ui = context.resource(mapping, 'ui') | |
|
108 | diffopts = diffutil.diffallopts(ui) | |
|
109 | chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1)), | |
|
110 | opts=diffopts) | |
|
106 | 111 | |
|
107 | 112 | return ''.join(chunks) |
|
108 | 113 |
@@ -370,6 +370,17 b' Test diff function:' | |||
|
370 | 370 | @@ -0,0 +1,1 @@ |
|
371 | 371 | +second |
|
372 | 372 | |
|
373 | $ hg --config diff.git=true log -r 8 -T "{diff()}" | |
|
374 | diff --git a/second b/fourth | |
|
375 | rename from second | |
|
376 | rename to fourth | |
|
377 | diff --git a/third b/third | |
|
378 | new file mode 100644 | |
|
379 | --- /dev/null | |
|
380 | +++ b/third | |
|
381 | @@ -0,0 +1,1 @@ | |
|
382 | +third | |
|
383 | ||
|
373 | 384 | $ cd .. |
|
374 | 385 | |
|
375 | 386 | latesttag() function: |
General Comments 0
You need to be logged in to leave comments.
Login now