censor: fix [hg update] away from a revision with censored files
Differential Revision: https://phab.mercurial-scm.org/D12604
--- a/mercurial/filelog.py Fri Apr 22 14:39:00 2022 +0100
+++ b/mercurial/filelog.py Wed May 04 17:40:23 2022 +0100
@@ -202,10 +202,10 @@
# for revisions with renames, we have to go the slow way
node = self.node(rev)
+ if self.iscensored(rev):
+ return 0
if self.renamed(node):
return len(self.read(node))
- if self.iscensored(rev):
- return 0
# XXX if self.read(node).startswith("\1\n"), this returns (size+4)
return self._revlog.size(rev)
--- a/tests/test-censor2.t Fri Apr 22 14:39:00 2022 +0100
+++ b/tests/test-censor2.t Wed May 04 17:40:23 2022 +0100
@@ -19,5 +19,4 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat target
$ hg update tip
- abort: file censored data/target:b1c12cf98dc8 (known-bad-output !)
- [255]
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved