disable expansion in kwfilelog.read() if file renamed in node
authorChristian Ebert <blacktrash@gmx.net>
Sat, 09 Oct 2010 11:34:39 +0100
changeset 816 00570f650792
parent 815 1c9959ca570a
child 817 cd834b4035ec
disable expansion in kwfilelog.read() if file renamed in node Simplifies kwfilelog.cmp() and avoids fiddling with/importing revlog. Reorder imports alphabetically.
hgkw/keyword.py
--- a/hgkw/keyword.py	Sat Oct 09 11:33:38 2010 +0100
+++ b/hgkw/keyword.py	Sat Oct 09 11:34:39 2010 +0100
@@ -82,8 +82,8 @@
 {desc}" expands to the first line of the changeset description.
 '''
 
-from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
-from mercurial import patch, localrepo, templater, templatefilters, util, match
+from mercurial import commands, cmdutil, dispatch, filelog, extensions
+from mercurial import localrepo, match, patch, templatefilters, templater, util
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
 import re, shutil, tempfile
@@ -263,6 +263,8 @@
     def read(self, node):
         '''Expands keywords when reading filelog.'''
         data = super(kwfilelog, self).read(node)
+        if self.renamed(node):
+            return data
         return self.kwt.expand(self.path, node, data)
 
     def add(self, text, meta, tr, link, p1=None, p2=None):
@@ -273,10 +275,7 @@
     def cmp(self, node, text):
         '''Removes keyword substitutions for comparison.'''
         text = self.kwt.shrink(self.path, text)
-        if self.renamed(node):
-            t2 = super(kwfilelog, self).read(node)
-            return t2 != text
-        return revlog.revlog.cmp(self, node, text)
+        return super(kwfilelog, self).cmp(node, text)
 
 def _status(ui, repo, kwt, *pats, **opts):
     '''Bails out if [keyword] configuration is not active.