[PATCH] keyword: restrict expensive cmp to keyword configured files

Christian Ebert blacktrash at gmx.net
Wed Oct 13 03:08:29 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1286957037 -3600
# Node ID c78999783143972410dff7f6b5991192c4710526
# Parent  52971985be14f12930a9809d375b97e1ee77d21a
keyword: restrict expensive cmp to keyword configured files

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -592,11 +592,13 @@
     repo.__class__ = kwrepo
 
     def kwfilectx_cmp(orig, self, fctx):
-        # keyword affects data size, comparing wdir and filelog size does
-        # not make sense
-        return self._filelog.cmp(self._filenode, fctx.data())
+        if kwt.match(fctx.path()) and not 'l' in fctx.flags():
+            # keyword affects data size, comparing wdir and filelog size
+            # does not make sense
+            return self._filelog.cmp(self._filenode, fctx.data())
+        return orig(self, fctx)
+
     extensions.wrapfunction(context.filectx, 'cmp', kwfilectx_cmp)
-
     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
     extensions.wrapfunction(patch, 'diff', kw_diff)
     extensions.wrapfunction(cmdutil, 'copy', kw_copy)


More information about the Mercurial-devel mailing list