Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
000f662b
Commit
000f662b
authored
May 20, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f21ee047
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
4 deletions
+57
-4
wcfs/testprog/wcfs_commit_tree_deltas.py
wcfs/testprog/wcfs_commit_tree_deltas.py
+57
-4
No files found.
wcfs/testprog/wcfs_commit_tree_deltas.py
View file @
000f662b
...
...
@@ -2,6 +2,22 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""Program treedelta-genallstructs commits subset of all possible tree changes
in between two trees specified key->value sets.
...
...
@@ -15,8 +31,8 @@ correspondingly.
For every made commit it prints to stdout:
# <tree1> -> <tree2>
tid <tid>
tid <tid>
# <tree1> -> <tree2>
tree <oid>
δ
<LF>
...
...
@@ -28,6 +44,44 @@ XXX
from
__future__
import
print_function
,
absolute_import
import
sys
from
ZODB
import
DB
import
transaction
from
wendelin.wcfs.internal
import
xbtree
# init initializes ...
@
func
def
init
(
zstor
):
db
=
DB
(
zstor
);
defer
(
db
.
close
)
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
root
=
zconn
.
root
()
# valdict is {} for values
# {} v -> ZBlk(v)
valdict
=
root
.
setdefault
(
'treedelta/values'
,
{})
for
v
in
b'abcdefghi'
:
valdict
[
v
]
=
ZBlk
(
v
)
transaction
.
commit
()
# XXX
#
# kv: k₁:v₁,k₂:v₂,...
@
func
def
treedeltaGenAllStructs
(
zstor
,
kv1
,
kv2
,
n
):
db
=
DB
(
zstor
);
defer
(
db
.
close
)
zconn
=
db
.
open
();
defer
(
zconn
.
close
)
root
=
zconn
.
root
()
valdict
=
root
[
'treedelta/values'
]
# vdecode decodes value text into value object, e.g. 'a' -> ZBlk(a)
def
vdecode
(
vtxt
):
# -> vobj
return
valdict
[
vtxt
]
# vencode encodes value object into value text, e.g. ZBlk(a) -> 'a'
def
vencode
(
vobj
):
# -> vtxt
for
(
k
,
v
)
in
valdict
.
items
():
if
v
is
vobj
:
return
k
raise
KeyError
(
"%r not found in value registry"
%
(
vobj
,))
def
main
():
...
...
@@ -36,8 +90,7 @@ def main():
sys
.
exit
(
1
)
n
=
int
(
sys
.
argv
[
1
])
zurl
,
kv1
,
kv2
=
sys
.
argv
[
2
:]
zurl
,
kv1
,
kv2
=
sys
.
argv
[
2
:]
# XXX kv decode
if
__name__
==
'__main__'
:
...
...
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