Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/upgrade_utils/engine.py @ 50505:521fec115dad
store: use a StoreEntry object instead of tuple for store files
We want to make the store return more semantic information instead of a stream
of file path. To achieve this, we start with adding a simple object that hold
the same information as the tuple it replace, and do a simple update to the
user code to fetch and use the same information.
From there, we will be able to iteratively upgrade the codebase toward better
objects.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 May 2023 08:56:23 +0200 |
parents | b4b1791f36e4 |
children | 2eb7f0b5a499 |
comparison
equal
deleted
inserted
replaced
50504:814f55775b21 | 50505:521fec115dad |
---|---|
198 changelogs = {} | 198 changelogs = {} |
199 filelogs = {} | 199 filelogs = {} |
200 | 200 |
201 # Perform a pass to collect metadata. This validates we can open all | 201 # Perform a pass to collect metadata. This validates we can open all |
202 # source files and allows a unified progress bar to be displayed. | 202 # source files and allows a unified progress bar to be displayed. |
203 for rl_type, unencoded, size in alldatafiles: | 203 for entry in alldatafiles: |
204 if not rl_type & store.FILEFLAGS_REVLOG_MAIN: | 204 if not (entry.is_revlog and entry.is_revlog_main): |
205 continue | 205 continue |
206 unencoded = entry.unencoded_path | |
206 | 207 |
207 # the store.walk function will wrongly pickup transaction backup and | 208 # the store.walk function will wrongly pickup transaction backup and |
208 # get confused. As a quick fix for 5.9 release, we ignore those. | 209 # get confused. As a quick fix for 5.9 release, we ignore those. |
209 # (this is not a module constants because it seems better to keep the | 210 # (this is not a module constants because it seems better to keep the |
210 # hack together) | 211 # hack together) |
213 b'undo.backup.00manifest.i', | 214 b'undo.backup.00manifest.i', |
214 ) | 215 ) |
215 if unencoded in skip_undo: | 216 if unencoded in skip_undo: |
216 continue | 217 continue |
217 | 218 |
218 rl = _revlogfrompath(srcrepo, rl_type, unencoded) | 219 rl = _revlogfrompath(srcrepo, entry.revlog_type, unencoded) |
219 | 220 |
220 info = rl.storageinfo( | 221 info = rl.storageinfo( |
221 exclusivefiles=True, | 222 exclusivefiles=True, |
222 revisionscount=True, | 223 revisionscount=True, |
223 trackedsize=True, | 224 trackedsize=True, |
230 | 231 |
231 srcsize += datasize | 232 srcsize += datasize |
232 srcrawsize += rawsize | 233 srcrawsize += rawsize |
233 | 234 |
234 # This is for the separate progress bars. | 235 # This is for the separate progress bars. |
235 if rl_type & store.FILEFLAGS_CHANGELOG: | 236 if entry.revlog_type & store.FILEFLAGS_CHANGELOG: |
236 changelogs[unencoded] = rl_type | 237 changelogs[unencoded] = entry.revlog_type |
237 crevcount += len(rl) | 238 crevcount += len(rl) |
238 csrcsize += datasize | 239 csrcsize += datasize |
239 crawsize += rawsize | 240 crawsize += rawsize |
240 elif rl_type & store.FILEFLAGS_MANIFESTLOG: | 241 elif entry.revlog_type & store.FILEFLAGS_MANIFESTLOG: |
241 manifests[unencoded] = rl_type | 242 manifests[unencoded] = entry.revlog_type |
242 mcount += 1 | 243 mcount += 1 |
243 mrevcount += len(rl) | 244 mrevcount += len(rl) |
244 msrcsize += datasize | 245 msrcsize += datasize |
245 mrawsize += rawsize | 246 mrawsize += rawsize |
246 elif rl_type & store.FILEFLAGS_FILELOG: | 247 elif entry.revlog_type & store.FILEFLAGS_FILELOG: |
247 filelogs[unencoded] = rl_type | 248 filelogs[unencoded] = entry.revlog_type |
248 fcount += 1 | 249 fcount += 1 |
249 frevcount += len(rl) | 250 frevcount += len(rl) |
250 fsrcsize += datasize | 251 fsrcsize += datasize |
251 frawsize += rawsize | 252 frawsize += rawsize |
252 else: | 253 else: |