Mercurial > hg
diff mercurial/filelog.py @ 46530:b994db7c4d1e stable
narrow: fix flaky behavior described in issue6150
This has been plaguing the CI for a good while, and it doesn't appear to have
an easy fix proposed yet. The solution in this change is to always do an
unambiguous (but expensive) lookup in case of comparison. This should always
be correct, albeit suboptimal.
Differential Revision: https://phab.mercurial-scm.org/D10034
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Fri, 19 Feb 2021 17:52:04 +0100 |
parents | a5206e71c536 |
children | 6f4a481f182a |
line wrap: on
line diff
--- a/mercurial/filelog.py Tue Feb 16 15:44:51 2021 +0530 +++ b/mercurial/filelog.py Fri Feb 19 17:52:04 2021 +0100 @@ -279,14 +279,12 @@ return super(narrowfilelog, self).size(rev) def cmp(self, node, text): - different = super(narrowfilelog, self).cmp(node, text) + # We don't call `super` because narrow parents can be buggy in case of a + # ambiguous dirstate. Always take the slow path until there is a better + # fix, see issue6150. - # Because renamed() may lie, we may get false positives for - # different content. Check for this by comparing against the original - # renamed() implementation. - if different: - if super(narrowfilelog, self).renamed(node): - t2 = self.read(node) - return t2 != text + # Censored files compare against the empty file. + if self.iscensored(self.rev(node)): + return text != b'' - return different + return self.read(node) != text