Patchwork D7263: pvec: migrate to modern integer division

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

Comments

phabricator - Nov. 7, 2019, 8:31 a.m.
Closed by commit rHG90aac60b6697: pvec: migrate to modern integer division (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/D7263?vs=17633&id=17680

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

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

AFFECTED FILES
  mercurial/pvec.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/pvec.py b/mercurial/pvec.py
--- a/mercurial/pvec.py
+++ b/mercurial/pvec.py
@@ -48,7 +48,7 @@ 
   different branches
 '''
 
-from __future__ import absolute_import
+from __future__ import absolute_import, division
 
 from .node import nullrev
 from . import (
@@ -57,12 +57,12 @@ 
 )
 
 _size = 448  # 70 chars b85-encoded
-_bytes = _size / 8
+_bytes = _size // 8
 _depthbits = 24
-_depthbytes = _depthbits / 8
+_depthbytes = _depthbits // 8
 _vecbytes = _bytes - _depthbytes
 _vecbits = _vecbytes * 8
-_radius = (_vecbits - 30) / 2  # high probability vectors are related
+_radius = (_vecbits - 30) // 2  # high probability vectors are related
 
 
 def _bin(bs):
@@ -131,7 +131,7 @@ 
     if hdist > ddist:
         # if delta = 10 and hdist = 100, then we need to go up 55 steps
         # to the ancestor and down 45
-        changes = (hdist - ddist + 1) / 2
+        changes = (hdist - ddist + 1) // 2
     else:
         # must make at least one change
         changes = 1