# HG changeset patch # User Yuya Nishihara # Date 2018-12-16 07:31:31 # Node ID 21ffe6b97a25106ab3b61ff560ac647123503a83 # Parent 39953bcf1f51dedfd4e4950b25917c449b18048b 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. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -702,6 +702,10 @@ class basefilectx(object): if fctx._customcmp: return fctx.cmp(self) + if self._filenode is None: + raise error.ProgrammingError( + 'filectx.cmp() must be reimplemented if not backed by revlog') + if fctx._filenode is None: if self._repo._encodefilterpats: # can't rely on size() because wdir content may be decoded