Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade_utils/engine.py @ 47660:aa2296893168
upgrade: avoid a traceback in case of unrecognized revlog
Without this, in case of revlog name not matching any know pattern we would get
a traceback. Raising a clear error seems simpler.
Differential Revision: https://phab.mercurial-scm.org/D11202
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 19 Jul 2021 22:19:36 +0200 |
parents | f030c7d22032 |
children | ff97e793ed36 |
comparison
equal
deleted
inserted
replaced
47659:f030c7d22032 | 47660:aa2296893168 |
---|---|
62 return manifest.manifestrevlog( | 62 return manifest.manifestrevlog( |
63 repo.nodeconstants, repo.svfs, tree=mandir | 63 repo.nodeconstants, repo.svfs, tree=mandir |
64 ) | 64 ) |
65 else: | 65 else: |
66 # drop the extension and the `data/` prefix | 66 # drop the extension and the `data/` prefix |
67 path = path.rsplit(b'.', 1)[0].split(b'/', 1)[1] | 67 path_part = path.rsplit(b'.', 1)[0].split(b'/', 1) |
68 if len(path_part) < 2: | |
69 msg = _('cannot recognize revlog from filename: %s') | |
70 msg %= path | |
71 raise error.Abort(msg) | |
72 path = path_part[1] | |
68 return filelog.filelog(repo.svfs, path) | 73 return filelog.filelog(repo.svfs, path) |
69 | 74 |
70 | 75 |
71 def _copyrevlog(tr, destrepo, oldrl, rl_type, unencodedname): | 76 def _copyrevlog(tr, destrepo, oldrl, rl_type, unencodedname): |
72 """copy all relevant files for `oldrl` into `destrepo` store | 77 """copy all relevant files for `oldrl` into `destrepo` store |