changeset 47476:aab064416f0c

censor: rename `rl` to `revlog` in the main function Now that the bulk of the code moved to smaller function we are less restricted on line length and we can use more explicite naming. Differential Revision: https://phab.mercurial-scm.org/D10902
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 22 Jun 2021 22:35:37 +0200
parents d6afe1478a2a
children c81a5297f185
files mercurial/revlogutils/rewrite.py
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/rewrite.py	Tue Jun 22 22:28:51 2021 +0200
+++ b/mercurial/revlogutils/rewrite.py	Tue Jun 22 22:35:37 2021 +0200
@@ -125,7 +125,7 @@
     rl._loadindex()
 
 
-def v2_censor(rl, tr, censornode, tombstone=b''):
+def v2_censor(revlog, tr, censornode, tombstone=b''):
     """censors a revision in a "version 2" revlog"""
     # General principle
     #
@@ -140,31 +140,31 @@
     # All data before the censored data can be blindly copied. The rest needs
     # to be copied as we go and the associated index entry needs adjustement.
 
-    assert rl._format_version != REVLOGV0, rl._format_version
-    assert rl._format_version != REVLOGV1, rl._format_version
+    assert revlog._format_version != REVLOGV0, revlog._format_version
+    assert revlog._format_version != REVLOGV1, revlog._format_version
 
-    old_index = rl.index
-    docket = rl._docket
+    old_index = revlog.index
+    docket = revlog._docket
 
-    censor_rev = rl.rev(censornode)
+    censor_rev = revlog.rev(censornode)
     tombstone = storageutil.packmeta({b'censored': tombstone}, b'')
 
-    censored_entry = rl.index[censor_rev]
-    index_cutoff = rl.index.entry_size * censor_rev
+    censored_entry = revlog.index[censor_rev]
+    index_cutoff = revlog.index.entry_size * censor_rev
     data_cutoff = censored_entry[ENTRY_DATA_OFFSET] >> 16
-    sidedata_cutoff = rl.sidedata_cut_off(censor_rev)
+    sidedata_cutoff = revlog.sidedata_cut_off(censor_rev)
 
     with pycompat.unnamedtempfile(mode=b"w+b") as tmp_storage:
         # rev → (new_base, data_start, data_end, compression_mode)
         rewritten_entries = _precompute_rewritten_delta(
-            rl,
+            revlog,
             old_index,
             {censor_rev},
             tmp_storage,
         )
 
         all_files = _setup_new_files(
-            rl,
+            revlog,
             index_cutoff,
             data_cutoff,
             sidedata_cutoff,
@@ -183,7 +183,7 @@
 
             # writing the censored revision
             _rewrite_censor(
-                rl,
+                revlog,
                 old_index,
                 open_files,
                 censor_rev,
@@ -193,7 +193,7 @@
             # Writing all subsequent revisions
             for rev in range(censor_rev + 1, len(old_index)):
                 _rewrite_simple(
-                    rl,
+                    revlog,
                     old_index,
                     open_files,
                     rev,