Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/rewrite.py @ 51156:3e2a878fb96f stable
censor: fix things around inlining
The temporary revlog cannot go through the inline ? split process as this would
break at transaction commit. (that might be fixable, but lets keep things
simple for now). We introduce a cleaner way to enforce this as the previous one
was broken in 6.6
On the way we remove multiple weird, fragile and broken overwrite of revlog
attributes and we focus on passing the configuration across.
We also had to update the test to actually create a non-inline revlog.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 02 Dec 2023 02:13:23 +0100 |
parents | 9c8df10ea6e0 |
children | ceeb8fa23cc8 |
comparison
equal
deleted
inserted
replaced
51155:e9eac01c57f3 | 51156:3e2a878fb96f |
---|---|
70 rl.opener, | 70 rl.opener, |
71 target=rl.target, | 71 target=rl.target, |
72 radix=rl.radix, | 72 radix=rl.radix, |
73 postfix=b'tmpcensored', | 73 postfix=b'tmpcensored', |
74 censorable=True, | 74 censorable=True, |
75 data_config=rl.data_config, | |
76 delta_config=rl.delta_config, | |
77 feature_config=rl.feature_config, | |
78 may_inline=rl._inline, | |
75 ) | 79 ) |
76 newrl._format_version = rl._format_version | 80 # inline splitting will prepare some transaction work that will get |
77 newrl._format_flags = rl._format_flags | 81 # confused by the final file move. So if there is a risk of not being |
78 newrl.delta_config.general_delta = rl.delta_config.general_delta | 82 # inline at the end, we prevent the new revlog to be inline in the first |
79 newrl._parse_index = rl._parse_index | 83 # place. |
84 assert not (newrl._inline and not rl._inline) | |
80 | 85 |
81 for rev in rl.revs(): | 86 for rev in rl.revs(): |
82 node = rl.node(rev) | 87 node = rl.node(rev) |
83 p1, p2 = rl.parents(node) | 88 p1, p2 = rl.parents(node) |
84 | 89 |
120 tr.addbackup(rl._indexfile, location=b'store') | 125 tr.addbackup(rl._indexfile, location=b'store') |
121 if not rl._inline: | 126 if not rl._inline: |
122 tr.addbackup(rl._datafile, location=b'store') | 127 tr.addbackup(rl._datafile, location=b'store') |
123 | 128 |
124 rl.opener.rename(newrl._indexfile, rl._indexfile) | 129 rl.opener.rename(newrl._indexfile, rl._indexfile) |
125 if not rl._inline: | 130 if newrl._inline: |
131 assert rl._inline | |
132 else: | |
133 assert not rl._inline | |
126 rl.opener.rename(newrl._datafile, rl._datafile) | 134 rl.opener.rename(newrl._datafile, rl._datafile) |
127 | 135 |
128 rl.clearcaches() | 136 rl.clearcaches() |
129 chunk_cache = rl._loadindex() | 137 chunk_cache = rl._loadindex() |
130 rl._load_inner(chunk_cache) | 138 rl._load_inner(chunk_cache) |