# HG changeset patch # User Christian Ebert # Date 1287089597 -7200 # Node ID 12f6e285e4e7f33b358d1ed2555ab3a454025308 # Parent a6865ff86aaf248e7ec3483197276ffa641f0ab1 Only use expensive fctx.cmp when needed Restrict expensive cmp to cases when: - comparing against working directory and - encode filters active or - path is configured for keyword expansion diff -r a6865ff86aaf -r 12f6e285e4e7 hgkw/keyword.py --- a/hgkw/keyword.py Wed Oct 13 09:21:19 2010 +0100 +++ b/hgkw/keyword.py Thu Oct 14 22:53:17 2010 +0200 @@ -594,9 +594,14 @@ 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 (fctx._filerev is None and + (self._repo._encodefilterpats or + kwt.match(fctx.path()) and not 'l' in fctx.flags()) or + self.size() == fctx.size()): + return self._filelog.cmp(self._filenode, fctx.data()) + return True + 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)