591 ctx = mapping['ctx'] |
592 ctx = mapping['ctx'] |
592 chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1))) |
593 chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1))) |
593 |
594 |
594 return ''.join(chunks) |
595 return ''.join(chunks) |
595 |
596 |
|
597 @templatefunc('extdata(source)', argspec='source') |
|
598 def extdata(context, mapping, args): |
|
599 """Show a text read from the specified extdata source. (EXPERIMENTAL)""" |
|
600 if 'source' not in args: |
|
601 # i18n: "extdata" is a keyword |
|
602 raise error.ParseError(_('extdata expects one argument')) |
|
603 |
|
604 source = evalstring(context, mapping, args['source']) |
|
605 cache = mapping['cache'].setdefault('extdata', {}) |
|
606 ctx = mapping['ctx'] |
|
607 if source in cache: |
|
608 data = cache[source] |
|
609 else: |
|
610 data = cache[source] = scmutil.extdatasource(ctx.repo(), source) |
|
611 return data.get(ctx.rev(), '') |
|
612 |
596 @templatefunc('files(pattern)') |
613 @templatefunc('files(pattern)') |
597 def files(context, mapping, args): |
614 def files(context, mapping, args): |
598 """All files of the current changeset matching the pattern. See |
615 """All files of the current changeset matching the pattern. See |
599 :hg:`help patterns`.""" |
616 :hg:`help patterns`.""" |
600 if not len(args) == 1: |
617 if not len(args) == 1: |