Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/upgrade_utils/engine.py @ 50525:5f636e0fec4a
upgrade: actually use StoreEntry API to create revlog
Lets make use of the semanctic of the object we are passed.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 May 2023 09:01:53 +0200 |
parents | 0935b9db21b6 |
children | 3473d18c029a |
comparison
equal
deleted
inserted
replaced
50524:0935b9db21b6 | 50525:5f636e0fec4a |
---|---|
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 rl_type = entry.revlog_type | 55 if entry.revlog_type == store.FILEFLAGS_CHANGELOG: |
56 path = entry.unencoded_path | |
57 if rl_type & store.FILEFLAGS_CHANGELOG: | |
58 return changelog.changelog(repo.svfs) | 56 return changelog.changelog(repo.svfs) |
59 elif rl_type & store.FILEFLAGS_MANIFESTLOG: | 57 elif entry.revlog_type == store.FILEFLAGS_MANIFESTLOG: |
60 mandir = b'' | 58 mandir = entry.target_id.rstrip(b'/') |
61 if b'/' in path: | |
62 mandir = path.rsplit(b'/', 1)[0] | |
63 return manifest.manifestrevlog( | 59 return manifest.manifestrevlog( |
64 repo.nodeconstants, repo.svfs, tree=mandir | 60 repo.nodeconstants, repo.svfs, tree=mandir |
65 ) | 61 ) |
66 else: | 62 else: |
67 # drop the extension and the `data/` prefix | 63 return filelog.filelog(repo.svfs, entry.target_id) |
68 path_part = path.rsplit(b'.', 1)[0].split(b'/', 1) | |
69 if len(path_part) < 2: | |
70 msg = _(b'cannot recognize revlog from filename: %s') | |
71 msg %= path | |
72 raise error.Abort(msg) | |
73 path = path_part[1] | |
74 return filelog.filelog(repo.svfs, path) | |
75 | 64 |
76 | 65 |
77 def _copyrevlog(tr, destrepo, oldrl, entry): | 66 def _copyrevlog(tr, destrepo, oldrl, entry): |
78 """copy all relevant files for `oldrl` into `destrepo` store | 67 """copy all relevant files for `oldrl` into `destrepo` store |
79 | 68 |