diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -59,6 +59,11 @@ UNDO_FILES_MAY_NEED_CLEANUP = [ ] +def has_abandoned_transaction(repo): + """Return True if the repo has an abandoned transaction""" + return os.path.exists(repo.sjoin(b"journal")) + + def cleanup_undo_files(report, vfsmap, undo_prefix=b'undo'): """remove "undo" files used by the rollback logic diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -17,6 +17,7 @@ from . import ( pycompat, requirements, revlog, + transaction, util, ) @@ -195,7 +196,7 @@ class verifier: if not repo.url().startswith(b'file:'): raise error.Abort(_(b"cannot verify bundle or remote repos")) - if os.path.exists(repo.sjoin(b"journal")): + if transaction.has_abandoned_transaction(repo): ui.warn(_(b"abandoned transaction found - run hg recover\n")) if ui.verbose or not self.revlogv1: