784 def _show(self, ctx, copies, props): |
784 def _show(self, ctx, copies, props): |
785 '''show a single changeset or file revision''' |
785 '''show a single changeset or file revision''' |
786 |
786 |
787 showlist = templatekw.showlist |
787 showlist = templatekw.showlist |
788 |
788 |
|
789 # showparents() behaviour depends on ui trace level which |
|
790 # causes unexpected behaviours at templating level and makes |
|
791 # it harder to extract it in a standalone function. Its |
|
792 # behaviour cannot be changed so leave it here for now. |
789 def showparents(repo, ctx, templ, **args): |
793 def showparents(repo, ctx, templ, **args): |
790 parents = [[('rev', p.rev()), ('node', p.hex())] |
794 parents = [[('rev', p.rev()), ('node', p.hex())] |
791 for p in self._meaningful_parentrevs(ctx)] |
795 for p in self._meaningful_parentrevs(ctx)] |
792 return showlist(templ, 'parent', parents, **args) |
796 return showlist(templ, 'parent', parents, **args) |
793 |
797 |
794 def showcopies(repo, ctx, templ, **args): |
|
795 c = [{'name': x[0], 'source': x[1]} for x in copies] |
|
796 return showlist(templ, 'file_copy', c, plural='file_copies', **args) |
|
797 |
|
798 defprops = { |
|
799 'file_copies': showcopies, |
|
800 'parents': showparents, |
|
801 } |
|
802 props = props.copy() |
798 props = props.copy() |
803 props.update(templatekw.keywords) |
799 props.update(templatekw.keywords) |
804 props.update(defprops) |
800 props['parents'] = showparents |
805 props['templ'] = self.t |
801 props['templ'] = self.t |
806 props['ctx'] = ctx |
802 props['ctx'] = ctx |
807 props['repo'] = self.repo |
803 props['repo'] = self.repo |
808 props['revcache'] = {} |
804 props['revcache'] = {'copies': copies} |
809 props['cache'] = self.cache |
805 props['cache'] = self.cache |
810 |
806 |
811 # find correct templates for current mode |
807 # find correct templates for current mode |
812 |
808 |
813 tmplmodes = [ |
809 tmplmodes = [ |