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
b1aba2bf
Commit
b1aba2bf
authored
May 26, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
db6c8a01
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
wcfs/testprog/treegen.py
wcfs/testprog/treegen.py
+13
-6
No files found.
wcfs/testprog/treegen.py
View file @
b1aba2bf
...
...
@@ -114,14 +114,19 @@ class ZCtx(object):
zctx
.
root
=
zctx
.
zconn
.
root
()
# init root['treegen/values'] = {} v -> ZBlk(v)
# TODO don't generate if already there
zctx
.
valdict
=
zctx
.
root
[
'treegen/values'
]
=
PersistentMapping
()
valdict
=
zctx
.
root
.
get
(
'treegen/values'
,
None
)
if
valdict
is
None
:
valdict
=
zctx
.
root
[
'treegen/values'
]
=
PersistentMapping
()
valv
=
b'abcdefghi'
for
v
in
valv
:
zblk
=
valdict
.
get
(
v
,
None
)
if
zblk
is
not
None
and
zblk
.
loadblkdata
()
==
v
:
continue
zblk
=
ZBlk
()
zblk
.
setblkdata
(
v
)
zctx
.
valdict
[
v
]
=
zblk
commit
(
'treegen/values: init %r'
%
valv
)
valdict
[
v
]
=
zblk
zctx
.
valdict
=
valdict
commit
(
'treegen/values: init %r'
%
valv
,
skipIfEmpty
=
True
)
# close release resources associated with zctx.
def
close
(
zctx
):
...
...
@@ -343,11 +348,13 @@ def patch(d, diff, verify):
# commit commits current transaction with description.
def
commit
(
description
):
# -> tid
def
commit
(
description
,
skipIfEmpty
=
False
):
# -> tid | None
txn
=
transaction
.
get
()
if
skipIfEmpty
and
len
(
txn
.
_resources
)
==
0
:
return
None
txn
.
description
=
description
# XXX hack to retrieve committed transaction ID via ._p_serial of object changed in this transaction
assert
len
(
txn
.
_resources
)
==
1
assert
len
(
txn
.
_resources
)
==
1
,
txn
.
_resources
zconn
=
txn
.
_resources
[
0
]
assert
isinstance
(
zconn
,
Connection
)
assert
len
(
zconn
.
_registered_objects
)
>
0
...
...
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