Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5diff
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
nexedi
erp5diff
Commits
1692fd42
Commit
1692fd42
authored
Jul 08, 2010
by
Nicolas Delaby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some nodes stay orphans if they are replaced by another one and followed
by a modification. This patch address this issue.
parent
8748c709
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
ERP5Diff.py
ERP5Diff.py
+13
-0
No files found.
ERP5Diff.py
View file @
1692fd42
...
...
@@ -581,6 +581,8 @@ class ERP5Diff:
path_list
=
self
.
_makeRelativePathList
(
old_list
)
new_start
=
0
new_len
=
len
(
new_list
)
# Usefull set to detect orphan in new_list
new_object_left_index_set
=
set
()
for
old_node
,
node_path
in
zip
(
old_list
,
path_list
):
child_path
=
self
.
_concatPath
(
path
,
node_path
)
for
new_current
in
range
(
new_start
,
new_len
):
...
...
@@ -589,13 +591,24 @@ class ERP5Diff:
self
.
_testAttributes
(
old_node
,
new_node
,
child_path
)
self
.
_compareChildNodes
(
old_node
,
new_node
,
child_path
)
new_start
=
new_current
+
1
if
new_current
in
new_object_left_index_set
:
new_object_left_index_set
.
remove
(
new_current
)
break
else
:
new_object_left_index_set
.
add
(
new_current
)
else
:
# There is no matching node. So this element must be removed.
self
.
_xupdateRemoveElement
(
child_path
,
old_node
.
nsmap
)
if
new_len
>
new_start
:
# There are remaining nodes in the new children.
self
.
_xupdateAppendElements
(
new_list
[
new_start
:
new_len
],
path
)
# if New children are allready added, clean up new_object_left_index_set
[
new_object_left_index_set
.
remove
(
index
)
\
for
index
in
range
(
new_start
,
new_len
)
if
\
index
in
new_object_left_index_set
]
if
new_object_left_index_set
:
self
.
_xupdateAppendElements
([
new_list
[
index
]
for
index
\
in
new_object_left_index_set
],
path
)
if
misplaced_node_dict
:
self
.
_xupdateMoveElements
(
misplaced_node_dict
,
path
)
...
...
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