diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -82,7 +82,7 @@ like CVS' $Log$, are not supported. A ke {desc}" expands to the first line of the changeset description. ''' -from mercurial import commands, cmdutil, dispatch, filelog, extensions +from mercurial import commands, context, cmdutil, dispatch, filelog, extensions from mercurial import localrepo, match, patch, templatefilters, templater, util from mercurial.hgweb import webcommands from mercurial.i18n import _ @@ -586,6 +586,12 @@ def reposetup(ui, repo): 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()) + 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) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -357,6 +357,9 @@ class filectx(object): returns True if different than fctx. """ + if not self._repo._encodefilterpats and self.size() != fctx.size(): + return True + return self._filelog.cmp(self._filenode, fctx.data()) def renamed(self):