changeset 49166:77b5a190571c stable

censor: fix [hg update] away from a revision with censored files Differential Revision: https://phab.mercurial-scm.org/D12604
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Wed, 04 May 2022 17:40:23 +0100
parents 72936be2a21b
children dc342071297f
files mercurial/filelog.py tests/test-censor2.t
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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