D5760: remotefilelog: cast division result to an int

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Jan 30 21:37:44 UTC 2019


indygreg created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Otherwise mid is a float and this confuses __slice__ on Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  hgext/remotefilelog/datapack.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/datapack.py b/hgext/remotefilelog/datapack.py
--- a/hgext/remotefilelog/datapack.py
+++ b/hgext/remotefilelog/datapack.py
@@ -243,7 +243,7 @@
         else:
             while start < end - entrylen:
                 mid = start  + (end - start) / 2
-                mid = mid - ((mid - params.indexstart) % entrylen)
+                mid = int(mid - ((mid - params.indexstart) % entrylen))
                 midnode = index[mid:mid + NODELENGTH]
                 if midnode == node:
                     entry = index[mid:mid + entrylen]
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -588,6 +588,7 @@
 test-remotefilelog-cacheprocess.t
 test-remotefilelog-clone-tree.t
 test-remotefilelog-clone.t
+test-remotefilelog-datapack.py
 test-remotefilelog-gcrepack.t
 test-remotefilelog-histpack.py
 test-remotefilelog-http.t



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


More information about the Mercurial-devel mailing list