Mercurial > public > mercurial-scm > hg
comparison mercurial/pvec.py @ 43465:90aac60b6697
pvec: migrate to modern integer division
Detected with pytype.
Differential Revision: https://phab.mercurial-scm.org/D7263
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 06 Nov 2019 15:17:38 -0500 |
parents | 271af23d01a9 |
children | 8e89b6e1e0cd |
comparison
equal
deleted
inserted
replaced
43464:3e57809d3251 | 43465:90aac60b6697 |
---|---|
46 and approximately how many changesets are involved | 46 and approximately how many changesets are involved |
47 - can be used to find a heuristic divergence measure between changesets on | 47 - can be used to find a heuristic divergence measure between changesets on |
48 different branches | 48 different branches |
49 ''' | 49 ''' |
50 | 50 |
51 from __future__ import absolute_import | 51 from __future__ import absolute_import, division |
52 | 52 |
53 from .node import nullrev | 53 from .node import nullrev |
54 from . import ( | 54 from . import ( |
55 pycompat, | 55 pycompat, |
56 util, | 56 util, |
57 ) | 57 ) |
58 | 58 |
59 _size = 448 # 70 chars b85-encoded | 59 _size = 448 # 70 chars b85-encoded |
60 _bytes = _size / 8 | 60 _bytes = _size // 8 |
61 _depthbits = 24 | 61 _depthbits = 24 |
62 _depthbytes = _depthbits / 8 | 62 _depthbytes = _depthbits // 8 |
63 _vecbytes = _bytes - _depthbytes | 63 _vecbytes = _bytes - _depthbytes |
64 _vecbits = _vecbytes * 8 | 64 _vecbits = _vecbytes * 8 |
65 _radius = (_vecbits - 30) / 2 # high probability vectors are related | 65 _radius = (_vecbits - 30) // 2 # high probability vectors are related |
66 | 66 |
67 | 67 |
68 def _bin(bs): | 68 def _bin(bs): |
69 '''convert a bytestring to a long''' | 69 '''convert a bytestring to a long''' |
70 v = 0 | 70 v = 0 |
129 i = 1 | 129 i = 1 |
130 | 130 |
131 if hdist > ddist: | 131 if hdist > ddist: |
132 # if delta = 10 and hdist = 100, then we need to go up 55 steps | 132 # if delta = 10 and hdist = 100, then we need to go up 55 steps |
133 # to the ancestor and down 45 | 133 # to the ancestor and down 45 |
134 changes = (hdist - ddist + 1) / 2 | 134 changes = (hdist - ddist + 1) // 2 |
135 else: | 135 else: |
136 # must make at least one change | 136 # must make at least one change |
137 changes = 1 | 137 changes = 1 |
138 depth = d1 + changes | 138 depth = d1 + changes |
139 | 139 |