in fluent/migrate/tool.py [0:0]
def run(self, migration: ModuleType):
print("\nRunning migration {} for {}".format(migration.__name__, self.locale))
# For each migration create a new context.
ctx = MigrationContext(self.locale, self.reference_dir, self.localization_dir)
try:
# Add the migration spec.
migration.migrate(ctx)
except MigrationError as e:
print(
" Skipping migration {} for {}:\n {}".format(
migration.__name__, self.locale, e
)
)
return
# Keep track of how many changesets we're committing.
index = 0
description_template = cast(str, migration.migrate.__doc__)
# Annotate localization files used as sources by this migration
# to preserve attribution of translations.
files = ctx.localization_resources.keys()
blame = Blame(self.client).attribution(files)
changesets = convert_blame_to_changesets(blame)
known_legacy_translations = set()
for changeset in changesets:
snapshot = self.snapshot(
ctx, changeset["changes"], known_legacy_translations
)
if not snapshot:
continue
self.serialize_changeset(snapshot)
index += 1
self.commit_changeset(description_template, changeset["author"], index)