comparison mercurial/verify.py @ 50996:cf47b83d8ad0

transaction: abstract away the detection of an abandoned transaction We're about to add another place where this is used, let's not spill this implementation detail.
author Rapha?l Gom?s <rgomes@octobus.net>
date Wed, 13 Sep 2023 12:25:51 +0200
parents 862e3a13da44
children 812cd3dfa4cb
comparison
equal deleted inserted replaced
50995:727428c7e1fc 50996:cf47b83d8ad0
15 from . import ( 15 from . import (
16 error, 16 error,
17 pycompat, 17 pycompat,
18 requirements, 18 requirements,
19 revlog, 19 revlog,
20 transaction,
20 util, 21 util,
21 ) 22 )
22 23
23 VERIFY_DEFAULT = 0 24 VERIFY_DEFAULT = 0
24 VERIFY_FULL = 1 25 VERIFY_FULL = 1
193 repo = self.repo 194 repo = self.repo
194 ui = repo.ui 195 ui = repo.ui
195 if not repo.url().startswith(b'file:'): 196 if not repo.url().startswith(b'file:'):
196 raise error.Abort(_(b"cannot verify bundle or remote repos")) 197 raise error.Abort(_(b"cannot verify bundle or remote repos"))
197 198
198 if os.path.exists(repo.sjoin(b"journal")): 199 if transaction.has_abandoned_transaction(repo):
199 ui.warn(_(b"abandoned transaction found - run hg recover\n")) 200 ui.warn(_(b"abandoned transaction found - run hg recover\n"))
200 201
201 if ui.verbose or not self.revlogv1: 202 if ui.verbose or not self.revlogv1:
202 ui.status( 203 ui.status(
203 _(b"repository uses revlog format %d\n") 204 _(b"repository uses revlog format %d\n")