Patchwork D1891: transaction: fix hg version check when loading journal

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2018, 1:38 p.m.
Message ID <differential-rev-PHID-DREV-yho45tdjjkhc3rtgnymr-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26877/
State Superseded
Headers show

Comments

phabricator - Jan. 18, 2018, 1:38 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1891

AFFECTED FILES
  mercurial/transaction.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 18, 2018, 1:56 p.m.
pulkit added inline comments.

INLINE COMMENTS

> transaction.py:616
>              ver = lines[0][:-1]
> -            if ver == str(version):
> +            if ver == pycompat.bytestr(version):
>                  for line in lines[1:]:

"%d" is preferred

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1891

To: durin42, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -18,6 +18,7 @@ 
 from .i18n import _
 from . import (
     error,
+    pycompat,
     util,
 )
 
@@ -612,7 +613,7 @@ 
         lines = fp.readlines()
         if lines:
             ver = lines[0][:-1]
-            if ver == str(version):
+            if ver == pycompat.bytestr(version):
                 for line in lines[1:]:
                     if line:
                         # Shave off the trailing newline