comparison mercurial/repair.py @ 50487:92611344aec2

store: use StoreEntry API instead of parsing filename when listing manifestlog This is more explicit and more robust.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 15 May 2023 09:00:46 +0200
parents 521fec115dad
children e50d1fe7ebb4
comparison
equal deleted inserted replaced
50486:85c5b4b507af 50487:92611344aec2
22 obsutil, 22 obsutil,
23 pathutil, 23 pathutil,
24 phases, 24 phases,
25 requirements, 25 requirements,
26 scmutil, 26 scmutil,
27 store,
27 transaction, 28 transaction,
28 util, 29 util,
29 ) 30 )
30 from .utils import ( 31 from .utils import (
31 hashutil, 32 hashutil,
443 yield repo.manifestlog.getstorage(b'') 444 yield repo.manifestlog.getstorage(b'')
444 if scmutil.istreemanifest(repo): 445 if scmutil.istreemanifest(repo):
445 # This logic is safe if treemanifest isn't enabled, but also 446 # This logic is safe if treemanifest isn't enabled, but also
446 # pointless, so we skip it if treemanifest isn't enabled. 447 # pointless, so we skip it if treemanifest isn't enabled.
447 for entry in repo.store.datafiles(): 448 for entry in repo.store.datafiles():
448 unencoded = entry.unencoded_path 449 if not entry.is_revlog:
449 # XXX use the entry.revlog_type instead 450 continue
450 if unencoded.startswith(b'meta/') and unencoded.endswith( 451 if not entry.revlog_type == store.FILEFLAGS_MANIFESTLOG:
451 b'00manifest.i' 452 continue
452 ): 453 if entry.is_revlog_main:
453 dir = unencoded[5:-12] 454 yield repo.manifestlog.getstorage(entry.target_id)
454 yield repo.manifestlog.getstorage(dir)
455 455
456 456
457 def rebuildfncache(ui, repo, only_data=False): 457 def rebuildfncache(ui, repo, only_data=False):
458 """Rebuilds the fncache file from repo history. 458 """Rebuilds the fncache file from repo history.
459 459