py3: use integer division instead of `int(...)` call
authorBoris Feld <boris.feld@octobus.net>
Sun, 03 Feb 2019 10:01:43 +0100
changeset 41527 eb37d95cc486
parent 41526 1be7a9b994a2
child 41528 b7a0efb3c370
py3: use integer division instead of `int(...)` call Changeset 38a82e0333c9 and 7f853549823b introduced explicit conversion to integer to work around the division behavior change from python2 to python3. Using the integer division operator is a simpler and clearer way to achieve this.
hgext/remotefilelog/datapack.py
tests/test-remotefilelog-datapack.py
--- a/hgext/remotefilelog/datapack.py	Sun Feb 03 17:15:11 2019 +0530
+++ b/hgext/remotefilelog/datapack.py	Sun Feb 03 10:01:43 2019 +0100
@@ -242,8 +242,8 @@
             entry = index[end:end + entrylen]
         else:
             while start < end - entrylen:
-                mid = start  + (end - start) / 2
-                mid = int(mid - ((mid - params.indexstart) % entrylen))
+                mid = start + (end - start) // 2
+                mid = mid - ((mid - params.indexstart) % entrylen)
                 midnode = index[mid:mid + NODELENGTH]
                 if midnode == node:
                     entry = index[mid:mid + entrylen]
--- a/tests/test-remotefilelog-datapack.py	Sun Feb 03 17:15:11 2019 +0530
+++ b/tests/test-remotefilelog-datapack.py	Sun Feb 03 10:01:43 2019 +0100
@@ -292,7 +292,7 @@
 
         class testdatapackstore(datapack.datapackstore):
             # Ensures that we are not keeping everything in the cache.
-            DEFAULTCACHESIZE = int(numpacks / 2)
+            DEFAULTCACHESIZE = numpacks // 2
 
         store = testdatapackstore(uimod.ui(), packdir)