Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
526ee887c4d5
Commit
526ee887c4d5
authored
6 years ago
by
Boris Feld
Browse files
Options
Downloads
Patches
Plain Diff
sparse-revlog: stop using a heap to track selected gap
Same logic as for 'gapsheap', we don't actually need a heap.
parent
54de23400b2a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/revlogutils/deltas.py
+4
-6
4 additions, 6 deletions
mercurial/revlogutils/deltas.py
with
4 additions
and
6 deletions
mercurial/revlogutils/deltas.py
+
4
−
6
View file @
526ee887
...
...
@@ -10,7 +10,6 @@
from
__future__
import
absolute_import
import
collections
import
heapq
import
struct
# import stuff from node for others to import from revlog
...
...
@@ -296,8 +295,7 @@
gaps
.
sort
()
# Collect the indices of the largest holes until the density is acceptable
indicesheap
=
[]
heapq
.
heapify
(
indicesheap
)
selected
=
[]
while
gaps
and
density
<
targetdensity
:
gapsize
,
gapidx
=
gaps
.
pop
()
...
...
@@ -301,7 +299,7 @@
while
gaps
and
density
<
targetdensity
:
gapsize
,
gapidx
=
gaps
.
pop
()
heapq
.
heappush
(
indicesheap
,
gapidx
)
selected
.
append
(
gapidx
)
# the gap sizes are stored as negatives to be sorted decreasingly
# by the heap
...
...
@@ -310,6 +308,7 @@
density
=
chainpayload
/
float
(
readdata
)
else
:
density
=
1.0
selected
.
sort
()
# Cut the revs at collected indices
previdx
=
0
...
...
@@ -313,8 +312,7 @@
# Cut the revs at collected indices
previdx
=
0
while
indicesheap
:
idx
=
heapq
.
heappop
(
indicesheap
)
for
idx
in
selected
:
chunk
=
_trimchunk
(
revlog
,
revs
,
previdx
,
idx
)
if
chunk
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment