Mercurial > hg-stable
diff mercurial/cmdutil.py @ 26222:3095b1027661
templater: add new docheader/footer components for XML (issue4135)
The existing header/footer components were templated per-changeset,
and thus couldn't be correctly printed for an empty log
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 26 Aug 2015 16:27:14 -0500 |
parents | ab1c6e4efda4 |
children | d1530c6e8613 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Sep 10 09:52:17 2015 -0400 +++ b/mercurial/cmdutil.py Wed Aug 26 16:27:14 2015 -0500 @@ -1422,7 +1422,8 @@ (self.ui.debugflag, 'debug'), ] - self._parts = {'header': '', 'footer': '', 'changeset': 'changeset'} + self._parts = {'header': '', 'footer': '', 'changeset': 'changeset', + 'docheader': '', 'docfooter': ''} for mode, postfix in tmplmodes: for t in self._parts: cur = t @@ -1431,6 +1432,16 @@ if mode and cur in self.t: self._parts[t] = cur + if self._parts['docheader']: + self.ui.write(templater.stringify(self.t(self._parts['docheader']))) + + def close(self): + if self._parts['docfooter']: + if not self.footer: + self.footer = "" + self.footer += templater.stringify(self.t(self._parts['docfooter'])) + return super(changeset_templater, self).close() + def _show(self, ctx, copies, matchfn, props): '''show a single changeset or file revision'''