##// END OF EJS Templates
filectx: use ctx.size comparisons to speed up ctx.cmp...
Nicolas Dumazet -
r12709:4147a292 default
parent child Browse files
Show More
@@ -82,7 +82,7 b" like CVS' $Log$, are not supported. A ke"
82 {desc}" expands to the first line of the changeset description.
82 {desc}" expands to the first line of the changeset description.
83 '''
83 '''
84
84
85 from mercurial import commands, cmdutil, dispatch, filelog, extensions
85 from mercurial import commands, context, cmdutil, dispatch, filelog, extensions
86 from mercurial import localrepo, match, patch, templatefilters, templater, util
86 from mercurial import localrepo, match, patch, templatefilters, templater, util
87 from mercurial.hgweb import webcommands
87 from mercurial.hgweb import webcommands
88 from mercurial.i18n import _
88 from mercurial.i18n import _
@@ -586,6 +586,12 b' def reposetup(ui, repo):'
586
586
587 repo.__class__ = kwrepo
587 repo.__class__ = kwrepo
588
588
589 def kwfilectx_cmp(orig, self, fctx):
590 # keyword affects data size, comparing wdir and filelog size does
591 # not make sense
592 return self._filelog.cmp(self._filenode, fctx.data())
593 extensions.wrapfunction(context.filectx, 'cmp', kwfilectx_cmp)
594
589 extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
595 extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
590 extensions.wrapfunction(patch, 'diff', kw_diff)
596 extensions.wrapfunction(patch, 'diff', kw_diff)
591 extensions.wrapfunction(cmdutil, 'copy', kw_copy)
597 extensions.wrapfunction(cmdutil, 'copy', kw_copy)
@@ -357,6 +357,9 b' class filectx(object):'
357
357
358 returns True if different than fctx.
358 returns True if different than fctx.
359 """
359 """
360 if not self._repo._encodefilterpats and self.size() != fctx.size():
361 return True
362
360 return self._filelog.cmp(self._filenode, fctx.data())
363 return self._filelog.cmp(self._filenode, fctx.data())
361
364
362 def renamed(self):
365 def renamed(self):
General Comments 0
You need to be logged in to leave comments. Login now