comparison mercurial/upgrade_utils/engine.py @ 50499:e4186ddab473

store: use the new boolean property in `upgrade`
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 15 May 2023 22:11:27 +0200
parents e50d1fe7ebb4
children aede57466804
comparison
equal deleted inserted replaced
50498:4242acf5c399 50499:e4186ddab473
50 def _revlog_from_store_entry(repo, entry): 50 def _revlog_from_store_entry(repo, entry):
51 """Obtain a revlog from a repo store entry. 51 """Obtain a revlog from a repo store entry.
52 52
53 An instance of the appropriate class is returned. 53 An instance of the appropriate class is returned.
54 """ 54 """
55 if entry.revlog_type == store.FILEFLAGS_CHANGELOG: 55 if entry.is_changelog:
56 return changelog.changelog(repo.svfs) 56 return changelog.changelog(repo.svfs)
57 elif entry.revlog_type == store.FILEFLAGS_MANIFESTLOG: 57 elif entry.is_manifestlog:
58 mandir = entry.target_id.rstrip(b'/') 58 mandir = entry.target_id.rstrip(b'/')
59 return manifest.manifestrevlog( 59 return manifest.manifestrevlog(
60 repo.nodeconstants, repo.svfs, tree=mandir 60 repo.nodeconstants, repo.svfs, tree=mandir
61 ) 61 )
62 else: 62 else:
87 util.copyfile(oldindex, newindex) 87 util.copyfile(oldindex, newindex)
88 copydata = oldrl.opener.exists(oldrl._datafile) 88 copydata = oldrl.opener.exists(oldrl._datafile)
89 if copydata: 89 if copydata:
90 util.copyfile(olddata, newdata) 90 util.copyfile(olddata, newdata)
91 91
92 if entry.revlog_type & store.FILEFLAGS_FILELOG: 92 if entry.is_filelog:
93 unencodedname = entry.main_file_path() 93 unencodedname = entry.main_file_path()
94 destrepo.svfs.fncache.add(unencodedname) 94 destrepo.svfs.fncache.add(unencodedname)
95 if copydata: 95 if copydata:
96 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d') 96 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
97 97
212 212
213 srcsize += datasize 213 srcsize += datasize
214 srcrawsize += rawsize 214 srcrawsize += rawsize
215 215
216 # This is for the separate progress bars. 216 # This is for the separate progress bars.
217 if entry.revlog_type & store.FILEFLAGS_CHANGELOG: 217 if entry.is_changelog:
218 changelogs[entry.target_id] = entry 218 changelogs[entry.target_id] = entry
219 crevcount += len(rl) 219 crevcount += len(rl)
220 csrcsize += datasize 220 csrcsize += datasize
221 crawsize += rawsize 221 crawsize += rawsize
222 elif entry.revlog_type & store.FILEFLAGS_MANIFESTLOG: 222 elif entry.is_manifestlog:
223 manifests[entry.target_id] = entry 223 manifests[entry.target_id] = entry
224 mcount += 1 224 mcount += 1
225 mrevcount += len(rl) 225 mrevcount += len(rl)
226 msrcsize += datasize 226 msrcsize += datasize
227 mrawsize += rawsize 227 mrawsize += rawsize
228 elif entry.revlog_type & store.FILEFLAGS_FILELOG: 228 elif entry.is_filelog:
229 filelogs[entry.target_id] = entry 229 filelogs[entry.target_id] = entry
230 fcount += 1 230 fcount += 1
231 frevcount += len(rl) 231 frevcount += len(rl)
232 fsrcsize += datasize 232 fsrcsize += datasize
233 frawsize += rawsize 233 frawsize += rawsize