comparison mercurial/context.py @ 49012:5b65721a75eb

revlog: recommit 49fd21f32695 with a fix for issue6528 `filelog.size` currently special cases two forms of metadata encoding: - copy data via the parent order as flag bit - censor data by peaking into the raw delta All other forms of metadata encoding including the empty metadata block are mishandled. In `basefilectx.cmp` the empty metadata block is explicitly checked to compensate for this. Restore 49fd21f32695, but disable it for filelog, so that the original flag bit use contines to work. Document all this mess for now in preparation of a proper rework. Differential Revision: https://phab.mercurial-scm.org/D11203
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 20 Jul 2021 15:07:10 +0200
parents 642e31cb55f0
children d44e3c45f0e4
comparison
equal deleted inserted replaced
49011:b999edb15f8c 49012:5b65721a75eb
990 990
991 if fctx._filenode is None: 991 if fctx._filenode is None:
992 if self._repo._encodefilterpats: 992 if self._repo._encodefilterpats:
993 # can't rely on size() because wdir content may be decoded 993 # can't rely on size() because wdir content may be decoded
994 return self._filelog.cmp(self._filenode, fctx.data()) 994 return self._filelog.cmp(self._filenode, fctx.data())
995 # filelog.size() has two special cases:
996 # - censored metadata
997 # - copy/rename tracking
998 # The first is detected by peaking into the delta,
999 # the second is detected by abusing parent order
1000 # in the revlog index as flag bit. This leaves files using
1001 # the dummy encoding and non-standard meta attributes.
1002 # The following check is a special case for the empty
1003 # metadata block used if the raw file content starts with '\1\n'.
1004 # Cases of arbitrary metadata flags are currently mishandled.
995 if self.size() - 4 == fctx.size(): 1005 if self.size() - 4 == fctx.size():
996 # size() can match: 1006 # size() can match:
997 # if file data starts with '\1\n', empty metadata block is 1007 # if file data starts with '\1\n', empty metadata block is
998 # prepended, which adds 4 bytes to filelog.size(). 1008 # prepended, which adds 4 bytes to filelog.size().
999 return self._filelog.cmp(self._filenode, fctx.data()) 1009 return self._filelog.cmp(self._filenode, fctx.data())