Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
10055:e400a511e63a | 10056:1a114aca93fa |
---|---|
67 yield one(last, tag=lastname) | 67 yield one(last, tag=lastname) |
68 endname = 'end_' + names | 68 endname = 'end_' + names |
69 if endname in templ: | 69 if endname in templ: |
70 yield templ(endname, **args) | 70 yield templ(endname, **args) |
71 | 71 |
72 def getfiles(repo, ctx, revcache): | |
73 if 'files' not in revcache: | |
74 revcache['files'] = repo.status(ctx.parents()[0].node(), | |
75 ctx.node())[:3] | |
76 return revcache['files'] | |
77 | |
72 def showauthor(repo, ctx, templ, **args): | 78 def showauthor(repo, ctx, templ, **args): |
73 return ctx.user() | 79 return ctx.user() |
74 | 80 |
75 def showbranches(repo, ctx, templ, **args): | 81 def showbranches(repo, ctx, templ, **args): |
76 branch = ctx.branch() | 82 branch = ctx.branch() |
97 for key, value in sorted(ctx.extra().items()): | 103 for key, value in sorted(ctx.extra().items()): |
98 args = args.copy() | 104 args = args.copy() |
99 args.update(dict(key=key, value=value)) | 105 args.update(dict(key=key, value=value)) |
100 yield templ('extra', **args) | 106 yield templ('extra', **args) |
101 | 107 |
108 def showfileadds(repo, ctx, templ, revcache, **args): | |
109 return showlist(templ, 'file_add', getfiles(repo, ctx, revcache)[1], **args) | |
110 | |
111 def showfiledels(repo, ctx, templ, revcache, **args): | |
112 return showlist(templ, 'file_del', getfiles(repo, ctx, revcache)[2], **args) | |
113 | |
114 def showfilemods(repo, ctx, templ, revcache, **args): | |
115 return showlist(templ, 'file_mod', getfiles(repo, ctx, revcache)[0], **args) | |
116 | |
102 def showfiles(repo, ctx, templ, **args): | 117 def showfiles(repo, ctx, templ, **args): |
103 return showlist(templ, 'file', ctx.files(), **args) | 118 return showlist(templ, 'file', ctx.files(), **args) |
104 | 119 |
105 def showmanifest(repo, ctx, templ, **args): | 120 def showmanifest(repo, ctx, templ, **args): |
106 args = args.copy() | 121 args = args.copy() |
122 'branches': showbranches, | 137 'branches': showbranches, |
123 'date': showdate, | 138 'date': showdate, |
124 'desc': showdescription, | 139 'desc': showdescription, |
125 'diffstat': showdiffstat, | 140 'diffstat': showdiffstat, |
126 'extras': showextras, | 141 'extras': showextras, |
142 'file_adds': showfileadds, | |
143 'file_dels': showfiledels, | |
144 'file_mods': showfilemods, | |
127 'files': showfiles, | 145 'files': showfiles, |
128 'manifest': showmanifest, | 146 'manifest': showmanifest, |
129 'node': shownode, | 147 'node': shownode, |
130 'rev': showrev, | 148 'rev': showrev, |
131 'tags': showtags, | 149 'tags': showtags, |