hgkw/keyword.py
changeset 201 e826c3cdc52d
parent 192 0d2a6c9f8343
child 203 20eaa6147391
--- a/hgkw/keyword.py	Wed Jul 18 22:50:47 2007 +0200
+++ b/hgkw/keyword.py	Thu Jul 19 03:43:20 2007 +0200
@@ -69,6 +69,10 @@
 and do not want to store expanded keywords in change history, run
 "hg kwshrink", and then change configuration.
 
+Expansions spanning more than one line and incremental exapansions
+(like CVS' $Log$) are not supported. A keyword template map
+"Log = {desc}" expands to the first line of the changeset description.
+
 Caveat: "hg import" fails if the patch context contains an active
         keyword. In that case run "hg kwshrink", reimport, and then
         "hg kwexpand".
@@ -101,6 +105,8 @@
 nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy', 'export',
                 'incoming', 'outgoing', 'push', 'remove', 'rename', 'rollback')
 
+keyword_raw = r'\$(%s)[^$\n\r]*?\$'
+
 def utcdate(date):
     '''Returns hgdate in cvs-like UTC format.'''
     return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0]))
@@ -148,7 +154,7 @@
                                                      quoted=False)
         self.templates = templates or deftemplates
         escaped = [re.escape(k) for k in self.templates.keys()]
-        self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % '|'.join(escaped))
+        self.re_kw = re.compile(keyword_raw % '|'.join(escaped))
         if expand:
             templater.common_filters['utcdate'] = utcdate
             try: