##// END OF EJS Templates
upgrade: use StoreEntry object in upgrade...
marmoute -
r51383:0935b9db default
parent child Browse files
Show More
@@ -47,11 +47,13 b' def get_sidedata_helpers(srcrepo, dstrep'
47 return sidedatamod.get_sidedata_helpers(srcrepo, dstrepo._wanted_sidedata)
47 return sidedatamod.get_sidedata_helpers(srcrepo, dstrepo._wanted_sidedata)
48
48
49
49
50 def _revlogfrompath(repo, rl_type, path):
50 def _revlog_from_store_entry(repo, entry):
51 """Obtain a revlog from a repo path.
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 rl_type = entry.revlog_type
56 path = entry.unencoded_path
55 if rl_type & store.FILEFLAGS_CHANGELOG:
57 if rl_type & store.FILEFLAGS_CHANGELOG:
56 return changelog.changelog(repo.svfs)
58 return changelog.changelog(repo.svfs)
57 elif rl_type & store.FILEFLAGS_MANIFESTLOG:
59 elif rl_type & store.FILEFLAGS_MANIFESTLOG:
@@ -72,7 +74,7 b' def _revlogfrompath(repo, rl_type, path)'
72 return filelog.filelog(repo.svfs, path)
74 return filelog.filelog(repo.svfs, path)
73
75
74
76
75 def _copyrevlog(tr, destrepo, oldrl, rl_type, unencodedname):
77 def _copyrevlog(tr, destrepo, oldrl, entry):
76 """copy all relevant files for `oldrl` into `destrepo` store
78 """copy all relevant files for `oldrl` into `destrepo` store
77
79
78 Files are copied "as is" without any transformation. The copy is performed
80 Files are copied "as is" without any transformation. The copy is performed
@@ -80,7 +82,7 b' def _copyrevlog(tr, destrepo, oldrl, rl_'
80 content is compatible with format of the destination repository.
82 content is compatible with format of the destination repository.
81 """
83 """
82 oldrl = getattr(oldrl, '_revlog', oldrl)
84 oldrl = getattr(oldrl, '_revlog', oldrl)
83 newrl = _revlogfrompath(destrepo, rl_type, unencodedname)
85 newrl = _revlog_from_store_entry(destrepo, entry)
84 newrl = getattr(newrl, '_revlog', newrl)
86 newrl = getattr(newrl, '_revlog', newrl)
85
87
86 oldvfs = oldrl.opener
88 oldvfs = oldrl.opener
@@ -98,7 +100,8 b' def _copyrevlog(tr, destrepo, oldrl, rl_'
98 if copydata:
100 if copydata:
99 util.copyfile(olddata, newdata)
101 util.copyfile(olddata, newdata)
100
102
101 if rl_type & store.FILEFLAGS_FILELOG:
103 if entry.revlog_type & store.FILEFLAGS_FILELOG:
104 unencodedname = entry.unencoded_path
102 destrepo.svfs.fncache.add(unencodedname)
105 destrepo.svfs.fncache.add(unencodedname)
103 if copydata:
106 if copydata:
104 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
107 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
@@ -133,19 +136,20 b' def _perform_clone('
133 dstrepo,
136 dstrepo,
134 tr,
137 tr,
135 old_revlog,
138 old_revlog,
136 rl_type,
139 entry,
137 unencoded,
138 upgrade_op,
140 upgrade_op,
139 sidedata_helpers,
141 sidedata_helpers,
140 oncopiedrevision,
142 oncopiedrevision,
141 ):
143 ):
142 """returns the new revlog object created"""
144 """returns the new revlog object created"""
143 newrl = None
145 newrl = None
144 if matchrevlog(upgrade_op.revlogs_to_process, rl_type):
146 revlog_path = entry.unencoded_path
147 if matchrevlog(upgrade_op.revlogs_to_process, entry.revlog_type):
145 ui.note(
148 ui.note(
146 _(b'cloning %d revisions from %s\n') % (len(old_revlog), unencoded)
149 _(b'cloning %d revisions from %s\n')
150 % (len(old_revlog), revlog_path)
147 )
151 )
148 newrl = _revlogfrompath(dstrepo, rl_type, unencoded)
152 newrl = _revlog_from_store_entry(dstrepo, entry)
149 old_revlog.clone(
153 old_revlog.clone(
150 tr,
154 tr,
151 newrl,
155 newrl,
@@ -156,10 +160,10 b' def _perform_clone('
156 )
160 )
157 else:
161 else:
158 msg = _(b'blindly copying %s containing %i revisions\n')
162 msg = _(b'blindly copying %s containing %i revisions\n')
159 ui.note(msg % (unencoded, len(old_revlog)))
163 ui.note(msg % (revlog_path, len(old_revlog)))
160 _copyrevlog(tr, dstrepo, old_revlog, rl_type, unencoded)
164 _copyrevlog(tr, dstrepo, old_revlog, entry)
161
165
162 newrl = _revlogfrompath(dstrepo, rl_type, unencoded)
166 newrl = _revlog_from_store_entry(dstrepo, entry)
163 return newrl
167 return newrl
164
168
165
169
@@ -203,9 +207,8 b' def _clonerevlogs('
203 for entry in alldatafiles:
207 for entry in alldatafiles:
204 if not (entry.is_revlog and entry.is_revlog_main):
208 if not (entry.is_revlog and entry.is_revlog_main):
205 continue
209 continue
206 unencoded = entry.unencoded_path
207
210
208 rl = _revlogfrompath(srcrepo, entry.revlog_type, unencoded)
211 rl = _revlog_from_store_entry(srcrepo, entry)
209
212
210 info = rl.storageinfo(
213 info = rl.storageinfo(
211 exclusivefiles=True,
214 exclusivefiles=True,
@@ -223,18 +226,18 b' def _clonerevlogs('
223
226
224 # This is for the separate progress bars.
227 # This is for the separate progress bars.
225 if entry.revlog_type & store.FILEFLAGS_CHANGELOG:
228 if entry.revlog_type & store.FILEFLAGS_CHANGELOG:
226 changelogs[unencoded] = entry.revlog_type
229 changelogs[entry.target_id] = entry
227 crevcount += len(rl)
230 crevcount += len(rl)
228 csrcsize += datasize
231 csrcsize += datasize
229 crawsize += rawsize
232 crawsize += rawsize
230 elif entry.revlog_type & store.FILEFLAGS_MANIFESTLOG:
233 elif entry.revlog_type & store.FILEFLAGS_MANIFESTLOG:
231 manifests[unencoded] = entry.revlog_type
234 manifests[entry.target_id] = entry
232 mcount += 1
235 mcount += 1
233 mrevcount += len(rl)
236 mrevcount += len(rl)
234 msrcsize += datasize
237 msrcsize += datasize
235 mrawsize += rawsize
238 mrawsize += rawsize
236 elif entry.revlog_type & store.FILEFLAGS_FILELOG:
239 elif entry.revlog_type & store.FILEFLAGS_FILELOG:
237 filelogs[unencoded] = entry.revlog_type
240 filelogs[entry.target_id] = entry
238 fcount += 1
241 fcount += 1
239 frevcount += len(rl)
242 frevcount += len(rl)
240 fsrcsize += datasize
243 fsrcsize += datasize
@@ -279,16 +282,15 b' def _clonerevlogs('
279 )
282 )
280 )
283 )
281 progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount)
284 progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount)
282 for unencoded, rl_type in sorted(filelogs.items()):
285 for target_id, entry in sorted(filelogs.items()):
283 oldrl = _revlogfrompath(srcrepo, rl_type, unencoded)
286 oldrl = _revlog_from_store_entry(srcrepo, entry)
284
287
285 newrl = _perform_clone(
288 newrl = _perform_clone(
286 ui,
289 ui,
287 dstrepo,
290 dstrepo,
288 tr,
291 tr,
289 oldrl,
292 oldrl,
290 rl_type,
293 entry,
291 unencoded,
292 upgrade_op,
294 upgrade_op,
293 sidedata_helpers,
295 sidedata_helpers,
294 oncopiedrevision,
296 oncopiedrevision,
@@ -321,15 +323,14 b' def _clonerevlogs('
321 progress = srcrepo.ui.makeprogress(
323 progress = srcrepo.ui.makeprogress(
322 _(b'manifest revisions'), total=mrevcount
324 _(b'manifest revisions'), total=mrevcount
323 )
325 )
324 for unencoded, rl_type in sorted(manifests.items()):
326 for target_id, entry in sorted(manifests.items()):
325 oldrl = _revlogfrompath(srcrepo, rl_type, unencoded)
327 oldrl = _revlog_from_store_entry(srcrepo, entry)
326 newrl = _perform_clone(
328 newrl = _perform_clone(
327 ui,
329 ui,
328 dstrepo,
330 dstrepo,
329 tr,
331 tr,
330 oldrl,
332 oldrl,
331 rl_type,
333 entry,
332 unencoded,
333 upgrade_op,
334 upgrade_op,
334 sidedata_helpers,
335 sidedata_helpers,
335 oncopiedrevision,
336 oncopiedrevision,
@@ -361,15 +362,14 b' def _clonerevlogs('
361 progress = srcrepo.ui.makeprogress(
362 progress = srcrepo.ui.makeprogress(
362 _(b'changelog revisions'), total=crevcount
363 _(b'changelog revisions'), total=crevcount
363 )
364 )
364 for unencoded, rl_type in sorted(changelogs.items()):
365 for target_id, entry in sorted(changelogs.items()):
365 oldrl = _revlogfrompath(srcrepo, rl_type, unencoded)
366 oldrl = _revlog_from_store_entry(srcrepo, entry)
366 newrl = _perform_clone(
367 newrl = _perform_clone(
367 ui,
368 ui,
368 dstrepo,
369 dstrepo,
369 tr,
370 tr,
370 oldrl,
371 oldrl,
371 rl_type,
372 entry,
372 unencoded,
373 upgrade_op,
373 upgrade_op,
374 sidedata_helpers,
374 sidedata_helpers,
375 oncopiedrevision,
375 oncopiedrevision,
General Comments 0
You need to be logged in to leave comments. Login now