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