##// END OF EJS Templates
templater: add new docheader/footer components for XML (issue4135)...
Matt Mackall -
r26222:3095b102 default
parent child Browse files
Show More
@@ -1422,7 +1422,8 b' class changeset_templater(changeset_prin'
1422 1422 (self.ui.debugflag, 'debug'),
1423 1423 ]
1424 1424
1425 self._parts = {'header': '', 'footer': '', 'changeset': 'changeset'}
1425 self._parts = {'header': '', 'footer': '', 'changeset': 'changeset',
1426 'docheader': '', 'docfooter': ''}
1426 1427 for mode, postfix in tmplmodes:
1427 1428 for t in self._parts:
1428 1429 cur = t
@@ -1431,6 +1432,16 b' class changeset_templater(changeset_prin'
1431 1432 if mode and cur in self.t:
1432 1433 self._parts[t] = cur
1433 1434
1435 if self._parts['docheader']:
1436 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1437
1438 def close(self):
1439 if self._parts['docfooter']:
1440 if not self.footer:
1441 self.footer = ""
1442 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1443 return super(changeset_templater, self).close()
1444
1434 1445 def _show(self, ctx, copies, matchfn, props):
1435 1446 '''show a single changeset or file revision'''
1436 1447
@@ -1,5 +1,5 b''
1 header = '<?xml version="1.0"?>\n<log>\n'
2 footer = '</log>\n'
1 docheader = '<?xml version="1.0"?>\n<log>\n'
2 docfooter = '</log>\n'
3 3
4 4 changeset = '<logentry revision="{rev}" node="{node}">\n{branches}{bookmarks}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n</logentry>\n'
5 5 changeset_verbose = '<logentry revision="{rev}" node="{node}">\n{branches}{bookmarks}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n<paths>\n{file_adds}{file_dels}{file_mods}</paths>\n{file_copies}</logentry>\n'
@@ -343,6 +343,11 b' Compact style works:'
343 343
344 344 Test xml styles:
345 345
346 $ hg log --style xml -r 'not all()'
347 <?xml version="1.0"?>
348 <log>
349 </log>
350
346 351 $ hg log --style xml
347 352 <?xml version="1.0"?>
348 353 <log>
General Comments 0
You need to be logged in to leave comments. Login now