transaction: extract message about different version in a constants
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 09 Jun 2021 01:14:18 +0200
changeset 47419 0e4e9c1b4cc8
parent 47418 22e21deed474
child 47420 e7ad2490d623
transaction: extract message about different version in a constants This make the code a bit simpler and clearer. (This is an opportunity improvement while looking at something next to that.) Differential Revision: https://phab.mercurial-scm.org/D10843
mercurial/transaction.py
--- a/mercurial/transaction.py	Wed Jun 09 01:12:03 2021 +0200
+++ b/mercurial/transaction.py	Wed Jun 09 01:14:18 2021 +0200
@@ -702,6 +702,11 @@
             self._releasefn = None  # Help prevent cycles.
 
 
+BAD_VERSION_MSG = _(
+    b"journal was created by a different version of Mercurial\n"
+)
+
+
 def rollback(opener, vfsmap, file, report, checkambigfiles=None):
     """Rolls back the transaction contained in the given file
 
@@ -746,12 +751,7 @@
                         l, f, b, c = line.split(b'\0')
                         backupentries.append((l, f, b, bool(c)))
             else:
-                report(
-                    _(
-                        b"journal was created by a different version of "
-                        b"Mercurial\n"
-                    )
-                )
+                report(BAD_VERSION_MSG)
 
     _playback(
         file,