()
| 142 | |
| 143 | |
| 144 | def main(): |
| 145 | if len(sys.argv) < 3: |
| 146 | print("Usage: python diff_schema.py <old_snapshot.json> <new_snapshot.json>") |
| 147 | return |
| 148 | |
| 149 | old_path = Path(sys.argv[1]) |
| 150 | new_path = Path(sys.argv[2]) |
| 151 | |
| 152 | with open(old_path) as f: |
| 153 | old = json.load(f) |
| 154 | with open(new_path) as f: |
| 155 | new = json.load(f) |
| 156 | |
| 157 | print(f"Old: {old.get('_meta', {}).get('mujoco_version', '?')} ({old_path.name})") |
| 158 | print(f"New: {new.get('_meta', {}).get('mujoco_version', '?')} ({new_path.name})") |
| 159 | |
| 160 | diff = diff_schemas(old, new) |
| 161 | print_diff(diff) |
| 162 | |
| 163 | # Summary |
| 164 | total_added = len(diff["added_elements"]) + sum(len(c["added"]) for c in diff["attribute_changes"]) |
| 165 | total_removed = len(diff["removed_elements"]) + sum(len(c["removed"]) for c in diff["attribute_changes"]) |
| 166 | print(f"\nTotal: +{total_added} additions, -{total_removed} removals") |
| 167 | |
| 168 | |
| 169 | if __name__ == "__main__": |
no test coverage detected