censor: drop size limitation on the tombstone
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 21 May 2021 20:08:11 +0200
changeset 47392 8089d0fa8400
parent 47391 33d626910374
child 47393 7a0ec25d5836
censor: drop size limitation on the tombstone This limitation seems to date back from a previous implementation of censors, were the revision were censored" in place. For a long while the implementation actually involved rewriting the revlog before replacing the original data. So it looks like we can safely remove this limitation. The tests suite agrees. Differential Revision: https://phab.mercurial-scm.org/D10790
mercurial/revlogutils/censor.py
tests/test-censor.t
--- a/mercurial/revlogutils/censor.py	Sat May 29 00:11:56 2021 +0200
+++ b/mercurial/revlogutils/censor.py	Fri May 21 20:08:11 2021 +0200
@@ -29,11 +29,6 @@
     censorrev = rl.rev(censornode)
     tombstone = storageutil.packmeta({b'censored': tombstone}, b'')
 
-    if len(tombstone) > rl.rawsize(censorrev):
-        raise error.Abort(
-            _(b'censor tombstone must be no longer than censored data')
-        )
-
     # Rewriting the revlog in place is hard. Our strategy for censoring is
     # to create a new revlog, copy all revisions to it, then replace the
     # revlogs on transaction close.
--- a/tests/test-censor.t	Sat May 29 00:11:56 2021 +0200
+++ b/tests/test-censor.t	Fri May 21 20:08:11 2021 +0200
@@ -66,12 +66,6 @@
   $ hg cat -r 0 target | head -n 10
   Initially untainted file
 
-Try to censor revision with too large of a tombstone message
-
-  $ hg censor -r $C1 -t 'blah blah blah blah blah blah blah blah bla' target
-  abort: censor tombstone must be no longer than censored data
-  [255]
-
 Censor revision with 2 offenses
 
 (this also tests file pattern matching: path relative to cwd case)