Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
b2abfbf6
Commit
b2abfbf6
authored
5 years ago
by
Tomaž Jerman
Browse files
Options
Download
Email Patches
Plain Diff
Improve node splicing
Reuse existing spliced nodes to reduce the node count.
parent
7e80cac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
pkg/migrate/types/node.go
pkg/migrate/types/node.go
+14
-6
No files found.
pkg/migrate/types/node.go
View file @
b2abfbf6
...
...
@@ -29,6 +29,7 @@ type (
// determines if node was spliced; used to break the loop
spliced
bool
original
*
Node
spl
*
Node
// records are applicable in the case of spliced nodes
records
[]
*
types
.
Record
...
...
@@ -266,13 +267,20 @@ func (n *Node) clone() *Node {
// splices the node from the original graph and removes the cycle
func
(
n
*
Node
)
Splice
(
from
*
Node
)
*
Node
{
splicedN
:=
from
.
clone
()
splicedN
.
spliced
=
true
splicedN
.
Parents
=
nil
splicedN
.
Children
=
nil
splicedN
.
inPath
=
false
splicedN
:=
from
.
spl
splicedN
.
original
=
from
if
splicedN
==
nil
{
splicedN
=
from
.
clone
()
splicedN
.
spliced
=
true
splicedN
.
Parents
=
nil
splicedN
.
Children
=
nil
splicedN
.
inPath
=
false
splicedN
.
original
=
from
from
.
spl
=
splicedN
from
.
LinkAdd
(
splicedN
)
}
n
.
LinkRemove
(
from
)
n
.
LinkAdd
(
splicedN
)
...
...
This diff is collapsed.
Click to expand it.
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