Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
be6ca14c
Commit
be6ca14c
authored
May 30, 2024
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
dc8eeb8c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
tools/reflink
tools/reflink
+30
-30
No files found.
tools/reflink
View file @
be6ca14c
...
...
@@ -118,29 +118,33 @@ class OidArray(object):
__slots__
=
'arrays'
,
def
__init__
(
self
,
arrays
):
self
.
arrays
=
arrays
a
=
self
.
arrays
=
defaultdict
(
array32u
)
for
k
,
v
in
arrays
:
if
v
:
a
[
k
]
=
v
def
__iand__
(
self
,
other
):
arrays
=
self
.
arrays
other
=
other
.
arrays
for
i
,
a
in
enumerate
(
arrays
):
a
=
set
(
a
)
try
:
a
.
intersection_update
(
other
[
i
])
except
IndexError
:
del
arrays
[
i
:]
break
for
i
in
sorted
(
arrays
):
a
=
set
(
arrays
[
i
])
a
.
intersection_update
(
other
.
get
(
i
,
()))
if
a
:
arrays
[
i
]
=
array32u
(
sorted
(
a
))
else
:
del
arrays
[
i
]
return
self
def
__nonzero__
(
self
):
return
any
(
self
.
arrays
)
return
any
(
self
.
arrays
.
itervalues
()
)
def
__len__
(
self
):
return
sum
(
map
(
len
,
self
.
arrays
))
return
sum
(
map
(
len
,
self
.
arrays
.
itervalues
()
))
def
__iter__
(
self
):
for
i
,
x
in
enumerate
(
self
.
arrays
):
arrays
=
self
.
arrays
for
i
in
sorted
(
arrays
):
x
=
arrays
[
i
]
i
<<=
32
for
x
in
x
:
yield
p64
(
i
|
x
)
...
...
@@ -148,24 +152,19 @@ class OidArray(object):
def
__delitem__
(
self
,
key
):
assert
None
is
key
.
start
is
key
.
step
,
key
n
=
key
.
stop
for
x
in
self
.
arrays
:
arrays
=
self
.
arrays
for
i
in
sorted
(
arrays
):
x
=
arrays
[
i
]
k
=
len
(
x
)
if
n
<
k
:
del
x
[:
n
]
n
-=
k
if
n
<=
0
:
break
n
-=
k
del
arrays
[
i
]
def
append
(
self
,
oid
):
oid
=
u64
(
oid
)
i
=
oid
>>
32
oid
&=
0xFFFFFFFF
arrays
=
self
.
arrays
while
True
:
try
:
arrays
[
i
].
append
(
oid
)
break
except
IndexError
:
arrays
.
append
(
array32u
())
self
.
arrays
[
oid
>>
32
].
append
(
oid
&
0xFFFFFFFF
)
class
Object
(
object
):
...
...
@@ -399,13 +398,14 @@ class Changeset(object):
try
:
oid
=
stack
.
pop
()
except
IndexError
:
x
,
=
q
(
'SELECT MAX(oid) >> 32 FROM t'
).
fetchone
()
return
OidArray
([
array32u
(
x
for
x
,
in
q
(
(
k
,
x
),
=
q
(
'SELECT MIN(oid) >> 32, MAX(oid) >> 32 FROM t'
)
return
OidArray
(()
if
k
is
None
else
((
k
,
array32u
(
v
for
v
,
in
q
(
'SELECT oid & 0xFFFFFFFF FROM t'
' WHERE oid>=? AND oid<? ORDER BY oid'
,
(
x
<<
32
,
x
+
1
<<
32
)))
for
x
in
xrange
(
x
+
1
)]
)
(
k
<<
32
,
k
+
1
<<
32
)
)))
for
k
in
xrange
(
k
,
x
+
1
))
)
k
=
oid
,
try
:
(
v
,),
=
q
(
'SELECT referents FROM t WHERE oid=?'
,
k
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment