Patchwork D7271: linelog: be more careful about types before looking for _target attribute

login
register
mail settings
Submitter phabricator
Date Nov. 7, 2019, 8:32 a.m.
Message ID <bb6db69d58e3590edf3cd0891f540c94@localhost.localdomain>
Download mbox | patch
Permalink /patch/42870/
State Not Applicable
Headers show

Comments

phabricator - Nov. 7, 2019, 8:32 a.m.
Closed by commit rHG14e374d4c9ee: linelog: be more careful about types before looking for _target attribute (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7271?vs=17641&id=17688

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7271/new/

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

AFFECTED FILES
  mercurial/linelog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/linelog.py b/mercurial/linelog.py
--- a/mercurial/linelog.py
+++ b/mercurial/linelog.py
@@ -278,8 +278,14 @@ 
         fakejge = _decodeone(buf, 0)
         if isinstance(fakejge, _jump):
             maxrev = 0
+        elif isinstance(fakejge, (_jge, _jl)):
+            maxrev = fakejge._cmprev
         else:
-            maxrev = fakejge._cmprev
+            raise LineLogError(
+                'Expected one of _jump, _jge, or _jl. Got %s.'
+                % type(fakejge).__name__
+            )
+        assert isinstance(fakejge, (_jump, _jge, _jl))  # help pytype
         numentries = fakejge._target
         if expected != numentries:
             raise LineLogError(