diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1422,7 +1422,8 @@ class changeset_templater(changeset_prin
(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 @@ class changeset_templater(changeset_prin
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'''
diff --git a/mercurial/templates/map-cmdline.xml b/mercurial/templates/map-cmdline.xml
--- a/mercurial/templates/map-cmdline.xml
+++ b/mercurial/templates/map-cmdline.xml
@@ -1,5 +1,5 @@
-header = '\n\n'
-footer = '\n'
+docheader = '\n\n'
+docfooter = '\n'
changeset = '\n{branches}{bookmarks}{tags}{parents}{author|person|xmlescape}\n{date|rfc3339date}\n{desc|xmlescape}\n\n'
changeset_verbose = '\n{branches}{bookmarks}{tags}{parents}{author|person|xmlescape}\n{date|rfc3339date}\n{desc|xmlescape}\n\n{file_adds}{file_dels}{file_mods}\n{file_copies}\n'
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -343,6 +343,11 @@ Compact style works:
Test xml styles:
+ $ hg log --style xml -r 'not all()'
+
+
+
+
$ hg log --style xml