##// END OF EJS Templates
cmdutil: extract file copies closure into templatekw
Patrick Mezard -
r10058:c829563b default
parent child Browse files
Show More
@@ -786,26 +786,22 class changeset_templater(changeset_prin
786 786
787 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 793 def showparents(repo, ctx, templ, **args):
790 794 parents = [[('rev', p.rev()), ('node', p.hex())]
791 795 for p in self._meaningful_parentrevs(ctx)]
792 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 798 props = props.copy()
803 799 props.update(templatekw.keywords)
804 props.update(defprops)
800 props['parents'] = showparents
805 801 props['templ'] = self.t
806 802 props['ctx'] = ctx
807 803 props['repo'] = self.repo
808 props['revcache'] = {}
804 props['revcache'] = {'copies': copies}
809 805 props['cache'] = self.cache
810 806
811 807 # find correct templates for current mode
@@ -141,6 +141,10 def showextras(repo, ctx, templ, **args)
141 141 def showfileadds(repo, ctx, templ, revcache, **args):
142 142 return showlist(templ, 'file_add', getfiles(repo, ctx, revcache)[1], **args)
143 143
144 def showfilecopies(repo, ctx, templ, revcache, **args):
145 c = [{'name': x[0], 'source': x[1]} for x in revcache['copies']]
146 return showlist(templ, 'file_copy', c, plural='file_copies', **args)
147
144 148 def showfiledels(repo, ctx, templ, revcache, **args):
145 149 return showlist(templ, 'file_del', getfiles(repo, ctx, revcache)[2], **args)
146 150
@@ -179,6 +183,7 keywords = {
179 183 'diffstat': showdiffstat,
180 184 'extras': showextras,
181 185 'file_adds': showfileadds,
186 'file_copies': showfilecopies,
182 187 'file_dels': showfiledels,
183 188 'file_mods': showfilemods,
184 189 'files': showfiles,
General Comments 0
You need to be logged in to leave comments. Login now