hgkw/keyword.py
branchsolo-extension
changeset 49 5acfe7dc3086
parent 48 59fedb6b41da
child 50 fe891f87a16c
--- a/hgkw/keyword.py	Thu Dec 21 19:52:25 2006 +0100
+++ b/hgkw/keyword.py	Thu Dec 28 15:06:19 2006 +0100
@@ -39,7 +39,7 @@
 '''
 
 from mercurial.i18n import _
-from mercurial import commands, cmdutil, context, filelog, revlog, util
+from mercurial import cmdutil, commands, context, filelog, revlog, util
 import os.path, re, sys
 
 # supported keywords for use in regexes
@@ -105,12 +105,18 @@
                         return re_kw.sub(kwexpander, data)
             return data
 
-        def add(self, text, meta, tr, link, p1=None, p2=None):
-            if (not util.binary(text) and
-                   self._repo.ui.config('keyword', 'remove', True)):
-                re_kw = re.compile(r'\$(%s): [^$]+? \$' % hgkeywords)
-                text = re_kw.sub(r'$\1$', text)
-            return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
+        def size(self, rev):
+            '''Overrides filelog's size() to use kwfilelog.read().'''
+            node = self.node(rev)
+            if self.renamed(node):
+                return len(self.read(node))
+            return revlog.size(self, rev)
+
+        def cmp(self, node, text):
+            '''Overrides filelog's cmp() to use kwfilelog.read().'''
+            if self.renamed(node):
+                t2 = self.read(node)
+                return t2 != text
 
     filelog.filelog = kwfilelog
     repo.__class__ = kwrepo