Mercurial > hg
diff mercurial/templatekw.py @ 10056:1a114aca93fa
cmdutil: extract file changes closures into templatekw
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 13 Dec 2009 18:06:24 +0100 |
parents | e400a511e63a |
children | babc00a82c5e |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sun Dec 13 18:06:23 2009 +0100 +++ b/mercurial/templatekw.py Sun Dec 13 18:06:24 2009 +0100 @@ -69,6 +69,12 @@ if endname in templ: yield templ(endname, **args) +def getfiles(repo, ctx, revcache): + if 'files' not in revcache: + revcache['files'] = repo.status(ctx.parents()[0].node(), + ctx.node())[:3] + return revcache['files'] + def showauthor(repo, ctx, templ, **args): return ctx.user() @@ -99,6 +105,15 @@ args.update(dict(key=key, value=value)) yield templ('extra', **args) +def showfileadds(repo, ctx, templ, revcache, **args): + return showlist(templ, 'file_add', getfiles(repo, ctx, revcache)[1], **args) + +def showfiledels(repo, ctx, templ, revcache, **args): + return showlist(templ, 'file_del', getfiles(repo, ctx, revcache)[2], **args) + +def showfilemods(repo, ctx, templ, revcache, **args): + return showlist(templ, 'file_mod', getfiles(repo, ctx, revcache)[0], **args) + def showfiles(repo, ctx, templ, **args): return showlist(templ, 'file', ctx.files(), **args) @@ -124,6 +139,9 @@ 'desc': showdescription, 'diffstat': showdiffstat, 'extras': showextras, + 'file_adds': showfileadds, + 'file_dels': showfiledels, + 'file_mods': showfilemods, 'files': showfiles, 'manifest': showmanifest, 'node': shownode,