Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 5545:5a124ce4602a
cmdutil: always expose "files_add", "files_del" and "manifest" templater properties
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 24 Nov 2007 17:56:15 +0100 |
parents | 7a64931e2d76 |
children | db6633f11d59 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Nov 20 14:41:47 2007 +0100 +++ b/mercurial/cmdutil.py Sat Nov 24 17:56:15 2007 +0100 @@ -571,26 +571,31 @@ def showcopies(**args): c = [{'name': x[0], 'source': x[1]} for x in copies] return showlist('file_copy', c, plural='file_copies', **args) - + + files = [] + def getfiles(): + if not files: + files[:] = self.repo.status( + log.parents(changenode)[0], changenode)[:3] + return files + # XXX: "files" means "modified files" in debug, "all changed + # files" otherwise. This should be fixed and a "file_mods" be + # introduced instead. if self.ui.debugflag: - files = self.repo.status(log.parents(changenode)[0], changenode)[:3] def showfiles(**args): - return showlist('file', files[0], **args) - def showadds(**args): - return showlist('file_add', files[1], **args) - def showdels(**args): - return showlist('file_del', files[2], **args) - def showmanifest(**args): - args = args.copy() - args.update(dict(rev=self.repo.manifest.rev(changes[0]), - node=hex(changes[0]))) - return self.t('manifest', **args) + return showlist('file', getfiles()[0], **args) else: def showfiles(**args): return showlist('file', changes[3], **args) - showadds = '' - showdels = '' - showmanifest = '' + def showadds(**args): + return showlist('file_add', getfiles()[1], **args) + def showdels(**args): + return showlist('file_del', getfiles()[2], **args) + def showmanifest(**args): + args = args.copy() + args.update(dict(rev=self.repo.manifest.rev(changes[0]), + node=hex(changes[0]))) + return self.t('manifest', **args) defprops = { 'author': changes[1],