durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -251,23 +251,22 @@
         raise BadRemotefilelogHeader(
             "unexpected remotefilelog header: illegal format"
         )
-    if True:
-        header = raw[:index]
-        if header.startswith(b'v'):
-            # v1 and above, header starts with 'v'
-            if header.startswith(b'v1\n'):
-                for s in header.split(b'\n'):
-                    if s.startswith(constants.METAKEYSIZE):
-                        size = int(s[len(constants.METAKEYSIZE) :])
-                    elif s.startswith(constants.METAKEYFLAG):
-                        flags = int(s[len(constants.METAKEYFLAG) :])
-            else:
-                raise BadRemotefilelogHeader(
-                    b'unsupported remotefilelog header: %s' % header
-                )
+    header = raw[:index]
+    if header.startswith(b'v'):
+        # v1 and above, header starts with 'v'
+        if header.startswith(b'v1\n'):
+            for s in header.split(b'\n'):
+                if s.startswith(constants.METAKEYSIZE):
+                    size = int(s[len(constants.METAKEYSIZE) :])
+                elif s.startswith(constants.METAKEYFLAG):
+                    flags = int(s[len(constants.METAKEYFLAG) :])
         else:
-            # v0, str(int(size)) is the header
-            size = int(header)
+            raise BadRemotefilelogHeader(
+                b'unsupported remotefilelog header: %s' % header
+            )
+    else:
+        # v0, str(int(size)) is the header
+        size = int(header)
     if size is None:
         raise BadRemotefilelogHeader(
             "unexpected remotefilelog header: no size found"



To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to