Mercurial > hg-stable
changeset 12732:4bca87c29445
keyword: 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
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Thu, 14 Oct 2010 22:53:17 +0200 |
parents | 95514b58709d |
children | 098dfb2b7596 |
files | hgext/keyword.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py Thu Oct 14 22:47:50 2010 +0200 +++ b/hgext/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)