Show More
@@ -16,6 +16,7 b' from .node import (' | |||||
16 | ) |
|
16 | ) | |
17 | from . import ( |
|
17 | from . import ( | |
18 | color, |
|
18 | color, | |
|
19 | diffutil, | |||
19 | encoding, |
|
20 | encoding, | |
20 | error, |
|
21 | error, | |
21 | minirst, |
|
22 | minirst, | |
@@ -86,7 +87,8 b' def dict_(context, mapping, args):' | |||||
86 | for k, v in args['kwargs'].iteritems()) |
|
87 | for k, v in args['kwargs'].iteritems()) | |
87 | return templateutil.hybriddict(data) |
|
88 | return templateutil.hybriddict(data) | |
88 |
|
89 | |||
89 |
@templatefunc('diff([includepattern [, excludepattern]])', |
|
90 | @templatefunc('diff([includepattern [, excludepattern]])', | |
|
91 | requires={'ctx', 'ui'}) | |||
90 | def diff(context, mapping, args): |
|
92 | def diff(context, mapping, args): | |
91 | """Show a diff, optionally |
|
93 | """Show a diff, optionally | |
92 | specifying files to include or exclude.""" |
|
94 | specifying files to include or exclude.""" | |
@@ -102,7 +104,10 b' def diff(context, mapping, args):' | |||||
102 | return [] |
|
104 | return [] | |
103 |
|
105 | |||
104 | ctx = context.resource(mapping, 'ctx') |
|
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 | return ''.join(chunks) |
|
112 | return ''.join(chunks) | |
108 |
|
113 |
@@ -370,6 +370,17 b' Test diff function:' | |||||
370 | @@ -0,0 +1,1 @@ |
|
370 | @@ -0,0 +1,1 @@ | |
371 | +second |
|
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 | $ cd .. |
|
384 | $ cd .. | |
374 |
|
385 | |||
375 | latesttag() function: |
|
386 | latesttag() function: |
General Comments 0
You need to be logged in to leave comments.
Login now