Detected with pytype.
Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG90aac60b6697: pvec: migrate to modern integer division
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Detected with pytype.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/pvec.py (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
88ee204acada | ea2a11840e29 | Augie Fackler | Nov 6 2019, 3:17 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
resolving conflicts | resolving conflicts | ||||
- ordering of patches can be established without a DAG | - ordering of patches can be established without a DAG | ||||
- two head pvecs can be compared to determine whether push/pull/merge is needed | - two head pvecs can be compared to determine whether push/pull/merge is needed | ||||
and approximately how many changesets are involved | and approximately how many changesets are involved | ||||
- can be used to find a heuristic divergence measure between changesets on | - can be used to find a heuristic divergence measure between changesets on | ||||
different branches | different branches | ||||
''' | ''' | ||||
from __future__ import absolute_import | from __future__ import absolute_import, division | ||||
from .node import nullrev | from .node import nullrev | ||||
from . import ( | from . import ( | ||||
pycompat, | pycompat, | ||||
util, | util, | ||||
) | ) | ||||
_size = 448 # 70 chars b85-encoded | _size = 448 # 70 chars b85-encoded | ||||
_bytes = _size / 8 | _bytes = _size // 8 | ||||
_depthbits = 24 | _depthbits = 24 | ||||
_depthbytes = _depthbits / 8 | _depthbytes = _depthbits // 8 | ||||
_vecbytes = _bytes - _depthbytes | _vecbytes = _bytes - _depthbytes | ||||
_vecbits = _vecbytes * 8 | _vecbits = _vecbytes * 8 | ||||
_radius = (_vecbits - 30) / 2 # high probability vectors are related | _radius = (_vecbits - 30) // 2 # high probability vectors are related | ||||
def _bin(bs): | def _bin(bs): | ||||
'''convert a bytestring to a long''' | '''convert a bytestring to a long''' | ||||
v = 0 | v = 0 | ||||
for b in bs: | for b in bs: | ||||
v = v * 256 + ord(b) | v = v * 256 + ord(b) | ||||
return v | return v | ||||
ddist = d1 - d2 | ddist = d1 - d2 | ||||
v = v1 | v = v1 | ||||
m = v1 ^ v2 # mask of different bits | m = v1 ^ v2 # mask of different bits | ||||
i = 1 | i = 1 | ||||
if hdist > ddist: | if hdist > ddist: | ||||
# if delta = 10 and hdist = 100, then we need to go up 55 steps | # if delta = 10 and hdist = 100, then we need to go up 55 steps | ||||
# to the ancestor and down 45 | # to the ancestor and down 45 | ||||
changes = (hdist - ddist + 1) / 2 | changes = (hdist - ddist + 1) // 2 | ||||
else: | else: | ||||
# must make at least one change | # must make at least one change | ||||
changes = 1 | changes = 1 | ||||
depth = d1 + changes | depth = d1 + changes | ||||
# copy changes from v2 | # copy changes from v2 | ||||
if m: | if m: | ||||
while changes: | while changes: |