Skip to content

Commit

Permalink
don't recreate archive if no migration required
Browse files Browse the repository at this point in the history
  • Loading branch information
ltalirz committed Sep 7, 2020
1 parent dadf5a8 commit 00c89b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions aiida/cmdline/commands/cmd_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ def migrate(input_file, output_file, force, silent, in_place, archive_format, ve
echo.echo_critical('export archive does not contain the required file {}'.format(fhandle.filename))

old_version = migration.verify_metadata_version(metadata)
if version <= old_version:
echo.echo_success('nothing to be done - archive already at version {} >= {}'.format(old_version, version))
return

try:
new_version = migration.migrate_recursively(metadata, data, folder, version)
except ArchiveMigrationError as exception:
Expand Down Expand Up @@ -232,7 +236,4 @@ def migrate(input_file, output_file, force, silent, in_place, archive_format, ve
tempdir.cleanup()

if not silent:
if new_version > old_version:
echo.echo_success('migrated the archive from version {} to {}'.format(old_version, new_version))
else:
echo.echo_success('archive was already at latest version {}'.format(new_version))
echo.echo_success('migrated the archive from version {} to {}'.format(old_version, new_version))

0 comments on commit 00c89b1

Please sign in to comment.