Make patterns stricter again, to avoid unvolontary expansions extension
authorChristian Ebert <blacktrash@gmx.net>
Wed, 20 Dec 2006 14:54:38 +0100
branchextension
changeset 41 e1c539e1282b
parent 40 38ee735886d2
child 42 ba000e29ecf3
Make patterns stricter again, to avoid unvolontary expansions
hgkw/keyword.py
hgkw/pretxnkw.py
--- a/hgkw/keyword.py	Wed Dec 20 10:37:06 2006 +0100
+++ b/hgkw/keyword.py	Wed Dec 20 14:54:38 2006 +0100
@@ -45,7 +45,8 @@
         def add(self, text, meta, tr, link, p1=None, p2=None):
             if (not util.binary(text) and
                    self._repo.ui.config('keyword', 'remove', True)):
-                text = re.sub(r'\$Hg[^$]*?\$', '$Hg$', text)
+                re_kw = re.compile(r'\$Hg: [^$]+?,v [a-z0-9]{12} [^$]+? \$')
+                text = re_kw.sub('$Hg$', text)
             return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
 
     filelog.filelog = kwfilelog
--- a/hgkw/pretxnkw.py	Wed Dec 20 10:37:06 2006 +0100
+++ b/hgkw/pretxnkw.py	Wed Dec 20 14:54:38 2006 +0100
@@ -43,7 +43,7 @@
     date = util.datestr(date=date, format=util.defaultdateformats[0])
                                                # %Y-%m-%d %H:%M:%S
 
-    re_kw = re.compile(r'\$Hg[^$]*?\$')
+    re_kw = re.compile(r'\$Hg(: [^$]+?,v [a-z0-9]{12} [^$]+? )?\$')
 
     for f in files:
         data = repo.wfile(f).read()