Skip to content

Commit

Permalink
Try to create rule from BAG to CURRENT msg
Browse files Browse the repository at this point in the history
fixes CORE-6641

Consider the following scenario for a message G with the following
versions:

G0 -- rule.bmr --> G1 -- auto-generated rule --> G3

where G3 is the CURRENT msg, and G2 is the BAG message that needs
migration.

We need to check for a migration rule like this first:

G2 --> G3

instead of the backwards ones that were generated before this bug fix:

G2 --> G1

Note that the 'lazy' check to valid the rules in the make_update_rule
method makes that rule pass initially, but later it fails because
there's no rule for the sub fields.
  • Loading branch information
Enrique Fernandez committed Mar 15, 2017
1 parent 8cbbe6b commit 045b7b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/rosbag/src/rosbag/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,18 @@ def find_path(self, old_class, new_class):
found_start = True
break

# Next see if we can create a valid rule directly to the end, including the sub rules
if not found_start:
new_rule = self.make_update_rule(old_class, new_class)
R = new_rule(self, 'GENERATED.' + new_rule.__name__)
if R.valid:
R.find_sub_paths()
if R.sub_rules_valid:
sn = ScaffoldNode(old_class, new_class, R)
self.extra_nodes.append(sn)
self.found_paths[key] = [sn]
return [sn]

# Next see if we can create a valid rule
if not found_start:
for (ind, tmp_sn) in reversed(list(zip(range(len(sn_range)), sn_range))):
Expand Down

0 comments on commit 045b7b1

Please sign in to comment.