comparison mercurial/context.py @ 11703:55a2af02e45c

context: reuse filecontext.cmp in workingfilecontext.cmp Same code path should mean less mistakes, and hopefully, better caching.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 29 Jul 2010 10:39:59 +0900
parents eb07fbc21e9c
children a8614c5a5e9a
comparison
equal deleted inserted replaced
11702:eb07fbc21e9c 11703:55a2af02e45c
938 def cmp(self, fctx): 938 def cmp(self, fctx):
939 """compare with other file context 939 """compare with other file context
940 940
941 returns True if different than fctx. 941 returns True if different than fctx.
942 """ 942 """
943 return self._repo.wread(self._path) != fctx.data() 943 # fctx should be a filectx (not a wfctx)
944 # invert comparison to reuse the same code path
945 return fctx.cmp(self)
944 946
945 class memctx(object): 947 class memctx(object):
946 """Use memctx to perform in-memory commits via localrepo.commitctx(). 948 """Use memctx to perform in-memory commits via localrepo.commitctx().
947 949
948 Revision information is supplied at initialization time while 950 Revision information is supplied at initialization time while