diff mercurial/templatekw.py @ 10058:c829563b3118

cmdutil: extract file copies closure into templatekw
author Patrick Mezard <pmezard@gmail.com>
date Sun, 13 Dec 2009 18:06:24 +0100
parents babc00a82c5e
children f780b1098efc
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sun Dec 13 18:06:24 2009 +0100
+++ b/mercurial/templatekw.py	Sun Dec 13 18:06:24 2009 +0100
@@ -141,6 +141,10 @@
 def showfileadds(repo, ctx, templ, revcache, **args):
     return showlist(templ, 'file_add', getfiles(repo, ctx, revcache)[1], **args)
 
+def showfilecopies(repo, ctx, templ, revcache, **args):
+    c = [{'name': x[0], 'source': x[1]} for x in revcache['copies']]
+    return showlist(templ, 'file_copy', c, plural='file_copies', **args)
+
 def showfiledels(repo, ctx, templ, revcache, **args):
     return showlist(templ, 'file_del', getfiles(repo, ctx, revcache)[2], **args)
 
@@ -179,6 +183,7 @@
     'diffstat': showdiffstat,
     'extras': showextras,
     'file_adds': showfileadds,
+    'file_copies': showfilecopies,
     'file_dels': showfiledels,
     'file_mods': showfilemods,
     'files': showfiles,