comparison mercurial/context.py @ 41001:21ffe6b97a25

context: error out if basefilectx.cmp() is called without self._filenode The base implementation can't handle such cases because the filelog has no knowledge about the working directory. Loading self._filenode should have no extra cost since self.size() would load it anyway.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 16 Dec 2018 16:31:31 +0900
parents 39953bcf1f51
children f18f665b1424
comparison
equal deleted inserted replaced
41000:39953bcf1f51 41001:21ffe6b97a25
700 returns True if different than fctx. 700 returns True if different than fctx.
701 """ 701 """
702 if fctx._customcmp: 702 if fctx._customcmp:
703 return fctx.cmp(self) 703 return fctx.cmp(self)
704 704
705 if self._filenode is None:
706 raise error.ProgrammingError(
707 'filectx.cmp() must be reimplemented if not backed by revlog')
708
705 if fctx._filenode is None: 709 if fctx._filenode is None:
706 if self._repo._encodefilterpats: 710 if self._repo._encodefilterpats:
707 # can't rely on size() because wdir content may be decoded 711 # can't rely on size() because wdir content may be decoded
708 return self._filelog.cmp(self._filenode, fctx.data()) 712 return self._filelog.cmp(self._filenode, fctx.data())
709 if self.size() - 4 == fctx.size(): 713 if self.size() - 4 == fctx.size():