Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGe0b485a76009: py3: fix couple of division operator to do integer divison
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/remotefilelog/basepack.py (2 lines) | |||
M | hgext/remotefilelog/historypack.py (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | Nov 26 2018, 7:38 AM |
# The number of entries in the index at which point we switch to a large fanout. | # The number of entries in the index at which point we switch to a large fanout. | ||||
# It is chosen to balance the linear scan through a sparse fanout, with the | # It is chosen to balance the linear scan through a sparse fanout, with the | ||||
# size of the bisect in actual index. | # size of the bisect in actual index. | ||||
# 2^16 / 8 was chosen because it trades off (1 step fanout scan + 5 step | # 2^16 / 8 was chosen because it trades off (1 step fanout scan + 5 step | ||||
# bisect) with (8 step fanout scan + 1 step bisect) | # bisect) with (8 step fanout scan + 1 step bisect) | ||||
# 5 step bisect = log(2^16 / 8 / 255) # fanout | # 5 step bisect = log(2^16 / 8 / 255) # fanout | ||||
# 10 step fanout scan = 2^16 / (2^16 / 8) # fanout space divided by entries | # 10 step fanout scan = 2^16 / (2^16 / 8) # fanout space divided by entries | ||||
SMALLFANOUTCUTOFF = 2**16 / 8 | SMALLFANOUTCUTOFF = 2**16 // 8 | ||||
# The amount of time to wait between checking for new packs. This prevents an | # The amount of time to wait between checking for new packs. This prevents an | ||||
# exception when data is moved to a new pack after the process has already | # exception when data is moved to a new pack after the process has already | ||||
# loaded the pack list. | # loaded the pack list. | ||||
REFRESHRATE = 0.1 | REFRESHRATE = 0.1 | ||||
if pycompat.isposix: | if pycompat.isposix: | ||||
# With glibc 2.7+ the 'e' flag uses O_CLOEXEC when opening. | # With glibc 2.7+ the 'e' flag uses O_CLOEXEC when opening. |
endnode = self._index[end:end + NODELENGTH] | endnode = self._index[end:end + NODELENGTH] | ||||
if startnode == node: | if startnode == node: | ||||
return self._index[start:start + entrylen] | return self._index[start:start + entrylen] | ||||
elif endnode == node: | elif endnode == node: | ||||
return self._index[end:end + entrylen] | return self._index[end:end + entrylen] | ||||
else: | else: | ||||
while start < end - entrylen: | while start < end - entrylen: | ||||
mid = start + (end - start) / 2 | mid = start + (end - start) // 2 | ||||
mid = mid - ((mid - origstart) % entrylen) | mid = mid - ((mid - origstart) % entrylen) | ||||
midnode = self._index[mid:mid + NODELENGTH] | midnode = self._index[mid:mid + NODELENGTH] | ||||
if midnode == node: | if midnode == node: | ||||
return self._index[mid:mid + entrylen] | return self._index[mid:mid + entrylen] | ||||
if node > midnode: | if node > midnode: | ||||
start = mid | start = mid | ||||
startnode = midnode | startnode = midnode | ||||
elif node < midnode: | elif node < midnode: |