Show More
@@ -19,6 +19,7 b' from .node import hex' | |||
|
19 | 19 | from . import ( |
|
20 | 20 | changelog, |
|
21 | 21 | error, |
|
22 | filelog, | |
|
22 | 23 | manifest, |
|
23 | 24 | policy, |
|
24 | 25 | pycompat, |
@@ -545,6 +546,21 b' class RevlogStoreEntry(BaseStoreEntry):' | |||
|
545 | 546 | files.append(StoreFile(unencoded_path=path, **data)) |
|
546 | 547 | return files |
|
547 | 548 | |
|
549 | def get_revlog_instance(self, repo): | |
|
550 | """Obtain a revlog instance from this store entry | |
|
551 | ||
|
552 | An instance of the appropriate class is returned. | |
|
553 | """ | |
|
554 | if self.is_changelog: | |
|
555 | return changelog.changelog(repo.svfs) | |
|
556 | elif self.is_manifestlog: | |
|
557 | mandir = self.target_id.rstrip(b'/') | |
|
558 | return manifest.manifestrevlog( | |
|
559 | repo.nodeconstants, repo.svfs, tree=mandir | |
|
560 | ) | |
|
561 | else: | |
|
562 | return filelog.filelog(repo.svfs, self.target_id) | |
|
563 | ||
|
548 | 564 | |
|
549 | 565 | @attr.s(slots=True) |
|
550 | 566 | class StoreFile: |
@@ -11,10 +11,7 b' import stat' | |||
|
11 | 11 | from ..i18n import _ |
|
12 | 12 | from ..pycompat import getattr |
|
13 | 13 | from .. import ( |
|
14 | changelog, | |
|
15 | 14 | error, |
|
16 | filelog, | |
|
17 | manifest, | |
|
18 | 15 | metadata, |
|
19 | 16 | pycompat, |
|
20 | 17 | requirements, |
@@ -47,22 +44,6 b' def get_sidedata_helpers(srcrepo, dstrep' | |||
|
47 | 44 | return sidedatamod.get_sidedata_helpers(srcrepo, dstrepo._wanted_sidedata) |
|
48 | 45 | |
|
49 | 46 | |
|
50 | def _revlog_from_store_entry(repo, entry): | |
|
51 | """Obtain a revlog from a repo store entry. | |
|
52 | ||
|
53 | An instance of the appropriate class is returned. | |
|
54 | """ | |
|
55 | if entry.is_changelog: | |
|
56 | return changelog.changelog(repo.svfs) | |
|
57 | elif entry.is_manifestlog: | |
|
58 | mandir = entry.target_id.rstrip(b'/') | |
|
59 | return manifest.manifestrevlog( | |
|
60 | repo.nodeconstants, repo.svfs, tree=mandir | |
|
61 | ) | |
|
62 | else: | |
|
63 | return filelog.filelog(repo.svfs, entry.target_id) | |
|
64 | ||
|
65 | ||
|
66 | 47 | def _copyrevlog(tr, destrepo, oldrl, entry): |
|
67 | 48 | """copy all relevant files for `oldrl` into `destrepo` store |
|
68 | 49 | |
@@ -71,7 +52,7 b' def _copyrevlog(tr, destrepo, oldrl, ent' | |||
|
71 | 52 | content is compatible with format of the destination repository. |
|
72 | 53 | """ |
|
73 | 54 | oldrl = getattr(oldrl, '_revlog', oldrl) |
|
74 |
newrl = _revlog_ |
|
|
55 | newrl = entry.get_revlog_instance(destrepo) | |
|
75 | 56 | newrl = getattr(newrl, '_revlog', newrl) |
|
76 | 57 | |
|
77 | 58 | oldvfs = oldrl.opener |
@@ -138,7 +119,7 b' def _perform_clone(' | |||
|
138 | 119 | _(b'cloning %d revisions from %s\n') |
|
139 | 120 | % (len(old_revlog), revlog_path) |
|
140 | 121 | ) |
|
141 |
newrl = _revlog_ |
|
|
122 | newrl = entry.get_revlog_instance(dstrepo) | |
|
142 | 123 | old_revlog.clone( |
|
143 | 124 | tr, |
|
144 | 125 | newrl, |
@@ -152,7 +133,7 b' def _perform_clone(' | |||
|
152 | 133 | ui.note(msg % (revlog_path, len(old_revlog))) |
|
153 | 134 | _copyrevlog(tr, dstrepo, old_revlog, entry) |
|
154 | 135 | |
|
155 |
newrl = _revlog_ |
|
|
136 | newrl = entry.get_revlog_instance(dstrepo) | |
|
156 | 137 | return newrl |
|
157 | 138 | |
|
158 | 139 | |
@@ -197,7 +178,7 b' def _clonerevlogs(' | |||
|
197 | 178 | if not entry.is_revlog: |
|
198 | 179 | continue |
|
199 | 180 | |
|
200 |
rl = _revlog_ |
|
|
181 | rl = entry.get_revlog_instance(srcrepo) | |
|
201 | 182 | |
|
202 | 183 | info = rl.storageinfo( |
|
203 | 184 | exclusivefiles=True, |
@@ -272,7 +253,7 b' def _clonerevlogs(' | |||
|
272 | 253 | ) |
|
273 | 254 | progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount) |
|
274 | 255 | for target_id, entry in sorted(filelogs.items()): |
|
275 |
oldrl = _revlog_ |
|
|
256 | oldrl = entry.get_revlog_instance(srcrepo) | |
|
276 | 257 | |
|
277 | 258 | newrl = _perform_clone( |
|
278 | 259 | ui, |
@@ -313,7 +294,7 b' def _clonerevlogs(' | |||
|
313 | 294 | _(b'manifest revisions'), total=mrevcount |
|
314 | 295 | ) |
|
315 | 296 | for target_id, entry in sorted(manifests.items()): |
|
316 |
oldrl = _revlog_ |
|
|
297 | oldrl = entry.get_revlog_instance(srcrepo) | |
|
317 | 298 | newrl = _perform_clone( |
|
318 | 299 | ui, |
|
319 | 300 | dstrepo, |
@@ -352,7 +333,7 b' def _clonerevlogs(' | |||
|
352 | 333 | _(b'changelog revisions'), total=crevcount |
|
353 | 334 | ) |
|
354 | 335 | for target_id, entry in sorted(changelogs.items()): |
|
355 |
oldrl = _revlog_ |
|
|
336 | oldrl = entry.get_revlog_instance(srcrepo) | |
|
356 | 337 | newrl = _perform_clone( |
|
357 | 338 | ui, |
|
358 | 339 | dstrepo, |
General Comments 0
You need to be logged in to leave comments.
Login now