Emergency brake against multiline expansion kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Tue, 16 Jan 2007 03:14:40 +0100
branchkwmap-templates
changeset 103 e086f7eb0198
parent 102 393d6f8ea83c
child 104 e8b9a500f2e1
Emergency brake against multiline expansion As expansion always happens ad hoc, is not tracked, multiline or incremental expansion do not seem worth the trouble. If at all, it would make sense with static, hardcoded keywords.
hgkw/keyword.py
--- a/hgkw/keyword.py	Tue Jan 16 01:04:46 2007 +0100
+++ b/hgkw/keyword.py	Tue Jan 16 03:14:40 2007 +0100
@@ -17,6 +17,9 @@
 You can either use the default cvs-like keywords or provide your
 own in hgrc.
 
+Expansions spanning more than one line are truncated to their first line.
+Incremental expansion (like CVS' $Log$) is not supported.
+
 Default $keywords$ and their $keyword: substition $ are:
     Revision: changeset id
     Author:   username
@@ -40,7 +43,7 @@
     # in case you prefer your own keyword maps over the cvs-like defaults:
     [keywordmaps]
     HGdate = {date|rfc822date}
-    lastlog = {desc|firstline}
+    lastlog = {desc} ## same as {desc|firstline} in this context
     checked in by = {author}
     ...
 '''
@@ -106,7 +109,8 @@
         self.t.use_template(template)
         self.ui.pushbuffer()
         self.t.show(changenode=node, root=self.repo.root, file=path)
-        return '$%s: %s $' % (kw, self.ui.popbuffer())
+        expansion = templater.firstline(self.ui.popbuffer())
+        return '$%s: %s $' % (kw, expansion)
 
 
 def reposetup(ui, repo):