-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate number nodes with sequence to CBNs. #7582
Conversation
|
||
// Increase the number values. | ||
numNode.Value = numNodeValue; | ||
numNode.SetCodeContent(numNodeValue + ";", new ProtoCore.Namespace.ElementResolver()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just a temporary change for testing purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This test needs to be updated to work after this migration is added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's going to replace the existing test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see now.
@@ -321,22 +321,16 @@ orderby result.From | |||
var migrationData = new NodeMigrationData(elNode.OwnerDocument); | |||
migrationData.AppendNode(elNode as XmlElement); | |||
|
|||
while (workspaceVersion != null && workspaceVersion < currentVersion) | |||
foreach(var migration in migrations.Where(m=>m.From >= workspaceVersion)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to make sense - does it break any existing migration tests here or for revit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though - From
seems kind of strange in context when said out loud, this WorkspaceMigration migrates workspaces with versions from 2.0... I don't know how to finish this sentence to make this correct.
Perhaps WorkspaceAttribute needs a different property name like migrateWorkspaceVersionsBelow
... I am not sure.
Also seems CurrentVersion
is no longer used in this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove CurrentVersion
, and I propose to rename from:
to version
, as in "This node migration is applied to nodes in version x.x.x and higher."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it "version x.x.x and lower", or "lower than version x.x.x"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregmarr You are correct :)
@@ -1360,6 +1354,7 @@ public class NodeMigrationAttribute : Attribute | |||
/// <summary> | |||
/// Version this migrates to. | |||
/// </summary> | |||
[Obsolete("All migrations are now processed, beginning with the first migration whose version is >= the workspace version. The To property will be ignored.", false)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, if this is targeted towards Dynamo 2.0 release should we just get rid of this? Or you prefer the tag for documentation purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's open for discussion. I can just rip it out, and take out all references to to:
as well. I started to do that yesterday and thought better of it. But we are making a major version change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need to do this in the Revit branches as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be only one NodeMigration
applied in the Revit repos: https://github.com/DynamoDS/DynamoRevit/search?utf8=✓&q=NodeMigration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how these are used (it's been a while) but I just want to be sure that this change doesn't break them:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe that Zero Touch migrations are affected, because they don't use the NodeMigrationAttribute
.
@ikeough this looks good to me - is there anything else besides updating the API doc that needs to be done? |
Purpose
While developing a migration for the number node, a behavior was noticed in the migration framework that causes a second migration to not be applied when the first migration has the
to
field set tonull
. Theto
field has never really been clear in its intent, and could potentially cause a migration to get "swallowed" by another migration. Ex. you have a migrationfrom: 0.0.0.1 to: 2.0.0.0
and onefrom: 1.0.0.0 to: 2.0.0.0
. The second migration would never be applied because the first would set the current version to2.0.0.0
during the loop. Similarly, withoutto:
defined as infrom: 0.0.0.1
, any other migrations would not get processed because the loop exits whento:
is null.This PR marks the
To
field as obsolete onNodeMigrationAttribute
, and adjusts the migration code to apply all migrations sequentially starting with the one whose version is>=
the version of the stored workspace. All existing migrations have this intent, with migrations version ranges being sequential. So this change does not affect those migrations, and they will continue to be processed sequentially.This PR also migrates number nodes with sequences, i.e.
0..5
to CBNs with0..5;
. Currently, we do not allow the user to input0..5
in a number node, but we do not disallow the number node from opening such a node. It has been tested to work on number nodes with numeric ranges like0..5
and ranges with variables likea..b..c
. All connectors are successfully re-established after migration.PTAL @mjkkirschner
FYI @gregmarr