transaction: clarify a conditionnal about version check
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 09 Jun 2021 01:13:09 +0200
changeset 47420 e7ad2490d623
parent 47419 0e4e9c1b4cc8
child 47421 d2e0226b511a
transaction: clarify a conditionnal about version check Let us move the short branch early. Differential Revision: https://phab.mercurial-scm.org/D10844
mercurial/transaction.py
--- a/mercurial/transaction.py	Wed Jun 09 01:14:18 2021 +0200
+++ b/mercurial/transaction.py	Wed Jun 09 01:13:09 2021 +0200
@@ -743,15 +743,15 @@
         lines = fp.readlines()
         if lines:
             ver = lines[0][:-1]
-            if ver == (b'%d' % version):
+            if ver != (b'%d' % version):
+                report(BAD_VERSION_MSG)
+            else:
                 for line in lines[1:]:
                     if line:
                         # Shave off the trailing newline
                         line = line[:-1]
                         l, f, b, c = line.split(b'\0')
                         backupentries.append((l, f, b, bool(c)))
-            else:
-                report(BAD_VERSION_MSG)
 
     _playback(
         file,